pat2vec.pat2vec_get_methods.get_method_core_resus
Functions
|
Calculates resuscitation status features from observations. |
|
Retrieves CORE_RESUS_STATUS features for a patient within a date range. |
Searches for CORE_RESUS_STATUS observation data within a date range. |
- pat2vec.pat2vec_get_methods.get_method_core_resus.search_core_resus_observations(cohort_searcher_with_terms_and_search=None, client_id_codes=None, observations_time_field='observationdocument_recordeddtm', 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 CORE_RESUS_STATUS observation data within a date range.
Uses a cohort searcher to find CORE_RESUS_STATUS observation data for specified patients.
- 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.
observations_time_field (str) – The timestamp field for filtering observations. Defaults to ‘observationdocument_recordeddtm’.
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 CORE_RESUS_STATUS observation data.
- Return type:
pd.DataFrame
- Raises:
ValueError – If essential arguments are None.
- pat2vec.pat2vec_get_methods.get_method_core_resus.calculate_core_resus_features(features_data, term_prefix='core_resus_status', negate_biochem=False)[source]
Calculates resuscitation status features from observations.
Counts the occurrences of “For cardiopulmonary resuscitation” and “Not for cardiopulmonary resuscitation” statuses.
- Parameters:
features_data (pd.DataFrame) – DataFrame containing CORE_RESUS_STATUS observations.
term_prefix (str) – Prefix for feature column names. Defaults to “core_resus_status”.
negate_biochem (bool) – If True, returns features with a value of 0 when no data is available. Defaults to False.
- Returns:
A dictionary of calculated features.
- Return type:
Dict[str, int]
- pat2vec.pat2vec_get_methods.get_method_core_resus.get_core_resus(current_pat_client_id_code, target_date_range, pat_batch, batch_mode=False, cohort_searcher_with_terms_and_search=None, config_obj=None)[source]
Retrieves CORE_RESUS_STATUS features for a patient within a date range.
This function fetches CORE_RESUS_STATUS data, either from a pre-loaded batch or by searching, and then counts the occurrences of each status 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.
batch_mode (bool) – Indicates if batch mode is enabled. This is controlled by config_obj.batch_mode. Defaults to False.
cohort_searcher_with_terms_and_search (Optional[Callable]) – The function for cohort searching. Defaults to None.
config_obj (Optional[object]) – Configuration object containing batch_mode and other settings. Defaults to None.
- Returns:
- A DataFrame containing CORE_RESUS_STATUS features for the
specified patient.
- Return type:
pd.DataFrame
- Raises:
ValueError – If config_obj is None.