# cznmr/sih-162 architecture

> Architecture diagram of the GitHub repository cznmr/sih-162, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cznmr/sih-162
- Repository: https://github.com/cznmr/sih-162

## Overview

ENTRO-26162 is a geospatial thermal-event intelligence prototype for Telangana. Its development workflow combines historical FIRMS detections with persistence, spatial behavior, OSM infrastructure, land-cover, and forest context; builds features and conservative seed labels; then trains a Random Forest. At runtime, the Streamlit app fetches current FIRMS detections, classifies candidates with confidence, and presents them on an interactive map. The README documents these capabilities; some implementation wiring is therefore represented from that documentation rather than sampled source.

Main entry points: [`src/build_feature_table.py`](https://github.com/cznmr/sih-162/blob/main/src/build_feature_table.py) (Master feature table), [`src/historical_loader.py`](https://github.com/cznmr/sih-162/blob/main/src/historical_loader.py) (Historical detections), [`src/build_ml_dataset.py`](https://github.com/cznmr/sih-162/blob/main/src/build_ml_dataset.py) (ML dataset), [`src/seed_labeling_v2.py`](https://github.com/cznmr/sih-162/blob/main/src/seed_labeling_v2.py) (Seed labels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Data sources"]
  node_historic["Historical detections"]
end

subgraph group_enrichment["Spatial enrichment"]
  node_temporal["Persistence features"]
  node_spatial["Spatial behavior"]
  node_osmfeatures["OSM context"]
  node_landcover["Land-cover context"]
  node_forestcontext["Forest context"]
end

subgraph group_modeling["Feature and model development"]
  node_featuretable["Master feature table"]
  node_dataset["ML dataset"]
  node_labels["Seed labels"]
  node_trainer["Random Forest training"]
  node_model["Classifier bundle"]
end

subgraph group_runtime["Live detection"]
  node_livefetch["Live FIRMS fetch<br/>[app.py]"]
  node_predict["Candidate classification<br/>[app.py]"]
  node_dashboard["Interactive dashboard<br/>[app.py]"]
end

subgraph group_insight["Analysis and review"]
  node_districts["District assignment"]
  node_analysis["Evidence analysis"]
end

node_analyst(("Analyst"))
node_firms{{"NASA FIRMS"}}
node_osm{{"OpenStreetMap"}}
node_dynamicworld{{"Dynamic World"}}
node_forestdata["Forest boundaries"]

node_firms -->|"supplies history"| node_historic
node_firms -->|"provides detections"| node_livefetch
node_historic -->|"feeds detections"| node_temporal
node_historic -->|"feeds detections"| node_spatial
node_osm -->|"provides infrastructure"| node_osmfeatures
node_dynamicworld -->|"provides land cover"| node_landcover
node_forestdata -->|"provides boundaries"| node_forestcontext
node_temporal -->|"adds features"| node_featuretable
node_spatial -->|"adds features"| node_featuretable
node_osmfeatures -->|"adds context"| node_featuretable
node_landcover -->|"adds context"| node_featuretable
node_forestcontext -->|"adds context"| node_featuretable
node_featuretable -->|"contributes features"| node_dataset
node_dataset -->|"provides evidence"| node_labels
node_dataset -->|"provides training data"| node_trainer
node_labels -->|"provides labels"| node_trainer
node_trainer -->|"produces model"| node_model
node_livefetch -->|"passes detections"| node_predict
node_predict -->|"loads model"| node_model
node_predict -->|"displays predictions"| node_dashboard
node_analyst -->|"views results"| node_dashboard
node_featuretable -->|"provides locations"| node_districts
node_labels -->|"provides labels"| node_districts
node_districts -->|"summarizes districts"| node_analysis

click node_historic "https://github.com/cznmr/sih-162/blob/main/src/historical_loader.py"
click node_livefetch "https://github.com/cznmr/sih-162/blob/main/app.py"
click node_temporal "https://github.com/cznmr/sih-162/blob/main/src/persistence_analysis.py"
click node_spatial "https://github.com/cznmr/sih-162/blob/main/src/spatial_fire_behavior.py"
click node_osmfeatures "https://github.com/cznmr/sih-162/blob/main/src/feature_engineering.py"
click node_landcover "https://github.com/cznmr/sih-162/blob/main/src/merge_dynamic_world.py"
click node_forestcontext "https://github.com/cznmr/sih-162/blob/main/src/forest_location_evidence.py"
click node_featuretable "https://github.com/cznmr/sih-162/blob/main/src/build_feature_table.py"
click node_dataset "https://github.com/cznmr/sih-162/blob/main/src/build_ml_dataset.py"
click node_labels "https://github.com/cznmr/sih-162/blob/main/src/seed_labeling_v2.py"
click node_trainer "https://github.com/cznmr/sih-162/blob/main/src/train_classifier_v2.py"
click node_predict "https://github.com/cznmr/sih-162/blob/main/app.py"
click node_dashboard "https://github.com/cznmr/sih-162/blob/main/app.py"
click node_districts "https://github.com/cznmr/sih-162/blob/main/src/unknown_by_district.py"
click node_analysis "https://github.com/cznmr/sih-162/blob/main/src/district_evidence_analysis.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_historic toneBlue
class node_temporal,node_spatial,node_osmfeatures,node_landcover,node_forestcontext toneAmber
class node_featuretable,node_dataset,node_labels,node_trainer,node_model toneMint
class node_livefetch,node_predict,node_dashboard toneRose
class node_districts,node_analysis,node_analyst,node_firms,node_osm,node_dynamicworld,node_forestdata toneIndigo
```

## Components

### Data sources

- [Historical detections](https://github.com/cznmr/sih-162/blob/main/src/historical_loader.py): `src/historical_loader.py`

### Spatial enrichment

- [Persistence features](https://github.com/cznmr/sih-162/blob/main/src/persistence_analysis.py): `src/persistence_analysis.py`
- [Spatial behavior](https://github.com/cznmr/sih-162/blob/main/src/spatial_fire_behavior.py): `src/spatial_fire_behavior.py`
- [OSM context](https://github.com/cznmr/sih-162/blob/main/src/feature_engineering.py): `src/feature_engineering.py`
- [Land-cover context](https://github.com/cznmr/sih-162/blob/main/src/merge_dynamic_world.py): `src/merge_dynamic_world.py`
- [Forest context](https://github.com/cznmr/sih-162/blob/main/src/forest_location_evidence.py): `src/forest_location_evidence.py`

### Feature and model development

- [Master feature table](https://github.com/cznmr/sih-162/blob/main/src/build_feature_table.py): `src/build_feature_table.py`
- [ML dataset](https://github.com/cznmr/sih-162/blob/main/src/build_ml_dataset.py): `src/build_ml_dataset.py`
- [Seed labels](https://github.com/cznmr/sih-162/blob/main/src/seed_labeling_v2.py): `src/seed_labeling_v2.py`
- [Random Forest training](https://github.com/cznmr/sih-162/blob/main/src/train_classifier_v2.py): `src/train_classifier_v2.py`
- **Classifier bundle**

### Live detection

- [Live FIRMS fetch](https://github.com/cznmr/sih-162/blob/main/app.py): `app.py`
- [Candidate classification](https://github.com/cznmr/sih-162/blob/main/app.py): `app.py`
- [Interactive dashboard](https://github.com/cznmr/sih-162/blob/main/app.py): `app.py`

### Analysis and review

- [District assignment](https://github.com/cznmr/sih-162/blob/main/src/unknown_by_district.py): `src/unknown_by_district.py`
- [Evidence analysis](https://github.com/cznmr/sih-162/blob/main/src/district_evidence_analysis.py): `src/district_evidence_analysis.py`

### Other components

- **Analyst**
- **NASA FIRMS**
- **OpenStreetMap**
- **Dynamic World**
- **Forest boundaries**

## Connections

- NASA FIRMS → Historical detections: supplies history
- NASA FIRMS → Live FIRMS fetch: provides detections
- Historical detections → Persistence features: feeds detections
- Historical detections → Spatial behavior: feeds detections
- OpenStreetMap → OSM context: provides infrastructure
- Dynamic World → Land-cover context: provides land cover
- Forest boundaries → Forest context: provides boundaries
- Persistence features → Master feature table: adds features
- Spatial behavior → Master feature table: adds features
- OSM context → Master feature table: adds context
- Land-cover context → Master feature table: adds context
- Forest context → Master feature table: adds context
- Master feature table → ML dataset: contributes features
- ML dataset → Seed labels: provides evidence
- ML dataset → Random Forest training: provides training data
- Seed labels → Random Forest training: provides labels
- Random Forest training → Classifier bundle: produces model
- Live FIRMS fetch → Candidate classification: passes detections
- Candidate classification → Classifier bundle: loads model
- Candidate classification → Interactive dashboard: displays predictions
- Analyst → Interactive dashboard: views results
- Master feature table → District assignment: provides locations
- Seed labels → District assignment: provides labels
- District assignment → Evidence analysis: summarizes districts
