# h4ck3r0/crisisflow architecture

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

- Interactive diagram: https://gitdiagram.com/h4ck3r0/crisisflow
- Repository: https://github.com/h4ck3r0/crisisflow

## Overview

CrisisFlow combines a React crisis-operations interface with a FastAPI service for flood simulation, routing, weather, and emergency records. The user workflow runs from role-specific dashboards and map controls through simulation, route planning, citizen reports, and dispatch/triage operations. MongoDB backs the operational records; the STGCN/geospatial backend supplies flood predictions and routes. The README documents additional map, logistics, and role capabilities not fully represented in sampled source; those branches are included conservatively, and uncertain links are omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/App.tsx) (CrisisFlow app), [`backend/main.py`](https://github.com/h4ck3r0/crisisflow/blob/main/backend/main.py) (API application), [`backend/routers/triage.py`](https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/triage.py) (Triage commander), [`backend/api.py`](https://github.com/h4ck3r0/crisisflow/blob/main/backend/api.py) (STGCN and geospatial API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Command interface"]
  node_app["CrisisFlow app<br/>[App.tsx]"]
  node_map["City map<br/>[MapView.tsx]"]
  node_controls["Simulation controls<br/>[ControlPanel.tsx]"]
  node_roles["Role dashboards"]
  node_topbar["Role navigation<br/>[Topbar.tsx]"]
end

subgraph group_twin["Digital twin"]
  node_simulation["Flood simulation"]
  node_weather["Weather integration<br/>[useWeather.ts]"]
  node_routing["Route planning<br/>[useRouting.ts]"]
  node_clustering["Flood clustering"]
end

subgraph group_ops["Response operations"]
  node_dashboardhook["Dashboard data client<br/>[useDashboard.ts]"]
  node_dashboardapi["Role dashboard aggregation<br/>[dashboard.py]"]
  node_reports["Citizen reports<br/>[citizen_reports.py]"]
  node_triage["Triage commander<br/>[triage.py]"]
  node_dispatch["Dispatch orders<br/>[dispatches.py]"]
  node_crud["Emergency record APIs"]
end

subgraph group_service["API service"]
  node_twinapi["STGCN and geospatial API<br/>[api.py]"]
  node_server["API application<br/>[main.py]"]
end

subgraph group_data["Operational data"]
  node_database[("MongoDB connection<br/>[database.py]")]
  node_models["Dispatch model<br/>[dispatch.py]"]
  node_triagemodel["Triage session model<br/>[triage_session.py]"]
end

node_operator(("Responder or citizen"))

node_operator -->|"uses"| node_app
node_app -->|"renders"| node_map
node_app -->|"renders"| node_controls
node_app -->|"renders"| node_topbar
node_app -->|"invokes"| node_simulation
node_app -->|"invokes"| node_weather
node_app -->|"invokes"| node_routing
node_app -->|"uses"| node_clustering
node_app -->|"loads"| node_dashboardhook
node_app -->|"renders"| node_roles
node_simulation -->|"POSTs simulation"| node_twinapi
node_routing -->|"requests routes"| node_twinapi
node_weather -->|"requests weather"| node_twinapi
node_dashboardhook -->|"fetches dashboards"| node_dashboardapi
node_dashboardhook -->|"submits reports"| node_reports
node_dashboardhook -->|"starts triage"| node_triage
node_server -->|"registers routes"| node_twinapi
node_server -->|"registers routes"| node_dashboardapi
node_server -->|"registers routes"| node_reports
node_server -->|"registers routes"| node_triage
node_server -->|"registers routes"| node_dispatch
node_server -->|"registers routes"| node_crud
node_dashboardapi -->|"queries"| node_database
node_reports -->|"reads and writes"| node_database
node_dispatch -->|"reads and writes"| node_database
node_triage -->|"reads and writes"| node_database
node_triage -->|"creates dispatches"| node_models
node_triage -->|"creates sessions"| node_triagemodel
node_twinapi -->|"updates zone predictions"| node_database

click node_app "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/App.tsx"
click node_map "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/MapView.tsx"
click node_controls "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/ControlPanel.tsx"
click node_roles "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/RolePanelContent.tsx"
click node_topbar "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/Topbar.tsx"
click node_simulation "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useFloodSimulation.ts"
click node_weather "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useWeather.ts"
click node_routing "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useRouting.ts"
click node_clustering "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useFloodClustering.ts"
click node_twinapi "https://github.com/h4ck3r0/crisisflow/blob/main/backend/api.py"
click node_server "https://github.com/h4ck3r0/crisisflow/blob/main/backend/main.py"
click node_dashboardhook "https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useDashboard.ts"
click node_dashboardapi "https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/dashboard.py"
click node_reports "https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/citizen_reports.py"
click node_triage "https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/triage.py"
click node_dispatch "https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/dispatches.py"
click node_crud "https://github.com/h4ck3r0/crisisflow/tree/main/backend/routers"
click node_database "https://github.com/h4ck3r0/crisisflow/blob/main/backend/database.py"
click node_models "https://github.com/h4ck3r0/crisisflow/blob/main/backend/models/dispatch.py"
click node_triagemodel "https://github.com/h4ck3r0/crisisflow/blob/main/backend/models/triage_session.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_app,node_map,node_controls,node_roles,node_topbar toneBlue
class node_simulation,node_weather,node_routing,node_clustering toneAmber
class node_dashboardhook,node_dashboardapi,node_reports,node_triage,node_dispatch,node_crud toneMint
class node_twinapi,node_server toneRose
class node_database,node_models,node_triagemodel,node_operator toneIndigo
```

## Components

### Command interface

- [CrisisFlow app](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [City map](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/MapView.tsx): `frontend/src/components/MapView.tsx`
- [Simulation controls](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/ControlPanel.tsx): `frontend/src/components/ControlPanel.tsx`
- [Role dashboards](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/RolePanelContent.tsx): `frontend/src/components/RolePanelContent.tsx`
- [Role navigation](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/components/Topbar.tsx): `frontend/src/components/Topbar.tsx`

### Digital twin

- [Flood simulation](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useFloodSimulation.ts): `frontend/src/hooks/useFloodSimulation.ts`
- [Weather integration](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useWeather.ts): `frontend/src/hooks/useWeather.ts`
- [Route planning](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useRouting.ts): `frontend/src/hooks/useRouting.ts`
- [Flood clustering](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useFloodClustering.ts): `frontend/src/hooks/useFloodClustering.ts`

### Response operations

- [Dashboard data client](https://github.com/h4ck3r0/crisisflow/blob/main/frontend/src/hooks/useDashboard.ts): `frontend/src/hooks/useDashboard.ts`
- [Role dashboard aggregation](https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/dashboard.py): `backend/routers/dashboard.py`
- [Citizen reports](https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/citizen_reports.py): `backend/routers/citizen_reports.py`
- [Triage commander](https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/triage.py): `backend/routers/triage.py`
- [Dispatch orders](https://github.com/h4ck3r0/crisisflow/blob/main/backend/routers/dispatches.py): `backend/routers/dispatches.py`
- [Emergency record APIs](https://github.com/h4ck3r0/crisisflow/tree/main/backend/routers): `backend/routers`

### API service

- [STGCN and geospatial API](https://github.com/h4ck3r0/crisisflow/blob/main/backend/api.py): `backend/api.py`
- [API application](https://github.com/h4ck3r0/crisisflow/blob/main/backend/main.py): `backend/main.py`

### Operational data

- [MongoDB connection](https://github.com/h4ck3r0/crisisflow/blob/main/backend/database.py): `backend/database.py`
- [Dispatch model](https://github.com/h4ck3r0/crisisflow/blob/main/backend/models/dispatch.py): `backend/models/dispatch.py`
- [Triage session model](https://github.com/h4ck3r0/crisisflow/blob/main/backend/models/triage_session.py): `backend/models/triage_session.py`

### Other components

- **Responder or citizen**

## Connections

- Responder or citizen → CrisisFlow app: uses
- CrisisFlow app → City map: renders (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Simulation controls: renders (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Role navigation: renders (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Flood simulation: invokes (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Weather integration: invokes (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Route planning: invokes (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Flood clustering: uses (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Dashboard data client: loads (evidence: `frontend/src/App.tsx`)
- CrisisFlow app → Role dashboards: renders (evidence: `frontend/src/App.tsx`)
- Flood simulation → STGCN and geospatial API: POSTs simulation (evidence: `frontend/src/hooks/useFloodSimulation.ts`)
- Route planning → STGCN and geospatial API: requests routes (evidence: `frontend/src/hooks/useRouting.ts`)
- Weather integration → STGCN and geospatial API: requests weather (evidence: `frontend/src/hooks/useWeather.ts`)
- Dashboard data client → Role dashboard aggregation: fetches dashboards (evidence: `frontend/src/hooks/useDashboard.ts`)
- Dashboard data client → Citizen reports: submits reports (evidence: `frontend/src/hooks/useDashboard.ts`)
- Dashboard data client → Triage commander: starts triage (evidence: `frontend/src/hooks/useDashboard.ts`)
- API application → STGCN and geospatial API: registers routes (evidence: `backend/main.py`)
- API application → Role dashboard aggregation: registers routes (evidence: `backend/main.py`)
- API application → Citizen reports: registers routes (evidence: `backend/main.py`)
- API application → Triage commander: registers routes (evidence: `backend/main.py`)
- API application → Dispatch orders: registers routes (evidence: `backend/main.py`)
- API application → Emergency record APIs: registers routes (evidence: `backend/main.py`)
- Role dashboard aggregation → MongoDB connection: queries (evidence: `backend/routers/dashboard.py`)
- Citizen reports → MongoDB connection: reads and writes (evidence: `backend/routers/citizen_reports.py`)
- Dispatch orders → MongoDB connection: reads and writes (evidence: `backend/routers/dispatches.py`)
- Triage commander → MongoDB connection: reads and writes (evidence: `backend/routers/triage.py`)
- Triage commander → Dispatch model: creates dispatches (evidence: `backend/routers/triage.py`)
- Triage commander → Triage session model: creates sessions (evidence: `backend/routers/triage.py`)
- STGCN and geospatial API → MongoDB connection: updates zone predictions (evidence: `backend/api.py`)
