pat2vec.pat2vec_get_methods.get_method_pat_annotations

Functions

get_current_pat_annotations(...[, ...])

Retrieves and processes EPR document annotations for a patient.

pat2vec.pat2vec_get_methods.get_method_pat_annotations.get_current_pat_annotations(current_pat_client_id_code, target_date_range, batch_epr_docs_annotations, config_obj=None, t=None, cohort_searcher_with_terms_and_search=None, cat=None)[source]

Retrieves and processes EPR document annotations for a patient.

This function filters a batch of pre-existing EPR document annotations for a specific patient within a given date range. It then calculates count-based features from the ‘pretty_name’ of the annotations.

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

  • target_date_range (Tuple) – The date range to filter annotations by.

  • batch_epr_docs_annotations (Optional[pd.DataFrame]) – DataFrame containing EPR document annotations for a batch of patients.

  • config_obj (Optional[object]) – Configuration object with settings such as verbosity and start_time. Defaults to None.

  • t (Optional[object]) – A progress bar object for updating status. Defaults to None.

  • cohort_searcher_with_terms_and_search (Optional[Callable]) – Placeholder for a cohort searcher function, unused in this implementation. Defaults to None.

  • cat (Optional[object]) – Placeholder for a MedCAT object, unused in this implementation. Defaults to None.

Returns:

A DataFrame containing the calculated annotation features

for the specified patient. If no annotations are found, a DataFrame with only the ‘client_idcode’ is returned.

Return type:

pd.DataFrame

Raises:
  • ValueError – If config_obj is None.

  • TypeError – If batch_epr_docs_annotations is provided and is not a pandas DataFrame.