# laybaatariq/3-days-aqi-forecast architecture

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

- Interactive diagram: https://gitdiagram.com/laybaatariq/3-days-aqi-forecast
- Repository: https://github.com/laybaatariq/3-days-aqi-forecast

## Overview

This repository is an hourly AQI forecasting dashboard backed by a Hopsworks data pipeline. The operational path is pollutant/weather API data → cleaning → feature engineering → dashboard forecasts and visualizations. README-described model evaluation and automated updates are included as documented capabilities, but their implementation is not established by the sampled source. The dashboard excerpt shows its feature-store read, model loading, prediction generation, and charts; the three pipeline scripts show their own store interactions. The README supplies the broader training and automation relationships.

Main entry points: [`app.py`](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py) (Streamlit dashboard), [`.github/workflows/daily_aqi.yml`](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/.github/workflows/daily_aqi.yml) (Scheduled updates), [`scripts/fetch_API_data.py`](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/fetch_API_data.py) (AQI and weather fetch), [`scripts/clean_and_upload.py`](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/clean_and_upload.py) (Clean and upload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data ingestion"]
  node_fetch["AQI and weather fetch<br/>[fetch_API_data.py]"]
  node_rawstore[("Raw feature group")]
end

subgraph group_features["Feature preparation"]
  node_clean["Clean and upload"]
  node_cleanstore[("Cleaned feature group")]
  node_engineer["Feature engineering"]
  node_featurestore[("Engineered feature group")]
end

subgraph group_forecast["Forecast experience"]
  node_model["LightGBM model"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_predict["72-hour predictions<br/>[app.py]"]
  node_visualize["Forecast charts<br/>[app.py]"]
end

subgraph group_automation["Model operations"]
  node_train["Model training"]
  node_evaluate["Model evaluation"]
  node_actions["Scheduled updates<br/>[daily_aqi.yml]"]
  node_hosting["Dashboard hosting"]
end

node_operator(("Dashboard user"))
node_openmeteo["Open-Meteo APIs"]

node_openmeteo -->|"provides readings"| node_fetch
node_fetch -->|"inserts records"| node_rawstore
node_rawstore -->|"reads data"| node_clean
node_clean -->|"uploads cleaned data"| node_cleanstore
node_cleanstore -->|"reads data"| node_engineer
node_engineer -->|"inserts features"| node_featurestore
node_featurestore -->|"loads features"| node_dashboard
node_dashboard -->|"loads model"| node_model
node_dashboard -->|"generates forecasts"| node_predict
node_predict -->|"renders charts"| node_visualize
node_operator -.->|"views forecast"| node_dashboard
node_featurestore -.->|"supplies training data"| node_train
node_train -.->|"produces model results"| node_evaluate
node_evaluate -.->|"selects model"| node_model
node_actions -.->|"triggers retraining"| node_train
node_actions -.->|"deploys updates"| node_hosting
node_hosting -.->|"hosts dashboard"| node_dashboard

click node_fetch "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/fetch_API_data.py"
click node_clean "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/clean_and_upload.py"
click node_engineer "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/feature_engineer_aqi.py"
click node_model "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/models/best_model_LightGBM.pkl"
click node_dashboard "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py"
click node_predict "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py"
click node_visualize "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py"
click node_actions "https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/.github/workflows/daily_aqi.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_fetch,node_rawstore,node_operator toneBlue
class node_clean,node_cleanstore,node_engineer,node_featurestore toneAmber
class node_model,node_dashboard,node_predict,node_visualize,node_openmeteo toneMint
class node_train,node_evaluate,node_actions,node_hosting toneRose
```

## Components

### Data ingestion

- [AQI and weather fetch](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/fetch_API_data.py): `scripts/fetch_API_data.py`
- **Raw feature group**

### Feature preparation

- [Clean and upload](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/clean_and_upload.py): `scripts/clean_and_upload.py`
- **Cleaned feature group**
- [Feature engineering](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/scripts/feature_engineer_aqi.py): `scripts/feature_engineer_aqi.py`
- **Engineered feature group**

### Forecast experience

- [LightGBM model](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/models/best_model_LightGBM.pkl): `models/best_model_LightGBM.pkl`
- [Streamlit dashboard](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py): `app.py`
- [72-hour predictions](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py): `app.py`
- [Forecast charts](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/app.py): `app.py`

### Model operations

- **Model training**
- **Model evaluation**
- [Scheduled updates](https://github.com/laybaatariq/3-days-aqi-forecast/blob/main/.github/workflows/daily_aqi.yml): `.github/workflows/daily_aqi.yml`
- **Dashboard hosting**

### Other components

- **Dashboard user**
- **Open-Meteo APIs**

## Connections

- Open-Meteo APIs → AQI and weather fetch: provides readings (evidence: `scripts/fetch_API_data.py`)
- AQI and weather fetch → Raw feature group: inserts records (evidence: `scripts/fetch_API_data.py`)
- Raw feature group → Clean and upload: reads data (evidence: `scripts/clean_and_upload.py`)
- Clean and upload → Cleaned feature group: uploads cleaned data (evidence: `scripts/clean_and_upload.py`)
- Cleaned feature group → Feature engineering: reads data (evidence: `scripts/feature_engineer_aqi.py`)
- Feature engineering → Engineered feature group: inserts features (evidence: `scripts/feature_engineer_aqi.py`)
- Engineered feature group → Streamlit dashboard: loads features (evidence: `app.py`)
- Streamlit dashboard → LightGBM model: loads model (evidence: `app.py`)
- Streamlit dashboard → 72-hour predictions: generates forecasts (evidence: `app.py`)
- 72-hour predictions → Forecast charts: renders charts (evidence: `app.py`)
- Dashboard user → Streamlit dashboard: views forecast
- Engineered feature group → Model training: supplies training data (evidence: `README.md`)
- Model training → Model evaluation: produces model results (evidence: `README.md`)
- Model evaluation → LightGBM model: selects model (evidence: `README.md`)
- Scheduled updates → Model training: triggers retraining (evidence: `README.md`)
- Scheduled updates → Dashboard hosting: deploys updates (evidence: `README.md`)
- Dashboard hosting → Streamlit dashboard: hosts dashboard (evidence: `README.md`)
