# potatoish/disaster-route-sim architecture

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

- Interactive diagram: https://gitdiagram.com/potatoish/disaster-route-sim
- Repository: https://github.com/potatoish/disaster-route-sim

## Overview

AGNAS is a pre-disaster evacuation route simulator for two Pasig barangays. A visitor selects a barangay and hazard, places map pins, and runs a simulation: flood runs seek routes between two pins, while earthquake runs seek evacuation sites. The Flask app queues simulation work and returns ranked route results for the interactive map. The README documents map layers, route alternatives and reports, responsive controls, tutorial and hotline content, plus contact and feedback features. Some API and data-loading details are not shown in the excerpts, so those links rely on README statements or are omitted.

Main entry points: [`Backend/app.py`](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/app.py) (Flask app and job queue), [`Frontend/static/script.js`](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/script.js) (Simulator interface), [`Backend/osm_routing.py`](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/osm_routing.py) (Flood route search), [`Backend/earthquake_data.py`](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/earthquake_data.py) (Earthquake data loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_sim_ui["Simulator interface<br/>[script.js]"]
  node_mobile_ui["Mobile layout<br/>[mobile-sim.js]"]
  node_route_map["Route map<br/>[osm.js]"]
  node_flood_views["Flood views<br/>[flood.js]"]
  node_quake_views["Earthquake views<br/>[earthquake.js]"]
  node_tutorial["Tutorial<br/>[tutorial.js]"]
  node_web_pages["Pages and contacts"]
end

subgraph group_api["Application API"]
  node_api_app["Flask app and job queue<br/>[app.py]"]
  node_progress["Simulation progress"]
end

subgraph group_routing["Routing and hazards"]
  node_flood_validation["Flood request validation<br/>[main.py]"]
  node_flood_routing["Flood route search<br/>[osm_routing.py]"]
  node_quake_routing["Earthquake routing"]
  node_quake_data["Earthquake data loading<br/>[earthquake_data.py]"]
end

subgraph group_data["Geospatial data"]
  node_boundaries["Barangay boundaries"]
  node_road_graphs["Walking road graphs"]
  node_flood_hazards["Flood hazard layers"]
  node_quake_hazards["Earthquake hazard layers"]
end

subgraph group_engagement["Visitor services"]
  node_contact_service["Contact and feedback<br/>[contact_service.py]"]
  node_resend["Resend email"]
  node_feedback_sheet[("Google Sheet")]
end

node_visitor(("Visitor"))

node_visitor -->|"sets pins"| node_sim_ui
node_sim_ui -->|"submits simulation"| node_api_app
node_api_app -->|"dispatches flood"| node_flood_validation
node_flood_validation -->|"calls route search"| node_flood_routing
node_api_app -->|"dispatches earthquake"| node_quake_routing
node_api_app -->|"tracks progress"| node_progress
node_flood_routing -.->|"reads boundaries"| node_boundaries
node_flood_routing -->|"uses road network"| node_road_graphs
node_flood_routing -->|"uses flood layers"| node_flood_hazards
node_quake_routing -->|"loads dataset"| node_quake_data
node_quake_routing -->|"reuses routing core"| node_flood_routing
node_quake_data -.->|"reads hazard layers"| node_quake_hazards
node_quake_data -.->|"uses boundaries"| node_boundaries
node_quake_data -.->|"uses road graphs"| node_road_graphs
node_api_app -.->|"returns results"| node_sim_ui
node_sim_ui -->|"draws routes"| node_route_map
node_sim_ui -->|"shows flood results"| node_flood_views
node_sim_ui -->|"shows quake views"| node_quake_views
node_visitor -->|"uses responsive controls"| node_mobile_ui
node_visitor -->|"opens guidance"| node_tutorial
node_visitor -->|"visits pages"| node_web_pages
node_api_app -->|"routes submissions"| node_contact_service
node_contact_service -->|"sends email"| node_resend
node_contact_service -->|"records feedback"| node_feedback_sheet

click node_sim_ui "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/script.js"
click node_mobile_ui "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/mobile-sim.js"
click node_route_map "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/osm.js"
click node_flood_views "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/flood.js"
click node_quake_views "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/earthquake.js"
click node_tutorial "https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/tutorial.js"
click node_web_pages "https://github.com/potatoish/disaster-route-sim/tree/main/Frontend/templates"
click node_api_app "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/app.py"
click node_progress "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/simulation_progress.py"
click node_flood_validation "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/main.py"
click node_flood_routing "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/osm_routing.py"
click node_quake_routing "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/earthquake_service.py"
click node_quake_data "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/earthquake_data.py"
click node_boundaries "https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/boundaries"
click node_road_graphs "https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/graphs"
click node_flood_hazards "https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/flood_classes"
click node_quake_hazards "https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/earthquake"
click node_contact_service "https://github.com/potatoish/disaster-route-sim/blob/main/Backend/contact_service.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_sim_ui,node_mobile_ui,node_route_map,node_flood_views,node_quake_views,node_tutorial,node_web_pages toneBlue
class node_api_app,node_progress toneAmber
class node_flood_validation,node_flood_routing,node_quake_routing,node_quake_data toneMint
class node_boundaries,node_road_graphs,node_flood_hazards,node_quake_hazards toneRose
class node_contact_service,node_resend,node_feedback_sheet,node_visitor toneIndigo
```

## Components

### Web experience

- [Simulator interface](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/script.js): `Frontend/static/script.js`
- [Mobile layout](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/mobile-sim.js): `Frontend/static/mobile-sim.js`
- [Route map](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/osm.js): `Frontend/static/osm.js`
- [Flood views](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/flood.js): `Frontend/static/flood.js`
- [Earthquake views](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/earthquake.js): `Frontend/static/earthquake.js`
- [Tutorial](https://github.com/potatoish/disaster-route-sim/blob/main/Frontend/static/tutorial.js): `Frontend/static/tutorial.js`
- [Pages and contacts](https://github.com/potatoish/disaster-route-sim/tree/main/Frontend/templates): `Frontend/templates`

### Application API

- [Flask app and job queue](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/app.py): `Backend/app.py`
- [Simulation progress](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/simulation_progress.py): `Backend/simulation_progress.py`

### Routing and hazards

- [Flood request validation](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/main.py): `Backend/main.py`
- [Flood route search](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/osm_routing.py): `Backend/osm_routing.py`
- [Earthquake routing](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/earthquake_service.py): `Backend/earthquake_service.py`
- [Earthquake data loading](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/earthquake_data.py): `Backend/earthquake_data.py`

### Geospatial data

- [Barangay boundaries](https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/boundaries): `Backend/data/boundaries`
- [Walking road graphs](https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/graphs): `Backend/data/graphs`
- [Flood hazard layers](https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/flood_classes): `Backend/data/flood_classes`
- [Earthquake hazard layers](https://github.com/potatoish/disaster-route-sim/tree/main/Backend/data/earthquake): `Backend/data/earthquake`

### Visitor services

- [Contact and feedback](https://github.com/potatoish/disaster-route-sim/blob/main/Backend/contact_service.py): `Backend/contact_service.py`
- **Resend email**
- **Google Sheet**

### Other components

- **Visitor**

## Connections

- Visitor → Simulator interface: sets pins (evidence: `README.md`)
- Simulator interface → Flask app and job queue: submits simulation (evidence: `Frontend/static/script.js`)
- Flask app and job queue → Flood request validation: dispatches flood (evidence: `Backend/app.py`)
- Flood request validation → Flood route search: calls route search (evidence: `Backend/main.py`)
- Flask app and job queue → Earthquake routing: dispatches earthquake (evidence: `Backend/app.py`)
- Flask app and job queue → Simulation progress: tracks progress (evidence: `Backend/app.py`)
- Flood route search → Barangay boundaries: reads boundaries
- Flood route search → Walking road graphs: uses road network (evidence: `README.md`)
- Flood route search → Flood hazard layers: uses flood layers (evidence: `README.md`)
- Earthquake routing → Earthquake data loading: loads dataset (evidence: `Backend/earthquake_service.py`)
- Earthquake routing → Flood route search: reuses routing core (evidence: `README.md`)
- Earthquake data loading → Earthquake hazard layers: reads hazard layers
- Earthquake data loading → Barangay boundaries: uses boundaries
- Earthquake data loading → Walking road graphs: uses road graphs
- Flask app and job queue → Simulator interface: returns results
- Simulator interface → Route map: draws routes (evidence: `README.md`)
- Simulator interface → Flood views: shows flood results (evidence: `README.md`)
- Simulator interface → Earthquake views: shows quake views (evidence: `README.md`)
- Visitor → Mobile layout: uses responsive controls (evidence: `README.md`)
- Visitor → Tutorial: opens guidance (evidence: `README.md`)
- Visitor → Pages and contacts: visits pages (evidence: `README.md`)
- Flask app and job queue → Contact and feedback: routes submissions (evidence: `Backend/app.py`)
- Contact and feedback → Resend email: sends email (evidence: `Backend/contact_service.py`)
- Contact and feedback → Google Sheet: records feedback (evidence: `Backend/contact_service.py`)
