# quantum-ark/isro-hackathon architecture

> Architecture diagram of the GitHub repository quantum-ark/isro-hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quantum-ark/isro-hackathon
- Repository: https://github.com/quantum-ark/isro-hackathon

## Overview

#### 1. Purpose and entry points
HELIOS-CORTEX is a solar-flare intelligence system that fuses Aditya-L1 HEL1OS hard-X-ray and SoLEXS soft-X-ray telemetry for real-time nowcasting, short-horizon forecasting, alerts, and India-specific impact presentation.

Primary runtime entry points:
- FastAPI service: `api/main.py`, launched as `uvicorn api.main:app`.
- React/Vite operator dashboard: `frontend/src/main.jsx` → `frontend/src/App.jsx`.
- Pipeline orchestration: `pipeline/run.py`.
- Model-training entry points: `scripts/train_models.py`, `scripts/train_real.py`, `scripts/train_with_pytorch.py`.

#### 2. Telemetry acquisition and data boundary
The data layer accepts/pulls instrument telemetry, then standardizes it before inference. The repository includes cached raw JSON samples for each instrument:
- `pipeline/ingestion.py`
- `data/raw/helios/helios_20240915_level1.json`
- `data/raw/solexs/solexs_20240915_level2.json`

This is the key external-data boundary: production use expects satellite-derived Aditya-L1 feeds, while development can operate from repository data. Training also references external NOAA GOES data according to the project description.

#### 3. Fusion and feature engineering
Feature extraction combines the thermal soft-X-ray and non-thermal hard-X-ray streams, including their temporal relationship (Neupert-effect rationale), flux trends, spectral hardness, and adaptive anomaly signals:
- `pipeline/features.py`
- `pipeline/aggregator.py`
- `pipeline/ingestion.py`

The aggregator is the synchronization/fusion boundary between independently sourced telemetry and downstream ML inputs. Feature outputs should remain the shared contract for both inference stages.

#### 4. Cascaded inference and model artifacts
Inference is intentionally split into two specialized stages:
- Nowcasting detects an imminent/current flare from a short observation window: `pipeline/nowcast.py`, with artifact `models/nowcast_cnn_weights.json`.
- Forecasting estimates future flare probability/lead time from longer temporal context: `pipeline/forecast.py`, with artifact `models/forecast_tcn_weights.json`.

`pipeline/run.py` is the control-flow coordinator: ingest → aggregate/features → nowcast → forecast → combined operational result. The cascade separates immediate detection from temporal prediction rather than exposing a single opaque model.

#### 5. API, update path, and live delivery
The FastAPI backend owns the externally consumable operational interface:
- REST routes and application wiring: `api/main.py`
- Shared response/domain schemas: `api/models.py`
- WebSocket live stream: `api/ws.py`

REST supports status, time series, alerts, catalog, impact, explainability, metrics, and inbound telemetry update operations. A telemetry update should trigger or feed pipeline evaluation; results are then surfaced through REST snapshots and `/ws/live` for push-style dashboard updates. The API is the boundary isolating ML/pipeline internals from UI clients.

#### 6. Dashboard and operator-facing views
The frontend is a React 18 SPA built with Vite. It consumes the API/live feed and organizes the result into mission-control, alert, historical/replay, explanatory, and impact workflows:
- Application composition: `frontend/src/App.jsx`
- Dashboard/telemetry visualization: `frontend/src/components/Dashboard.jsx`, `frontend/src/components/FluxChart.jsx`
- Alert and risk presentation: `frontend/src/components/AlertList.jsx`, `frontend/src/components/ImpactPanel.jsx`, `frontend/src/components/IndiaImpactMap.jsx`
- Local/demo data boundary: `frontend/src/lib/data.js`

The UI remains distinct from inference: it visualizes API contracts, including explainability and regional risk, rather than embedding model logic.

#### 7. Training, evaluation, and deployment
Model lifecycle code is separated from serving:
- Automated retraining flow: `pipeline/auto_train.py`
- Backtesting: `scripts/backtest.py`
- Data extraction/mock generation: `scripts/extract_al1_data.py`, `scripts/generate_mock_fits.py`

Material runtimes are Python 3.10+/FastAPI/PyTorch for ingestion, ML, and API delivery, plus Node.js 18+/React/Vite for the dashboard. Dependency installation is rooted in `requirements.txt` and `frontend/package.json`. Deployment automation is defined in `.github/workflows/deploy.yml`; the frontend includes static-hosting/PWA artifacts in `frontend/public/sw.js` and `frontend/public/.nojekyll`.

