# himanshu-genai/2nd-year-mini-project architecture

> Architecture diagram of the GitHub repository himanshu-genai/2nd-year-mini-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/himanshu-genai/2nd-year-mini-project
- Repository: https://github.com/himanshu-genai/2nd-year-mini-project

## Overview

This is a wildfire hazard forecasting system: fire detections and weather observations are mapped to spatial cells, enriched with drought and time-safe features, then used to train and serve calibrated risk forecasts. Users receive forecasts through an API or an interactive dashboard, with explanations and operational briefings as supporting capabilities. The README documents the overall workflow; source excerpts and the SOURCE INDEX confirm selected calls and imports. Some implementation details, especially unsampled training and dashboard paths, are not verified beyond that documentation.

Main entry points: [`src/features/build_features.py`](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/features/build_features.py) (Feature builder), [`src/dashboard/app.py`](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/dashboard/app.py) (Risk dashboard), [`src/api/main.py`](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/api/main.py) (Inference API), [`src/data/firms_ingest.py`](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/firms_ingest.py) (FIRMS ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and drought"]
  node_firms["FIRMS ingestion<br/>[firms_ingest.py]"]
  node_weather["Weather retrieval<br/>[weather_fetch.py]"]
  node_grid["Spatial grid<br/>[grid.py]"]
  node_kbdi["KBDI drought<br/>[kbdi.py]"]
  node_raw[("Raw data")]
  node_processed[("Processed data")]
end

subgraph group_features["Feature engineering"]
  node_featurebuild["Feature builder<br/>[build_features.py]"]
  node_labels["Forecast labels<br/>[labels.py]"]
  node_config["System configuration<br/>[config.py]"]
end

subgraph group_models["Modeling"]
  node_baselines["Baseline models<br/>[baselines.py]"]
  node_training["Model training<br/>[train.py]"]
  node_calibration["Probability calibration<br/>[calibrate.py]"]
end

subgraph group_serving["Forecast delivery"]
  node_api["Inference API<br/>[main.py]"]
  node_dashboard["Risk dashboard<br/>[app.py]"]
end

subgraph group_insight["Risk insights"]
  node_shap["SHAP explanations<br/>[shap_utils.py]"]
  node_reports["Intelligence reports<br/>[llm_report.py]"]
end

node_operator(("Forecast user"))
node_openmeteo["Open-Meteo"]
node_nasa["NASA FIRMS archive"]

node_nasa -->|"provides detections"| node_firms
node_firms -->|"reads archives"| node_raw
node_firms -->|"maps coordinates"| node_grid
node_openmeteo -->|"provides observations"| node_weather
node_weather -->|"caches weather"| node_raw
node_featurebuild -->|"uses fire data"| node_firms
node_featurebuild -->|"uses weather data"| node_weather
node_featurebuild -->|"uses drought index"| node_kbdi
node_featurebuild -->|"uses neighbors"| node_grid
node_featurebuild -->|"builds targets"| node_labels
node_featurebuild -->|"saves features"| node_processed
node_training -->|"trains on features"| node_processed
node_training -->|"benchmarks against"| node_baselines
node_training -->|"calibrates probabilities"| node_calibration
node_operator -->|"requests forecasts"| node_api
node_operator -->|"views forecasts"| node_dashboard
node_api -->|"maps coordinates"| node_grid
node_api -->|"uses calibrated model"| node_calibration
node_api -->|"requests explanations"| node_shap
node_dashboard -->|"generates mesh"| node_grid
node_dashboard -->|"classifies drought"| node_kbdi
node_dashboard -->|"generates briefing"| node_reports
node_dashboard -->|"shows attributions"| node_shap

click node_firms "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/firms_ingest.py"
click node_weather "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/weather_fetch.py"
click node_grid "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/grid.py"
click node_kbdi "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/kbdi.py"
click node_raw "https://github.com/himanshu-genai/2nd-year-mini-project/tree/main/data/raw"
click node_processed "https://github.com/himanshu-genai/2nd-year-mini-project/tree/main/data/processed"
click node_featurebuild "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/features/build_features.py"
click node_labels "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/features/labels.py"
click node_config "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/config.py"
click node_baselines "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/baselines.py"
click node_training "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/train.py"
click node_calibration "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/calibrate.py"
click node_api "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/api/main.py"
click node_dashboard "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/dashboard/app.py"
click node_shap "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/explain/shap_utils.py"
click node_reports "https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/reports/llm_report.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_firms,node_weather,node_grid,node_kbdi,node_raw,node_processed,node_operator toneBlue
class node_featurebuild,node_labels,node_config toneAmber
class node_baselines,node_training,node_calibration toneMint
class node_api,node_dashboard toneRose
class node_shap,node_reports,node_openmeteo,node_nasa toneIndigo
```

## Components

### Data and drought

- [FIRMS ingestion](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/firms_ingest.py): `src/data/firms_ingest.py`
- [Weather retrieval](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/weather_fetch.py): `src/data/weather_fetch.py`
- [Spatial grid](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/grid.py): `src/data/grid.py`
- [KBDI drought](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/data/kbdi.py): `src/data/kbdi.py`
- [Raw data](https://github.com/himanshu-genai/2nd-year-mini-project/tree/main/data/raw): `data/raw`
- [Processed data](https://github.com/himanshu-genai/2nd-year-mini-project/tree/main/data/processed): `data/processed`

### Feature engineering

- [Feature builder](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/features/build_features.py): `src/features/build_features.py`
- [Forecast labels](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/features/labels.py): `src/features/labels.py`
- [System configuration](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/config.py): `src/config.py`

### Modeling

- [Baseline models](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/baselines.py): `src/models/baselines.py`
- [Model training](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/train.py): `src/models/train.py`
- [Probability calibration](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/models/calibrate.py): `src/models/calibrate.py`

### Forecast delivery

- [Inference API](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/api/main.py): `src/api/main.py`
- [Risk dashboard](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/dashboard/app.py): `src/dashboard/app.py`

### Risk insights

- [SHAP explanations](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/explain/shap_utils.py): `src/explain/shap_utils.py`
- [Intelligence reports](https://github.com/himanshu-genai/2nd-year-mini-project/blob/main/src/reports/llm_report.py): `src/reports/llm_report.py`

### Other components

- **Forecast user**
- **Open-Meteo**
- **NASA FIRMS archive**

## Connections

- NASA FIRMS archive → FIRMS ingestion: provides detections (evidence: `README.md`)
- FIRMS ingestion → Raw data: reads archives (evidence: `src/data/firms_ingest.py`)
- FIRMS ingestion → Spatial grid: maps coordinates (evidence: `src/data/firms_ingest.py`)
- Open-Meteo → Weather retrieval: provides observations (evidence: `README.md`)
- Weather retrieval → Raw data: caches weather (evidence: `src/data/weather_fetch.py`)
- Feature builder → FIRMS ingestion: uses fire data (evidence: `src/features/build_features.py`)
- Feature builder → Weather retrieval: uses weather data (evidence: `src/features/build_features.py`)
- Feature builder → KBDI drought: uses drought index (evidence: `src/features/build_features.py`)
- Feature builder → Spatial grid: uses neighbors (evidence: `src/features/build_features.py`)
- Feature builder → Forecast labels: builds targets (evidence: `src/features/build_features.py`)
- Feature builder → Processed data: saves features (evidence: `README.md`)
- Model training → Processed data: trains on features (evidence: `README.md`)
- Model training → Baseline models: benchmarks against (evidence: `src/models/train.py`)
- Model training → Probability calibration: calibrates probabilities (evidence: `src/models/train.py`)
- Forecast user → Inference API: requests forecasts (evidence: `README.md`)
- Forecast user → Risk dashboard: views forecasts (evidence: `README.md`)
- Inference API → Spatial grid: maps coordinates (evidence: `src/api/main.py`)
- Inference API → Probability calibration: uses calibrated model (evidence: `src/api/main.py`)
- Inference API → SHAP explanations: requests explanations (evidence: `src/api/main.py`)
- Risk dashboard → Spatial grid: generates mesh (evidence: `src/dashboard/app.py`)
- Risk dashboard → KBDI drought: classifies drought (evidence: `src/dashboard/app.py`)
- Risk dashboard → Intelligence reports: generates briefing (evidence: `src/dashboard/app.py`)
- Risk dashboard → SHAP explanations: shows attributions (evidence: `README.md`)
