FastEHR.dataloader.utils.study_criteria ======================================= .. py:module:: FastEHR.dataloader.utils.study_criteria Classes ------- .. autoapisummary:: FastEHR.dataloader.utils.study_criteria.index_inclusion_method Module Contents --------------- .. py:class:: index_inclusion_method(index_on, outcomes, require_outcome=False, include_on_events_prior_to_index=None, exclude_on_events_prior_to_index=None, exclude_on_events=None, study_period=['1998-01-01', '2019-12-31'], age_at_entry_range=[25, 85], min_registered_years=1, min_events=None) Filters a dataset based on indexing criteria, outcomes, and study constraints. Parameters ---------- index_on (Union[str, List[str], float, int]): Defines the indexing criteria: - If indexing on an event, provide the event name as a string. - If indexing on multiple events, provide a list of event name strings. - If indexing by age, provide a float or integer representing age in days. - When multiple index events exist, the first valid index date is taken. outcomes (Union[List[str], Callable]): Specifies the outcomes of interest: - A list of event names to be used as outcomes. - A callable object that filters the event column of the dataframe for the desired outcomes. require_outcome (bool, optional): Whether the outcome must be observed within the study period constraints. - If `False`, includes patients who have not yet seen the outcome (e.g., survival analysis). - If `True`, includes only patients who have observed the outcome, though its value may still be missing. include_on_events_prior_to_index (Tuple[str, int], optional): Filters patients based on prior events before the index date. - The first element is a string indicating the event token. - The second element is an integer representing the number of days before the index event. - Example: If studying medication effects post-diagnosis, you may include only those diagnosed 60 days before medication. exclude_on_events_prior_to_index (List[str], optional): Excludes patients based on events occurring before the index date. - Example 1: If studying the initiation of a medication, patients already on the medication may be excluded. exclude_on_events (List[str], optional): Excludes patients based on whether they have experienced an event at any time. - Example: If studying Type II diabetes, patients with a Type I diabetes diagnosis may be excluded. study_period (List[str], optional): Defines the study period in the format `["yyyy-mm-dd", "yyyy-mm-dd"]` in chronological order. - The start of the study period does not determine the start of observations but contributes to defining the indexing period. - The study end date marks the end of observations. age_at_entry_range (List[int], optional): Defines the allowable age range for cohort entry in years `[min_age, max_age]`. min_registered_years (int, optional): The minimum number of years a patient must be registered at the practice for inclusion at cohort entry. min_events (int, optional): The minimum number of events a patient must have experienced (up to and including the index event) to be included in the study. Notes: - This function is executed on a per-practice basis, so there is no concern about overlapping `PATIENT_ID` values. .. py:method:: fit(lazy_static, lazy_combined_frame)