How govindsin-gh/aqiforecast works
AQI Forecast serves hourly PM2.5 and US AQI forecasts for eight Indian cities through a web dashboard and API. The workflow prepares observation features, runs a promoted quantile LSTM model, and presents forecast bands and histories; an explanation endpoint can narrate forecast facts. Separate operational stages retrain and gate candidate models, score and monitor production, and compare outputs with OpenAQ stations. The excerpts show API prediction and model-gating behavior; connections for unsampled jobs are included only where the source index names dependencies.
Main entry points: main.py Forecast API · store.py Observation store · gate.py Promotion gate · transform.py Feature windows
Components 24
Data preparation
- Weather ingestion
src/ingest/open_meteo.py - Observation store
src/serving/store.py - Feature windows
src/features/transform.py - AQI conversion
src/features/aqi.py
Forecast modeling
- Model training
src/models/train.py - Quantile LSTM
src/models/lstm.py - Model metrics
src/models/metrics.py - Promotion gate
src/models/gate.py - Model artifacts
src/serving/store.py - ONNX predictor
src/serving/predictor.py
Monitoring and validation
- Hourly scoring
src/monitoring/score.py - Drift checks
src/monitoring/drift.py - Monitor predictions
src/monitoring/predict.py - Station validation
src/validation/openaq.py
API service
- Forecast API
api/main.py - Forecast narration
api/explain.py
Web dashboard
- Web API client
web/src/api.js - Dashboard routes
web/src/App.jsx - City map
web/src/pages/MapPage.jsx - City forecast
web/src/pages/CityPage.jsx - Model health view
web/src/pages/HealthPage.jsx
Other components
- Dashboard user
- OpenAQ stations
- Groq language model
Connections 33
- Weather ingestion → Observation store: writes observations
- Observation store → Feature windows: feeds windows
src/serving/store.py - Model training → Feature windows: uses transforms
src/models/train.py - Model training → Quantile LSTM: trains model
src/models/train.py - Model training → Model metrics: evaluates
src/models/train.py - Promotion gate → Quantile LSTM: loads candidate
src/models/gate.py - Promotion gate → Model metrics: compares metrics
src/models/gate.py - Promotion gate → ONNX predictor: tests production
src/models/gate.py - Promotion gate → Model artifacts: stores promotion
src/models/gate.py - Promotion gate → Observation store: reads production
src/models/gate.py - ONNX predictor → Feature windows: normalizes input
src/serving/predictor.py - Monitor predictions → Feature windows: builds windows
src/monitoring/predict.py - Monitor predictions → ONNX predictor: runs inference
src/monitoring/predict.py - Monitor predictions → Observation store: reads data
src/monitoring/predict.py - Hourly scoring → Observation store: reads scores
- Drift checks → Observation store: checks data
- Station validation → OpenAQ stations: checks stations
- Forecast API → Observation store: reads history
api/main.py - Forecast API → Model artifacts: loads production
api/main.py - Forecast API → ONNX predictor: runs forecasts
api/main.py - Forecast API → Feature windows: builds windows
api/main.py - Forecast API → AQI conversion: converts AQI
api/main.py - Forecast API → Forecast narration: requests narration
api/main.py - Forecast narration → Groq language model: narrates facts
api/explain.py - Dashboard user → Dashboard routes: uses dashboard
- Dashboard routes → City map: routes to
web/src/App.jsx - Dashboard routes → City forecast: routes to
web/src/App.jsx - Dashboard routes → Model health view: routes to
web/src/App.jsx - City map → Web API client: fetches data
web/src/pages/MapPage.jsx - City forecast → Web API client: fetches data
web/src/pages/CityPage.jsx - Model health view → Web API client: fetches data
web/src/pages/HealthPage.jsx - Web API client → Forecast API: calls endpoints
- Forecast API → Station validation: serves comparisons