Skip to main content

ga_trial_inclusion_criteria_match_algorithm_base

Base classes for criteria match algorithms.

Classes

BaseGATrialInclusionAlgorithmFactory

class BaseGATrialInclusionAlgorithmFactory(    datastructure: DataStructure,    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    **kwargs: Any,):

Base factory class for all GA trial inclusion criteria match algorithms.

Ancestors

Variables

  • static fields_dict : ClassVar[T_FIELDS_DICT]

Methods


modeller

def modeller(    self, **kwargs: Any,)> NoResultsModellerAlgorithm:

Modeller-side of the algorithm.

BaseGATrialInclusionAlgorithmFactoryBothEyes

class BaseGATrialInclusionAlgorithmFactoryBothEyes(    datastructure: DataStructure,    renamed_columns: Optional[Mapping[str, str]] = None,    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    **kwargs: Any,):

Base class for GA trial criteria match algorithms that handle both eyes.

Ancestors

Variables

  • static fields_dict : ClassVar[T_FIELDS_DICT]

Methods


modeller

def modeller(    self, **kwargs: Any,)> NoResultsModellerAlgorithm:

Inherited from:

BaseGATrialInclusionAlgorithmFactory.modeller :

Modeller-side of the algorithm.

worker

def worker(    self,    **kwargs: Any,)> BaseGATrialInclusionWorkerAlgorithmBothEyes:

Worker-side of the algorithm.

This is an abstract method that should be implemented by subclasses.

BaseGATrialInclusionAlgorithmFactorySingleEye

class BaseGATrialInclusionAlgorithmFactorySingleEye(    datastructure: DataStructure,    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    **kwargs: Any,):

Base factory class single eye GA trial inclusion criteria match algorithms.

Ancestors

Variables

  • static fields_dict : ClassVar[T_FIELDS_DICT]

Methods


modeller

def modeller(    self, **kwargs: Any,)> NoResultsModellerAlgorithm:

Inherited from:

BaseGATrialInclusionAlgorithmFactory.modeller :

Modeller-side of the algorithm.

worker

def worker(    self,    **kwargs: Any,)> BaseGATrialInclusionWorkerAlgorithmSingleEye:

Worker-side of the algorithm.

This is an abstract method that should be implemented by subclasses.

BaseGATrialInclusionWorkerAlgorithm

class BaseGATrialInclusionWorkerAlgorithm(    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    renamed_columns: Optional[Mapping[str, str]] = None,    **kwargs: Any,):

Base worker side class for all GA trial inclusion criteria match algorithms.

This base algorithm is designed to find patients that match a set of clinical criteria. The baseline criteria are as follows:

  1. Total GA area between TOTAL_GA_AREA_LOWER_BOUND and TOTAL_GA_AREA_UPPER_BOUND
  2. Largest GA lesion size greater than LARGEST_GA_LESION_LOWER_BOUND
  3. No CNV (CNV probability less than CNV_THRESHOLD)

Ancestors

Methods


get_base_column_filters

def get_base_column_filters(    self,)> list[ColumnFilter]:

Returns the basic column filters common to all GA algorithms.

These are the most fundamental filters that all variants might use. Subclasses should extend this with their specific filters.

initialise

def initialise(    self,    datasource: BaseSource,    data_splitter: Optional[DatasetSplitter] = None,    pod_dp: Optional[DPPodConfig] = None,    pod_identifier: Optional[str] = None,    **kwargs: Any,)> None:

Sets Datasource.

initialise_data

def initialise_data(    self, datasource: BaseSource, data_splitter: Optional[DatasetSplitter] = None,)> None:

Inherited from:

BaseWorkerAlgorithm.initialise_data :

Initialises the algorithm with data.

This method will be called once per task batch. It is expected that algorithms will override this method to initialise their data in the required way.

note

This is called by the initialise method and should not be called directly by the algorithm or protocol.

BaseGATrialInclusionWorkerAlgorithmBothEyes

class BaseGATrialInclusionWorkerAlgorithmBothEyes(    renamed_columns: Optional[Mapping[str, str]] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    **kwargs: Any,):

