# arshh06/vitavia architecture

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

- Interactive diagram: https://gitdiagram.com/arshh06/vitavia
- Repository: https://github.com/arshh06/vitavia

## Overview

VITAVIA is an ambulance emergency-response platform: simulated patient telemetry enters a backend, which assesses urgency, checks hospital resources, compares traffic-aware routes, selects a suitable destination, and tracks the journey. The repository contains both the README-described backend and a more extensive `hospital/` application with triage, journey, API, dashboard, and audit-history modules. The graph preserves both implementations. Some links—especially across HTTP and unsampled route handlers—are supported only by the README or source-index references; those limits are reflected in the evidence.

Main entry points: [`hospital/backend/app/api/routes.py`](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/api/routes.py) (Emergency API), [`hospital/frontend/dashboard.py`](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/dashboard.py) (Operations dashboard), [`backend/main.py`](https://github.com/arshh06/vitavia/blob/main/backend/main.py) (Legacy API), [`hospital/backend/app/services/selection_service.py`](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/selection_service.py) (Hospital selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sim["Ambulance simulation"]
  node_simulator["Telemetry simulator<br/>[simulator.py]"]
end

subgraph group_legacy["Core response backend"]
  node_legacy_api["Legacy API<br/>[main.py]"]
  node_legacy_models["Legacy schemas<br/>[models.py]"]
  node_legacy_ai["Legacy clinical analysis<br/>[gemini_service.py]"]
  node_legacy_hospitals[("Legacy hospital registry<br/>[hospitals.py]")]
  node_legacy_decision["Eligibility and selection<br/>[decision.py]"]
  node_legacy_routing["Legacy routing engine<br/>[routing.py]"]
end

subgraph group_hospital["Hospital backend"]
  node_hospital_api["Emergency API<br/>[routes.py]"]
  node_schemas["Emergency schemas<br/>[schemas.py]"]
  node_simulation["Vitals simulation"]
  node_triage["Assisted triage<br/>[triage_service.py]"]
  node_gemini["Gemini decision support<br/>[gemini_service.py]"]
  node_selection["Hospital selection"]
  node_hospital_data[("Hospital registry<br/>[hospitals.py]")]
  node_hospital_service["Resource verification"]
  node_routing["Traffic-aware routing<br/>[routing_service.py]"]
  node_journey["Journey and acknowledgment<br/>[journey_service.py]"]
  node_incoming["Emergency intake"]
end

subgraph group_history["Audit history"]
  node_persistence["History persistence"]
  node_db[("SQLite audit store<br/>[database.py]")]
  node_orm["History records<br/>[models.py]"]
end

subgraph group_ui["Operations dashboards"]
  node_legacy_dashboard["Legacy command dashboard<br/>[app.py]"]
  node_dashboard["Operations dashboard<br/>[dashboard.py]"]
  node_client["Dashboard API client<br/>[api_client.py]"]
  node_route_panel["Route and acknowledgment view<br/>[route_panel.py]"]
  node_presentation["Display terminology<br/>[presentation.py]"]
  node_hospital_cards["Hospital comparison cards<br/>[hospital_cards.py]"]
  node_vitals_panel["Vitals monitor<br/>[vitals_panel.py]"]
  node_history_panel["History viewer<br/>[history_panel.py]"]
  node_journey_panel["Journey view<br/>[journey_panel.py]"]
end

node_request(("Patient / request"))
node_maps["Google Routes API"]
node_gemini_service["Gemini service"]

node_request -->|"starts scenario"| node_simulator
node_simulator -->|"posts telemetry"| node_legacy_api
node_legacy_api -->|"requests analysis"| node_legacy_ai
node_legacy_api -->|"requests decision"| node_legacy_decision
node_legacy_api -->|"uses registry"| node_legacy_hospitals
node_legacy_decision -->|"uses assessment"| node_legacy_ai
node_legacy_decision -->|"checks capacity"| node_legacy_hospitals
node_legacy_decision -->|"evaluates routes"| node_legacy_routing
node_legacy_api -.->|"serves workflow"| node_legacy_dashboard
node_hospital_api -->|"reads and sets vitals"| node_simulation
node_hospital_api -->|"requests triage"| node_triage
node_triage -->|"requests analysis"| node_gemini
node_hospital_api -->|"requests selection"| node_selection
node_selection -->|"checks resources"| node_hospital_service
node_selection -->|"calculates routes"| node_routing
node_selection -->|"uses requirements"| node_triage
node_selection -->|"reads candidates"| node_hospital_data
node_routing -.->|"requests traffic routes"| node_maps
node_hospital_api -->|"starts journey"| node_journey
node_hospital_api -.->|"orchestrates intake"| node_incoming
node_hospital_api -->|"saves operation results"| node_persistence
node_persistence -->|"opens transactions"| node_db
node_db -->|"creates tables"| node_orm
node_dashboard -->|"requests backend data"| node_client
node_dashboard -->|"renders route view"| node_route_panel
node_dashboard -->|"uses display helpers"| node_presentation
node_dashboard -->|"renders vitals"| node_vitals_panel
node_dashboard -->|"renders history"| node_history_panel
node_route_panel -->|"formats resources"| node_presentation
node_hospital_cards -->|"uses route context"| node_route_panel
node_history_panel -->|"renders route details"| node_route_panel
node_history_panel -->|"formats history"| node_presentation
node_journey_panel -->|"uses route display"| node_route_panel

click node_simulator "https://github.com/arshh06/vitavia/blob/main/ambulance/simulator.py"
click node_legacy_api "https://github.com/arshh06/vitavia/blob/main/backend/main.py"
click node_legacy_models "https://github.com/arshh06/vitavia/blob/main/backend/models.py"
click node_legacy_ai "https://github.com/arshh06/vitavia/blob/main/backend/gemini_service.py"
click node_legacy_hospitals "https://github.com/arshh06/vitavia/blob/main/backend/hospitals.py"
click node_legacy_decision "https://github.com/arshh06/vitavia/blob/main/backend/decision.py"
click node_legacy_routing "https://github.com/arshh06/vitavia/blob/main/backend/routing.py"
click node_hospital_api "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/api/routes.py"
click node_schemas "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/models/schemas.py"
click node_simulation "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/simulation_service.py"
click node_triage "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/triage_service.py"
click node_gemini "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/gemini_service.py"
click node_selection "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/selection_service.py"
click node_hospital_data "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/data/hospitals.py"
click node_hospital_service "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/hospital_service.py"
click node_routing "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/routing_service.py"
click node_journey "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/journey_service.py"
click node_incoming "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/incoming_emergency_service.py"
click node_persistence "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/persistence_service.py"
click node_db "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/db/database.py"
click node_orm "https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/db/models.py"
click node_legacy_dashboard "https://github.com/arshh06/vitavia/blob/main/frontend/app.py"
click node_dashboard "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/dashboard.py"
click node_client "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/api_client.py"
click node_route_panel "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/route_panel.py"
click node_presentation "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/presentation.py"
click node_hospital_cards "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/hospital_cards.py"
click node_vitals_panel "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/vitals_panel.py"
click node_history_panel "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/history_panel.py"
click node_journey_panel "https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/journey_panel.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_simulator toneBlue
class node_legacy_api,node_legacy_models,node_legacy_ai,node_legacy_hospitals,node_legacy_decision,node_legacy_routing toneAmber
class node_hospital_api,node_schemas,node_simulation,node_triage,node_gemini,node_selection,node_hospital_data,node_hospital_service,node_routing,node_journey,node_incoming,node_request,node_maps toneMint
class node_persistence,node_db,node_orm toneRose
class node_legacy_dashboard,node_dashboard,node_client,node_route_panel,node_presentation,node_hospital_cards,node_vitals_panel,node_history_panel,node_journey_panel,node_gemini_service toneIndigo
```

## Components

### Ambulance simulation

- [Telemetry simulator](https://github.com/arshh06/vitavia/blob/main/ambulance/simulator.py): `ambulance/simulator.py`

### Core response backend

- [Legacy API](https://github.com/arshh06/vitavia/blob/main/backend/main.py): `backend/main.py`
- [Legacy schemas](https://github.com/arshh06/vitavia/blob/main/backend/models.py): `backend/models.py`
- [Legacy clinical analysis](https://github.com/arshh06/vitavia/blob/main/backend/gemini_service.py): `backend/gemini_service.py`
- [Legacy hospital registry](https://github.com/arshh06/vitavia/blob/main/backend/hospitals.py): `backend/hospitals.py`
- [Eligibility and selection](https://github.com/arshh06/vitavia/blob/main/backend/decision.py): `backend/decision.py`
- [Legacy routing engine](https://github.com/arshh06/vitavia/blob/main/backend/routing.py): `backend/routing.py`

### Hospital backend

- [Emergency API](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/api/routes.py): `hospital/backend/app/api/routes.py`
- [Emergency schemas](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/models/schemas.py): `hospital/backend/app/models/schemas.py`
- [Vitals simulation](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/simulation_service.py): `hospital/backend/app/services/simulation_service.py`
- [Assisted triage](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/triage_service.py): `hospital/backend/app/services/triage_service.py`
- [Gemini decision support](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/gemini_service.py): `hospital/backend/app/services/gemini_service.py`
- [Hospital selection](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/selection_service.py): `hospital/backend/app/services/selection_service.py`
- [Hospital registry](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/data/hospitals.py): `hospital/backend/app/data/hospitals.py`
- [Resource verification](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/hospital_service.py): `hospital/backend/app/services/hospital_service.py`
- [Traffic-aware routing](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/routing_service.py): `hospital/backend/app/services/routing_service.py`
- [Journey and acknowledgment](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/journey_service.py): `hospital/backend/app/services/journey_service.py`
- [Emergency intake](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/incoming_emergency_service.py): `hospital/backend/app/services/incoming_emergency_service.py`

### Audit history

- [History persistence](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/services/persistence_service.py): `hospital/backend/app/services/persistence_service.py`
- [SQLite audit store](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/db/database.py): `hospital/backend/app/db/database.py`
- [History records](https://github.com/arshh06/vitavia/blob/main/hospital/backend/app/db/models.py): `hospital/backend/app/db/models.py`

### Operations dashboards

- [Legacy command dashboard](https://github.com/arshh06/vitavia/blob/main/frontend/app.py): `frontend/app.py`
- [Operations dashboard](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/dashboard.py): `hospital/frontend/dashboard.py`
- [Dashboard API client](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/api_client.py): `hospital/frontend/api_client.py`
- [Route and acknowledgment view](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/route_panel.py): `hospital/frontend/components/route_panel.py`
- [Display terminology](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/presentation.py): `hospital/frontend/components/presentation.py`
- [Hospital comparison cards](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/hospital_cards.py): `hospital/frontend/components/hospital_cards.py`
- [Vitals monitor](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/vitals_panel.py): `hospital/frontend/components/vitals_panel.py`
- [History viewer](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/history_panel.py): `hospital/frontend/components/history_panel.py`
- [Journey view](https://github.com/arshh06/vitavia/blob/main/hospital/frontend/components/journey_panel.py): `hospital/frontend/components/journey_panel.py`

### Other components

- **Patient / request**
- **Google Routes API**
- **Gemini service**

## Connections

- Patient / request → Telemetry simulator: starts scenario (evidence: `README.md`)
- Telemetry simulator → Legacy API: posts telemetry (evidence: `ambulance/simulator.py`)
- Legacy API → Legacy clinical analysis: requests analysis (evidence: `backend/main.py`)
- Legacy API → Eligibility and selection: requests decision (evidence: `backend/main.py`)
- Legacy API → Legacy hospital registry: uses registry (evidence: `backend/main.py`)
- Eligibility and selection → Legacy clinical analysis: uses assessment (evidence: `backend/decision.py`)
- Eligibility and selection → Legacy hospital registry: checks capacity (evidence: `backend/decision.py`)
- Eligibility and selection → Legacy routing engine: evaluates routes (evidence: `backend/decision.py`)
- Legacy API → Legacy command dashboard: serves workflow (evidence: `README.md`)
- Emergency API → Vitals simulation: reads and sets vitals (evidence: `hospital/backend/app/api/routes.py`)
- Emergency API → Assisted triage: requests triage (evidence: `hospital/backend/app/api/routes.py`)
- Assisted triage → Gemini decision support: requests analysis (evidence: `hospital/backend/app/services/triage_service.py`)
- Emergency API → Hospital selection: requests selection (evidence: `hospital/backend/app/api/routes.py`)
- Hospital selection → Resource verification: checks resources (evidence: `hospital/backend/app/services/selection_service.py`)
- Hospital selection → Traffic-aware routing: calculates routes (evidence: `hospital/backend/app/services/selection_service.py`)
- Hospital selection → Assisted triage: uses requirements (evidence: `hospital/backend/app/services/selection_service.py`)
- Hospital selection → Hospital registry: reads candidates (evidence: `hospital/backend/app/services/selection_service.py`)
- Traffic-aware routing → Google Routes API: requests traffic routes (evidence: `hospital/backend/app/services/routing_service.py`)
- Emergency API → Journey and acknowledgment: starts journey (evidence: `hospital/backend/app/api/routes.py`)
- Emergency API → Emergency intake: orchestrates intake (evidence: `hospital/backend/app/api/routes.py`)
- Emergency API → History persistence: saves operation results (evidence: `hospital/backend/app/api/routes.py`)
- History persistence → SQLite audit store: opens transactions (evidence: `hospital/backend/app/services/persistence_service.py`)
- SQLite audit store → History records: creates tables (evidence: `hospital/backend/app/db/database.py`)
- Operations dashboard → Dashboard API client: requests backend data (evidence: `hospital/frontend/dashboard.py`)
- Operations dashboard → Route and acknowledgment view: renders route view (evidence: `hospital/frontend/dashboard.py`)
- Operations dashboard → Display terminology: uses display helpers (evidence: `hospital/frontend/dashboard.py`)
- Operations dashboard → Vitals monitor: renders vitals (evidence: `hospital/frontend/dashboard.py`)
- Operations dashboard → History viewer: renders history (evidence: `hospital/frontend/dashboard.py`)
- Route and acknowledgment view → Display terminology: formats resources (evidence: `hospital/frontend/components/route_panel.py`)
- Hospital comparison cards → Route and acknowledgment view: uses route context (evidence: `hospital/frontend/components/hospital_cards.py`)
- History viewer → Route and acknowledgment view: renders route details (evidence: `hospital/frontend/components/history_panel.py`)
- History viewer → Display terminology: formats history (evidence: `hospital/frontend/components/history_panel.py`)
- Journey view → Route and acknowledgment view: uses route display (evidence: `hospital/frontend/components/journey_panel.py`)
