pat2vec.pat2vec_get_methods.get_method_appointments

Functions

get_appointments(current_pat_client_id_code,Β ...)

Retrieves pims_apps features for a given patient within a date range.

search_appointments([...])

Searches for appointment data for a specific patient within a date range.

pat2vec.pat2vec_get_methods.get_method_appointments.search_appointments(cohort_searcher_with_terms_and_search=None, client_id_codes=None, appointments_time_field='AppointmentDateTime', start_year='1995', start_month='01', start_day='01', end_year='2025', end_month='12', end_day='12', additional_custom_search_string=None)[source]

Searches for appointment data for a specific patient within a date range.

Uses a cohort searcher to find appointment data.

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

  • client_id_codes (Optional[Union[str, List[str]]]) – The client ID code(s) of the patient(s). Defaults to None.

  • appointments_time_field (str) – The timestamp field for filtering appointments. Defaults to β€˜AppointmentDateTime’.

  • start_year (str) – Start year for the search. Defaults to β€˜1995’.

  • start_month (str) – Start month for the search. Defaults to β€˜01’.

  • start_day (str) – Start day for the search. Defaults to β€˜01’.

  • end_year (str) – End year for the search. Defaults to β€˜2025’.

  • end_month (str) – End month for the search. Defaults to β€˜12’.

  • end_day (str) – End day for the search. Defaults to β€˜12’.

  • additional_custom_search_string (Optional[str]) – An additional string to append to the search query. Defaults to None.

Returns:

A DataFrame containing the raw appointment data.

Return type:

pd.DataFrame

pat2vec.pat2vec_get_methods.get_method_appointments.get_appointments(current_pat_client_id_code, target_date_range, pat_batch, config_obj=None, cohort_searcher_with_terms_and_search=None)[source]

Retrieves pims_apps features for a given patient within a date range.

This function retrieves appointment data, either from a pre-loaded batch DataFrame or by searching, and then processes it to create one-hot encoded features for consultant, clinic, and appointment type.

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

  • target_date_range (tuple) – A tuple representing the target date range.

  • 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 pims_apps features for the

specified patient. If no data is found, a DataFrame with only the β€˜client_idcode’ is returned.

Return type:

pd.DataFrame