End to End Mlops System to predict the air quality in Cameroon. Everything is automatic from the Data pipeline, to model retraining and redeployment.
Last updated Sep 21, 2025
11
Stars
2
Forks
0
Issues
0
Stars/day
Attention Score
1
Language breakdown
Jupyter Notebook 97.0%
Python 3.0%
Dockerfile 0.0%
โธ Files
click to expand
README
# Air Quality Prediction System for Cameroon
This repository hosts the codebase for an end-to-end machine learning system designed to predict air quality across the ten major cities of Cameroon. By leveraging satellite data, weather information, and advanced machine learning workflows, this project eliminates the need for unreliable ground-based sensors in resource-constrained settings.
The system is fully autonomous, and get better over time with automatic model retraining and redeployment when drift is detected.
Features
- End-to-End Architecture:
- Data Pipeline: Automates daily data fetching, transformation, and storage using Prefect.
- Offline Components: Includes EDA, model development, and a robust model registry with MLflow.
- CI/CD Pipeline: Automates testing, building Docker images, and deployment to AWS ECS using GitHub Actions.
- Monitoring Pipeline: Tracks data drift using Evidently, sends alerts, and integrates seamlessly with the data pipeline.
- Model Retraining Pipeline: Retrains the model weekly, compares performance, and redeploys only if the new model outperforms the production model.
- Scalable Deployment:
- Hosted on AWS ECS with containerized model APIs for high availability.
- Integrated with a Load Balancer to ensure stable traffic routing despite dynamic IP changes.
- User-Friendly Interface:
- Streamlit Cloud host an interactive UI for visualizing air quality predictions and insights.
System Architecture
The system is composed of the following key components:
- Data Pipeline:
- Offline Development:
- CI/CD Pipeline:
- Monitoring Pipeline:
- Model Retraining:
- Load Balancer:
- UI:

Getting Started
Prerequisites
- Python 3.10.12
- Docker
- AWS CLI configured with necessary permissions
- Prefect Cloud account for orchestration
- GitHub repository with Actions enabled
Installation
- Clone the repository:
git clone https://github.com/NembotJules/Cameroon-Air-Quality-Prediction.git
- Install dependencies:
pip install requirements.txt
- Configure AWS credentials for ECS and ECR:
aws configure
- Start the prefect server and follow the instructions in the terminal to direct the Prefect API URl to Prefect Cloud
prefect server start
- Create an S3 Bucket, and update the paths in the config/default.yaml to match your paths.
- Set environment variables
- Add required API keys (e.g., Openmeteo API) and other configuration values to .env or your secrets manager.
- Deploying the API
docker build -t air-quality-api .
docker tag air-quality-api:latest <AWSECRREPO_URI>:latest
docker push <AWSECRREPO_URI>:latest
- Deploy your ECR Image to AWS ECS
- Update the data_pipeline script to send data to your AWS ECS service public ip address
- Run the data_pipeline.py script
python data_pipeline.py
- You can use the script in the monitoring folder to Monitor the system using Evidently, adapt the script to your preference.
python monitoring_service.py
- Use the workflow file in the githuv folder to automate everything.
Project Structure
.
โโโ .github/workflows/ # GitHub Actions workflows for CI/CD, monitoring, and retraining pipelines
โ โโโ airqualityci_cd.yml
โ โโโ monitoring_pipeline.yml
โ โโโ retraining.yml
โโโ config/ # Configuration files
โ โโโ default.yaml
โโโ data/ # Directory for all data-related files
โ โโโ dailyweatherdata/ # Raw daily weather data
โ โโโ hourlyaqidata/ # Raw hourly AQI data
โ โโโ traintestdata/ # Training and test data
โ โ โโโ preprocessed_data/ # Preprocessed datasets
โ โ โ โโโ train_X.csv
โ โ โ โโโ train_y.csv
โ โ โ โโโ test_X.csv
โ โ โ โโโ test_y.csv
โ โ โโโ raw_data/ # Raw datasets before preprocessing
โโโ monitoring/ # Monitoring service code
โ โโโ monitoring_service.py
โโโ models/ # ML models and training scripts
โ โโโ init.py
โ โโโ train_model.py
โโโ notebooks/ # Jupyter notebooks for analysis
โ โโโ data_processing.ipynb # Data cleaning and preprocessing
โ โโโ Modeling.ipynb # Model experimentation and evaluation
โ โโโ Kaggle Split.ipynb # Data splitting logic
โ โโโ featureimportanceplot.png
โโโ src/ # Core source code
โ โโโ api/ # FastAPI application
โ โ โโโ app.py
โ โ โโโ test_api.py
โ โโโ data/ # Data pipeline scripts
โ โ โโโ data_pipeline.py
โ โ โโโ make_dataset.py
โ โ โโโ combineddailyaqi_df.csv
โ โ โโโ combineddailyweather_df.csv
โ โ โโโ dailyweatheraqi_df.csv
โ โโโ processed_features.csv # Final feature dataset
โโโ ui/ # Streamlit-based user interface
โ โโโ aqi.py
โ โโโ historicaldailyweather.py
โ โโโ historicalhourlyaqi.py
โ โโโ uploadtos3.py
โโโ .devcontainer/ # Development container configuration
โโโ backend.db # Backend database file
โโโ Dockerfile # Dockerfile for containerizing the application
โโโ requirements.txt # Python dependencies
โโโ task-definition.json # ECS task definition for deployment
โโโ .env # Environment variables (not included in the repository for security)
Image of the System:

๐ More in this category