# supriyo760/bah architecture

> Architecture diagram of the GitHub repository supriyo760/bah, 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/supriyo760/bah
- Repository: https://github.com/supriyo760/bah

## Overview

KAVACH is a GEO radiation-monitoring product that forecasts energetic-electron flux and communicates operational risk. Its serving workflow accepts forecast inputs through the API, classifies the geomagnetic regime, computes physics and model forecasts, fuses them into risk results, and exposes storm replays. The repository also includes operator-dashboard and NOAA telemetry capabilities, plus historical-data preparation, model training, evaluation, and satellite-specific fine-tuning. The README is empty; connections for unsampled subsystems are omitted unless the source index or excerpts support them.

Main entry points: [`kavach/api/main.py`](https://github.com/supriyo760/bah/blob/main/kavach/api/main.py) (Forecast API), [`kavach/dashboard/app.py`](https://github.com/supriyo760/bah/blob/main/kavach/dashboard/app.py) (Operator Dashboard), [`kavach/models/tft_model.py`](https://github.com/supriyo760/bah/blob/main/kavach/models/tft_model.py) (Temporal Fusion Model), [`kavach/models/radial_diff.py`](https://github.com/supriyo760/bah/blob/main/kavach/models/radial_diff.py) (Radial Diffusion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Forecast Serving"]
  node_api["Forecast API<br/>[main.py]"]
  node_dashboard["Operator Dashboard<br/>[app.py]"]
  node_alerts["Alert Dispatch<br/>[alert_dispatch.py]"]
end

subgraph group_data["Telemetry Data"]
  node_noaa["NOAA Live Ingest<br/>[noaa_ingest.py]"]
  node_sample["Storm Replay Data<br/>[sample_data.py]"]
  node_features["Feature Engineering<br/>[features.py]"]
  node_clean["Data Cleaning<br/>[clean.py]"]
  node_archive["Historical Archive"]
  node_goes["GOES Ingest<br/>[ingest_goes.py]"]
  node_grasp["GRASP Ingest<br/>[ingest_grasp.py]"]
  node_magnetometer["Magnetometer Ingest"]
  node_omni["OMNI Ingest<br/>[ingest_omni.py]"]
end

subgraph group_models["Forecast Models"]
  node_tft["Temporal Fusion Model<br/>[tft_model.py]"]
  node_physics["Radial Diffusion<br/>[radial_diff.py]"]
  node_regime["Regime Classifier<br/>[regime.py]"]
  node_ensemble["Risk Ensemble<br/>[ensemble.py]"]
end

subgraph group_training["Model Development"]
  node_train11["Archive Training"]
  node_traintft["TFT Fine-Tuning<br/>[train_tft.py]"]
  node_transfer["Satellite Transfer"]
  node_calibration["Calibration<br/>[calibration.py]"]
  node_evaluation["Evaluation<br/>[evaluate.py]"]
end

node_operator(("Operator"))

node_operator -->|"submits inputs"| node_api
node_api -->|"classifies regime"| node_regime
node_api -->|"computes forecast"| node_physics
node_api -->|"fuses predictions"| node_ensemble
node_api -->|"lists replays"| node_sample
node_operator -->|"views telemetry"| node_dashboard
node_dashboard -->|"uses live data"| node_noaa
node_dashboard -->|"uses forecast"| node_physics
node_dashboard -->|"uses risk model"| node_ensemble
node_dashboard -->|"uses model"| node_tft
node_sample -->|"engineers features"| node_features
node_train11 -->|"loads archive"| node_archive
node_train11 -->|"trains model"| node_tft
node_train11 -->|"regularizes training"| node_physics
node_traintft -->|"fine-tunes model"| node_tft
node_transfer -->|"adapts model"| node_tft
node_transfer -->|"bootstraps data"| node_archive
node_evaluation -->|"evaluates replays"| node_sample
node_evaluation -->|"evaluates forecasts"| node_physics
node_evaluation -->|"evaluates fusion"| node_ensemble
node_alerts -.->|"dispatches alerts"| node_operator

click node_api "https://github.com/supriyo760/bah/blob/main/kavach/api/main.py"
click node_dashboard "https://github.com/supriyo760/bah/blob/main/kavach/dashboard/app.py"
click node_alerts "https://github.com/supriyo760/bah/blob/main/kavach/serving/alert_dispatch.py"
click node_noaa "https://github.com/supriyo760/bah/blob/main/kavach/data/noaa_ingest.py"
click node_sample "https://github.com/supriyo760/bah/blob/main/kavach/data/sample_data.py"
click node_features "https://github.com/supriyo760/bah/blob/main/kavach/data/features.py"
click node_clean "https://github.com/supriyo760/bah/blob/main/kavach/data/clean.py"
click node_archive "https://github.com/supriyo760/bah/blob/main/kavach/data/download_11yr_archive.py"
click node_goes "https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_goes.py"
click node_grasp "https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_grasp.py"
click node_magnetometer "https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_magnetometer.py"
click node_omni "https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_omni.py"
click node_tft "https://github.com/supriyo760/bah/blob/main/kavach/models/tft_model.py"
click node_physics "https://github.com/supriyo760/bah/blob/main/kavach/models/radial_diff.py"
click node_regime "https://github.com/supriyo760/bah/blob/main/kavach/models/regime.py"
click node_ensemble "https://github.com/supriyo760/bah/blob/main/kavach/models/ensemble.py"
click node_train11 "https://github.com/supriyo760/bah/blob/main/kavach/training/train_11yr_model.py"
click node_traintft "https://github.com/supriyo760/bah/blob/main/kavach/training/train_tft.py"
click node_transfer "https://github.com/supriyo760/bah/blob/main/kavach/training/transfer_learning_gsat19.py"
click node_calibration "https://github.com/supriyo760/bah/blob/main/kavach/training/calibration.py"
click node_evaluation "https://github.com/supriyo760/bah/blob/main/kavach/training/evaluate.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_api,node_dashboard,node_alerts toneBlue
class node_noaa,node_sample,node_features,node_clean,node_archive,node_goes,node_grasp,node_magnetometer,node_omni toneAmber
class node_tft,node_physics,node_regime,node_ensemble toneMint
class node_train11,node_traintft,node_transfer,node_calibration,node_evaluation toneRose
class node_operator toneIndigo
```

## Components

### Forecast Serving

- [Forecast API](https://github.com/supriyo760/bah/blob/main/kavach/api/main.py): `kavach/api/main.py`
- [Operator Dashboard](https://github.com/supriyo760/bah/blob/main/kavach/dashboard/app.py): `kavach/dashboard/app.py`
- [Alert Dispatch](https://github.com/supriyo760/bah/blob/main/kavach/serving/alert_dispatch.py): `kavach/serving/alert_dispatch.py`

### Telemetry Data

- [NOAA Live Ingest](https://github.com/supriyo760/bah/blob/main/kavach/data/noaa_ingest.py): `kavach/data/noaa_ingest.py`
- [Storm Replay Data](https://github.com/supriyo760/bah/blob/main/kavach/data/sample_data.py): `kavach/data/sample_data.py`
- [Feature Engineering](https://github.com/supriyo760/bah/blob/main/kavach/data/features.py): `kavach/data/features.py`
- [Data Cleaning](https://github.com/supriyo760/bah/blob/main/kavach/data/clean.py): `kavach/data/clean.py`
- [Historical Archive](https://github.com/supriyo760/bah/blob/main/kavach/data/download_11yr_archive.py): `kavach/data/download_11yr_archive.py`
- [GOES Ingest](https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_goes.py): `kavach/data/ingest_goes.py`
- [GRASP Ingest](https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_grasp.py): `kavach/data/ingest_grasp.py`
- [Magnetometer Ingest](https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_magnetometer.py): `kavach/data/ingest_magnetometer.py`
- [OMNI Ingest](https://github.com/supriyo760/bah/blob/main/kavach/data/ingest_omni.py): `kavach/data/ingest_omni.py`

### Forecast Models

- [Temporal Fusion Model](https://github.com/supriyo760/bah/blob/main/kavach/models/tft_model.py): `kavach/models/tft_model.py`
- [Radial Diffusion](https://github.com/supriyo760/bah/blob/main/kavach/models/radial_diff.py): `kavach/models/radial_diff.py`
- [Regime Classifier](https://github.com/supriyo760/bah/blob/main/kavach/models/regime.py): `kavach/models/regime.py`
- [Risk Ensemble](https://github.com/supriyo760/bah/blob/main/kavach/models/ensemble.py): `kavach/models/ensemble.py`

### Model Development

- [Archive Training](https://github.com/supriyo760/bah/blob/main/kavach/training/train_11yr_model.py): `kavach/training/train_11yr_model.py`
- [TFT Fine-Tuning](https://github.com/supriyo760/bah/blob/main/kavach/training/train_tft.py): `kavach/training/train_tft.py`
- [Satellite Transfer](https://github.com/supriyo760/bah/blob/main/kavach/training/transfer_learning_gsat19.py): `kavach/training/transfer_learning_gsat19.py`
- [Calibration](https://github.com/supriyo760/bah/blob/main/kavach/training/calibration.py): `kavach/training/calibration.py`
- [Evaluation](https://github.com/supriyo760/bah/blob/main/kavach/training/evaluate.py): `kavach/training/evaluate.py`

### Other components

- **Operator**

## Connections

- Operator → Forecast API: submits inputs (evidence: `kavach/api/main.py`)
- Forecast API → Regime Classifier: classifies regime (evidence: `kavach/api/main.py`)
- Forecast API → Radial Diffusion: computes forecast (evidence: `kavach/api/main.py`)
- Forecast API → Risk Ensemble: fuses predictions (evidence: `kavach/api/main.py`)
- Forecast API → Storm Replay Data: lists replays (evidence: `kavach/api/main.py`)
- Operator → Operator Dashboard: views telemetry (evidence: `kavach/dashboard/app.py`)
- Operator Dashboard → NOAA Live Ingest: uses live data (evidence: `kavach/dashboard/app.py`)
- Operator Dashboard → Radial Diffusion: uses forecast (evidence: `kavach/dashboard/app.py`)
- Operator Dashboard → Risk Ensemble: uses risk model (evidence: `kavach/dashboard/app.py`)
- Operator Dashboard → Temporal Fusion Model: uses model (evidence: `kavach/dashboard/app.py`)
- Storm Replay Data → Feature Engineering: engineers features (evidence: `kavach/data/sample_data.py`)
- Archive Training → Historical Archive: loads archive (evidence: `kavach/training/train_11yr_model.py`)
- Archive Training → Temporal Fusion Model: trains model (evidence: `kavach/training/train_11yr_model.py`)
- Archive Training → Radial Diffusion: regularizes training (evidence: `kavach/training/train_11yr_model.py`)
- TFT Fine-Tuning → Temporal Fusion Model: fine-tunes model (evidence: `kavach/training/train_tft.py`)
- Satellite Transfer → Temporal Fusion Model: adapts model (evidence: `kavach/training/transfer_learning_gsat19.py`)
- Satellite Transfer → Historical Archive: bootstraps data (evidence: `kavach/training/transfer_learning_gsat19.py`)
- Evaluation → Storm Replay Data: evaluates replays (evidence: `kavach/training/evaluate.py`)
- Evaluation → Radial Diffusion: evaluates forecasts (evidence: `kavach/training/evaluate.py`)
- Evaluation → Risk Ensemble: evaluates fusion (evidence: `kavach/training/evaluate.py`)
- Alert Dispatch → Operator: dispatches alerts
