Metadata-Version: 2.4
Name: hiperhealth
Version: 0.4.0
Summary: Provide a pipeline for medical encounter empowered by AI
Author-email: Ivan Ogasawara <ivan.ogasawara@gmail.com>
License: BSD 3 Clause
Project-URL: Homepage, https://github.com/hiperhealth/hiperhealth
Project-URL: Issues, https://github.com/hiperhealth/hiperhealth/issues
Requires-Python: <4,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anamnesisai>=0.4.0
Requires-Dist: fhir.resources>=8.1.0
Requires-Dist: pypdf>=5.4.0
Requires-Dist: sqlalchemy>=2.0.41
Requires-Dist: atpublic>=6
Requires-Dist: questionary>=2.1.0
Requires-Dist: pillow>=11.3.0
Requires-Dist: pytesseract>=0.3.13
Requires-Dist: python-magic>=0.4.27
Requires-Dist: presidio-analyzer<3.0.0,>=2.2.359
Requires-Dist: presidio-anonymizer<3.0.0,>=2.2.359
Requires-Dist: uvicorn<0.39.0,>=0.38.0
Requires-Dist: torch>=2
Requires-Dist: langchain<1,>=0.3.7
Requires-Dist: langchain-community<1,>=0.3.7
Requires-Dist: rago>=0.14.4
Requires-Dist: numpy<2,>=1.26; python_version < "3.13" and sys_platform == "darwin"
Requires-Dist: numpy>=2; python_version >= "3.13" and sys_platform == "darwin"
Requires-Dist: numpy<2.1,>=2; python_version < "3.10" and sys_platform != "darwin"
Requires-Dist: numpy<2.2,>=2; python_version == "3.10" and sys_platform != "darwin"
Provides-Extra: dev
Requires-Dist: build>=1.3.0; extra == "dev"
Requires-Dist: twine>=6; extra == "dev"
Requires-Dist: pytest>=7.3.2; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: coverage>=7.2.7; extra == "dev"
Requires-Dist: pre-commit>=3.3.2; extra == "dev"
Requires-Dist: ruff>=0.2.0; extra == "dev"
Requires-Dist: mypy>=1.5.0; extra == "dev"
Requires-Dist: bandit>=1.7.5; extra == "dev"
Requires-Dist: vulture>=2.7; extra == "dev"
Requires-Dist: ipython>=8; extra == "dev"
Requires-Dist: ipykernel>=6.0.0; extra == "dev"
Requires-Dist: Jinja2>=3.1.2; extra == "dev"
Requires-Dist: mkdocs>=1.3; extra == "dev"
Requires-Dist: mkdocs-exclude>=1.0.2; extra == "dev"
Requires-Dist: mkdocs-jupyter>=0.24.7; extra == "dev"
Requires-Dist: mkdocs-literate-nav>=0.4.1; extra == "dev"
Requires-Dist: mkdocs-macros-plugin>=0.6.3; extra == "dev"
Requires-Dist: mkdocs-material>=8; extra == "dev"
Requires-Dist: mkdocstrings>=0.21.2; extra == "dev"
Requires-Dist: mkdocstrings-python>=1.1.2; extra == "dev"
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "dev"
Requires-Dist: makim==1.27.0; extra == "dev"
Requires-Dist: python-multipart>=0.0.20; extra == "dev"
Dynamic: license-file

# hiperhealth

Core Python library for HiperHealth clinical AI workflows.

This repository is the **library/SDK** package (`hiperhealth`) and not the web
application.

- Software License: BSD 3-Clause
- Documentation: https://hiperhealth.com
- Source: https://github.com/hiperhealth/hiperhealth

## What this library provides

- LLM-powered clinical assistance utilities:
  - Differential diagnosis suggestions
  - Exam/procedure suggestions
- Data extraction utilities:
  - Medical reports (PDF/image) to structured FHIR-like resources
  - Wearable data (CSV/JSON) parsing and normalization
- Privacy utilities:
  - PII detection and de-identification
- Domain schemas and models:
  - Pydantic schemas
  - SQLAlchemy FHIR model definitions

## Installation

### Stable release

```bash
pip install hiperhealth
```

### From source (development)

```bash
git clone https://github.com/hiperhealth/hiperhealth.git
cd hiperhealth
./scripts/install-dev.sh
```

## System requirements

Some extraction features depend on system packages:

- `tesseract` (OCR for image-based reports)
- `libmagic` (MIME type detection)

They are included in the conda dev environment (`conda/dev.yaml`).

## Configuration

Set these environment variables before using LLM-dependent features:

- `OPENAI_API_KEY` (required)
- `OPENAI_MODEL` (optional, defaults to `o4-mini`)

Example:

```bash
export OPENAI_API_KEY="your-key"
export OPENAI_MODEL="o4-mini"
```

## Quickstart

### 1. Differential diagnosis and exam suggestions

```python
from hiperhealth.agents.diagnostics import core as diag

patient = {
    "age": 45,
    "gender": "M",
    "symptoms": "chest pain, shortness of breath",
    "previous_tests": "ECG normal"
}

dx = diag.differential(patient, language="en", session_id="demo-1")
print(dx.summary)
print(dx.options)

exams = diag.exams(["Acute coronary syndrome"], language="en", session_id="demo-1")
print(exams.summary)
print(exams.options)
```

### 2. Wearable data extraction (CSV/JSON)

```python
from hiperhealth.agents.extraction.wearable import WearableDataFileExtractor

extractor = WearableDataFileExtractor()
data = extractor.extract_wearable_data("tests/data/wearable/wearable_data.csv")
print(data[:2])
```

### 3. Medical report extraction (PDF/image -> structured output)

```python
from hiperhealth.agents.extraction.medical_reports import MedicalReportFileExtractor

extractor = MedicalReportFileExtractor()
report = extractor.extract_report_data("tests/data/reports/pdf_reports/report-1.pdf")
print(report.keys())
```

### 4. De-identification

```python
from hiperhealth.privacy.deidentifier import Deidentifier, deidentify_patient_record

engine = Deidentifier()
record = {
    "symptoms": "Patient John Doe reports severe headache.",
    "mental_health": "Lives at 123 Main St"
}
clean = deidentify_patient_record(record, engine)
print(clean)
```

## Repository layout

- `src/hiperhealth/agents`: AI interaction and extraction modules
- `src/hiperhealth/privacy`: de-identification tools
- `src/hiperhealth/schema`: Pydantic schemas
- `src/hiperhealth/models`: SQLAlchemy models
- `tests`: unit and integration tests
- `docs`: MkDocs documentation source

## Development

### Create development environment

```bash
conda env create -f conda/dev.yaml -n hiperhealth
conda activate hiperhealth
./scripts/install-dev.sh
```

### Run tests

```bash
pytest -vv
```

### Run quality checks

```bash
pre-commit run --all-files
ruff check .
mypy .
```

### Build docs locally

```bash
mkdocs serve --watch docs --config-file mkdocs.yaml
```

## License

BSD 3-Clause. See [LICENSE](LICENSE).