Base worker side class for criteria match algorithms that handle both eyes.

This base algorithm is designed to find patients that match a set of clinical criteria. The criteria are as follows:

  1. There are scans for both eyes for the same patient, taken within 24 hours of each other
  2. Age greater than or equal to PATIENT_AGE_LOWER_BOUND
  3. Total GA area between TOTAL_GA_AREA_LOWER_BOUND and TOTAL_GA_AREA_UPPER_BOUND
  4. Largest GA lesion size greater than LARGEST_GA_LESION_LOWER_BOUND
  5. No CNV in either eye (CNV probability less than CNV_THRESHOLD)

Ancestors

Subclasses

  • bitfount.federated.algorithms.ophthalmology.ga_trial_inclusion_criteria_match_algorithm_jade._WorkerSide

Methods


get_base_column_filters

def get_base_column_filters(    self,)> list[ColumnFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_base_column_filters :

Returns the basic column filters common to all GA algorithms.

These are the most fundamental filters that all variants might use. Subclasses should extend this with their specific filters.

get_matched_column_filters

def get_matched_column_filters(    self,)> list[ColumnFilter]:

Returns the column filters for the matched data.

initialise

def initialise(    self,    datasource: BaseSource,    data_splitter: Optional[DatasetSplitter] = None,    pod_dp: Optional[DPPodConfig] = None,    pod_identifier: Optional[str] = None,    **kwargs: Any,)> None:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.initialise :

Sets Datasource.

initialise_data

def initialise_data(    self, datasource: BaseSource, data_splitter: Optional[DatasetSplitter] = None,)> None:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.initialise_data :

Initialises the algorithm with data.

This method will be called once per task batch. It is expected that algorithms will override this method to initialise their data in the required way.

note

This is called by the initialise method and should not be called directly by the algorithm or protocol.

update_renamed_columns

def update_renamed_columns(self)> None:

Update the renamed columns.

BaseGATrialInclusionWorkerAlgorithmSingleEye

class BaseGATrialInclusionWorkerAlgorithmSingleEye(    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    renamed_columns: Optional[Mapping[str, str]] = None,    **kwargs: Any,):

Base worker class for single eye ga trial inclusion criteria match algorithms.

This algorithm uses the same baseline criteria as the superclass:

  1. Total GA area between TOTAL_GA_AREA_LOWER_BOUND and TOTAL_GA_AREA_UPPER_BOUND
  2. Largest GA lesion size greater than LARGEST_GA_LESION_LOWER_BOUND
  3. No CNV (CNV probability less than CNV_THRESHOLD)

Ancestors

Subclasses

  • bitfount.federated.algorithms.ophthalmology.ga_trial_inclusion_criteria_match_algorithm_amethyst._WorkerSide
  • bitfount.federated.algorithms.ophthalmology.ga_trial_inclusion_criteria_match_algorithm_bronze._WorkerSide

Methods


get_base_column_filters

def get_base_column_filters(    self,)> list[ColumnFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_base_column_filters :

Returns the basic column filters common to all GA algorithms.

These are the most fundamental filters that all variants might use. Subclasses should extend this with their specific filters.

initialise

def initialise(    self,    datasource: BaseSource,    data_splitter: Optional[DatasetSplitter] = None,    pod_dp: Optional[DPPodConfig] = None,    pod_identifier: Optional[str] = None,    **kwargs: Any,)> None:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.initialise :

Sets Datasource.

initialise_data

def initialise_data(    self, datasource: BaseSource, data_splitter: Optional[DatasetSplitter] = None,)> None:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.initialise_data :

Initialises the algorithm with data.

This method will be called once per task batch. It is expected that algorithms will override this method to initialise their data in the required way.

note

This is called by the initialise method and should not be called directly by the algorithm or protocol.

run

def run(self, dataframe: pd.DataFrame)> tuple[int, int]:

Finds number of patients that match the clinical criteria.

Arguments

  • dataframe: The dataframe to process.

Returns A tuple of counts of patients that match the clinical criteria. Tuple is of form (match criteria, don't match criteria).