# rakesh-dogga/solar-irradiance-prediction architecture

> Architecture diagram of the GitHub repository rakesh-dogga/solar-irradiance-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rakesh-dogga/solar-irradiance-prediction
- Repository: https://github.com/rakesh-dogga/solar-irradiance-prediction

## Overview

This Flask dashboard estimates solar irradiance from either manually entered weather and local times or current weather fetched for browser-supplied coordinates. Both prediction routes converge on feature validation and model inference, with the interactive dashboard presenting the result and educational context. A separate offline workflow acquires and prepares NASA POWER data, builds training datasets, compares and tunes regressors, and publishes saved models. The graph follows shown calls and documented behavior; some training-script internals and frontend wiring were not sampled, so uncertain links are omitted.

Main entry points: [`app.py`](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/app.py) (Flask routes), [`src/prediction.py`](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/prediction.py) (Prediction service), [`scripts/prepare_nasa_power.py`](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/prepare_nasa_power.py) (Data validation), [`templates/index.html`](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/templates/index.html) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_flask["Flask routes<br/>[app.py]"]
  node_dashboard["Dashboard UI<br/>[index.html]"]
  node_client["Interactive client<br/>[script.js]"]
  node_styles["Dashboard styling<br/>[style.css]"]
  node_education["Solar map"]
end

subgraph group_inference["Prediction runtime"]
  node_weather["Weather adapter<br/>[weather_service.py]"]
  node_features["Feature engineering"]
  node_prediction["Prediction service<br/>[prediction.py]"]
end

subgraph group_data["Data preparation"]
  node_download["NASA acquisition"]
  node_prepare["Data validation"]
  node_sample["2024 sampling"]
  node_split["Temporal splitting"]
end

subgraph group_training["Model development"]
  node_baseline["Baseline training"]
  node_portfolio["Portfolio training"]
  node_tuning["Model tuning"]
  node_finalize["Model finalization"]
end

subgraph group_assets["Data and artifacts"]
  node_model[("Selected regressor")]
  node_dataset[("Prepared dataset")]
  node_models[("Saved model portfolio")]
end

node_user(("Dashboard user"))
node_browser(("Browser"))
node_openmeteo["Open-Meteo"]

node_user -->|"uses"| node_browser
node_browser -->|"opens"| node_dashboard
node_flask -->|"renders"| node_dashboard
node_browser -->|"runs"| node_client
node_client -->|"submits inputs"| node_flask
node_dashboard -.->|"uses styles"| node_styles
node_dashboard -->|"shows map"| node_education
node_flask -->|"routes predictions"| node_prediction
node_flask -->|"fetches weather"| node_weather
node_prediction -->|"gets current weather"| node_weather
node_prediction -->|"builds features"| node_features
node_weather -->|"validates pressure"| node_features
node_prediction -->|"loads and predicts"| node_model
node_weather -->|"requests conditions"| node_openmeteo
node_download -->|"provides source data"| node_prepare
node_prepare -->|"supplies validated rows"| node_sample
node_prepare -->|"supplies prepared rows"| node_split
node_prepare -->|"provides preparation"| node_baseline
node_split -->|"provides partitions"| node_baseline
node_sample -->|"provides dataset"| node_portfolio
node_portfolio -->|"trains from"| node_dataset
node_baseline -->|"supplies baselines"| node_tuning
node_tuning -->|"provides selected candidate"| node_finalize
node_portfolio -.->|"writes trained artifacts"| node_models
node_finalize -.->|"publishes selected model"| node_models

