Skip to content

medical_reports

Re-exports from hiperhealth.skills.extraction.medical_reports for backward compatibility.

Classes:

Functions:

BaseMedicalReportExtractor

Bases: ABC, Generic[T]

Methods:

extract_report_data abstractmethod

extract_report_data(source: T) -> dict[str, Any]
Source code in src/hiperhealth/skills/extraction/medical_reports.py
@abstractmethod
def extract_report_data(
    self,
    source: T,
) -> dict[str, Any]:
    """
    title: Extract structured text data from source file.
    parameters:
      source:
        type: T
        description: Value for source.
    returns:
      type: dict[str, Any]
      description: Return value.
    """
    raise NotImplementedError

MedicalReportExtractorError

Bases: Exception

MedicalReportFileExtractor

MedicalReportFileExtractor()

Bases: BaseMedicalReportExtractor[FileInput]

Methods:

Attributes:

Source code in src/hiperhealth/skills/extraction/medical_reports.py
def __init__(self) -> None:
    """
    title: Initialize extractor with caches and mimetype detector.
    """
    self._mimetype_cache: dict[str, MimeType] = {}
    self._text_cache: dict[str, str] = {}
    self.mime = magic.Magic(mime=True)

allowed_extensions property

allowed_extensions: list[FileExtension]

allowed_mimetypes property

allowed_mimetypes: list[MimeType]

extract_report_data

extract_report_data(source: FileInput) -> dict[str, Any]
Source code in src/hiperhealth/skills/extraction/medical_reports.py
def extract_report_data(
    self,
    source: FileInput,
) -> dict[str, Any]:
    """
    title: Validate input and return extracted text plus basic metadata.
    parameters:
      source:
        type: FileInput
        description: Value for source.
    returns:
      type: dict[str, Any]
      description: Return value.
    """
    self._validate_or_raise(source)
    return self._process_file(source)

extract_text

extract_text(source: FileInput) -> str
Source code in src/hiperhealth/skills/extraction/medical_reports.py
def extract_text(self, source: FileInput) -> str:
    """
    title: Validate input and return the extracted raw text only.
    parameters:
      source:
        type: FileInput
        description: Value for source.
    returns:
      type: str
      description: Return value.
    """
    self._validate_or_raise(source)
    return self._extract_text(source)

TextExtractionError

get_medical_report_extractor

get_medical_report_extractor() -> (
    MedicalReportFileExtractor
)
Source code in src/hiperhealth/skills/extraction/medical_reports.py
def get_medical_report_extractor() -> MedicalReportFileExtractor:
    """
    title: Create and return an instance of MedicalReportFileExtractor.
    returns:
      type: MedicalReportFileExtractor
      description: Return value.
    """
    return MedicalReportFileExtractor()