pat2vec.pat2vec_get_methods.get_method_news
Functions
|
Computes summary statistics for a feature column in the NEWS dataset. |
|
Retrieves NEWS/NEWS2 features for a patient within a date range. |
- pat2vec.pat2vec_get_methods.get_method_news.compute_feature_stats(data, column, feature_name, config_obj)[source]
Computes summary statistics for a feature column in the NEWS dataset.
- Parameters:
data (pd.DataFrame) – Subset of patient data for the feature.
column (str) – Column to compute stats from (e.g., ‘observation_valuetext_analysed’).
feature_name (str) – Base name for the output feature columns.
config_obj (object) – Configuration object with negate_biochem attribute.
- Returns:
- A dictionary of calculated feature statistics (mean, median, std,
max, min, n).
- Return type:
Dict
- pat2vec.pat2vec_get_methods.get_method_news.get_news(current_pat_client_id_code, target_date_range, pat_batch, config_obj=None, cohort_searcher_with_terms_and_search=None)[source]
Retrieves NEWS/NEWS2 features for a patient within a date range.
This function fetches NEWS (National Early Warning Score) observation data, either from a pre-loaded batch or by searching. It then calculates summary statistics (mean, median, std, etc.) for each component of the NEWS score.
- 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 client_idcode_term_name. Defaults to None.
cohort_searcher_with_terms_and_search (Optional[Callable]) – The function for cohort searching. Defaults to None.
- Returns:
A DataFrame containing NEWS features for the specified patient.
- Return type:
pd.DataFrame