Main entry points: [`pipeline/run.py`](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/run.py) (Pipeline coordinator), [`api/main.py`](https://github.com/quantum-ark/isro-hackathon/blob/main/api/main.py) (FastAPI service), [`frontend/src/App.jsx`](https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/App.jsx) (React application), [`pipeline/features.py`](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/features.py) (Feature extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Telemetry &amp; Fusion"]
  node_aditya_feed[("Aditya-L1 telemetry<br/>external data feed")]
  node_cached_telemetry["Cached telemetry samples<br/>raw JSON"]
  node_ingestion["Telemetry ingestion<br/>Python module<br/>[ingestion.py]"]
  node_fusion["Stream fusion<br/>Python module<br/>[aggregator.py]"]
  node_features["Feature extraction<br/>Python module<br/>[features.py]"]
end

subgraph group_inference["Inference Pipeline"]
  node_pipeline_runner["Pipeline coordinator<br/>Python runtime<br/>[run.py]"]
  node_nowcast["Flare nowcast<br/>CNN inference<br/>[nowcast.py]"]
  node_nowcast_weights["Nowcast weights<br/>model artifact"]
  node_forecast["Flare forecast<br/>TCN inference<br/>[forecast.py]"]
  node_forecast_weights["Forecast weights<br/>model artifact"]
end

subgraph group_serving["Operational API"]
  node_api_app["FastAPI service<br/>Python API<br/>[main.py]"]
  node_api_schemas["API schemas<br/>domain models<br/>[models.py]"]
  node_live_ws["Live WebSocket<br/>push stream<br/>[ws.py]"]
end

subgraph group_ui["Operator Dashboard"]
  node_dashboard_app["React application<br/>React/Vite SPA<br/>[App.jsx]"]
  node_dashboard_views["Mission-control views<br/>React components<br/>[Dashboard.jsx]"]
  node_demo_data["Demo data<br/>frontend data<br/>[data.js]"]
end

subgraph group_lifecycle["Model Lifecycle"]
  node_training["Model training<br/>training scripts<br/>[train_models.py]"]
  node_auto_training["Automated retraining<br/>Python pipeline<br/>[auto_train.py]"]
  node_backtesting["Backtesting<br/>evaluation script<br/>[backtest.py]"]
  node_deployment["Deployment workflow<br/>GitHub Actions<br/>[deploy.yml]"]
end

node_aditya_feed -->|"production telemetry"| node_ingestion
node_cached_telemetry -.->|"development input"| node_ingestion
node_ingestion -->|"standardized streams"| node_fusion
node_fusion -->|"synchronized telemetry"| node_features
node_pipeline_runner -->|"orchestrates"| node_ingestion
node_pipeline_runner -->|"orchestrates"| node_features
node_features -->|"short-window features"| node_nowcast
node_features -->|"temporal features"| node_forecast
node_nowcast_weights -.->|"loads"| node_nowcast
node_forecast_weights -.->|"loads"| node_forecast
node_nowcast -->|"cascade context"| node_forecast
node_nowcast -->|"current-flare result"| node_pipeline_runner
node_forecast -->|"future-risk result"| node_pipeline_runner
node_api_app -->|"telemetry update / evaluation"| node_pipeline_runner
node_pipeline_runner -->|"operational result"| node_api_app
node_api_schemas -->|"response contracts"| node_api_app
node_api_app -->|"publishes updates"| node_live_ws
node_api_app -->|"REST snapshots"| node_dashboard_app
node_live_ws -->|"live updates"| node_dashboard_app
node_dashboard_app -->|"renders"| node_dashboard_views
node_demo_data -.->|"local fallback"| node_dashboard_app
node_training -->|"produces"| node_nowcast_weights
node_training -->|"produces"| node_forecast_weights
node_auto_training -->|"triggers"| node_training
node_backtesting -.->|"evaluates"| node_training
node_deployment -->|"deploys"| node_api_app
node_deployment -->|"deploys"| node_dashboard_app

click node_cached_telemetry "https://github.com/quantum-ark/isro-hackathon/blob/main/data/raw/helios/helios_20240915_level1.json"
click node_ingestion "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/ingestion.py"
click node_fusion "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/aggregator.py"
click node_features "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/features.py"
click node_pipeline_runner "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/run.py"
click node_nowcast "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/nowcast.py"
click node_nowcast_weights "https://github.com/quantum-ark/isro-hackathon/blob/main/models/nowcast_cnn_weights.json"
click node_forecast "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/forecast.py"
click node_forecast_weights "https://github.com/quantum-ark/isro-hackathon/blob/main/models/forecast_tcn_weights.json"
click node_api_app "https://github.com/quantum-ark/isro-hackathon/blob/main/api/main.py"
click node_api_schemas "https://github.com/quantum-ark/isro-hackathon/blob/main/api/models.py"
click node_live_ws "https://github.com/quantum-ark/isro-hackathon/blob/main/api/ws.py"
click node_dashboard_app "https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/App.jsx"
click node_dashboard_views "https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/components/Dashboard.jsx"
click node_demo_data "https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/lib/data.js"
click node_training "https://github.com/quantum-ark/isro-hackathon/blob/main/scripts/train_models.py"
click node_auto_training "https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/auto_train.py"
click node_backtesting "https://github.com/quantum-ark/isro-hackathon/blob/main/scripts/backtest.py"
click node_deployment "https://github.com/quantum-ark/isro-hackathon/blob/main/.github/workflows/deploy.yml"

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_aditya_feed,node_cached_telemetry,node_ingestion,node_fusion,node_features toneBlue
class node_pipeline_runner,node_nowcast,node_nowcast_weights,node_forecast,node_forecast_weights toneAmber
class node_api_app,node_api_schemas,node_live_ws toneMint
class node_dashboard_app,node_dashboard_views,node_demo_data toneRose
class node_training,node_auto_training,node_backtesting,node_deployment toneIndigo
```

## Components

### Telemetry & Fusion

- **Aditya-L1 telemetry**: external data feed · Production instrument telemetry boundary.
- [Cached telemetry samples](https://github.com/quantum-ark/isro-hackathon/blob/main/data/raw/helios/helios_20240915_level1.json): raw JSON · Development HEL1OS and SoLEXS inputs. · `data/raw/helios/helios_20240915_level1.json`
- [Telemetry ingestion](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/ingestion.py): Python module · Accepts and standardizes instrument streams. · `pipeline/ingestion.py`
- [Stream fusion](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/aggregator.py): Python module · Synchronizes independently sourced telemetry. · `pipeline/aggregator.py`
- [Feature extraction](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/features.py): Python module · Produces shared thermal, non-thermal, trend, and anomaly features. · `pipeline/features.py`

### Inference Pipeline

- [Pipeline coordinator](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/run.py): Python runtime · Coordinates ingest, fusion, nowcast, forecast, and results. · `pipeline/run.py`
- [Flare nowcast](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/nowcast.py): CNN inference · Detects imminent or current flares from short windows. · `pipeline/nowcast.py`
- [Nowcast weights](https://github.com/quantum-ark/isro-hackathon/blob/main/models/nowcast_cnn_weights.json): model artifact · `models/nowcast_cnn_weights.json`
- [Flare forecast](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/forecast.py): TCN inference · Estimates future probability and lead time from temporal context. · `pipeline/forecast.py`
- [Forecast weights](https://github.com/quantum-ark/isro-hackathon/blob/main/models/forecast_tcn_weights.json): model artifact · `models/forecast_tcn_weights.json`

### Operational API

- [FastAPI service](https://github.com/quantum-ark/isro-hackathon/blob/main/api/main.py): Python API · External operational boundary for pipeline results and telemetry updates. · `api/main.py`
- [API schemas](https://github.com/quantum-ark/isro-hackathon/blob/main/api/models.py): domain models · Shared operational response contracts. · `api/models.py`
- [Live WebSocket](https://github.com/quantum-ark/isro-hackathon/blob/main/api/ws.py): push stream · Delivers live operational updates. · `api/ws.py`

### Operator Dashboard

- [React application](https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/App.jsx): React/Vite SPA · Composes operator workflows around API contracts. · `frontend/src/App.jsx`
- [Mission-control views](https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/components/Dashboard.jsx): React components · Dashboard, flux visualization, alerts, and impact presentation. · `frontend/src/components/Dashboard.jsx`
- [Demo data](https://github.com/quantum-ark/isro-hackathon/blob/main/frontend/src/lib/data.js): frontend data · Local fallback data boundary. · `frontend/src/lib/data.js`

### Model Lifecycle

- [Model training](https://github.com/quantum-ark/isro-hackathon/blob/main/scripts/train_models.py): training scripts · Trains serving model artifacts using instrument and NOAA GOES data. · `scripts/train_models.py`
- [Automated retraining](https://github.com/quantum-ark/isro-hackathon/blob/main/pipeline/auto_train.py): Python pipeline · `pipeline/auto_train.py`
- [Backtesting](https://github.com/quantum-ark/isro-hackathon/blob/main/scripts/backtest.py): evaluation script · `scripts/backtest.py`
- [Deployment workflow](https://github.com/quantum-ark/isro-hackathon/blob/main/.github/workflows/deploy.yml): GitHub Actions · Deploys service and dashboard artifacts. · `.github/workflows/deploy.yml`

## Connections

- Aditya-L1 telemetry → Telemetry ingestion: production telemetry
- Cached telemetry samples → Telemetry ingestion: development input
- Telemetry ingestion → Stream fusion: standardized streams
- Stream fusion → Feature extraction: synchronized telemetry
- Pipeline coordinator → Telemetry ingestion: orchestrates
- Pipeline coordinator → Feature extraction: orchestrates
- Feature extraction → Flare nowcast: short-window features
- Feature extraction → Flare forecast: temporal features
- Nowcast weights → Flare nowcast: loads
- Forecast weights → Flare forecast: loads
- Flare nowcast → Flare forecast: cascade context
- Flare nowcast → Pipeline coordinator: current-flare result
- Flare forecast → Pipeline coordinator: future-risk result
- FastAPI service → Pipeline coordinator: telemetry update / evaluation
- Pipeline coordinator → FastAPI service: operational result
- API schemas → FastAPI service: response contracts
- FastAPI service → Live WebSocket: publishes updates
- FastAPI service → React application: REST snapshots
- Live WebSocket → React application: live updates
- React application → Mission-control views: renders
- Demo data → React application: local fallback
- Model training → Nowcast weights: produces
- Model training → Forecast weights: produces
- Automated retraining → Model training: triggers
- Backtesting → Model training: evaluates
- Deployment workflow → FastAPI service: deploys
- Deployment workflow → React application: deploys
