Air quality · XGBoost · Flask
Building an AI-powered air quality dashboard for Chennai, with forecasts and healthy routing
Flask, MongoDB, XGBoost and an A* route planner in Pollumap V3
By Jeyadev R · 2026-10-18
What it does
Pollumap V3 is a full-stack web app that pulls real-time air quality, weather, fire and IoT sensor data into one interactive dashboard for Chennai. It shows pollutant levels (PM2.5, PM10, O3, NO2, SO2 and CO), a map with sensor locations, weather and UV charts, satellite fire detections, and a source breakdown by category such as vehicles, industry and dust.
Data pipeline
A background worker fetches from the WAQI air quality API, Open-Meteo for weather, NASA FIRMS for satellite fire data and Overpass for the OpenStreetMap road graph, and stores time-series data in MongoDB. A Flask REST API serves the React front end, which uses SWR for fetching and caching and Recharts and Leaflet for charts and maps.
24-hour forecasting with XGBoost
The forecasting module uses XGBoost models to predict pollutant and weather values 24 hours ahead. These feed the forecast cards and the health advisory shown to users.
Healthy routing with A*
The Healthy Routing feature searches the OpenStreetMap road graph with an A* algorithm and computes fastest, cleanest and balanced routes for walking or cycling. The point is to minimise pollution exposure on the way, not just distance.
Related work
The same air quality theme runs through my other projects: HyperlocalAQ combines seven data sources with hybrid IDW interpolation, and PHYS-TRUST Lite estimates air quality on a single low-cost Arduino sensor node.
The full feature list
- Live AQI dashboard with animated charts for PM2.5, PM10, O3, NO2, SO2 and CO.
- Leaflet map with a pollution overlay and sensor locations.
- Weather panels for temperature, humidity, UV index, wind and rainfall.
- NASA FIRMS satellite fire detections.
- XGBoost 24-hour pollutant and weather forecasts.
- Healthy routing with fastest, cleanest and balanced options.
- Source apportionment pie chart: vehicles, industry, dust and other sources.
- An IoT sensor grid with connectivity indicators.
- Dark and light themes.
Stack
The front end is React 18 with Vite, Recharts for charts, React-Leaflet for the map, Framer Motion for transitions, Lucide icons, and Axios with SWR for data fetching and caching. The back end is Flask 3 with MongoDB for time-series storage and XGBoost with scikit-learn for forecasting.
The back end is split into fetchers for each data source and core logic modules for source apportionment, forecasting and routing, with all REST endpoints in one routes file.
Running it yourself
- Install Python 3.12+, Node.js 18+ and MongoDB on its default port 27017.
- In the backend folder, create a virtual environment, install requirements, copy .env.example to .env and add your WAQI and FIRMS API keys.
- Initialise the database with init_db.py and start the API on port 5000.
- In the frontend folder, run npm install and npm run dev to open the dashboard on port 5173.
- Or run run_dashboard.sh from the project root to start both together.
Questions people ask
What data does Pollumap V3 use?
Live air quality from the WAQI API, weather from Open-Meteo, satellite fire detections from NASA FIRMS, and the OpenStreetMap road graph through the Overpass API, stored as time series in MongoDB.
How does it forecast air quality?
XGBoost models predict pollutant and weather values 24 hours ahead. The forecasts feed the forecast cards and the health advisory.
What is healthy routing?
An A* search over the road graph that finds fastest, cleanest and balanced routes for walking or cycling, so you can trade a little distance for less pollution exposure.
Which pollutants does it show?
PM2.5, PM10, ozone (O3), nitrogen dioxide (NO2), sulphur dioxide (SO2) and carbon monoxide (CO).