# shivamgawade-xs/sih26080 architecture

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

- Interactive diagram: https://gitdiagram.com/shivamgawade-xs/sih26080
- Repository: https://github.com/shivamgawade-xs/sih26080

## Overview

Varsha turns synthetic or real monsoon data into regime-conditioned rainfall forecasts, district decision products and scientific verification. The CLI coordinates dataset creation, model fitting and bundle compilation; the bundle is then served by FastAPI to a React console with map, district, regime, method and verification views. README documents the GFS/IMD data mode, model ladder, alerts and verification capabilities. Several subsystem links are omitted because the relevant runtime calls were not excerpted; the graph shows only evidenced relationships.

Main entry points: [`src/varsha/cli.py`](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/cli.py) (Pipeline CLI), [`web/src/App.tsx`](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/App.tsx) (Console application), [`web/src/lib/api.ts`](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/lib/api.ts) (API client), [`web/src/routes/Console.tsx`](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Console.tsx) (Forecast console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and regimes"]
  node_config["Run configuration<br/>[config.py]"]
  node_synthetic["Synthetic dataset<br/>[generator.py]"]
  node_connectors["GFS / IMD inputs"]
  node_alignment["Dataset alignment<br/>[align.py]"]
  node_boundaries["District boundaries<br/>[boundaries.py]"]
  node_predictors["Circulation predictors<br/>[predictors.py]"]
  node_regimes["Regime classification<br/>[classifier.py]"]
end

subgraph group_forecast["Forecast modeling"]
  node_registry["Feature registry<br/>[registry.py]"]
  node_ladder["B0–B4 model ladder<br/>[b4_regime_gbm.py]"]
  node_heavy["Heavy-rain probabilities<br/>[heavy_rain.py]"]
  node_calibration["Probability calibration<br/>[calibration.py]"]
end

subgraph group_products["Decision products"]
  node_cli["Pipeline CLI<br/>[cli.py]"]
  node_districts["District aggregation<br/>[districts.py]"]
  node_alerts["Indicative alerts<br/>[alerts.py]"]
  node_explain["Forecast explanations<br/>[explain.py]"]
  node_bundle["Run bundle compiler<br/>[bundle.py]"]
  node_api["Forecast API<br/>[app.py]"]
end

subgraph group_verify["Scientific verification"]
  node_metrics["Verification metrics<br/>[metrics.py]"]
  node_controls["Scientific controls<br/>[controls.py]"]
  node_verification["Verification reports<br/>[generator.py]"]
end

subgraph group_web["Web console"]
  node_app["Console application<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_console["Forecast console<br/>[Console.tsx]"]
  node_map["Forecast map<br/>[MapComponent.tsx]"]
  node_inspector["District inspector"]
  node_brief["District brief<br/>[DistrictBrief.tsx]"]
  node_regime_view["Regime view<br/>[Regimes.tsx]"]
  node_method["Methods view<br/>[Method.tsx]"]
  node_verification_view["Verification view<br/>[Verification.tsx]"]
  node_honesty["Provenance panel<br/>[HonestyPanel.tsx]"]
end

node_operator(("Forecaster"))

node_operator -.->|"runs pipeline"| node_cli
node_cli -->|"loads settings"| node_config
node_cli -->|"generates data"| node_synthetic
node_connectors -.->|"supplies forecasts"| node_alignment
node_cli -->|"fits classifier"| node_regimes
node_regimes -->|"uses predictors"| node_predictors
node_cli -->|"fits models"| node_ladder
node_ladder -->|"uses features"| node_registry
node_cli -->|"fits probabilities"| node_heavy
node_heavy -->|"uses calibration"| node_calibration
node_cli -->|"runs controls"| node_controls
node_controls -->|"computes scores"| node_metrics
node_cli -->|"computes verification"| node_metrics
node_cli -->|"generates report"| node_verification
node_cli -->|"compiles outputs"| node_bundle
node_bundle -->|"aggregates forecasts"| node_districts
node_districts -->|"uses boundaries"| node_boundaries
node_districts -->|"assigns alerts"| node_alerts
node_bundle -.->|"serves artifacts"| node_api
node_operator -.->|"opens console"| node_app
node_app -->|"fetches metadata"| node_api_client
node_app -->|"routes to"| node_console
node_app -->|"routes to"| node_brief
node_app -->|"routes to"| node_regime_view
node_app -->|"routes to"| node_method
node_app -->|"routes to"| node_verification_view
node_console -->|"requests forecasts"| node_api_client
node_console -->|"renders map"| node_map
node_console -->|"renders inspector"| node_inspector
node_brief -->|"requests detail"| node_api_client
node_verification_view -->|"requests scores"| node_api_client
node_verification_view -->|"renders provenance"| node_honesty
node_api_client -->|"calls HTTP API"| node_api

click node_cli "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/cli.py"
click node_config "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/config.py"
click node_synthetic "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/synthetic/generator.py"
click node_connectors "https://github.com/shivamgawade-xs/sih26080/tree/main/src/varsha/data/connectors"
click node_alignment "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/align.py"
click node_boundaries "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/boundaries.py"
click node_predictors "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/features/predictors.py"
click node_regimes "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/regimes/classifier.py"
click node_registry "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/features/registry.py"
click node_ladder "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/b4_regime_gbm.py"
click node_heavy "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/heavy_rain.py"
click node_calibration "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/calibration.py"
click node_districts "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/districts.py"
click node_alerts "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/alerts.py"
click node_explain "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/explain.py"
click node_bundle "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/bundle.py"
click node_metrics "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/metrics.py"
click node_controls "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/controls.py"
click node_verification "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/report/generator.py"
click node_api "https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/api/app.py"
click node_app "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/App.tsx"
click node_api_client "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/lib/api.ts"
click node_console "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Console.tsx"
click node_map "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/MapComponent.tsx"
click node_inspector "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/DistrictInspector.tsx"
click node_brief "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/DistrictBrief.tsx"
click node_regime_view "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Regimes.tsx"
click node_method "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Method.tsx"
click node_verification_view "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Verification.tsx"
click node_honesty "https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/HonestyPanel.tsx"

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_config,node_synthetic,node_connectors,node_alignment,node_boundaries,node_predictors,node_regimes toneBlue
class node_registry,node_ladder,node_heavy,node_calibration toneAmber
class node_cli,node_districts,node_alerts,node_explain,node_bundle,node_api toneMint
class node_metrics,node_controls,node_verification toneRose
class node_app,node_api_client,node_console,node_map,node_inspector,node_brief,node_regime_view,node_method,node_verification_view,node_honesty,node_operator toneIndigo
```

## Components

### Data and regimes

- [Run configuration](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/config.py): `src/varsha/config.py`
- [Synthetic dataset](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/synthetic/generator.py): `src/varsha/data/synthetic/generator.py`
- [GFS / IMD inputs](https://github.com/shivamgawade-xs/sih26080/tree/main/src/varsha/data/connectors): `src/varsha/data/connectors`
- [Dataset alignment](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/align.py): `src/varsha/data/align.py`
- [District boundaries](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/data/boundaries.py): `src/varsha/data/boundaries.py`
- [Circulation predictors](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/features/predictors.py): `src/varsha/features/predictors.py`
- [Regime classification](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/regimes/classifier.py): `src/varsha/regimes/classifier.py`

### Forecast modeling

- [Feature registry](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/features/registry.py): `src/varsha/features/registry.py`
- [B0–B4 model ladder](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/b4_regime_gbm.py): `src/varsha/models/b4_regime_gbm.py`
- [Heavy-rain probabilities](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/heavy_rain.py): `src/varsha/models/heavy_rain.py`
- [Probability calibration](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/models/calibration.py): `src/varsha/models/calibration.py`

### Decision products

- [Pipeline CLI](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/cli.py): `src/varsha/cli.py`
- [District aggregation](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/districts.py): `src/varsha/product/districts.py`
- [Indicative alerts](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/alerts.py): `src/varsha/product/alerts.py`
- [Forecast explanations](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/explain.py): `src/varsha/product/explain.py`
- [Run bundle compiler](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/product/bundle.py): `src/varsha/product/bundle.py`
- [Forecast API](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/api/app.py): `src/varsha/api/app.py`

### Scientific verification

- [Verification metrics](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/metrics.py): `src/varsha/verify/metrics.py`
- [Scientific controls](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/controls.py): `src/varsha/verify/controls.py`
- [Verification reports](https://github.com/shivamgawade-xs/sih26080/blob/main/src/varsha/verify/report/generator.py): `src/varsha/verify/report/generator.py`

### Web console

- [Console application](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [API client](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- [Forecast console](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Console.tsx): `web/src/routes/Console.tsx`
- [Forecast map](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/MapComponent.tsx): `web/src/components/MapComponent.tsx`
- [District inspector](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/DistrictInspector.tsx): `web/src/components/DistrictInspector.tsx`
- [District brief](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/DistrictBrief.tsx): `web/src/routes/DistrictBrief.tsx`
- [Regime view](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Regimes.tsx): `web/src/routes/Regimes.tsx`
- [Methods view](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Method.tsx): `web/src/routes/Method.tsx`
- [Verification view](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/routes/Verification.tsx): `web/src/routes/Verification.tsx`
- [Provenance panel](https://github.com/shivamgawade-xs/sih26080/blob/main/web/src/components/HonestyPanel.tsx): `web/src/components/HonestyPanel.tsx`

### Other components

- **Forecaster**

## Connections

- Forecaster → Pipeline CLI: runs pipeline
- Pipeline CLI → Run configuration: loads settings (evidence: `src/varsha/cli.py`)
- Pipeline CLI → Synthetic dataset: generates data (evidence: `src/varsha/cli.py`)
- GFS / IMD inputs → Dataset alignment: supplies forecasts
- Pipeline CLI → Regime classification: fits classifier (evidence: `src/varsha/cli.py`)
- Regime classification → Circulation predictors: uses predictors (evidence: `src/varsha/regimes/classifier.py`)
- Pipeline CLI → B0–B4 model ladder: fits models (evidence: `src/varsha/cli.py`)
- B0–B4 model ladder → Feature registry: uses features (evidence: `src/varsha/models/b4_regime_gbm.py`)
- Pipeline CLI → Heavy-rain probabilities: fits probabilities (evidence: `src/varsha/cli.py`)
- Heavy-rain probabilities → Probability calibration: uses calibration (evidence: `src/varsha/models/heavy_rain.py`)
- Pipeline CLI → Scientific controls: runs controls (evidence: `src/varsha/cli.py`)
- Scientific controls → Verification metrics: computes scores (evidence: `src/varsha/verify/controls.py`)
- Pipeline CLI → Verification metrics: computes verification (evidence: `src/varsha/cli.py`)
- Pipeline CLI → Verification reports: generates report (evidence: `src/varsha/cli.py`)
- Pipeline CLI → Run bundle compiler: compiles outputs (evidence: `src/varsha/cli.py`)
- Run bundle compiler → District aggregation: aggregates forecasts (evidence: `src/varsha/product/bundle.py`)
- District aggregation → District boundaries: uses boundaries (evidence: `src/varsha/product/districts.py`)
- District aggregation → Indicative alerts: assigns alerts (evidence: `src/varsha/product/districts.py`)
- Run bundle compiler → Forecast API: serves artifacts
- Forecaster → Console application: opens console
- Console application → API client: fetches metadata (evidence: `web/src/App.tsx`)
- Console application → Forecast console: routes to (evidence: `web/src/App.tsx`)
- Console application → District brief: routes to (evidence: `web/src/App.tsx`)
- Console application → Regime view: routes to (evidence: `web/src/App.tsx`)
- Console application → Methods view: routes to (evidence: `web/src/App.tsx`)
- Console application → Verification view: routes to (evidence: `web/src/App.tsx`)
- Forecast console → API client: requests forecasts (evidence: `web/src/routes/Console.tsx`)
- Forecast console → Forecast map: renders map (evidence: `web/src/routes/Console.tsx`)
- Forecast console → District inspector: renders inspector (evidence: `web/src/routes/Console.tsx`)
- District brief → API client: requests detail (evidence: `web/src/routes/DistrictBrief.tsx`)
- Verification view → API client: requests scores (evidence: `web/src/routes/Verification.tsx`)
- Verification view → Provenance panel: renders provenance (evidence: `web/src/routes/Verification.tsx`)
- API client → Forecast API: calls HTTP API (evidence: `web/src/lib/api.ts`)
