pat2vec.pat2vec_get_methods.get_method_bed
Functions
|
Retrieves CORE_BedNumber3 features for a patient within a date range. |
|
Searches for bed data for patients within a date range. |
- pat2vec.pat2vec_get_methods.get_method_bed.search_bed_data(cohort_searcher_with_terms_and_search=None, client_id_codes=None, client_idcode_name='client_idcode.keyword', bed_time_field='observationdocument_recordeddtm', start_year=1995, start_month=1, start_day=1, end_year=2025, end_month=12, end_day=12, search_term='CORE_BedNumber3', additional_custom_search_string=None)[source]
Searches for bed data for patients within a date range.
Uses a cohort searcher to find bed data based on a search term and date range.
- 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.
client_idcode_name (str) – The name of the client ID code field in the index. Defaults to “client_idcode.keyword”.
bed_time_field (str) – The timestamp field for filtering bed data. Defaults to ‘observationdocument_recordeddtm’.
start_year (Union[int, str]) – Start year for the search. Defaults to 1995.
start_month (Union[int, str]) – Start month for the search. Defaults to 1.
start_day (Union[int, str]) – Start day for the search. Defaults to 1.
end_year (Union[int, str]) – End year for the search. Defaults to 2025.
end_month (Union[int, str]) – End month for the search. Defaults to 12.
end_day (Union[int, str]) – End day for the search. Defaults to 12.
search_term (str) – The search term for bed data. Defaults to “CORE_BedNumber3”.
additional_custom_search_string (Optional[str]) – An additional string to append to the search query. Defaults to None.
- Returns:
A DataFrame containing the raw bed data.
- Return type:
pd.DataFrame
- pat2vec.pat2vec_get_methods.get_method_bed.get_bed(current_pat_client_id_code, target_date_range, pat_batch, config_obj=None, cohort_searcher_with_terms_and_search=None)[source]
Retrieves CORE_BedNumber3 features for a patient within a date range.
This function fetches bed data, either from a pre-loaded batch DataFrame or by searching, and then creates one-hot encoded features for each unique bed number found.
- 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 CORE_BedNumber3 features for the
specified patient. If no data is found, a DataFrame with only the ‘client_idcode’ is returned.
- Return type:
pd.DataFrame