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,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    **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, *, context: ProtocolContext, **kwargs: Any,)> NoResultsModellerAlgorithm:

Inherited from:

BaseNonModelAlgorithmFactory.modeller :

Modeller-side of the algorithm.

worker

def worker(self, *, context: ProtocolContext, **kwargs: Any)> ~T_WorkerSide:

Inherited from:

BaseNonModelAlgorithmFactory.worker :

Worker-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,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    **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, *, context: ProtocolContext, **kwargs: Any,)> NoResultsModellerAlgorithm:

Inherited from:

BaseGATrialInclusionAlgorithmFactory.modeller :

Modeller-side of the algorithm.

worker

def worker(    self,    *,    context: ProtocolContext,    **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,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    **kwargs: Any,):

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

Ancestors

Methods


modeller

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

Inherited from:

BaseGATrialInclusionAlgorithmFactory.modeller :

Modeller-side of the algorithm.

worker

def worker(    self,    *,    context: ProtocolContext,    **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,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    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 | MethodFilter]:

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_column_filters

def get_column_filters(    self,)> list[ColumnFilter | MethodFilter]:

Deprecated method for getting list of eligibility filters.

get_filters

def get_filters(    self,)> list[ColumnFilter | MethodFilter]:

Method for getting list of eligibility 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(    *,    cnv_threshold: float = 0.5,    largest_ga_lesion_lower_bound: float = 1.26,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    renamed_columns: Optional[Mapping[str, str]] = None,    **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 | MethodFilter]:

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_column_filters

def get_column_filters(    self,)> list[ColumnFilter | MethodFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_column_filters :

Deprecated method for getting list of eligibility filters.

get_filters

def get_filters(    self,)> list[ColumnFilter | MethodFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_filters :

Method for getting list of eligibility 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,    largest_ga_lesion_upper_bound: Optional[float] = None,    total_ga_area_lower_bound: float = 2.5,    total_ga_area_upper_bound: float = 17.5,    patient_age_lower_bound: Optional[int] = None,    patient_age_upper_bound: Optional[int] = None,    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
  • bitfount.federated.algorithms.ophthalmology.ga_trial_inclusion_criteria_match_algorithm_charcoal._WorkerSide

Methods


get_base_column_filters

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

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_column_filters

def get_column_filters(    self,)> list[ColumnFilter | MethodFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_column_filters :

Deprecated method for getting list of eligibility filters.

get_filters

def get_filters(    self,)> list[ColumnFilter | MethodFilter]:

Inherited from:

BaseGATrialInclusionWorkerAlgorithm.get_filters :

Method for getting list of eligibility 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).

CodeFilterMixIn

class CodeFilterMixIn(    *,    conditions_inclusion_codes: Optional[list[str]] = None,    conditions_exclusion_codes: Optional[list[str]] = None,    procedures_exclusion_codes: Optional[list[str]] = None,    **kwargs: Any,):

MixIn class for TrialInclusion algorithms that support code filters.

Subclasses

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

Methods


diagnosis_filter

def diagnosis_filter(self, row: pd.Series)> bool:

Filter to check patient diagnosis.

Matches patient if

excluded_conditions_filter

def excluded_conditions_filter(self, row: pd.Series)> bool:

Filter to exclude any disqualifying conditions for the trial.

Patient is eligible if they do not have any of the excluded diagnosed conditions on file.

excluded_procedures_filter

def excluded_procedures_filter(self, row: pd.Series)> bool:

Filter to exclude any disqualifying procedures/medications for the trial.

Patient is eligible if they do not have any of the excluded procedures on file