This project is an interactive air quality monitoring system designed for the Lombardy region. It processes data from Dati Lombardia and includes:
- A PostgreSQL/PostGIS spatial database
- A Flask REST API for data access
- A Dash web app for interactive visualization
├── create_table.py # Creates the PostgreSQL schema and tables
├── manage_data.py # Loads and cleans data into PostgreSQL
├── app.py # Flask REST API
├── dash_app.py # Dash dashboard frontend
├── /docs # Documentation
├── /data # Raw input CSV files
git clone https://github.com/<your-username>/air-quality-dashboard.git
cd air-quality-dashboardpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Create the database:
CREATE DATABASE se4geo;
\c se4geo
CREATE EXTENSION postgis;- Update database credentials in:
create_table.pymanage_data.pyapp.pydash_app.py
Run the table creation script:
python create_table.pyPlace your CSV files from Dati Lombardia into the /data folder, then run:
python manage_data.pyThis script:
- Loads sensors and their metadata
- Links sensors to pollutants
- Loads hourly measurements
- Computes daily aggregates
python app.py- Base URL:
http://localhost:5000/api - Example:
http://localhost:5000/api/sensors
python dash_app.pyThen open your browser at:
📍 http://localhost:8050
-
📍 Map Panel
Shows pollutant levels by sensor on a map (color/size-coded) -
📈 Time-Series Panel
Visualizes trends for a selected sensor (raw or daily-aggregated) -
🔎 Filters
Dropdowns for pollutant, station, date range, and resolution
- Python 3.11
- Flask 3.x
- Dash 2.x / Plotly
- PostgreSQL 17 + PostGIS 3.4
- Pandas / Requests / Psycopg2
- Python 3.8+
- PostgreSQL with PostGIS extension
- Internet browser (Chrome, Firefox, etc.)
- Sadra Zahed Kachaee
- Hananeh Asadi Aghbolaghi
- Hoda Sadat Mousavi Tabar
- Firoozeh Rahimian