Logo Lanfrica

MAcDen34/Rwanda-air-watch

Domaine:

environment and energy

Type de record:

software
Créateur:
MAc
Hôte:
A backend system that continuously pulls air quality + weather data for Rwandan cities (Kigali, Musanze, Rubavu), detects anomalies using a lightweight statistical model, and routes alerts to different channels depending on severity — all distributed across 3 servers with a load balancer in front. # Rwanda Air Watch A backend monitoring system that pulls real-time air quality data for three Rwandan cities — Kigali, Musanze, and Rubavu — detects pollution anomalies using Z-score analysis, and routes alerts through SMS and push notifications. Deployed across two application servers with an nginx load balancer. --- ## What it does - Polls the Open-Meteo Air Quality API every 5 minutes for PM2.5, PM10, NO2, O3, and CO readings - Stores readings in PostgreSQL with time-series indexing - Runs statistical anomaly detection (Z-score with rolling hourly baseline per city per pollutant) - Fires alerts via Africa's Talking SMS and ntfy.sh push notifications when a Z-score exceeds 2.5 - Deduplicates alerts using Redis so duplicate events don't fire twice - Serves a REST API with city filtering, sorting, and history endpoints - Includes a web frontend dashboard accessible through the load balancer --- ## Demo-video link # Demo_video: ## Architecture ``` Client (browser / curl) | [lb-01: nginx] -- round-robin load balancer / \ [web-01] [web-02] ingestion analysis worker worker \ / PostgreSQL (web-01) Redis (web-01 + web-02) ``` - **web-01** runs the ingestion worker (FastAPI on port 8001) — polls Open-Meteo, writes readings to PostgreSQL - **web-02** runs the analysis worker (FastAPI on port 8002) — reads readings, runs anomaly detection, fires alerts - **lb-01** runs nginx — routes `/poll/` and `/readings/` to web-01, `/analyze/` and `/alerts/` to web-02, `/health` to both --- ## APIs Used ### Open-Meteo Air Quality API - **URL**: open-meteo.com - **Purpose**: Real-time air quality data (PM2.5, PM10, NO2, O3, CO) for Rwandan coordinates - **Authentication**: No API key required — free and open - **Rate limits**: No hard rate limit; we poll every 5 minutes per city - **Credit**: Open-Meteo — open-source weather API, CC BY 4.0 ### Africa's Talking SMS API - **URL**: developers.africastal

Languages