Skip to content

Issue #4: 🟢 Implement Air Quality Forecasting Model #7

Description

@ZEZE1020

Description

Implement ML-based air quality forecasting to predict conditions 24-48 hours ahead.

Tasks

Phase 1: Simple Forecasting

  • Install Prophet or ARIMA library
  • Implement time-series forecaster
  • Use historical OpenAQ data
  • Generate 24-hour forecast
  • Add confidence intervals

Phase 2: Feature Engineering

  • Add weather features
  • Add temporal features (hour, day, season)
  • Add spatial features
  • Normalize features

Phase 3: Model Training

  • Train Random Forest or XGBoost
  • Use the last 30 days of data
  • Validate with the last 7 days
  • Save model to disk
  • Compute accuracy metrics

Phase 4: API

  • Create forecast endpoint
  • Load trained model
  • Generate predictions on demand
  • Cache predictions (1 hour)
  • Return confidence intervals

Files to Create

backend/src/ml_models/
├── forecaster.py
├── trainer.py
├── feature_engineer.py
└── model_loader.py

API Endpoints

GET /api/v1/forecast/location?lat={lat}&lon={lon}&hours={hours}
POST /api/v1/forecast/train
GET /api/v1/forecast/accuracy

Alternative (if time-constrained)

Use a simple persistence model or linear regression instead of Prophet/ARIMA.

Acceptance Criteria

  • Working forecast model
  • 24-hour predictions generated
  • Confidence intervals included
  • API endpoints are functional
  • Predictions cached
  • Model accuracy documented

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions