nlpmed_portal.annotations.utils module

nlpmed_portal.annotations.utils.read_dataframe(file_path, file_format, nrows=None)[source]
Parameters:
  • file_path (Path)

  • file_format (str)

  • nrows (int | None)

Return type:

DataFrame

nlpmed_portal.annotations.utils.get_required_fields_for_import(*, import_target, import_missing_patients)[source]
Parameters:
  • import_target (str)

  • import_missing_patients (bool)

Return type:

list

nlpmed_portal.annotations.utils.pivot_labs(labs_qs)[source]
Parameters:

labs_qs (QuerySet)

Return type:

dict[str, list]

nlpmed_portal.annotations.utils.highlight_keywords(text, keywords=None, css_class='pink-hl')[source]
Parameters:
  • text (str)

  • keywords (list[str] | None)

Return type:

str

nlpmed_portal.annotations.utils.highlight_sentences_in_note(note_text, sections, important_css_class='yellow-hl', duplicate_css_class='gray-hl')[source]
Parameters:
  • note_text (str)

  • sections (Iterable[Section])

Return type:

str

nlpmed_portal.annotations.utils.build_html_note_text(note, sections, keywords=None)[source]
Parameters:
  • note (Note)

  • sections (Iterable[Section])

  • keywords (list[str] | None)

Return type:

str

nlpmed_portal.annotations.utils.build_html_hover_text(sections, keywords=None)[source]
Parameters:
  • sections (list[Section])

  • keywords (list[str] | None)

Return type:

str

nlpmed_portal.annotations.utils.annotations_to_buffer(output, fmt, filename)[source]
Parameters:
  • fmt (str)

  • filename (str)

Return type:

tuple[BytesIO, str, str]

nlpmed_portal.annotations.utils.is_valid_annotation_lv(lv)[source]
Return type:

bool

nlpmed_portal.annotations.utils.build_annotation_window_start_map(patient_id, window_size_days=WINDOW_GROUP_SIZE_DAYS)[source]
Parameters:
  • patient_id (int)

  • window_size_days (int)