# mrgxmer0004/openhand-112 architecture

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

- Interactive diagram: https://gitdiagram.com/mrgxmer0004/openhand-112
- Repository: https://github.com/mrgxmer0004/openhand-112

## Overview

OpenHand 112 combines call triage and live dispatch with city-scale response planning, flood operations, monitoring, and an inter-agency platform. A dispatcher submits a call; the API runs the triage pipeline, resolves location, applies repeat-call context and fixed rules, then the city world recommends units by road and handles dispatch. The dashboard also exposes forecasts, watches, flood plans, cross-city comparisons, and evidence. Edges cite excerpts, indexed references, or README claims; several unsampled subsystems are represented by their exact directory paths, with uncertain internal links omitted.

Main entry points: [`web/src/App.tsx`](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/App.tsx) (Dashboard shell), [`web/src/api.ts`](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/api.ts) (API client), [`src/csafe/triage/pipeline.py`](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/pipeline.py) (Triage pipeline), [`src/csafe/api/server.py`](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/server.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dispatcher dashboard"]
  node_dashboard["Dashboard shell<br/>[App.tsx]"]
  node_liveui["Live dispatch UI<br/>[Live.tsx]"]
  node_map["Operational map<br/>[MapView.tsx]"]
  node_predictui["Forecast UI<br/>[Predict.tsx]"]
  node_monsoonui["Rain UI<br/>[Monsoon.tsx]"]
  node_citiesui["City comparison UI<br/>[Cities.tsx]"]
  node_platformui["Platform UI<br/>[Platform.tsx]"]
  node_evidenceui["Evidence UI<br/>[Evidence.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_triage["Call triage"]
  node_triageflow["Triage pipeline<br/>[pipeline.py]"]
  node_extract["Fact extraction<br/>[client.py]"]
  node_rules["Priority rules<br/>[rules.py]"]
  node_location["Location resolution<br/>[location.py]"]
  node_triageothers["Triage alternatives"]
end

subgraph group_dispatch["Dispatch and roads"]
  node_server["HTTP API<br/>[server.py]"]
  node_world["City dispatch state<br/>[world.py]"]
  node_roadnet["Road network<br/>[network.py]"]
end

subgraph group_planning["Forecast and flood"]
  node_demand["Demand model<br/>[demand.py]"]
  node_placement["Standby placement<br/>[placement.py]"]
  node_watch["Live watch<br/>[watch.py]"]
  node_floodops["Flood operations<br/>[flood_ops.py]"]
  node_floodmodel["Flood model<br/>[flood.py]"]
  node_worldapi["City analytics API<br/>[world.py]"]
end

subgraph group_platform["Platform and evidence"]
  node_dpi["Agency interfaces<br/>[dpi.py]"]
  node_evidenceapi["Evidence and scoring"]
end

node_dispatcher(("Dispatcher"))
node_externalagencies(("Other agencies"))

node_dispatcher -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_liveui
node_dashboard -->|"renders"| node_map
node_dashboard -->|"renders"| node_predictui
node_dashboard -->|"renders"| node_monsoonui
node_dashboard -->|"renders"| node_citiesui
node_dashboard -->|"renders"| node_platformui
node_dashboard -->|"renders"| node_evidenceui
node_liveui -->|"requests"| node_webapi
node_predictui -->|"requests"| node_webapi
node_monsoonui -->|"requests"| node_webapi
node_citiesui -->|"requests"| node_webapi
node_platformui -->|"requests"| node_webapi
node_evidenceui -->|"requests"| node_webapi
node_webapi -->|"HTTP calls"| node_server
node_server -->|"triages calls"| node_triageflow
node_triageflow -->|"extracts facts"| node_extract
node_triageflow -->|"resolves location"| node_location
node_triageflow -->|"decides priority"| node_rules
node_triageflow -->|"uses helpers"| node_triageothers
node_extract -->|"uses schema and prompts"| node_triageothers
node_server -->|"routes dispatch"| node_world
node_world -->|"routes by road"| node_roadnet
node_world -.->|"triages incidents"| node_triageflow
node_worldapi -->|"models demand"| node_demand
node_placement -->|"uses travel network"| node_roadnet
node_watch -->|"reads demand model"| node_demand
node_floodops -->|"runs flood model"| node_floodmodel
node_worldapi -->|"uses standby planning"| node_placement
node_worldapi -->|"serves watch data"| node_watch
node_worldapi -->|"serves flood operations"| node_floodops
node_server -->|"serves platform APIs"| node_dpi
node_dpi -.->|"sends agency messages"| node_externalagencies
node_evidenceui -.->|"views evidence"| node_evidenceapi
node_server -->|"routes flood requests"| node_floodops

click node_dashboard "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/App.tsx"
click node_liveui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Live.tsx"
click node_map "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/MapView.tsx"
click node_predictui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Predict.tsx"
click node_monsoonui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Monsoon.tsx"
click node_citiesui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Cities.tsx"
click node_platformui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Platform.tsx"
click node_evidenceui "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Evidence.tsx"
click node_webapi "https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/api.ts"
click node_server "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/server.py"
click node_triageflow "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/pipeline.py"
click node_extract "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/client.py"
click node_rules "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/rules.py"
click node_location "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/location.py"
click node_triageothers "https://github.com/mrgxmer0004/openhand-112/tree/master/src/csafe/triage"
click node_world "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/world.py"
click node_roadnet "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/network.py"
click node_demand "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/demand.py"
click node_placement "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/placement.py"
click node_watch "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/watch.py"
click node_floodops "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/flood_ops.py"
click node_floodmodel "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/flood.py"
click node_worldapi "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/world.py"
click node_dpi "https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/dpi.py"
click node_evidenceapi "https://github.com/mrgxmer0004/openhand-112/tree/master/src/csafe/api"

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_dashboard,node_liveui,node_map,node_predictui,node_monsoonui,node_citiesui,node_platformui,node_evidenceui,node_webapi toneBlue
class node_triageflow,node_extract,node_rules,node_location,node_triageothers toneAmber
class node_server,node_world,node_roadnet toneMint
class node_demand,node_placement,node_watch,node_floodops,node_floodmodel,node_worldapi toneRose
class node_dpi,node_evidenceapi,node_dispatcher,node_externalagencies toneIndigo
```

## Components

### Dispatcher dashboard

- [Dashboard shell](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/App.tsx): `web/src/App.tsx`
- [Live dispatch UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Live.tsx): `web/src/Live.tsx`
- [Operational map](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/MapView.tsx): `web/src/MapView.tsx`
- [Forecast UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Predict.tsx): `web/src/Predict.tsx`
- [Rain UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Monsoon.tsx): `web/src/Monsoon.tsx`
- [City comparison UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Cities.tsx): `web/src/Cities.tsx`
- [Platform UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Platform.tsx): `web/src/Platform.tsx`
- [Evidence UI](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/Evidence.tsx): `web/src/Evidence.tsx`
- [API client](https://github.com/mrgxmer0004/openhand-112/blob/master/web/src/api.ts): `web/src/api.ts`

### Call triage

- [Triage pipeline](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/pipeline.py): `src/csafe/triage/pipeline.py`
- [Fact extraction](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/client.py): `src/csafe/triage/client.py`
- [Priority rules](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/rules.py): `src/csafe/triage/rules.py`
- [Location resolution](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/triage/location.py): `src/csafe/triage/location.py`
- [Triage alternatives](https://github.com/mrgxmer0004/openhand-112/tree/master/src/csafe/triage): `src/csafe/triage`

### Dispatch and roads

- [HTTP API](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/server.py): `src/csafe/api/server.py`
- [City dispatch state](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/world.py): `src/csafe/api/world.py`
- [Road network](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/network.py): `src/csafe/network.py`

### Forecast and flood

- [Demand model](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/demand.py): `src/csafe/demand.py`
- [Standby placement](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/placement.py): `src/csafe/placement.py`
- [Live watch](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/watch.py): `src/csafe/api/watch.py`
- [Flood operations](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/flood_ops.py): `src/csafe/api/flood_ops.py`
- [Flood model](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/flood.py): `src/csafe/flood.py`
- [City analytics API](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/world.py): `src/csafe/api/world.py`

### Platform and evidence

- [Agency interfaces](https://github.com/mrgxmer0004/openhand-112/blob/master/src/csafe/api/dpi.py): `src/csafe/api/dpi.py`
- [Evidence and scoring](https://github.com/mrgxmer0004/openhand-112/tree/master/src/csafe/api): `src/csafe/api`

### Other components

- **Dispatcher**
- **Other agencies**

## Connections

- Dispatcher → Dashboard shell: uses
- Dashboard shell → Live dispatch UI: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → Operational map: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → Forecast UI: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → Rain UI: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → City comparison UI: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → Platform UI: renders (evidence: `web/src/App.tsx`)
- Dashboard shell → Evidence UI: renders (evidence: `web/src/App.tsx`)
- Live dispatch UI → API client: requests (evidence: `web/src/api.ts`)
- Forecast UI → API client: requests (evidence: `web/src/api.ts`)
- Rain UI → API client: requests (evidence: `web/src/api.ts`)
- City comparison UI → API client: requests (evidence: `web/src/api.ts`)
- Platform UI → API client: requests (evidence: `web/src/api.ts`)
- Evidence UI → API client: requests (evidence: `web/src/api.ts`)
- API client → HTTP API: HTTP calls (evidence: `web/src/api.ts`)
- HTTP API → Triage pipeline: triages calls (evidence: `src/csafe/api/server.py`)
- Triage pipeline → Fact extraction: extracts facts (evidence: `src/csafe/triage/pipeline.py`)
- Triage pipeline → Location resolution: resolves location (evidence: `src/csafe/triage/pipeline.py`)
- Triage pipeline → Priority rules: decides priority (evidence: `src/csafe/triage/pipeline.py`)
- Triage pipeline → Triage alternatives: uses helpers (evidence: `src/csafe/triage/pipeline.py`)
- Fact extraction → Triage alternatives: uses schema and prompts (evidence: `src/csafe/triage/client.py`)
- HTTP API → City dispatch state: routes dispatch (evidence: `src/csafe/api/server.py`)
- City dispatch state → Road network: routes by road (evidence: `src/csafe/api/world.py`)
- City dispatch state → Triage pipeline: triages incidents
- City analytics API → Demand model: models demand (evidence: `src/csafe/api/world.py`)
- Standby placement → Road network: uses travel network (evidence: `src/csafe/placement.py`)
- Live watch → Demand model: reads demand model (evidence: `src/csafe/api/watch.py`)
- Flood operations → Flood model: runs flood model (evidence: `src/csafe/api/flood_ops.py`)
- City analytics API → Standby placement: uses standby planning (evidence: `src/csafe/api/world.py`)
- City analytics API → Live watch: serves watch data (evidence: `src/csafe/api/world.py`)
- City analytics API → Flood operations: serves flood operations (evidence: `src/csafe/api/world.py`)
- HTTP API → Agency interfaces: serves platform APIs (evidence: `src/csafe/api/server.py`)
- Agency interfaces → Other agencies: sends agency messages
- Evidence UI → Evidence and scoring: views evidence
- HTTP API → Flood operations: routes flood requests (evidence: `src/csafe/api/server.py`)
