# kaif-67/nowcast architecture

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

- Interactive diagram: https://gitdiagram.com/kaif-67/nowcast
- Repository: https://github.com/kaif-67/nowcast

## Overview

Nowcast AI serves location-based thunderstorm and lightning nowcasts through a dashboard: users select a monitored region, the frontend requests a prediction, and the backend combines live weather context with learned risk signals, records prediction history, and returns map and risk details for monitoring. Radar acquisition and tensor preparation support the radar pathway; the dashboard also exposes alerts, data-source status, and settings. The README documents the broad pipeline, while excerpts show selected API, radar, and UI behavior; links without direct call evidence are omitted.

Main entry points: [`frontend/src/app/page.tsx`](https://github.com/kaif-67/nowcast/blob/main/frontend/src/app/page.tsx) (Dashboard shell), [`backend/main.py`](https://github.com/kaif-67/nowcast/blob/main/backend/main.py) (FastAPI prediction service), [`frontend/src/components/MapComponent.tsx`](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/MapComponent.tsx) (Risk map), [`ml_models/radar_pipeline.py`](https://github.com/kaif-67/nowcast/blob/main/ml_models/radar_pipeline.py) (Radar acquisition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Monitoring interface"]
  node_dashboard["Dashboard shell<br/>[page.tsx]"]
  node_dashboard_view["Risk dashboard<br/>[DashboardView.tsx]"]
  node_map["Risk map<br/>[MapComponent.tsx]"]
  node_alerts["Alerts view<br/>[AlertsView.tsx]"]
  node_sources["Data sources view"]
  node_settings["Settings view<br/>[SettingsView.tsx]"]
end

subgraph group_service["Prediction service"]
  node_api["FastAPI prediction service<br/>[main.py]"]
  node_history[("Prediction history<br/>[nowcast_history.db]")]
end

subgraph group_radar["Radar processing"]
  node_radar_fetch["Radar acquisition<br/>[radar_pipeline.py]"]
  node_radar_prep["Radar tensor preparation"]
end

subgraph group_models["Forecast models"]
  node_convlstm["ConvLSTM model<br/>[convlstm_model.py]"]
end

node_user(("Operator"))
node_weather["Open-Meteo"]
node_rainviewer["RainViewer"]
node_tiles["Map tile service"]

node_user -->|"opens"| node_dashboard
node_dashboard -->|"requests forecasts"| node_api
node_api -->|"fetches conditions"| node_weather
node_api -->|"reads and writes"| node_history
node_api -->|"returns risk data"| node_dashboard
node_dashboard -->|"renders"| node_dashboard_view
node_dashboard -->|"renders"| node_map
node_dashboard -->|"loads view"| node_alerts
node_dashboard -->|"loads view"| node_sources
node_dashboard -->|"loads view"| node_settings
node_map -->|"fetches radar metadata"| node_rainviewer
node_map -->|"loads map tiles"| node_tiles
node_radar_fetch -->|"downloads radar frames"| node_rainviewer
node_api -->|"imports radar pipeline"| node_radar_fetch
node_api -->|"imports tensor preparation"| node_radar_prep
node_api -.->|"uses sequence model"| node_convlstm

click node_dashboard "https://github.com/kaif-67/nowcast/blob/main/frontend/src/app/page.tsx"
click node_dashboard_view "https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/DashboardView.tsx"
click node_map "https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/MapComponent.tsx"
click node_alerts "https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/AlertsView.tsx"
click node_sources "https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/DataSourcesView.tsx"
click node_settings "https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/SettingsView.tsx"
click node_api "https://github.com/kaif-67/nowcast/blob/main/backend/main.py"
click node_history "https://github.com/kaif-67/nowcast/blob/main/backend/nowcast_history.db"
click node_radar_fetch "https://github.com/kaif-67/nowcast/blob/main/ml_models/radar_pipeline.py"
click node_radar_prep "https://github.com/kaif-67/nowcast/blob/main/ml_models/radar_tensor_prep.py"
click node_convlstm "https://github.com/kaif-67/nowcast/blob/main/ml_models/convlstm_model.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_dashboard,node_dashboard_view,node_map,node_alerts,node_sources,node_settings,node_rainviewer toneBlue
class node_api,node_history toneAmber
class node_radar_fetch,node_radar_prep toneMint
class node_convlstm toneRose
class node_user,node_weather,node_tiles toneIndigo
```

## Components

### Monitoring interface

- [Dashboard shell](https://github.com/kaif-67/nowcast/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Risk dashboard](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/DashboardView.tsx): `frontend/src/components/DashboardView.tsx`
- [Risk map](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/MapComponent.tsx): `frontend/src/components/MapComponent.tsx`
- [Alerts view](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/AlertsView.tsx): `frontend/src/components/AlertsView.tsx`
- [Data sources view](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/DataSourcesView.tsx): `frontend/src/components/DataSourcesView.tsx`
- [Settings view](https://github.com/kaif-67/nowcast/blob/main/frontend/src/components/SettingsView.tsx): `frontend/src/components/SettingsView.tsx`

### Prediction service

- [FastAPI prediction service](https://github.com/kaif-67/nowcast/blob/main/backend/main.py): `backend/main.py`
- [Prediction history](https://github.com/kaif-67/nowcast/blob/main/backend/nowcast_history.db): `backend/nowcast_history.db`

### Radar processing

- [Radar acquisition](https://github.com/kaif-67/nowcast/blob/main/ml_models/radar_pipeline.py): `ml_models/radar_pipeline.py`
- [Radar tensor preparation](https://github.com/kaif-67/nowcast/blob/main/ml_models/radar_tensor_prep.py): `ml_models/radar_tensor_prep.py`

### Forecast models

- [ConvLSTM model](https://github.com/kaif-67/nowcast/blob/main/ml_models/convlstm_model.py): `ml_models/convlstm_model.py`

### Other components

- **Operator**
- **Open-Meteo**
- **RainViewer**
- **Map tile service**

## Connections

- Operator → Dashboard shell: opens (evidence: `readme.md`)
- Dashboard shell → FastAPI prediction service: requests forecasts (evidence: `readme.md`)
- FastAPI prediction service → Open-Meteo: fetches conditions (evidence: `backend/main.py`)
- FastAPI prediction service → Prediction history: reads and writes (evidence: `backend/main.py`)
- FastAPI prediction service → Dashboard shell: returns risk data (evidence: `readme.md`)
- Dashboard shell → Risk dashboard: renders (evidence: `frontend/src/app/page.tsx`)
- Dashboard shell → Risk map: renders (evidence: `frontend/src/app/page.tsx`)
- Dashboard shell → Alerts view: loads view (evidence: `frontend/src/app/page.tsx`)
- Dashboard shell → Data sources view: loads view (evidence: `frontend/src/app/page.tsx`)
- Dashboard shell → Settings view: loads view (evidence: `frontend/src/app/page.tsx`)
- Risk map → RainViewer: fetches radar metadata (evidence: `frontend/src/components/MapComponent.tsx`)
- Risk map → Map tile service: loads map tiles (evidence: `frontend/src/components/MapComponent.tsx`)
- Radar acquisition → RainViewer: downloads radar frames (evidence: `ml_models/radar_pipeline.py`)
- FastAPI prediction service → Radar acquisition: imports radar pipeline (evidence: `backend/main.py`)
- FastAPI prediction service → Radar tensor preparation: imports tensor preparation (evidence: `backend/main.py`)
- FastAPI prediction service → ConvLSTM model: uses sequence model (evidence: `readme.md`)
