pat2vec.util.post_processing_get_pat_ipw_record

Functions

get_pat_ipw_record(current_pat_idcode[, ...])

Retrieves a patient's Individual Patient Window (IPW) record.

pat2vec.util.post_processing_get_pat_ipw_record.get_pat_ipw_record(current_pat_idcode, config_obj=None, annot_filter_arguments=None, filter_codes=None, mode='earliest', verbose=0, include_mct=True, include_textual_obs=True)[source]

Retrieves a patient’s Individual Patient Window (IPW) record.

This function finds the most relevant “index” record for a single patient by searching across multiple annotation sources (EPR, MCT, textual_obs). The index record is determined by filter_codes and the mode (e.g., the ‘earliest’ occurrence of a specific diagnosis CUI).

If no record is found, a fallback record is created based on the global date settings in the configuration.

Parameters:
  • current_pat_idcode (str) – The unique identifier for the patient.

  • config_obj (Optional[Any]) – The configuration object containing paths and settings. Defaults to None.

  • annot_filter_arguments (Optional[Dict[str, Any]]) – A dictionary of filters to apply to annotations before selecting the IPW record. Defaults to None.

  • filter_codes (Optional[List[Any]]) – A list of CUI codes to identify the relevant clinical events. Defaults to None.

  • mode (str) – Determines whether to find the ‘earliest’ or ‘latest’ record for the patient. Defaults to “earliest”.

  • verbose (int) – Verbosity level for logging. Defaults to 0.

  • include_mct (bool) – If True, includes annotations from MCT (MRC clinical notes) in the search. Defaults to True.

  • include_textual_obs (bool) – If True, includes annotations from textual observations. Defaults to True.

Returns:

A DataFrame containing the single IPW record for the patient.

Return type:

pd.DataFrame