pat2vec.util.methods_annotation_get_pat_document_annotation_batch

Functions

get_pat_batch_textual_obs_annotation_batch(...)

Retrieves or creates annotations for a textual observation batch.

get_pat_document_annotation_batch(...)

Retrieves or creates the annotation batch for a patient's documents.

get_pat_document_annotation_batch_mct(...)

Retrieves or creates the annotation batch for a patient's MCT documents.

get_pat_document_annotation_batch_reports(...)

Retrieves or creates the annotation batch for a patient's reports.

pat2vec.util.methods_annotation_get_pat_document_annotation_batch.get_pat_document_annotation_batch(current_pat_client_idcode, pat_batch, cat, config_obj, t)[source]

Retrieves or creates the annotation batch for a patient’s documents.

This function orchestrates the annotation of a patient’s document batch. It calls MedCAT to get annotations, saves them to a patient-specific CSV file, and then reads that file back into a DataFrame.

Parameters:
  • current_pat_client_idcode (str) – The client ID for the current patient.

  • pat_batch (DataFrame) – A DataFrame containing the batch of documents for the patient.

  • cat (Any) – The loaded MedCAT CAT object for entity recognition.

  • config_obj (Any) – The configuration object containing settings and paths.

  • t (Any) – The tqdm progress bar instance to update.

Return type:

DataFrame

Returns:

A DataFrame containing the annotation batch for the patient.

pat2vec.util.methods_annotation_get_pat_document_annotation_batch.get_pat_document_annotation_batch_mct(current_pat_client_idcode, pat_batch, cat, config_obj, t)[source]

Retrieves or creates the annotation batch for a patient’s MCT documents.

This function annotates a patient’s MCT (MRC clinical notes) document batch using MedCAT, saves the structured annotations to a CSV file, and returns the result as a DataFrame.

Parameters:
  • current_pat_client_idcode (str) – The client ID for the current patient.

  • pat_batch (DataFrame) – A DataFrame containing the batch of MCT documents.

  • cat (Any) – The loaded MedCAT CAT object.

  • config_obj (Any) – The configuration object.

  • t (Any) – The tqdm progress bar instance.

Return type:

DataFrame

Returns:

A DataFrame containing the annotation batch for the patient’s MCT documents.

pat2vec.util.methods_annotation_get_pat_document_annotation_batch.get_pat_batch_textual_obs_annotation_batch(current_pat_client_idcode, pat_batch, cat, config_obj, t)[source]

Retrieves or creates annotations for a textual observation batch.

This function annotates a patient’s textual observation batch using MedCAT, saves the structured annotations to a CSV file, and returns the result as a DataFrame.

Parameters:
  • current_pat_client_idcode (str) – The client ID for the current patient.

  • pat_batch (DataFrame) – A DataFrame containing the batch of textual observations.

  • cat (Any) – The loaded MedCAT CAT object.

  • config_obj (Any) – The configuration object.

  • t (Any) – The tqdm progress bar instance.

Return type:

DataFrame

Returns:

A DataFrame containing the annotation batch for the patient’s textual observations.

pat2vec.util.methods_annotation_get_pat_document_annotation_batch.get_pat_document_annotation_batch_reports(current_pat_client_idcode, pat_batch, cat, config_obj, t)[source]

Retrieves or creates the annotation batch for a patient’s reports.

This function annotates a patient’s reports batch using MedCAT, saves the structured annotations to a CSV file, and returns the result as a DataFrame.

Parameters:
  • current_pat_client_idcode (str) – The client ID for the current patient.

  • pat_batch (DataFrame) – A DataFrame containing the batch of reports.

  • cat (Any) – The loaded MedCAT CAT object.

  • config_obj (Any) – The configuration object.

  • t (Any) – The tqdm progress bar instance.

Return type:

DataFrame

Returns:

A DataFrame containing the annotation batch for the patient’s reports.