click node_flask "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/app.py"
click node_dashboard "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/templates/index.html"
click node_client "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/static/js/script.js"
click node_styles "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/static/css/style.css"
click node_education "https://github.com/rakesh-dogga/solar-irradiance-prediction/tree/main/static/images"
click node_weather "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/weather_service.py"
click node_features "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/feature_engineering.py"
click node_prediction "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/prediction.py"
click node_model "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/models/nasa_power/portfolio_2024/hist_gradient_boosting.joblib"
click node_download "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/download_nasa_power.py"
click node_prepare "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/prepare_nasa_power.py"
click node_sample "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/prepare_nasa_power_50k.py"
click node_split "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/split_nasa_power.py"
click node_dataset "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/data/nasa_power/prepared/solar_irradiance_2024_50k.csv"
click node_baseline "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/train_nasa_power_baselines.py"
click node_portfolio "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/train_nasa_power_50k.py"
click node_tuning "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/tune_nasa_power_models.py"
click node_finalize "https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/finalize_nasa_power_models.py"
click node_models "https://github.com/rakesh-dogga/solar-irradiance-prediction/tree/main/models/nasa_power/portfolio_2024"

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_flask,node_dashboard,node_client,node_styles,node_education,node_user,node_browser toneBlue
class node_weather,node_features,node_prediction toneAmber
class node_download,node_prepare,node_sample,node_split toneMint
class node_baseline,node_portfolio,node_tuning,node_finalize toneRose
class node_model,node_dataset,node_models,node_openmeteo toneIndigo
```

## Components

### Web dashboard

- [Flask routes](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/app.py): `app.py`
- [Dashboard UI](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/templates/index.html): `templates/index.html`
- [Interactive client](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/static/js/script.js): `static/js/script.js`
- [Dashboard styling](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/static/css/style.css): `static/css/style.css`
- [Solar map](https://github.com/rakesh-dogga/solar-irradiance-prediction/tree/main/static/images): `static/images`

### Prediction runtime

- [Weather adapter](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/weather_service.py): `src/weather_service.py`
- [Feature engineering](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/feature_engineering.py): `src/feature_engineering.py`
- [Prediction service](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/src/prediction.py): `src/prediction.py`

### Data preparation

- [NASA acquisition](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/download_nasa_power.py): `scripts/download_nasa_power.py`
- [Data validation](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/prepare_nasa_power.py): `scripts/prepare_nasa_power.py`
- [2024 sampling](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/prepare_nasa_power_50k.py): `scripts/prepare_nasa_power_50k.py`
- [Temporal splitting](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/split_nasa_power.py): `scripts/split_nasa_power.py`

### Model development

- [Baseline training](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/train_nasa_power_baselines.py): `scripts/train_nasa_power_baselines.py`
- [Portfolio training](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/train_nasa_power_50k.py): `scripts/train_nasa_power_50k.py`
- [Model tuning](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/tune_nasa_power_models.py): `scripts/tune_nasa_power_models.py`
- [Model finalization](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/scripts/finalize_nasa_power_models.py): `scripts/finalize_nasa_power_models.py`

### Data and artifacts

- [Selected regressor](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/models/nasa_power/portfolio_2024/hist_gradient_boosting.joblib): `models/nasa_power/portfolio_2024/hist_gradient_boosting.joblib`
- [Prepared dataset](https://github.com/rakesh-dogga/solar-irradiance-prediction/blob/main/data/nasa_power/prepared/solar_irradiance_2024_50k.csv): `data/nasa_power/prepared/solar_irradiance_2024_50k.csv`
- [Saved model portfolio](https://github.com/rakesh-dogga/solar-irradiance-prediction/tree/main/models/nasa_power/portfolio_2024): `models/nasa_power/portfolio_2024`

### Other components

- **Dashboard user**
- **Browser**
- **Open-Meteo**

## Connections

- Dashboard user → Browser: uses (evidence: `README.md`)
- Browser → Dashboard UI: opens (evidence: `README.md`)
- Flask routes → Dashboard UI: renders (evidence: `app.py`)
- Browser → Interactive client: runs (evidence: `README.md`)
- Interactive client → Flask routes: submits inputs (evidence: `README.md`)
- Dashboard UI → Dashboard styling: uses styles
- Dashboard UI → Solar map: shows map (evidence: `README.md`)
- Flask routes → Prediction service: routes predictions (evidence: `app.py`)
- Flask routes → Weather adapter: fetches weather (evidence: `app.py`)
- Prediction service → Weather adapter: gets current weather (evidence: `src/prediction.py`)
- Prediction service → Feature engineering: builds features (evidence: `src/prediction.py`)
- Weather adapter → Feature engineering: validates pressure (evidence: `src/weather_service.py`)
- Prediction service → Selected regressor: loads and predicts (evidence: `src/prediction.py`)
- Weather adapter → Open-Meteo: requests conditions (evidence: `src/weather_service.py`)
- NASA acquisition → Data validation: provides source data (evidence: `scripts/prepare_nasa_power.py`)
- Data validation → 2024 sampling: supplies validated rows (evidence: `scripts/prepare_nasa_power_50k.py`)
- Data validation → Temporal splitting: supplies prepared rows (evidence: `scripts/split_nasa_power.py`)
- Data validation → Baseline training: provides preparation (evidence: `scripts/train_nasa_power_baselines.py`)
- Temporal splitting → Baseline training: provides partitions (evidence: `scripts/train_nasa_power_baselines.py`)
- 2024 sampling → Portfolio training: provides dataset (evidence: `scripts/train_nasa_power_50k.py`)
- Portfolio training → Prepared dataset: trains from (evidence: `scripts/train_nasa_power_50k.py`)
- Baseline training → Model tuning: supplies baselines (evidence: `scripts/tune_nasa_power_models.py`)
- Model tuning → Model finalization: provides selected candidate (evidence: `scripts/finalize_nasa_power_models.py`)
- Portfolio training → Saved model portfolio: writes trained artifacts
- Model finalization → Saved model portfolio: publishes selected model
