# kailasss2k05/trackr_hospital_navigation_ecosystem- architecture

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

- Interactive diagram: https://gitdiagram.com/kailasss2k05/trackr_hospital_navigation_ecosystem-
- Repository: https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-

## Overview

1. **This repo is a three-part hospital platform**, not a single app: a Flutter **navigation client** (`navigation_app`), a React/TypeScript **operations dashboard** (`digital_twin`), and Python **backend services** (`serverside`, plus a smaller analytics/data service in `analytics_dashboard`).

2. **`navigation_app` is the patient-facing mobile/runtime client.** Its core code lives in `lib/` with feature screens such as search, route display, hospital details, street map, landmark directions, and a welcome flow. The app is asset-heavy: animations, videos, and images support the navigation experience.

3. **The navigation app’s service layer is where the domain logic sits.** `campus_routing_service`, `hospital_api_service`, `landmark_directions_service`, `image_hash_service`, and `notification_service` indicate a split between route computation, backend lookups, visual/media matching, and event/alert delivery. That means the Flutter UI is mostly a presentation shell over routing and live data services.

4. **The route-planning boundary in the mobile app is important.** From the README and file names, the app consumes hospital topology and real-time state to compute routes, then renders them through route and map screens. This is the main data flow for the mobile side: backend/route data → service layer → route UI.

5. **`digital_twin` is the admin-facing real-time dashboard.** It is a Vite-based React 18 + TypeScript application with a componentized UI in `src/components/dashboard/`, a page entry in `src/pages/Index.tsx`, and shared UI primitives under `src/components/ui/`. The structure suggests a single-page dashboard assembled from modular panels rather than a multi-route web app.

6. **The dashboard’s state/data boundary is concentrated in hooks and API helpers.** `src/hooks/useHospitalData.ts` and `src/lib/api.ts` are the main integration points, feeding panels such as alerts, maintenance, wards, capacity charts, summary cards, and live indicators. This is the dashboard’s key flow: backend data → hook/API client → dashboard panels.

7. **`analytics_dashboard` is a separate Python analytics/data service layer.** Its `main.py`, `data.py`, `models.py`, and routers for `alerts`, `maintenance`, `realtime`, and `wards` suggest it serves operational telemetry and simulated hospital events. In the architecture, this looks like the domain-specific data engine for the dashboard side.

8. **`serverside` is the shared system-of-record backend.** It contains FastAPI route handlers for `auth` and `health`, SQLAlchemy database setup (`db/`), ORM models (`models/user.py`), Pydantic schemas (`schemas/auth.py`), and auth/security helpers (`jwt_handler`, `oauth2`, `security`). This is the trust boundary for identity and core backend access.

9. **Persistence is centered on PostgreSQL.** The README names PostgreSQL as the persistent store, and the backend’s `db/` and `models/` layout matches that. The backend likely holds user records and shared hospital data, while the analytics service focuses on live operational state and event generation.

10. **The main system boundary is between two clients and the backend services.** The Flutter app serves visitors/patients and prioritizes navigation, while the React dashboard serves staff/admins and prioritizes monitoring. Both depend on live backend data, but `serverside` handles authentication/core APIs, and the analytics-oriented Python service(s) provide ward/alert/realtime operational feeds.

11. **Infrastructure and tooling are straightforward but relevant:** Flutter targets multiple platforms, React uses Vite + TypeScript + Tailwind-style component primitives, and the backend includes a Dockerfile for containerized deployment. Testing exists in all three areas: Flutter widget tests, Vitest for the dashboard, and backend test scaffolding.

12. **For an architecture diagram, the clearest picture is:** two frontends at the edge, a shared authenticated backend in the middle, and a separate analytics/realtime data layer feeding operational views. The important arrows are navigation service calls, dashboard data polling/streaming, auth requests, and database persistence behind the Python services.

