# yavanash/healthezy architecture

> Architecture diagram of the GitHub repository yavanash/healthezy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yavanash/healthezy
- Repository: https://github.com/yavanash/healthezy

## Overview

Healthezy is a healthcare operations API for identity, facilities, staff, patients, labs, schedules, and appointments. The principal workflow is an API request routed to a domain handler, processed by its service, and persisted through database managers and SQLAlchemy models; authentication and authorization guard relevant operations. The README documents additional endpoint capabilities such as schedule exceptions and hospital searches. Relationships are limited to routing, imports, and calls supported by the SOURCE INDEX or README; unsampled implementation details are not inferred.

Main entry points: [`src/api.py`](https://github.com/yavanash/healthezy/blob/main/src/api.py) (API router), [`src/database/managers`](https://github.com/yavanash/healthezy/tree/main/src/database/managers) (Domain managers), [`src/database/managers/users.py`](https://github.com/yavanash/healthezy/blob/main/src/database/managers/users.py) (User manager), [`src/auth/service.py`](https://github.com/yavanash/healthezy/blob/main/src/auth/service.py) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api["API router<br/>[api.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Auth routes<br/>[routes.py]"]
  node_auth_service["Auth service<br/>[service.py]"]
  node_auth_guard["Auth dependencies<br/>[dependencies.py]"]
  node_auth_types["Auth schemas<br/>[models.py]"]
  node_users_routes["User routes<br/>[routes.py]"]
  node_users_service["User service<br/>[service.py]"]
end

subgraph group_care["Care operations"]
  node_doctors_routes["Doctor routes<br/>[routes.py]"]
  node_doctors_service["Doctor service<br/>[service.py]"]
  node_schedules["Schedules and exceptions"]
  node_appointments_routes["Appointment routes<br/>[routes.py]"]
  node_appointments_service["Appointment service<br/>[service.py]"]
  node_patients["Patient operations"]
end

subgraph group_directory["Facilities and administration"]
  node_hospitals["Hospital operations"]
  node_labs["Lab operations"]
  node_tenants["Tenant operations"]
  node_admin["Administration"]
end

subgraph group_storage["Persistence"]
  node_manager_base["Database manager base<br/>[manager.py]"]
  node_doctor_manager["Doctor manager<br/>[doctors.py]"]
  node_user_manager["User manager<br/>[users.py]"]
  node_domain_managers["Domain managers"]
  node_db_models[("Healthcare data models<br/>[tenants.py]")]
  node_user_models[("User data models<br/>[users.py]")]
  node_response_models["Response schemas<br/>[response_models.py]"]
  node_db_sessions["Database sessions<br/>[sessions.py]"]
end

node_caller(("API client"))

node_caller -->|"sends request"| node_api
node_api -->|"routes to"| node_auth_routes
node_api -->|"routes to"| node_admin
node_api -->|"routes to"| node_users_routes
node_api -->|"routes to"| node_doctors_routes
node_api -->|"routes to"| node_schedules
node_api -->|"routes to"| node_hospitals
node_api -->|"routes to"| node_tenants
node_api -->|"routes to"| node_appointments_routes
node_api -->|"routes to"| node_patients
node_api -->|"routes to"| node_labs
node_auth_routes -->|"calls"| node_auth_service
node_auth_routes -->|"uses schemas"| node_auth_types
node_auth_service -->|"uses"| node_user_manager
node_auth_service -->|"uses"| node_doctor_manager
node_auth_guard -->|"validates token"| node_auth_service
node_users_routes -->|"calls"| node_users_service
node_users_routes -->|"depends on"| node_auth_guard
node_users_service -->|"uses"| node_user_manager
node_doctors_routes -->|"calls"| node_doctors_service
node_doctors_routes -->|"depends on"| node_auth_guard
node_doctors_service -->|"uses"| node_doctor_manager
node_doctors_service -->|"uses schedules"| node_domain_managers
node_schedules -->|"calls"| node_doctors_service
node_appointments_routes -->|"calls"| node_appointments_service
node_appointments_service -->|"uses appointment and schedule managers"| node_domain_managers
node_patients -->|"uses"| node_user_manager
node_patients -->|"uses patient manager"| node_domain_managers
node_hospitals -->|"uses domain managers"| node_domain_managers
node_labs -->|"uses lab and user managers"| node_domain_managers
node_tenants -->|"uses tenant manager"| node_domain_managers
node_admin -->|"uses managers"| node_domain_managers
node_doctor_manager -->|"inherits database operations"| node_manager_base
node_user_manager -->|"inherits database operations"| node_manager_base
node_domain_managers -->|"uses shared base"| node_manager_base
node_manager_base -.->|"operates on session"| node_db_sessions
node_doctor_manager -->|"queries healthcare data"| node_db_models
node_user_manager -->|"queries user data"| node_user_models
node_db_models -->|"converts to responses"| node_response_models
node_user_models -->|"converts to responses"| node_response_models

click node_api "https://github.com/yavanash/healthezy/blob/main/src/api.py"
click node_auth_routes "https://github.com/yavanash/healthezy/blob/main/src/auth/routes.py"
click node_auth_service "https://github.com/yavanash/healthezy/blob/main/src/auth/service.py"
click node_auth_guard "https://github.com/yavanash/healthezy/blob/main/src/auth/dependencies.py"
click node_auth_types "https://github.com/yavanash/healthezy/blob/main/src/auth/models.py"
click node_users_routes "https://github.com/yavanash/healthezy/blob/main/src/handlers/users/routes.py"
click node_users_service "https://github.com/yavanash/healthezy/blob/main/src/handlers/users/service.py"
click node_doctors_routes "https://github.com/yavanash/healthezy/blob/main/src/handlers/doctors/routes.py"
click node_doctors_service "https://github.com/yavanash/healthezy/blob/main/src/handlers/doctors/service.py"
click node_schedules "https://github.com/yavanash/healthezy/tree/main/src/handlers/doctors/doctor_schedules"
click node_appointments_routes "https://github.com/yavanash/healthezy/blob/main/src/handlers/appointments/routes.py"
click node_appointments_service "https://github.com/yavanash/healthezy/blob/main/src/handlers/appointments/service.py"
click node_patients "https://github.com/yavanash/healthezy/tree/main/src/handlers/patients"
click node_hospitals "https://github.com/yavanash/healthezy/tree/main/src/handlers/hospitals"
click node_labs "https://github.com/yavanash/healthezy/tree/main/src/handlers/labs"
click node_tenants "https://github.com/yavanash/healthezy/tree/main/src/handlers/tenants"
click node_admin "https://github.com/yavanash/healthezy/tree/main/src/handlers/admin"
click node_manager_base "https://github.com/yavanash/healthezy/blob/main/src/database/managers/manager.py"
click node_doctor_manager "https://github.com/yavanash/healthezy/blob/main/src/database/managers/doctors.py"
click node_user_manager "https://github.com/yavanash/healthezy/blob/main/src/database/managers/users.py"
click node_domain_managers "https://github.com/yavanash/healthezy/tree/main/src/database/managers"
click node_db_models "https://github.com/yavanash/healthezy/blob/main/src/database/models/tenants.py"
click node_user_models "https://github.com/yavanash/healthezy/blob/main/src/database/models/users.py"
click node_response_models "https://github.com/yavanash/healthezy/blob/main/src/database/models/response_models.py"
click node_db_sessions "https://github.com/yavanash/healthezy/blob/main/src/database/sessions.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_caller toneBlue
class node_auth_routes,node_auth_service,node_auth_guard,node_auth_types,node_users_routes,node_users_service toneAmber
class node_doctors_routes,node_doctors_service,node_schedules,node_appointments_routes,node_appointments_service,node_patients toneMint
class node_hospitals,node_labs,node_tenants,node_admin toneRose
class node_manager_base,node_doctor_manager,node_user_manager,node_domain_managers,node_db_models,node_user_models,node_response_models,node_db_sessions toneIndigo
```

## Components

### API entry

- [API router](https://github.com/yavanash/healthezy/blob/main/src/api.py): `src/api.py`

### Identity and access

- [Auth routes](https://github.com/yavanash/healthezy/blob/main/src/auth/routes.py): `src/auth/routes.py`
- [Auth service](https://github.com/yavanash/healthezy/blob/main/src/auth/service.py): `src/auth/service.py`
- [Auth dependencies](https://github.com/yavanash/healthezy/blob/main/src/auth/dependencies.py): `src/auth/dependencies.py`
- [Auth schemas](https://github.com/yavanash/healthezy/blob/main/src/auth/models.py): `src/auth/models.py`
- [User routes](https://github.com/yavanash/healthezy/blob/main/src/handlers/users/routes.py): `src/handlers/users/routes.py`
- [User service](https://github.com/yavanash/healthezy/blob/main/src/handlers/users/service.py): `src/handlers/users/service.py`

### Care operations

- [Doctor routes](https://github.com/yavanash/healthezy/blob/main/src/handlers/doctors/routes.py): `src/handlers/doctors/routes.py`
- [Doctor service](https://github.com/yavanash/healthezy/blob/main/src/handlers/doctors/service.py): `src/handlers/doctors/service.py`
- [Schedules and exceptions](https://github.com/yavanash/healthezy/tree/main/src/handlers/doctors/doctor_schedules): `src/handlers/doctors/doctor_schedules`
- [Appointment routes](https://github.com/yavanash/healthezy/blob/main/src/handlers/appointments/routes.py): `src/handlers/appointments/routes.py`
- [Appointment service](https://github.com/yavanash/healthezy/blob/main/src/handlers/appointments/service.py): `src/handlers/appointments/service.py`
- [Patient operations](https://github.com/yavanash/healthezy/tree/main/src/handlers/patients): `src/handlers/patients`

### Facilities and administration

- [Hospital operations](https://github.com/yavanash/healthezy/tree/main/src/handlers/hospitals): `src/handlers/hospitals`
- [Lab operations](https://github.com/yavanash/healthezy/tree/main/src/handlers/labs): `src/handlers/labs`
- [Tenant operations](https://github.com/yavanash/healthezy/tree/main/src/handlers/tenants): `src/handlers/tenants`
- [Administration](https://github.com/yavanash/healthezy/tree/main/src/handlers/admin): `src/handlers/admin`

### Persistence

- [Database manager base](https://github.com/yavanash/healthezy/blob/main/src/database/managers/manager.py): `src/database/managers/manager.py`
- [Doctor manager](https://github.com/yavanash/healthezy/blob/main/src/database/managers/doctors.py): `src/database/managers/doctors.py`
- [User manager](https://github.com/yavanash/healthezy/blob/main/src/database/managers/users.py): `src/database/managers/users.py`
- [Domain managers](https://github.com/yavanash/healthezy/tree/main/src/database/managers): `src/database/managers`
- [Healthcare data models](https://github.com/yavanash/healthezy/blob/main/src/database/models/tenants.py): `src/database/models/tenants.py`
- [User data models](https://github.com/yavanash/healthezy/blob/main/src/database/models/users.py): `src/database/models/users.py`
- [Response schemas](https://github.com/yavanash/healthezy/blob/main/src/database/models/response_models.py): `src/database/models/response_models.py`
- [Database sessions](https://github.com/yavanash/healthezy/blob/main/src/database/sessions.py): `src/database/sessions.py`

### Other components

- **API client**

## Connections

- API client → API router: sends request
- API router → Auth routes: routes to (evidence: `src/api.py`)
- API router → Administration: routes to (evidence: `src/api.py`)
- API router → User routes: routes to (evidence: `src/api.py`)
- API router → Doctor routes: routes to (evidence: `src/api.py`)
- API router → Schedules and exceptions: routes to (evidence: `src/api.py`)
- API router → Hospital operations: routes to (evidence: `src/api.py`)
- API router → Tenant operations: routes to (evidence: `src/api.py`)
- API router → Appointment routes: routes to (evidence: `src/api.py`)
- API router → Patient operations: routes to (evidence: `src/api.py`)
- API router → Lab operations: routes to (evidence: `src/api.py`)
- Auth routes → Auth service: calls (evidence: `src/auth/routes.py`)
- Auth routes → Auth schemas: uses schemas (evidence: `src/auth/routes.py`)
- Auth service → User manager: uses (evidence: `src/auth/service.py`)
- Auth service → Doctor manager: uses (evidence: `src/auth/service.py`)
- Auth dependencies → Auth service: validates token (evidence: `src/auth/dependencies.py`)
- User routes → User service: calls (evidence: `src/handlers/users/routes.py`)
- User routes → Auth dependencies: depends on (evidence: `src/handlers/users/routes.py`)
- User service → User manager: uses (evidence: `src/handlers/users/service.py`)
- Doctor routes → Doctor service: calls (evidence: `src/handlers/doctors/routes.py`)
- Doctor routes → Auth dependencies: depends on (evidence: `src/handlers/doctors/routes.py`)
- Doctor service → Doctor manager: uses (evidence: `src/handlers/doctors/service.py`)
- Doctor service → Domain managers: uses schedules (evidence: `src/handlers/doctors/service.py`)
- Schedules and exceptions → Doctor service: calls (evidence: `src/handlers/doctors/doctor_schedules/routes.py`)
- Appointment routes → Appointment service: calls (evidence: `src/handlers/appointments/routes.py`)
- Appointment service → Domain managers: uses appointment and schedule managers (evidence: `src/handlers/appointments/service.py`)
- Patient operations → User manager: uses (evidence: `src/handlers/patients/service.py`)
- Patient operations → Domain managers: uses patient manager (evidence: `src/handlers/patients/service.py`)
- Hospital operations → Domain managers: uses domain managers (evidence: `src/handlers/hospitals/service.py`)
- Lab operations → Domain managers: uses lab and user managers (evidence: `src/handlers/labs/service.py`)
- Tenant operations → Domain managers: uses tenant manager (evidence: `src/handlers/tenants/service.py`)
- Administration → Domain managers: uses managers (evidence: `src/handlers/admin/service.py`)
- Doctor manager → Database manager base: inherits database operations (evidence: `src/database/managers/doctors.py`)
- User manager → Database manager base: inherits database operations (evidence: `src/database/managers/users.py`)
- Domain managers → Database manager base: uses shared base (evidence: `src/database/managers/schedules.py`)
- Database manager base → Database sessions: operates on session
- Doctor manager → Healthcare data models: queries healthcare data (evidence: `src/database/managers/doctors.py`)
- User manager → User data models: queries user data (evidence: `src/database/managers/users.py`)
- Healthcare data models → Response schemas: converts to responses (evidence: `src/database/models/tenants.py`)
- User data models → Response schemas: converts to responses (evidence: `src/database/models/users.py`)
