# gayatri226-web/himraksha architecture

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

- Interactive diagram: https://gitdiagram.com/gayatri226-web/himraksha
- Repository: https://github.com/gayatri226-web/himraksha

## Overview

HimRaksha maps flood impacts from a user-specified area and date: satellite imagery is prepared and analyzed, damage and access impacts are assessed, and results are exported to an offline map dashboard and situation report. The graph follows the documented run workflow and preserves the separate flood-path and validation capabilities. Some orchestration and implementations are not excerpted; those relationships are included only where the README explicitly documents them.

Main entry points: [`code/pipeline/01_mapping.py`](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py) (Fused impact map), [`code/pipeline/03_damage.py`](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/03_damage.py) (Asset damage grading), [`code/pipeline/grd_preprocess.py`](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/grd_preprocess.py) (GRD preprocessing), [`code/dashboard/export_dashboard.py`](https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/export_dashboard.py) (Dashboard export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_imagery["Imagery preparation"]
  node_grd["GRD preprocessing<br/>[grd_preprocess.py]"]
  node_sentinel2["Optical change layer<br/>[s2_layer.py]"]
end

subgraph group_analysis["Flood impact analysis"]
  node_dem["DEM and valley mask<br/>[01_mapping.py]"]
  node_unet["Flood U-Net inference<br/>[01_mapping.py]"]
  node_debris["Radar change detection<br/>[01_mapping.py]"]
  node_impact["Fused impact map<br/>[01_mapping.py]"]
end

subgraph group_response["Damage and access"]
  node_osm["OSM asset fetch<br/>[02_osm_fetch_v2.py]"]
  node_damage["Asset damage grading<br/>[03_damage.py]"]
  node_bridges["Bridge grading<br/>[bridges.py]"]
  node_access["Cut-off and repairs"]
  node_flow["Flood path exposure<br/>[flow_path.py]"]
end

subgraph group_presentation["Results presentation"]
  node_exporter["Dashboard export"]
  node_eventdata["Event map data"]
  node_dashboard["Offline dashboard<br/>[app.js]"]
  node_sitrep["Situation report<br/>[sitrep.html]"]
end

subgraph group_assessment["Validation"]
  node_evaluation["EMS comparison<br/>[eval_emsr927.py]"]
  node_jrc["JRC comparison<br/>[compare_jrc.py]"]
  node_modelcheck["Model contribution check"]
end

node_operator(("Area and date"))
node_copernicus["Copernicus data"]
node_sentinel1["Sentinel-1 GRD"]
node_ems["Copernicus EMS reference"]

node_operator -->|"specifies area and dates"| node_grd
node_copernicus -->|"provides radar scenes"| node_grd
node_sentinel1 -->|"supplies raw scenes"| node_grd
node_grd -->|"prepares radar stack"| node_impact
node_operator -->|"sets analysis area"| node_dem
node_copernicus -->|"provides DEM"| node_dem
node_dem -->|"provides terrain inputs"| node_unet
node_dem -->|"limits valley analysis"| node_debris
node_grd -->|"provides radar pairs"| node_unet
node_grd -->|"provides radar pairs"| node_debris
node_unet -->|"contributes water detections"| node_impact
node_debris -->|"contributes debris detections"| node_impact
node_copernicus -->|"provides optical scenes"| node_sentinel2
node_impact -->|"fuses optical findings"| node_sentinel2
node_operator -->|"sets event snapshot"| node_osm
node_osm -->|"provides pre-event assets"| node_damage
node_impact -->|"identifies impacted assets"| node_damage
node_damage -->|"grades bridge decks"| node_bridges
node_damage -->|"provides damaged roads"| node_access
node_impact -.->|"provides flood context"| node_flow
node_impact -->|"supplies impact layers"| node_exporter
node_damage -->|"supplies damage results"| node_exporter
node_access -->|"supplies access results"| node_exporter
node_flow -->|"supplies flood-path layer"| node_exporter
node_exporter -->|"writes map data"| node_eventdata
node_eventdata -->|"loads event layers"| node_dashboard
node_eventdata -->|"provides report data"| node_sitrep
node_impact -->|"compares mapped area"| node_evaluation
node_damage -->|"compares asset detections"| node_evaluation
node_ems -->|"provides reference grades"| node_evaluation
node_impact -->|"tests permanent-water mask"| node_jrc
node_ems -->|"provides validation reference"| node_jrc
node_impact -->|"checks model contribution"| node_modelcheck
node_sentinel2 -->|"provides optical comparison"| node_modelcheck
node_ems -->|"provides validation reference"| node_modelcheck

click node_grd "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/grd_preprocess.py"
click node_dem "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py"
click node_unet "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py"
click node_debris "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py"
click node_impact "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py"
click node_sentinel2 "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/s2_layer.py"
click node_osm "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/02_osm_fetch_v2.py"
click node_damage "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/03_damage.py"
click node_bridges "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/bridges.py"
click node_access "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/04_access_cutoff.py"
click node_flow "https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/flow_path.py"
click node_exporter "https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/export_dashboard.py"
click node_eventdata "https://github.com/gayatri226-web/himraksha/tree/main/code/dashboard/web/data"
click node_dashboard "https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/web/app.js"
click node_sitrep "https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/web/sitrep.html"
click node_evaluation "https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/eval_emsr927.py"
click node_jrc "https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/compare_jrc.py"
click node_modelcheck "https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/model_only_check.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_grd,node_sentinel2 toneBlue
class node_dem,node_unet,node_debris,node_impact toneAmber
class node_osm,node_damage,node_bridges,node_access,node_flow toneMint
class node_exporter,node_eventdata,node_dashboard,node_sitrep toneRose
class node_evaluation,node_jrc,node_modelcheck,node_operator,node_copernicus,node_sentinel1,node_ems toneIndigo
```

## Components

### Imagery preparation

- [GRD preprocessing](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/grd_preprocess.py): `code/pipeline/grd_preprocess.py`
- [Optical change layer](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/s2_layer.py): `code/pipeline/s2_layer.py`

### Flood impact analysis

- [DEM and valley mask](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py): `code/pipeline/01_mapping.py`
- [Flood U-Net inference](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py): `code/pipeline/01_mapping.py`
- [Radar change detection](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py): `code/pipeline/01_mapping.py`
- [Fused impact map](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/01_mapping.py): `code/pipeline/01_mapping.py`

### Damage and access

- [OSM asset fetch](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/02_osm_fetch_v2.py): `code/pipeline/02_osm_fetch_v2.py`
- [Asset damage grading](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/03_damage.py): `code/pipeline/03_damage.py`
- [Bridge grading](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/bridges.py): `code/pipeline/bridges.py`
- [Cut-off and repairs](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/04_access_cutoff.py): `code/pipeline/04_access_cutoff.py`
- [Flood path exposure](https://github.com/gayatri226-web/himraksha/blob/main/code/pipeline/flow_path.py): `code/pipeline/flow_path.py`

### Results presentation

- [Dashboard export](https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/export_dashboard.py): `code/dashboard/export_dashboard.py`
- [Event map data](https://github.com/gayatri226-web/himraksha/tree/main/code/dashboard/web/data): `code/dashboard/web/data`
- [Offline dashboard](https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/web/app.js): `code/dashboard/web/app.js`
- [Situation report](https://github.com/gayatri226-web/himraksha/blob/main/code/dashboard/web/sitrep.html): `code/dashboard/web/sitrep.html`

### Validation

- [EMS comparison](https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/eval_emsr927.py): `code/evaluation/eval_emsr927.py`
- [JRC comparison](https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/compare_jrc.py): `code/evaluation/compare_jrc.py`
- [Model contribution check](https://github.com/gayatri226-web/himraksha/blob/main/code/evaluation/model_only_check.py): `code/evaluation/model_only_check.py`

### Other components

- **Area and date**
- **Copernicus data**
- **Sentinel-1 GRD**
- **Copernicus EMS reference**

## Connections

- Area and date → GRD preprocessing: specifies area and dates (evidence: `README.md`)
- Copernicus data → GRD preprocessing: provides radar scenes (evidence: `README.md`)
- Sentinel-1 GRD → GRD preprocessing: supplies raw scenes (evidence: `README.md`)
- GRD preprocessing → Fused impact map: prepares radar stack (evidence: `README.md`)
- Area and date → DEM and valley mask: sets analysis area (evidence: `README.md`)
- Copernicus data → DEM and valley mask: provides DEM (evidence: `README.md`)
- DEM and valley mask → Flood U-Net inference: provides terrain inputs (evidence: `README.md`)
- DEM and valley mask → Radar change detection: limits valley analysis (evidence: `README.md`)
- GRD preprocessing → Flood U-Net inference: provides radar pairs (evidence: `README.md`)
- GRD preprocessing → Radar change detection: provides radar pairs (evidence: `README.md`)
- Flood U-Net inference → Fused impact map: contributes water detections (evidence: `README.md`)
- Radar change detection → Fused impact map: contributes debris detections (evidence: `README.md`)
- Copernicus data → Optical change layer: provides optical scenes (evidence: `README.md`)
- Fused impact map → Optical change layer: fuses optical findings (evidence: `README.md`)
- Area and date → OSM asset fetch: sets event snapshot (evidence: `README.md`)
- OSM asset fetch → Asset damage grading: provides pre-event assets (evidence: `README.md`)
- Fused impact map → Asset damage grading: identifies impacted assets (evidence: `README.md`)
- Asset damage grading → Bridge grading: grades bridge decks (evidence: `README.md`)
- Asset damage grading → Cut-off and repairs: provides damaged roads (evidence: `README.md`)
- Fused impact map → Flood path exposure: provides flood context
- Fused impact map → Dashboard export: supplies impact layers (evidence: `README.md`)
- Asset damage grading → Dashboard export: supplies damage results (evidence: `README.md`)
- Cut-off and repairs → Dashboard export: supplies access results (evidence: `README.md`)
- Flood path exposure → Dashboard export: supplies flood-path layer (evidence: `README.md`)
- Dashboard export → Event map data: writes map data (evidence: `code/dashboard/export_dashboard.py`)
- Event map data → Offline dashboard: loads event layers (evidence: `code/dashboard/web/app.js`)
- Event map data → Situation report: provides report data (evidence: `README.md`)
- Fused impact map → EMS comparison: compares mapped area (evidence: `code/evaluation/eval_emsr927.py`)
- Asset damage grading → EMS comparison: compares asset detections (evidence: `code/evaluation/eval_emsr927.py`)
- Copernicus EMS reference → EMS comparison: provides reference grades (evidence: `README.md`)
- Fused impact map → JRC comparison: tests permanent-water mask (evidence: `code/evaluation/compare_jrc.py`)
- Copernicus EMS reference → JRC comparison: provides validation reference (evidence: `code/evaluation/compare_jrc.py`)
- Fused impact map → Model contribution check: checks model contribution (evidence: `code/evaluation/model_only_check.py`)
- Optical change layer → Model contribution check: provides optical comparison (evidence: `code/evaluation/model_only_check.py`)
- Copernicus EMS reference → Model contribution check: provides validation reference (evidence: `code/evaluation/model_only_check.py`)