Main entry points: [`serverside`](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside) (Serverside), [`analytics_dashboard`](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/analytics_dashboard) (Analytics Service), [`navigation_app`](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app) (Navigation App), [`navigation_app/lib/services`](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/lib/services) (Route Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_navigation["Navigation App"]
  node_navigation_app["Navigation App<br/>Flutter client"]
  node_nav_ui["Mobile UI<br/>screens"]
  node_nav_services["Route Services<br/>domain services"]
  node_nav_assets["Media Assets<br/>asset pack"]
end

subgraph group_g_dashboard["Operations Dashboard"]
  node_digital_twin["Digital Twin<br/>React dashboard"]
  node_dashboard_page["Dashboard Page<br/>page shell<br/>[Index.tsx]"]
  node_dashboard_panels["Dashboard Panels<br/>components"]
  node_dashboard_hooks["Data Hooks<br/>integration hooks<br/>[useHospitalData.ts]"]
  node_dashboard_api["API Client<br/>frontend api<br/>[api.ts]"]
end

subgraph group_g_analytics["Analytics Service"]
  node_analytics_dashboard["Analytics Service<br/>Python service"]
  node_analytics_main["Service App<br/>fastapi app<br/>[main.py]"]
  node_analytics_routers["Telemetry Routes<br/>route modules"]
  node_analytics_data["Data Layer<br/>data/models<br/>[data.py]"]
end

subgraph group_g_backend["Core Backend"]
  node_serverside["Serverside<br/>FastAPI backend"]
  node_auth_routes["Auth APIs<br/>route handlers"]
  node_auth_stack["Auth Stack<br/>jwt/oauth2"]
  node_db_layer["Database Layer<br/>sqlalchemy db"]
  node_user_model["User Model<br/>orm model<br/>[user.py]"]
  node_postgres[("PostgreSQL<br/>persistent store")]
end

node_navigation_app -->|"renders"| node_nav_ui
node_navigation_app -->|"uses"| node_nav_services
node_navigation_app -->|"loads"| node_nav_assets
node_nav_services -->|"queries"| node_serverside
node_nav_services -->|"consumes"| node_analytics_dashboard
node_digital_twin -->|"starts at"| node_dashboard_page
node_dashboard_page -->|"composes"| node_dashboard_panels
node_dashboard_panels -->|"binds data"| node_dashboard_hooks
node_dashboard_hooks -->|"calls"| node_dashboard_api
node_dashboard_api -->|"reads from"| node_analytics_dashboard
node_dashboard_api -->|"authenticates with"| node_serverside
node_analytics_dashboard -->|"exposes"| node_analytics_main
node_analytics_main -->|"mounts"| node_analytics_routers
node_analytics_main -->|"uses"| node_analytics_data
node_analytics_dashboard -.->|"shares data with"| node_serverside
node_serverside -->|"serves"| node_auth_routes
node_serverside -->|"secures"| node_auth_stack
node_serverside -->|"persists via"| node_db_layer
node_db_layer -->|"stores in"| node_postgres
node_user_model -->|"maps onto"| node_db_layer
node_analytics_data -.->|"may read/write"| node_postgres

click node_navigation_app "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app"
click node_nav_ui "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/lib/screens"
click node_nav_services "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/lib/services"
click node_nav_assets "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/assets"
click node_digital_twin "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/digital_twin"
click node_dashboard_page "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/pages/Index.tsx"
click node_dashboard_panels "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/digital_twin/src/components/dashboard"
click node_dashboard_hooks "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/hooks/useHospitalData.ts"
click node_dashboard_api "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/lib/api.ts"
click node_analytics_dashboard "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/analytics_dashboard"
click node_analytics_main "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/analytics_dashboard/main.py"
click node_analytics_routers "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/analytics_dashboard/routers"
click node_analytics_data "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/analytics_dashboard/data.py"
click node_serverside "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside"
click node_auth_routes "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/api/routes"
click node_auth_stack "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/auth"
click node_db_layer "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/db"
click node_user_model "https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/serverside/models/user.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_navigation_app,node_nav_ui,node_nav_services,node_nav_assets toneBlue
class node_digital_twin,node_dashboard_page,node_dashboard_panels,node_dashboard_hooks,node_dashboard_api toneAmber
class node_analytics_dashboard,node_analytics_main,node_analytics_routers,node_analytics_data toneMint
class node_serverside,node_auth_routes,node_auth_stack,node_db_layer,node_user_model,node_postgres toneRose
```

## Components

### Navigation App

Flutter patient-facing mobile and desktop client.

- [Navigation App](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app): Flutter client · Patient-facing navigation runtime with route, map, and hospital discovery flows. · `navigation_app`
- [Mobile UI](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/lib/screens): screens · Welcome, search, detail, route display, street map, and landmark direction screens. · `navigation_app/lib/screens`
- [Route Services](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/lib/services): domain services · Campus routing, hospital API access, landmark directions, image matching, and notifications. · `navigation_app/lib/services`
- [Media Assets](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/navigation_app/assets): asset pack · Animations, reference images, icons, and video used by the navigation experience. · `navigation_app/assets`

### Operations Dashboard

React/TypeScript staff dashboard.

- [Digital Twin](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/digital_twin): React dashboard · Staff-facing operations dashboard built with React, TypeScript, and Vite. · `digital_twin`
- [Dashboard Page](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/pages/Index.tsx): page shell · Main application entry that assembles the dashboard workspace. · `digital_twin/src/pages/Index.tsx`
- [Dashboard Panels](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/digital_twin/src/components/dashboard): components · Alerts, maintenance, capacity, ward, summary, and status panels composing the live view. · `digital_twin/src/components/dashboard`
- [Data Hooks](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/hooks/useHospitalData.ts): integration hooks · Hospital data hook that feeds the dashboard from backend state. · `digital_twin/src/hooks/useHospitalData.ts`
- [API Client](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/digital_twin/src/lib/api.ts): frontend api · Shared request layer for hospital data integration. · `digital_twin/src/lib/api.ts`

### Analytics Service

Python operational telemetry and event service.

- [Analytics Service](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/analytics_dashboard): Python service · Operational data engine for alerts, wards, realtime state, and maintenance feeds. · `analytics_dashboard`
- [Service App](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/analytics_dashboard/main.py): fastapi app · Service entry point wiring telemetry and operational routes. · `analytics_dashboard/main.py`
- [Telemetry Routes](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/analytics_dashboard/routers): route modules · Alerts, maintenance, realtime, and wards endpoints. · `analytics_dashboard/routers`
- [Data Layer](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/analytics_dashboard/data.py): data/models · Operational data helpers and domain models backing the analytics service. · `analytics_dashboard/data.py`

### Core Backend

Shared authenticated backend and persistence layer.

- [Serverside](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside): FastAPI backend · Shared authenticated system-of-record backend. · `serverside`
- [Auth APIs](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/api/routes): route handlers · Authentication and health endpoints exposed by the backend. · `serverside/api/routes`
- [Auth Stack](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/auth): jwt/oauth2 · JWT, OAuth2, and security helpers for identity and access control. · `serverside/auth`
- [Database Layer](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/tree/main/serverside/db): sqlalchemy db · Database session and base wiring for persistent storage. · `serverside/db`
- [User Model](https://github.com/kailasss2k05/trackr_hospital_navigation_ecosystem-/blob/main/serverside/models/user.py): orm model · Core user persistence model. · `serverside/models/user.py`
- **PostgreSQL**: persistent store · Shared relational persistence for users and hospital system data.

## Connections

- Navigation App → Mobile UI: renders · The Flutter app is primarily a presentation shell over its screen flow.
- Navigation App → Route Services: uses · UI depends on domain services for routing, hospital lookup, and notifications.
- Navigation App → Media Assets: loads · Navigation experience uses rich media assets for guidance and presentation.
- Route Services → Serverside: queries · Mobile services fetch hospital and routing data from backend APIs.
- Route Services → Analytics Service: consumes · Route and navigation logic can incorporate live operational state feeds.
- Digital Twin → Dashboard Page: starts at · Vite app boots through the main dashboard page.
- Dashboard Page → Dashboard Panels: composes · The page assembles the dashboard from modular panels.
- Dashboard Panels → Data Hooks: binds data · Panels receive live hospital state through hooks.
- Data Hooks → API Client: calls · Hook layer delegates network access to the API client.
- API Client → Analytics Service: reads from · Dashboard requests operational telemetry and ward data from the analytics service.
- API Client → Serverside: authenticates with · Shared backend provides identity and core API access for staff workflows.
- Analytics Service → Service App: exposes · Service entry point wires the Python analytics application.
- Service App → Telemetry Routes: mounts · Main app organizes operational endpoints into route modules.
- Service App → Data Layer: uses · Service app relies on local data helpers and models.
- Analytics Service → Serverside: shares data with · Operational service complements the system-of-record backend.
- Serverside → Auth APIs: serves · Backend exposes auth and health endpoints.
- Serverside → Auth Stack: secures · JWT and OAuth2 helpers define the trust boundary.
- Serverside → Database Layer: persists via · Backend persistence flows through database session and base setup.
- Database Layer → PostgreSQL: stores in · Database layer connects the backend to PostgreSQL.
- User Model → Database Layer: maps onto · ORM model is materialized through the database layer.
- Data Layer → PostgreSQL: may read/write · Analytics service data structures can be backed by shared relational storage.
