# shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator architecture

> Architecture diagram of the GitHub repository shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator
- Repository: https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator

## Overview

CrisisMesh is a fictional-city emergency decision and resource-allocation simulator. A citizen reports an incident; the authoritative C++ engine queues and prioritizes it, evaluates compatible responders, routes and dispatches one, then manages completion, citizen confirmation or escalation, and archival. The React app provides citizen and command-center workflows, map visualization, and algorithm playback; the browser requests simulation state and commands through an API bridge. The README documents several stages and capabilities whose implementation excerpts were not sampled, so those links cite the README; the bridge is development-only, not a production service.

Main entry points: [`backend/src/simulation/SimulationEngine.cpp`](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/src/simulation/SimulationEngine.cpp) (Simulation engine), [`core/simulation/api.ts`](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/core/simulation/api.ts) (Simulation API client), [`features/citizen/CitizenDashboard.tsx`](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/citizen/CitizenDashboard.tsx) (Citizen portal), [`features/command-center/CommandCenter.tsx`](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/CommandCenter.tsx) (Command center)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_users["User experiences"]
  node_citizen["Citizen portal"]
  node_report["Emergency reporting"]
  node_command["Command center<br/>[CommandCenter.tsx]"]
  node_map["Tactical map<br/>[TacticalMap.tsx]"]
  node_playback["Algorithm playback"]
  node_dsa_view["DSA views<br/>[MasterDSALab.tsx]"]
end

subgraph group_browser["Browser client"]
  node_api["Simulation API client<br/>[api.ts]"]
  node_state_types["Simulation state contract<br/>[types.ts]"]
  node_bridge["Development bridge<br/>[index.mjs]"]
end

subgraph group_operations["Operational engine"]
  node_engine["Simulation engine"]
  node_incident["Incident lifecycle<br/>[Incident.hpp]"]
  node_allocation["Responder allocation"]
  node_archive[("Incident archive")]
end

subgraph group_algorithms["Routing and DSA"]
  node_city["City road graph<br/>[Graph.hpp]"]
  node_routing["Weighted routing<br/>[Dijkstra.hpp]"]
  node_intake["Queue and priority<br/>[Queue.hpp]"]
  node_candidate_sort["Candidate ranking"]
  node_analysis["BFS / DFS analysis<br/>[BFS.hpp]"]
  node_road_undo["Road-change undo<br/>[Stack.hpp]"]
  node_allocation_dsa["Allocation algorithms"]
end

node_citizen_actor(("Citizen"))
node_author_actor(("Author / responder"))

node_citizen_actor -->|"uses"| node_citizen
node_citizen -->|"opens report"| node_report
node_citizen -->|"submits commands"| node_api
node_author_actor -->|"operates"| node_command
node_command -->|"requests state"| node_api
node_report -->|"submits report"| node_api
node_api -->|"POSTs requests"| node_bridge
node_bridge -->|"forwards commands"| node_engine
node_engine -->|"returns state"| node_api
node_api -->|"validates response"| node_state_types
node_engine -->|"queues and schedules"| node_intake
node_engine -->|"updates lifecycle"| node_incident
node_engine -->|"evaluates responders"| node_allocation
node_engine -->|"ranks candidates"| node_candidate_sort
node_engine -->|"calculates routes"| node_routing
node_routing -->|"reads topology"| node_city
node_engine -->|"changes road state"| node_city
node_engine -->|"records road undo"| node_road_undo
node_engine -->|"archives closed incidents"| node_archive
node_engine -->|"runs graph analysis"| node_analysis
node_engine -->|"allocates resources"| node_allocation_dsa
node_command -->|"renders operations"| node_map
node_map -->|"shows route playback"| node_playback
node_command -->|"shows DSA view"| node_dsa_view
node_citizen -->|"confirms or escalates"| node_engine

