A real-time and historical air quality monitoring dashboard built with Python, Dash, Plotly, and DuckDB.
This project is a live-updating dashboard that visualizes air quality data from OpenAQ (or other sources). It processes both real-time and historical air pollution data, stores it efficiently using DuckDB, and presents it in an interactive Dash (Plotly) dashboard.
Key features: ✅ Real-time data updates (pollutant levels, AQI, trends) ✅ Historical data analysis (time-series trends, comparisons) ✅ Scalable data pipeline (easily add new locations without downtime) ✅ Efficient storage with DuckDB (fast querying, low overhead) ✅ Interactive visualizations with Plotly & Dash
Category | Tools/Libraries |
---|---|
Backend | Python, DuckDB (for lightweight SQL-based storage) |
Dashboard | Plotly, Dash (for interactive web visualizations) |
Data Tools | Pandas (data processing), DBeaver (DB management) |
Data Source | OpenAQ API (or other air quality APIs) |
git clone https://github.com/YVandana/Live-Dashboard-for-Air-Quality-Data.git
cd Live-Dashboard-for-Air-Quality-Data
python -m venv venv
source venv/bin/activate # Linux/Mac
.\venv\Scripts\activate # Windows
pip install -r requirements.txt
- Rename
config.example.py
toconfig.py
and add your OpenAQ API key (if required) - Modify
data_pipeline.py
to adjust data fetching intervals or locations
python app.py
Visit http://127.0.0.1:8050/ in your browser
-
Fetching Data
- The app pulls real-time air quality data from OpenAQ (or another source)
- Historical data is stored in DuckDB for fast querying
-
Processing & Storing
- Data is cleaned and structured using Pandas
- DuckDB provides lightweight, SQL-based storage (no need for a full DB server)
-
Dashboard Updates
- The Dash app refreshes at a set interval (e.g., every 10 minutes)
- Users can filter by:
- Location (city, country)
- Time range (last 24h, 7 days, custom range)
- Pollutants (PM2.5, PM10, O₃, NO₂, etc.)
✔ Live AQI (Air Quality Index) gauge ✔ Time-series trends for pollutants ✔ Geographical heatmap (if location data is available) ✔ Comparison between multiple stations ✔ Export data (CSV/JSON)
The pipeline is designed to dynamically include new air quality stations without restarting.
- Edit
config.py
to include new city/station IDs - The data fetcher will automatically incorporate them in the next update cycle
- The dashboard will show them in the location dropdown
Want to improve this project? Contributions are welcome!
- Fork the repository
- Create a new branch (
git checkout -b feature/new-location-support
) - Commit your changes (
git commit -m "Add support for new data source"
) - Push to the branch (
git push origin feature/new-location-support
) - Open a Pull Request
For questions or feedback: 📧 Email: [vandanayalla321@gmail.com]
- OpenAQ – Open air quality data
- DuckDB – Lightweight analytical database
- Plotly Dash – Dashboard framework
Enjoy monitoring air quality in real-time! 🌍💨