pat2vec.pat2vec_get_methods.get_method_demographics

Functions

get_demo(current_pat_client_id_code, ...[, ...])

Retrieves and processes demographic features for a patient.

get_demographics3_batch(patlist, ...[, ...])

Retrieves the latest demographic record for patients within a date range.

pat2vec.pat2vec_get_methods.get_method_demographics.get_demo(current_pat_client_id_code, target_date_range, pat_batch, config_obj=None)[source]

Retrieves and processes demographic features for a patient.

This function orchestrates the retrieval of the latest demographic record for a patient within a target date range and then processes it to extract features for age, sex, deceased status, and ethnicity.

Parameters:
  • current_pat_client_id_code (str) – The client ID code for the patient.

  • target_date_range (Tuple) – The date range for which to get data.

  • pat_batch (pd.DataFrame) – The batch DataFrame containing demographic data.

  • config_obj (Optional[object]) – Configuration object. Defaults to None.

Returns:

A single-row DataFrame with demographic features.

Return type:

pd.DataFrame

pat2vec.pat2vec_get_methods.get_method_demographics.get_demographics3_batch(patlist, target_date_range, pat_batch, config_obj=None, cohort_searcher_with_terms_and_search=None)[source]

Retrieves the latest demographic record for patients within a date range.

This function either filters a pre-loaded batch DataFrame or searches for demographic data. It forward-fills missing critical information and returns the single most recent record for each patient within the specified time window.

Parameters:
  • patlist (List[str]) – A list of patient client ID codes.

  • target_date_range (Tuple) – The date range for which to retrieve data.

  • pat_batch (pd.DataFrame) – The DataFrame containing patient data for batch mode.

  • config_obj (Optional[object]) – Configuration object. Defaults to None.

  • cohort_searcher_with_terms_and_search (Optional[Callable]) – The function for cohort searching. Defaults to None.

Returns:

A DataFrame containing the most recent demographic record

for the patient(s) in the date range.

Return type:

pd.DataFrame