How rishu07368/urban-flood-nowcasting works
This prototype turns synthetic rainfall forecasts and simulated drainage observations into a three-hour flood-risk nowcast, exposed through a FastAPI service and GIS map. The risk-map path orchestrates rainfall loading, SWMM input generation and execution, result extraction, sensor comparison, scoring, and GeoJSON construction; the API also exposes sensor, rainfall, and full-simulation endpoints. README-documented Leaflet timeline, legend, and map capabilities are represented, but frontend source was not sampled, so its API interactions are not asserted. SWMM model and rainfall data are supported by the tree and README; finer internal connections are limited to excerpted code.
Main entry points: risk_mapper.py Forecast risk orchestration · api.py FastAPI routes · run_simulation.py Rainfall injection and SWMM · index.html GIS map and timeline
Components 14
Forecast and sensors
- Rainfall forecast
data/rainfall_nowcast.json - Sensor simulator
backend/sensors.py
Hydraulic simulation
- SWMM base model
swmm/urban_flood.inp - Rainfall injection and SWMM
run_simulation.py - SWMM result extraction
extract_result.py - SWMM output
swmm/flood_output.out - Simulation endpoint pipeline
backend/simulation.py
Risk and mapping
- Forecast risk orchestration
backend/risk_mapper.py - Risk scoring and summary
backend/flood_engine.py - Risk GeoJSON
backend/risk_mapper.py
API and map
- FastAPI routes
backend/api.py - GIS map and timeline
frontend/index.html
Other components
- Map user
- OpenStreetMap tiles
Connections 22
- FastAPI routes → GIS map and timeline: serves
backend/api.py - Map user → GIS map and timeline: views
README.md - GIS map and timeline → FastAPI routes: requests
README.md - GIS map and timeline → OpenStreetMap tiles: loads tiles
README.md - FastAPI routes → Sensor simulator: builds payload
backend/api.py - Sensor simulator → Rainfall forecast: reads forecast
backend/sensors.py - FastAPI routes → Rainfall forecast: loads forecast
backend/api.py - FastAPI routes → Simulation endpoint pipeline: runs pipeline
backend/api.py - Simulation endpoint pipeline → Rainfall injection and SWMM: runs model
backend/simulation.py - Simulation endpoint pipeline → SWMM result extraction: extracts results
backend/simulation.py - Rainfall injection and SWMM → Rainfall forecast: loads forecast
run_simulation.py - Rainfall injection and SWMM → SWMM base model: copies model
run_simulation.py - Rainfall injection and SWMM → SWMM output: writes output
run_simulation.py - SWMM result extraction → SWMM output: reads results
extract_result.py - FastAPI routes → Forecast risk orchestration: requests risk
backend/api.py - Forecast risk orchestration → Rainfall forecast: loads forecast
backend/risk_mapper.py - Forecast risk orchestration → Rainfall injection and SWMM: updates and runs
backend/risk_mapper.py - Forecast risk orchestration → SWMM result extraction: extracts metrics
backend/risk_mapper.py - Forecast risk orchestration → Sensor simulator: gets observations
backend/risk_mapper.py - Forecast risk orchestration → Risk scoring and summary: scores zones
backend/risk_mapper.py - Forecast risk orchestration → Risk GeoJSON: builds features
backend/risk_mapper.py - FastAPI routes → Risk GeoJSON: returns map
backend/api.py