# prithvisb08/flash-flood-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/prithvisb08/flash-flood-intelligence
- Repository: https://github.com/prithvisb08/flash-flood-intelligence

## Overview

JALRAKSHAK is a basin-scale flash-flood intelligence and OASIS CAP early-warning decision-support platform. Operators use the admin console to inspect basin risk, telemetry, spatial hazards and evacuation routes, and to run scenarios; the public citizen portal presents risk, safe zones and recommended actions. The backend syncs telemetry, evaluates hydrological and compound risk, maintains per-session simulation state, and exposes alerts, routes and bulletins. README-documented integrations and capabilities are included, but their precise internal call paths are not all visible in the sampled source.

Main entry points: [`backend/main.py`](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/main.py) (API and orchestration), [`frontend/src/pages/Admin.tsx`](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Admin.tsx) (Admin console), [`frontend/src/pages/Citizen.tsx`](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Citizen.tsx) (Citizen portal), [`backend/weather.py`](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/weather.py) (Weather provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend intelligence"]
  node_api["API and orchestration<br/>[main.py]"]
  node_session_state["Session state<br/>[state.py]"]
  node_risk_engine["Risk assessment<br/>[risk_engine.py]"]
  node_hydrology["Hydrology physics<br/>[hydrology.py]"]
  node_routing["Evacuation routing<br/>[routing.py]"]
  node_schemas["API data contracts<br/>[schemas.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_feeds["Telemetry and dispatch"]
  node_weather["Weather provider<br/>[weather.py]"]
  node_providers["External data feeds<br/>[providers.py]"]
  node_alerting["Alert and CAP dispatch<br/>[alerting.py]"]
end

subgraph group_operator["Operations console"]
  node_admin["Admin console<br/>[Admin.tsx]"]
  node_digital_twin["Spatial digital twin<br/>[MapDigitalTwin.tsx]"]
  node_simulation["Scenario simulation"]
  node_sensor_panel["Sensor monitoring<br/>[SensorPanel.tsx]"]
  node_satellite_feed["Satellite monitoring<br/>[SatelliteFeed.tsx]"]
  node_ai_assistant["AI assistant<br/>[RakshakAI.tsx]"]
  node_map_wrapper["Basin map<br/>[MapWrapper.tsx]"]
  node_frontend_config["API endpoint config<br/>[config.ts]"]
  node_india_boundary["India boundary data<br/>[indiaBoundary.ts]"]
end

subgraph group_public["Public interface"]
  node_citizen["Citizen portal<br/>[Citizen.tsx]"]
end

node_operator_user(("Duty officer"))
node_citizen_user(("Citizen"))
node_weather_service["Open-Meteo"]
node_external_feeds["Other telemetry feeds"]
node_dispatch_targets["Dispatch channels"]

node_operator_user -->|"uses"| node_admin
node_citizen_user -->|"uses"| node_citizen
node_admin -->|"requests risk"| node_api
node_citizen -->|"requests risk"| node_api
node_citizen -->|"syncs telemetry"| node_api
node_admin -->|"renders"| node_digital_twin
node_admin -->|"renders"| node_simulation
node_admin -->|"renders"| node_sensor_panel
node_admin -->|"renders"| node_satellite_feed
node_admin -->|"renders"| node_ai_assistant
node_digital_twin -->|"requests hazards"| node_api
node_api -->|"loads session"| node_session_state
node_api -->|"computes risk"| node_risk_engine
node_api -->|"uses hydrology"| node_hydrology
node_api -->|"calculates routes"| node_routing
node_api -->|"serves feed data"| node_providers
node_api -->|"syncs weather"| node_weather
node_api -->|"dispatches alerts"| node_alerting
node_weather -->|"fetches forecasts"| node_weather_service
node_hydrology -->|"uses weather data"| node_weather
node_providers -.->|"fetches telemetry"| node_external_feeds
node_alerting -.->|"sends notifications"| node_dispatch_targets
node_api -->|"uses contracts"| node_schemas
node_weather -->|"reads endpoints"| node_settings
node_providers -->|"reads endpoints"| node_settings
node_alerting -->|"reads config"| node_settings
node_api -->|"returns risk data"| node_admin
node_api -->|"returns risk data"| node_citizen
node_digital_twin -->|"uses API address"| node_frontend_config
node_citizen -->|"uses API address"| node_frontend_config
node_admin -->|"uses API address"| node_frontend_config
node_map_wrapper -->|"renders boundary"| node_india_boundary

click node_api "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/main.py"
click node_session_state "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/state.py"
click node_risk_engine "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/risk_engine.py"
click node_hydrology "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/hydrology.py"
click node_routing "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/routing.py"
click node_schemas "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/schemas.py"
click node_settings "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/settings.py"
click node_weather "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/weather.py"
click node_providers "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/providers.py"
click node_alerting "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/alerting.py"
click node_admin "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Admin.tsx"
click node_digital_twin "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/MapDigitalTwin.tsx"
click node_simulation "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SimulationPanel.tsx"
click node_sensor_panel "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SensorPanel.tsx"
click node_satellite_feed "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SatelliteFeed.tsx"
click node_ai_assistant "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/RakshakAI.tsx"
click node_citizen "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Citizen.tsx"
click node_map_wrapper "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/MapWrapper.tsx"
click node_frontend_config "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/config.ts"
click node_india_boundary "https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/data/indiaBoundary.ts"

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_api,node_session_state,node_risk_engine,node_hydrology,node_routing,node_schemas,node_settings toneBlue
class node_weather,node_providers,node_alerting toneAmber
class node_admin,node_digital_twin,node_simulation,node_sensor_panel,node_satellite_feed,node_ai_assistant,node_map_wrapper,node_frontend_config,node_india_boundary toneMint
class node_citizen toneRose
class node_operator_user,node_citizen_user,node_weather_service,node_external_feeds,node_dispatch_targets toneIndigo
```

## Components

### Backend intelligence

- [API and orchestration](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/main.py): `backend/main.py`
- [Session state](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/state.py): `backend/state.py`
- [Risk assessment](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/risk_engine.py): `backend/risk_engine.py`
- [Hydrology physics](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/hydrology.py): `backend/hydrology.py`
- [Evacuation routing](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/routing.py): `backend/routing.py`
- [API data contracts](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/schemas.py): `backend/schemas.py`
- [Runtime settings](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/settings.py): `backend/settings.py`

### Telemetry and dispatch

- [Weather provider](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/weather.py): `backend/weather.py`
- [External data feeds](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/providers.py): `backend/providers.py`
- [Alert and CAP dispatch](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/backend/alerting.py): `backend/alerting.py`

### Operations console

- [Admin console](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Admin.tsx): `frontend/src/pages/Admin.tsx`
- [Spatial digital twin](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/MapDigitalTwin.tsx): `frontend/src/components/MapDigitalTwin.tsx`
- [Scenario simulation](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SimulationPanel.tsx): `frontend/src/components/SimulationPanel.tsx`
- [Sensor monitoring](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SensorPanel.tsx): `frontend/src/components/SensorPanel.tsx`
- [Satellite monitoring](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/SatelliteFeed.tsx): `frontend/src/components/SatelliteFeed.tsx`
- [AI assistant](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/RakshakAI.tsx): `frontend/src/components/RakshakAI.tsx`
- [Basin map](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/components/MapWrapper.tsx): `frontend/src/components/MapWrapper.tsx`
- [API endpoint config](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/config.ts): `frontend/src/config.ts`
- [India boundary data](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/data/indiaBoundary.ts): `frontend/src/data/indiaBoundary.ts`

### Public interface

- [Citizen portal](https://github.com/prithvisb08/flash-flood-intelligence/blob/main/frontend/src/pages/Citizen.tsx): `frontend/src/pages/Citizen.tsx`

### Other components

- **Duty officer**
- **Citizen**
- **Open-Meteo**
- **Other telemetry feeds**
- **Dispatch channels**

## Connections

- Duty officer → Admin console: uses
- Citizen → Citizen portal: uses
- Admin console → API and orchestration: requests risk (evidence: `frontend/src/pages/Admin.tsx`)
- Citizen portal → API and orchestration: requests risk (evidence: `frontend/src/pages/Citizen.tsx`)
- Citizen portal → API and orchestration: syncs telemetry (evidence: `frontend/src/pages/Citizen.tsx`)
- Admin console → Spatial digital twin: renders (evidence: `frontend/src/pages/Admin.tsx`)
- Admin console → Scenario simulation: renders (evidence: `frontend/src/pages/Admin.tsx`)
- Admin console → Sensor monitoring: renders (evidence: `frontend/src/pages/Admin.tsx`)
- Admin console → Satellite monitoring: renders (evidence: `frontend/src/pages/Admin.tsx`)
- Admin console → AI assistant: renders (evidence: `frontend/src/pages/Admin.tsx`)
- Spatial digital twin → API and orchestration: requests hazards (evidence: `frontend/src/components/MapDigitalTwin.tsx`)
- API and orchestration → Session state: loads session (evidence: `backend/main.py`)
- API and orchestration → Risk assessment: computes risk (evidence: `backend/main.py`)
- API and orchestration → Hydrology physics: uses hydrology (evidence: `backend/main.py`)
- API and orchestration → Evacuation routing: calculates routes (evidence: `backend/main.py`)
- API and orchestration → External data feeds: serves feed data (evidence: `backend/main.py`)
- API and orchestration → Weather provider: syncs weather (evidence: `backend/main.py`)
- API and orchestration → Alert and CAP dispatch: dispatches alerts (evidence: `backend/main.py`)
- Weather provider → Open-Meteo: fetches forecasts (evidence: `README.md`)
- Hydrology physics → Weather provider: uses weather data (evidence: `backend/hydrology.py`)
- External data feeds → Other telemetry feeds: fetches telemetry (evidence: `README.md`)
- Alert and CAP dispatch → Dispatch channels: sends notifications (evidence: `README.md`)
- API and orchestration → API data contracts: uses contracts (evidence: `backend/main.py`)
- Weather provider → Runtime settings: reads endpoints (evidence: `backend/weather.py`)
- External data feeds → Runtime settings: reads endpoints (evidence: `backend/providers.py`)
- Alert and CAP dispatch → Runtime settings: reads config (evidence: `backend/alerting.py`)
- API and orchestration → Admin console: returns risk data (evidence: `frontend/src/pages/Admin.tsx`)
- API and orchestration → Citizen portal: returns risk data (evidence: `frontend/src/pages/Citizen.tsx`)
- Spatial digital twin → API endpoint config: uses API address (evidence: `frontend/src/components/MapDigitalTwin.tsx`)
- Citizen portal → API endpoint config: uses API address (evidence: `frontend/src/pages/Citizen.tsx`)
- Admin console → API endpoint config: uses API address (evidence: `frontend/src/pages/Admin.tsx`)
- Basin map → India boundary data: renders boundary (evidence: `frontend/src/components/MapWrapper.tsx`)
