# rishu07368/resqnet_2.0 architecture

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

- Interactive diagram: https://gitdiagram.com/rishu07368/resqnet_2.0
- Repository: https://github.com/rishu07368/resqnet_2.0

## Overview

ResQNet is an offline simulation and graph-algorithm teaching application, not a live emergency service. Operators use its web interface to inspect the simulated network, create and dispatch incidents, plan routes and hospital allocations, and explore evacuation and other graph problems; Flask services coordinate domain logic over SQLite snapshots and return results for the interface to display. The README documents additional features whose implementation was not sampled. Edges are limited to README claims and relationships visible in the supplied excerpts or source index.

Main entry points: [`backend/routes/api.py`](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/routes/api.py) (JSON API), [`backend/services/graph_service.py`](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/graph_service.py) (Graph snapshots), [`backend/database/repository.py`](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/database/repository.py) (Persistence helpers), [`backend/services/routing_service.py`](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/routing_service.py) (Route optimization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Operator interface"]
  node_webapp["Operations UI<br/>[app.js]"]
  node_map["Network map<br/>[map.js]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_api["HTTP application"]
  node_flask["Flask app<br/>[app.py]"]
  node_http["JSON API<br/>[api.py]"]
end

subgraph group_operations["Response planning"]
  node_dispatch["Incident dispatch"]
  node_hospital["Hospital allocation"]
  node_evacuation["Evacuation planning"]
  node_network["Road management<br/>[network_service.py]"]
  node_analytics["Dashboard analytics"]
end

subgraph group_graph["Graph analysis"]
  node_routing["Route optimization<br/>[routing_service.py]"]
  node_snapshot["Graph snapshots<br/>[graph_service.py]"]
  node_routealg["Dijkstra and A*<br/>[astar.py]"]
  node_bellman["Bellman–Ford lab<br/>[bellman_ford.py]"]
  node_flow["Maximum flow<br/>[edmonds_karp.py]"]
  node_connectivity["Traversal and forest<br/>[traversal.py]"]
  node_edge["Shared edge model<br/>[common.py]"]
end

subgraph group_persistence["Simulation data"]
  node_seed["Demo network seed<br/>[seed.py]"]
  node_repo["Persistence helpers<br/>[repository.py]"]
  node_sqlite[("SQLite schema<br/>[database.py]")]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_webapp
node_webapp -->|"requests data"| node_client
node_webapp -->|"renders network"| node_map
node_client -->|"calls JSON API"| node_http
node_flask -->|"registers routes"| node_http
node_flask -->|"initializes database"| node_sqlite
node_flask -->|"seeds demo"| node_seed
node_http -->|"dispatches incidents"| node_dispatch
node_http -->|"requests allocation"| node_hospital
node_http -->|"requests routes"| node_routing
node_http -->|"simulates evacuation"| node_evacuation
node_http -->|"manages roads"| node_network
node_http -->|"requests analytics"| node_analytics
node_dispatch -->|"ranks ETA"| node_routing
node_hospital -->|"ranks hospitals"| node_routing
node_dispatch -->|"loads graph"| node_snapshot
node_hospital -->|"loads graph"| node_snapshot
node_network -->|"loads graph"| node_snapshot
node_routing -->|"loads graph"| node_snapshot
node_evacuation -->|"calculates capacity flow"| node_flow
node_network -->|"analyzes connectivity"| node_connectivity
node_routing -->|"runs route search"| node_routealg
node_snapshot -->|"builds edges"| node_edge
node_routealg -->|"uses edge model"| node_edge
node_http -->|"runs sandbox"| node_bellman
node_dispatch -->|"persists updates"| node_repo
node_hospital -->|"reserves beds"| node_repo
node_snapshot -->|"reads graph"| node_repo
node_network -->|"updates roads"| node_repo
node_analytics -->|"reads aggregates"| node_repo
node_repo -->|"executes SQL"| node_sqlite

click node_webapp "https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/app.js"
click node_map "https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/map.js"
click node_client "https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/api.js"
click node_flask "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/app.py"
click node_http "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/routes/api.py"
click node_dispatch "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/dispatch_service.py"
click node_hospital "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/hospital_service.py"
click node_evacuation "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/evacuation_service.py"
click node_network "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/network_service.py"
click node_analytics "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/analytics_service.py"
click node_routing "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/routing_service.py"
click node_snapshot "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/graph_service.py"
click node_routealg "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/astar.py"
click node_bellman "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/bellman_ford.py"
click node_flow "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/edmonds_karp.py"
click node_connectivity "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/traversal.py"
click node_edge "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/common.py"
click node_seed "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/data/seed.py"
click node_repo "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/database/repository.py"
click node_sqlite "https://github.com/rishu07368/resqnet_2.0/blob/main/backend/database/database.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_webapp,node_map,node_client toneBlue
class node_flask,node_http toneAmber
class node_dispatch,node_hospital,node_evacuation,node_network,node_analytics toneMint
class node_routing,node_snapshot,node_routealg,node_bellman,node_flow,node_connectivity,node_edge toneRose
class node_seed,node_repo,node_sqlite,node_operator toneIndigo
```

## Components

### Operator interface

- [Operations UI](https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Network map](https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/map.js): `frontend/js/map.js`
- [API client](https://github.com/rishu07368/resqnet_2.0/blob/main/frontend/js/api.js): `frontend/js/api.js`

### HTTP application

- [Flask app](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/app.py): `backend/app.py`
- [JSON API](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/routes/api.py): `backend/routes/api.py`

### Response planning

- [Incident dispatch](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/dispatch_service.py): `backend/services/dispatch_service.py`
- [Hospital allocation](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/hospital_service.py): `backend/services/hospital_service.py`
- [Evacuation planning](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/evacuation_service.py): `backend/services/evacuation_service.py`
- [Road management](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/network_service.py): `backend/services/network_service.py`
- [Dashboard analytics](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/analytics_service.py): `backend/services/analytics_service.py`

### Graph analysis

- [Route optimization](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/routing_service.py): `backend/services/routing_service.py`
- [Graph snapshots](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/services/graph_service.py): `backend/services/graph_service.py`
- [Dijkstra and A*](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/astar.py): `backend/algorithms/astar.py`
- [Bellman–Ford lab](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/bellman_ford.py): `backend/algorithms/bellman_ford.py`
- [Maximum flow](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/edmonds_karp.py): `backend/algorithms/edmonds_karp.py`
- [Traversal and forest](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/traversal.py): `backend/algorithms/traversal.py`
- [Shared edge model](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/algorithms/common.py): `backend/algorithms/common.py`

### Simulation data

- [Demo network seed](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/data/seed.py): `backend/data/seed.py`
- [Persistence helpers](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/database/repository.py): `backend/database/repository.py`
- [SQLite schema](https://github.com/rishu07368/resqnet_2.0/blob/main/backend/database/database.py): `backend/database/database.py`

### Other components

- **Operator**

## Connections

- Operator → Operations UI: uses (evidence: `README.md`)
- Operations UI → API client: requests data (evidence: `frontend/js/app.js`)
- Operations UI → Network map: renders network (evidence: `frontend/js/app.js`)
- API client → JSON API: calls JSON API (evidence: `README.md`)
- Flask app → JSON API: registers routes (evidence: `backend/app.py`)
- Flask app → SQLite schema: initializes database (evidence: `backend/app.py`)
- Flask app → Demo network seed: seeds demo (evidence: `backend/app.py`)
- JSON API → Incident dispatch: dispatches incidents (evidence: `backend/routes/api.py`)
- JSON API → Hospital allocation: requests allocation (evidence: `backend/routes/api.py`)
- JSON API → Route optimization: requests routes (evidence: `backend/routes/api.py`)
- JSON API → Evacuation planning: simulates evacuation (evidence: `backend/routes/api.py`)
- JSON API → Road management: manages roads (evidence: `backend/routes/api.py`)
- JSON API → Dashboard analytics: requests analytics (evidence: `backend/routes/api.py`)
- Incident dispatch → Route optimization: ranks ETA (evidence: `backend/services/dispatch_service.py`)
- Hospital allocation → Route optimization: ranks hospitals (evidence: `backend/services/hospital_service.py`)
- Incident dispatch → Graph snapshots: loads graph (evidence: `backend/services/dispatch_service.py`)
- Hospital allocation → Graph snapshots: loads graph (evidence: `backend/services/hospital_service.py`)
- Road management → Graph snapshots: loads graph (evidence: `backend/services/network_service.py`)
- Route optimization → Graph snapshots: loads graph (evidence: `backend/services/routing_service.py`)
- Evacuation planning → Maximum flow: calculates capacity flow (evidence: `backend/services/evacuation_service.py`)
- Road management → Traversal and forest: analyzes connectivity (evidence: `backend/services/network_service.py`)
- Route optimization → Dijkstra and A*: runs route search (evidence: `backend/services/routing_service.py`)
- Graph snapshots → Shared edge model: builds edges (evidence: `backend/services/graph_service.py`)
- Dijkstra and A* → Shared edge model: uses edge model (evidence: `backend/algorithms/astar.py`)
- JSON API → Bellman–Ford lab: runs sandbox (evidence: `backend/routes/api.py`)
- Incident dispatch → Persistence helpers: persists updates (evidence: `backend/services/dispatch_service.py`)
- Hospital allocation → Persistence helpers: reserves beds (evidence: `backend/services/hospital_service.py`)
- Graph snapshots → Persistence helpers: reads graph (evidence: `backend/services/graph_service.py`)
- Road management → Persistence helpers: updates roads (evidence: `backend/services/network_service.py`)
- Dashboard analytics → Persistence helpers: reads aggregates (evidence: `backend/services/analytics_service.py`)
- Persistence helpers → SQLite schema: executes SQL (evidence: `README.md`)
