pat2vec.util.methods_annotation_filter_annot_dataframe

Functions

filter_annot_dataframe(dataframe, filter_args)

Filters an annotation DataFrame based on specified criteria.

pat2vec.util.methods_annotation_filter_annot_dataframe.filter_annot_dataframe(dataframe, filter_args)[source]

Filters an annotation DataFrame based on specified criteria.

This function applies a series of filters to a MedCAT annotation DataFrame. It supports filtering by: - Meta-annotation values (e.g., Time_Value, Presence_Value). - Confidence scores for meta-annotations (e.g., Time_Confidence). - Annotation accuracy (acc). - Annotation types (e.g., ‘disorder’, ‘procedure’).

Parameters:
  • dataframe (DataFrame) – The annotation DataFrame to filter.

  • filter_args (Dict[str, Any]) – A dictionary where keys are column names and values are the criteria to filter by. For confidence/accuracy scores, the value is a minimum threshold. For value columns, it’s a list of allowed values.

Return type:

DataFrame

Returns:

The filtered DataFrame.