# mabrurhasan/fynavox architecture

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

- Interactive diagram: https://gitdiagram.com/mabrurhasan/fynavox
- Repository: https://github.com/mabrurhasan/fynavox

## Overview

FynavoX is a healthcare-monitoring pilot prototype. The documented clinician journey moves from role selection to a command-center overview, then into patient monitoring, AI risk analysis, alerts and response, and analytics; a separate timed clinical simulation demonstrates deterioration and escalation. Live patient state is supplied by a browser hook, which connects to the backend WebSocket and also has a local simulation fallback. The backend maintains in-memory patient state and exposes risk prediction through a scikit-learn model with a rule-based fallback. Some screens and integrations are documented but their source wiring was not sampled, so uncertain links are omitted.

Main entry points: [`frontend/src/hooks/useLivePatients.ts`](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useLivePatients.ts) (Live patient hook), [`backend/main.py`](https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py) (Monitoring API), [`frontend/src/app/auth/page.tsx`](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/auth/page.tsx) (Role sign-in), [`frontend/src/app/page.tsx`](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/page.tsx) (Impact landing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Command"]
  node_landing["Impact landing<br/>[page.tsx]"]
  node_auth["Role sign-in<br/>[page.tsx]"]
  node_dashboard["Command center<br/>[page.tsx]"]
end

subgraph group_monitor["Patient Monitoring"]
  node_patients["Patient monitoring<br/>[page.tsx]"]
  node_live_state["Live patient state"]
  node_live_hook["Live patient hook<br/>[useLivePatients.ts]"]
  node_frontend_sim["Local vital simulation<br/>[simulation.ts]"]
  node_backend["Monitoring API<br/>[main.py]"]
  node_websocket_client["Patient WebSocket<br/>[useLivePatients.ts]"]
  node_websocket_service["Patient stream<br/>[main.py]"]
end

subgraph group_risk["Risk and Alerts"]
  node_risk_endpoint["Risk prediction endpoint<br/>[main.py]"]
  node_risk_model["Risk classifier<br/>[risk_model.py]"]
  node_ai_engine["AI engine screen<br/>[page.tsx]"]
  node_alerts["Alerts and response<br/>[page.tsx]"]
end

subgraph group_insights["Simulation and Insights"]
  node_simulation_page["Clinical simulation<br/>[page.tsx]"]
  node_simulation_view["Simulation view"]
  node_simulation_hook["Simulation state hook"]
  node_simulation_logic["Clinical scenario model"]
  node_analytics["Prediction analytics<br/>[page.tsx]"]
  node_impact["Business impact<br/>[page.tsx]"]
end

node_clinician(("Clinical staff"))

node_clinician -->|"opens product"| node_landing
node_landing -->|"sign-in link"| node_auth
node_clinician -->|"selects role"| node_auth
node_auth -->|"routes after sign-in"| node_dashboard
node_live_state -->|"runs hook"| node_live_hook
node_live_hook -->|"opens connection"| node_websocket_client
node_websocket_client -->|"receives patient updates"| node_websocket_service
node_websocket_service -->|"uses patient state"| node_backend
node_backend -->|"ticks and sends"| node_websocket_service
node_live_hook -->|"ticks on fallback"| node_frontend_sim
node_clinician -->|"opens scenario"| node_simulation_page
node_simulation_page -->|"renders"| node_simulation_view
node_simulation_view -->|"starts or resets"| node_simulation_hook
node_simulation_hook -->|"requests elapsed state"| node_simulation_logic
node_backend -->|"serves prediction"| node_risk_endpoint
node_risk_endpoint -->|"requests classification"| node_risk_model
node_clinician -->|"monitors patients"| node_patients
node_clinician -->|"reviews AI pipeline"| node_ai_engine
node_clinician -->|"responds to alerts"| node_alerts
node_clinician -->|"reviews insights"| node_analytics
node_clinician -->|"reviews impact"| node_impact

click node_landing "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/page.tsx"
click node_auth "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/auth/page.tsx"
click node_dashboard "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/dashboard/page.tsx"
click node_patients "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/patients/page.tsx"
click node_live_state "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/context/LivePatientsContext.tsx"
click node_live_hook "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useLivePatients.ts"
click node_frontend_sim "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/lib/simulation.ts"
click node_backend "https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py"
click node_risk_endpoint "https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py"
click node_risk_model "https://github.com/mabrurhasan/fynavox/blob/main/backend/ml/risk_model.py"
click node_ai_engine "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/ai-engine/page.tsx"
click node_alerts "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/alerts/page.tsx"
click node_simulation_page "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/simulation/page.tsx"
click node_simulation_view "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/components/simulation/ClinicalSimulationView.tsx"
click node_simulation_hook "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useClinicalSimulation.ts"
click node_simulation_logic "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/lib/clinical-simulation.ts"
click node_analytics "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/analytics/page.tsx"
click node_impact "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/impact/page.tsx"
click node_websocket_client "https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useLivePatients.ts"
click node_websocket_service "https://github.com/mabrurhasan/fynavox/blob/main/backend/main.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_landing,node_auth,node_dashboard toneBlue
class node_patients,node_live_state,node_live_hook,node_frontend_sim,node_backend,node_websocket_client,node_websocket_service toneAmber
class node_risk_endpoint,node_risk_model,node_ai_engine,node_alerts toneMint
class node_simulation_page,node_simulation_view,node_simulation_hook,node_simulation_logic,node_analytics,node_impact toneRose
class node_clinician toneIndigo
```

## Components

### Access and Command

- [Impact landing](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Role sign-in](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/auth/page.tsx): `frontend/src/app/auth/page.tsx`
- [Command center](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/dashboard/page.tsx): `frontend/src/app/(platform)/dashboard/page.tsx`

### Patient Monitoring

- [Patient monitoring](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/patients/page.tsx): `frontend/src/app/(platform)/patients/page.tsx`
- [Live patient state](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/context/LivePatientsContext.tsx): `frontend/src/context/LivePatientsContext.tsx`
- [Live patient hook](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useLivePatients.ts): `frontend/src/hooks/useLivePatients.ts`
- [Local vital simulation](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/lib/simulation.ts): `frontend/src/lib/simulation.ts`
- [Monitoring API](https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py): `backend/main.py`
- [Patient WebSocket](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useLivePatients.ts): `frontend/src/hooks/useLivePatients.ts`
- [Patient stream](https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py): `backend/main.py`

### Risk and Alerts

- [Risk prediction endpoint](https://github.com/mabrurhasan/fynavox/blob/main/backend/main.py): `backend/main.py`
- [Risk classifier](https://github.com/mabrurhasan/fynavox/blob/main/backend/ml/risk_model.py): `backend/ml/risk_model.py`
- [AI engine screen](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/ai-engine/page.tsx): `frontend/src/app/(platform)/ai-engine/page.tsx`
- [Alerts and response](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/alerts/page.tsx): `frontend/src/app/(platform)/alerts/page.tsx`

### Simulation and Insights

- [Clinical simulation](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/simulation/page.tsx): `frontend/src/app/simulation/page.tsx`
- [Simulation view](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/components/simulation/ClinicalSimulationView.tsx): `frontend/src/components/simulation/ClinicalSimulationView.tsx`
- [Simulation state hook](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/hooks/useClinicalSimulation.ts): `frontend/src/hooks/useClinicalSimulation.ts`
- [Clinical scenario model](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/lib/clinical-simulation.ts): `frontend/src/lib/clinical-simulation.ts`
- [Prediction analytics](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/analytics/page.tsx): `frontend/src/app/(platform)/analytics/page.tsx`
- [Business impact](https://github.com/mabrurhasan/fynavox/blob/main/frontend/src/app/(platform)/impact/page.tsx): `frontend/src/app/(platform)/impact/page.tsx`

### Other components

- **Clinical staff**

## Connections

- Clinical staff → Impact landing: opens product
- Impact landing → Role sign-in: sign-in link
- Clinical staff → Role sign-in: selects role
- Role sign-in → Command center: routes after sign-in
- Live patient state → Live patient hook: runs hook
- Live patient hook → Patient WebSocket: opens connection
- Patient WebSocket → Patient stream: receives patient updates
- Patient stream → Monitoring API: uses patient state
- Monitoring API → Patient stream: ticks and sends
- Live patient hook → Local vital simulation: ticks on fallback
- Clinical staff → Clinical simulation: opens scenario
- Clinical simulation → Simulation view: renders
- Simulation view → Simulation state hook: starts or resets
- Simulation state hook → Clinical scenario model: requests elapsed state
- Monitoring API → Risk prediction endpoint: serves prediction
- Risk prediction endpoint → Risk classifier: requests classification
- Clinical staff → Patient monitoring: monitors patients
- Clinical staff → AI engine screen: reviews AI pipeline
- Clinical staff → Alerts and response: responds to alerts
- Clinical staff → Prediction analytics: reviews insights
- Clinical staff → Business impact: reviews impact