click node_citizen "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/citizen/CitizenDashboard.tsx"
click node_report "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/emergency/EmergencyReport.tsx"
click node_command "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/CommandCenter.tsx"
click node_map "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/TacticalMap.tsx"
click node_playback "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/AlgorithmPlayback.tsx"
click node_dsa_view "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/MasterDSALab.tsx"
click node_api "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/core/simulation/api.ts"
click node_state_types "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/core/simulation/types.ts"
click node_bridge "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/server/index.mjs"
click node_engine "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/src/simulation/SimulationEngine.cpp"
click node_incident "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/domain/Incident.hpp"
click node_allocation "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/allocation/AllocationEngine.hpp"
click node_archive "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/tree/IncidentArchiveIndex.hpp"
click node_city "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/graph/Graph.hpp"
click node_routing "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/dijkstra/Dijkstra.hpp"
click node_intake "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/queue/Queue.hpp"
click node_candidate_sort "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/sort/CandidateMergeSort.hpp"
click node_analysis "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/bfs/BFS.hpp"
click node_road_undo "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/stack/Stack.hpp"
click node_allocation_dsa "https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/src/allocation/AllocationEngine.cpp"

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_citizen,node_report,node_command,node_map,node_playback,node_dsa_view toneBlue
class node_api,node_state_types,node_bridge toneAmber
class node_engine,node_incident,node_allocation,node_archive toneMint
class node_city,node_routing,node_intake,node_candidate_sort,node_analysis,node_road_undo,node_allocation_dsa toneRose
class node_citizen_actor,node_author_actor toneIndigo
```

## Components

### User experiences

- [Citizen portal](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/citizen/CitizenDashboard.tsx): `features/citizen/CitizenDashboard.tsx`
- [Emergency reporting](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/emergency/EmergencyReport.tsx): `features/emergency/EmergencyReport.tsx`
- [Command center](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/CommandCenter.tsx): `features/command-center/CommandCenter.tsx`
- [Tactical map](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/TacticalMap.tsx): `features/command-center/TacticalMap.tsx`
- [Algorithm playback](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/AlgorithmPlayback.tsx): `features/command-center/AlgorithmPlayback.tsx`
- [DSA views](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/features/command-center/MasterDSALab.tsx): `features/command-center/MasterDSALab.tsx`

### Browser client

- [Simulation API client](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/core/simulation/api.ts): `core/simulation/api.ts`
- [Simulation state contract](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/core/simulation/types.ts): `core/simulation/types.ts`
- [Development bridge](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/server/index.mjs): `server/index.mjs`

### Operational engine

- [Simulation engine](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/src/simulation/SimulationEngine.cpp): `backend/src/simulation/SimulationEngine.cpp`
- [Incident lifecycle](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/domain/Incident.hpp): `backend/include/domain/Incident.hpp`
- [Responder allocation](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/allocation/AllocationEngine.hpp): `backend/include/allocation/AllocationEngine.hpp`
- [Incident archive](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/tree/IncidentArchiveIndex.hpp): `backend/include/tree/IncidentArchiveIndex.hpp`

### Routing and DSA

- [City road graph](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/graph/Graph.hpp): `backend/include/graph/Graph.hpp`
- [Weighted routing](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/dijkstra/Dijkstra.hpp): `backend/include/dijkstra/Dijkstra.hpp`
- [Queue and priority](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/queue/Queue.hpp): `backend/include/queue/Queue.hpp`
- [Candidate ranking](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/sort/CandidateMergeSort.hpp): `backend/include/sort/CandidateMergeSort.hpp`
- [BFS / DFS analysis](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/bfs/BFS.hpp): `backend/include/bfs/BFS.hpp`
- [Road-change undo](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/include/stack/Stack.hpp): `backend/include/stack/Stack.hpp`
- [Allocation algorithms](https://github.com/shamiul-bashar/crisismesh-2.0-dynamic-emergency-decision-routing-resource-allocation-simulator/blob/deploy/fullstack/backend/src/allocation/AllocationEngine.cpp): `backend/src/allocation/AllocationEngine.cpp`

### Other components

- **Citizen**
- **Author / responder**

## Connections

- Citizen → Citizen portal: uses (evidence: `README.md`)
- Citizen portal → Emergency reporting: opens report (evidence: `features/citizen/CitizenDashboard.tsx`)
- Citizen portal → Simulation API client: submits commands (evidence: `features/citizen/CitizenDashboard.tsx`)
- Author / responder → Command center: operates (evidence: `README.md`)
- Command center → Simulation API client: requests state (evidence: `features/command-center/CommandCenter.tsx`)
- Emergency reporting → Simulation API client: submits report (evidence: `core/simulation/api.ts`)
- Simulation API client → Development bridge: POSTs requests (evidence: `core/simulation/api.ts`)
- Development bridge → Simulation engine: forwards commands (evidence: `README.md`)
- Simulation engine → Simulation API client: returns state (evidence: `README.md`)
- Simulation API client → Simulation state contract: validates response (evidence: `core/simulation/api.ts`)
- Simulation engine → Queue and priority: queues and schedules (evidence: `README.md`)
- Simulation engine → Incident lifecycle: updates lifecycle (evidence: `README.md`)
- Simulation engine → Responder allocation: evaluates responders
- Simulation engine → Candidate ranking: ranks candidates (evidence: `README.md`)
- Simulation engine → Weighted routing: calculates routes (evidence: `backend/src/simulation/SimulationEngine.cpp`)
- Weighted routing → City road graph: reads topology (evidence: `backend/include/dijkstra/Dijkstra.hpp`)
- Simulation engine → City road graph: changes road state (evidence: `README.md`)
- Simulation engine → Road-change undo: records road undo
- Simulation engine → Incident archive: archives closed incidents (evidence: `README.md`)
- Simulation engine → BFS / DFS analysis: runs graph analysis (evidence: `README.md`)
- Simulation engine → Allocation algorithms: allocates resources
- Command center → Tactical map: renders operations (evidence: `features/command-center/CommandCenter.tsx`)
- Tactical map → Algorithm playback: shows route playback (evidence: `features/command-center/TacticalMap.tsx`)
- Command center → DSA views: shows DSA view (evidence: `features/command-center/CommandCenter.tsx`)
- Citizen portal → Simulation engine: confirms or escalates (evidence: `README.md`)
