# Healthcare Platform (Torbat Healthcare)

| Field | Value |
| --- | --- |
| Service | `healthcare-service` |
| Database | `healthcare_db` |
| Port | 8010 |
| Permission prefix | `healthcare.*` |
| Version | 0.13.0.0 |
| Phase | 13.0 Healthcare Foundation |

## Owns

- Clinics, branches, departments, configuration/settings shells
- Doctor and patient profile shells (Identity user refs only)
- External provider **registrations** (contracts only)
- Healthcare roles/permissions catalog shells
- Healthcare audit log + transactional outbox
- Health / capabilities / metrics discovery
- Publish-only `healthcare.*` events

## Does not own

- Accounting journals / billing posting
- Communication SMS/email providers
- Loyalty ledger
- Identity user administration
- Appointment booking, visit workflows, medical records, pharmacy (phases 13.1–13.7)
- Delivery dispatch engines
- Frontend UI

## APIs

| Method | Path |
| --- | --- |
| GET | `/health` |
| GET | `/capabilities` |
| GET | `/metrics` |
| CRUD | `/api/v1/clinics` |
| CRUD | `/api/v1/branches` |
| CRUD | `/api/v1/departments` |
| CRUD | `/api/v1/doctors` |
| CRUD | `/api/v1/patients` |
| CRUD | `/api/v1/external-providers` |
| CRUD | `/api/v1/configurations` |
| PUT/GET | `/api/v1/settings` |
| GET | `/api/v1/audit` |
| GET | `/api/v1/permissions/catalog` |

## Run (dev)

```bash
export HEALTHCARE_DATABASE_URL=postgresql+asyncpg://...
export HEALTHCARE_DATABASE_URL_SYNC=postgresql+psycopg://...
python scripts/ensure_db.py
alembic upgrade head
uvicorn app.main:app --host 0.0.0.0 --port 8010 --reload
```

## Tests

```bash
pytest
```
