pat2vec.pat2vec_get_methods.get_method_hosp_site
Functions
|
Generate binary hospital site features from observation values. |
|
Retrieves CORE_HospitalSite features for a patient within a date range. |
|
Filter to valid CORE_HospitalSite records and drop NAs. |
|
Search hospital site observations via cohort search API. |
- pat2vec.pat2vec_get_methods.get_method_hosp_site.search_hospital_site(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, client_idcode_term_name='client_idcode.keyword')[source]
Search hospital site observations via cohort search API.
- pat2vec.pat2vec_get_methods.get_method_hosp_site.prepare_hospital_site_data(raw_data)[source]
Filter to valid CORE_HospitalSite records and drop NAs.
- pat2vec.pat2vec_get_methods.get_method_hosp_site.calculate_hospital_site_features(features_data, current_pat_client_id_code, negate_biochem=False)[source]
Generate binary hospital site features from observation values.
- pat2vec.pat2vec_get_methods.get_method_hosp_site.get_hosp_site(current_pat_client_id_code, target_date_range, pat_batch, config_obj=None, cohort_searcher_with_terms_and_search=None)[source]
Retrieves CORE_HospitalSite features for a patient within a date range.
This function fetches hospital site observation data, either from a pre-loaded batch or by searching, and then creates binary features indicating the presence of records from specific hospital sites.
- 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 with settings like batch_mode and negate_biochem. Defaults to None.
cohort_searcher_with_terms_and_search (Optional[Callable]) – The function for cohort searching. Defaults to None.
- Returns:
A DataFrame containing hospital site features for the patient.
- Return type:
pd.DataFrame