- The color-changing of the orangutan’s face is now automated by fetching from the overall_score in the database
- Created backend login with api connectors and data simulations
- Implemented metrics and index calculations based on WHO and EU targets (aligned with Green City Accord Indicators Guidebook (2024))
- Implemented Database Infrastrucure in Supabase
- New concept using a video to project animal faces
- Those faces can change color (red/orange/green) based on the index of Aarhus Green City Index (WIP, not yet implemented)
- Put the 3D concept in the legacy folder
- A website concept with a 3D object of a low-poly tree
- Featuring window tracking with phone
The Aarhus Green City Index (AGCI) is a comprehensive environmental monitoring system that collects, processes, and visualizes sustainability metrics for the city of Aarhus, Denmark. The system generates an environmental health score across five key dimensions:
- Air Quality
- Water Management
- Nature & Biodiversity
- Waste & Circular Economy
- Noise Pollution
The results are visualized through an interactive installation featuring animal faces that change colors (red/orange/green) based on the environmental scores.
agci/
├── backend/
│ ├── collectors/ # Data collectors for each environmental dimension
│ ├── pipeline/ # Data processing and index calculation
│ ├── storage/ # Database interaction (Supabase)
│ ├── installation/ # Physical installation controllers
│ └── tests/ # Test scripts
├── data/processed/ # Storage for processed index data
├── legacy/ # Previous version of the frontend (3D tree)
└── [frontend files] # Current frontend (HTML, CSS, JavaScript)
The system uses Supabase as its backend database with the following tables:
-
raw_metrics
:id
(uuid): Primary keydimension
(text): Environmental dimension (air, water, nature, waste, noise)metric_name
(text): Metric identifiervalue
(float): Raw measured valueunit
(text): Measurement unitsource
(text): Data source (API or Simulated)collection_timestamp
(datetime): Collection time
-
normalized_scores
:id
(uuid): Primary keydimension
(text): Environmental dimensionmetric_name
(text): Metric identifierraw_value
(float): Original raw valuenormalized_score
(float): Score from 0-100calculation_method
(text): Method used for normalizationdate
(date): Calculation date
-
dimension_scores
:id
(uuid): Primary keydate
(date): Calculation datedimension
(text): Environmental dimensionscore
(float): Normalized dimension score
-
green_city_index
:id
(uuid): Primary keydate
(date): Calculation dateoverall_score
(float): Overall index scoreair_score
(float): Air quality scorewater_score
(float): Water management scorenature_score
(float): Nature & biodiversity scorewaste_score
(float): Waste & circular economy scorenoise_score
(float): Noise pollution scoretarget_score
(float): Target score for comparison
The system collects data for each environmental dimension using specialized collector classes:
Class: AirQualityCollector
Data Source: Real-time air quality data from Open-Meteo API (https://air-quality-api.open-meteo.com/v1/air-quality
)
Metrics:
- PM2.5 particulate matter concentration (μg/m³)
- PM10 particulate matter concentration (μg/m³)
- NO2 nitrogen dioxide concentration (μg/m³)
Normalization:
- PM2.5: 100 points at 5μg/m³ (WHO guideline), 0 points at 25μg/m³ (EU limit)
- PM10: 100 points at 15μg/m³ (WHO guideline), 0 points at 40μg/m³ (EU limit)
- NO2: 100 points at 10μg/m³ (WHO guideline), 0 points at 40μg/m³ (EU limit)
Class: WaterManagementSimulator
Data Source: Simulated data based on Danish water consumption patterns
Metrics:
- Water consumption (liters per capita per day)
- Infrastructure Leakage Index (ILI)
- Treatment compliance with EU directives (%)
Normalization:
- Water consumption: 100 points at 100L/capita/day, 0 points at 200L/capita/day
- ILI: 100 points at 1.0 (no leakage), 0 points at 6.0
- Treatment compliance: 100 points at 100% compliance, 0 points below 50% compliance
Class: NatureBiodiversitySimulator
Data Source: Simulated data with seasonal variations
Metrics:
- Protected area percentage (%)
- Tree canopy coverage (%)
- Bird species change percentage (%)
Normalization:
- Protected area: 100 points at 10%+, 0 points at 0%
- Tree canopy: 100 points at 30%+, 0 points at 5% or below
- Bird species change: 100 points at +20%, 0 points at -20%
Class: WasteSimulator
Data Source: Simulated waste data with seasonal and holiday patterns
Metrics:
- Waste generation per capita (tonnes/year)
- Recycling rate (%)
- Landfill rate (%)
Normalization:
- Waste per capita: 100 points at 0.2 tonnes/year, 0 points at 0.7 tonnes/year
- Recycling rate: Direct percentage (100% recycling = 100 points)
- Landfill rate: 100 points at 0%, 0 points at 60%+
Class: NoiseSimulator
Data Source: Simulated noise data with daily and seasonal patterns
Metrics:
- Population exposed to Lden ≥ 55 dB (%)
- Population exposed to Lnight ≥ 50 dB (%)
- Population with high sleep disturbance (%)
Normalization:
- Lden exposure: 100 points at 0%, 0 points at 40%+
- Lnight exposure: 100 points at 0%, 0 points at 40%+
- Sleep disturbance: 100 points at 0%, 0 points at 25%+
The Green City Index is calculated in three steps:
-
Raw Data Collection: Each collector generates or retrieves metrics for its environmental dimension
-
Normalization: Raw metrics are converted to normalized scores (0-100) based on their respective thresholds
-
Index Calculation:
- Each dimension score is the average of its normalized metrics
- The overall index is a weighted average of the five dimension scores
- Default weights are 20% per dimension
-
Database Type Mismatch: There's a type mismatch when inserting into the
green_city_index
table. The error occurs because floating-point values are being sent to an integer column:Failed to store index: {'code': '22P02', 'details': None, 'hint': None, 'message': 'invalid input syntax for type integer: "100.0"'}
-
Missing Dimension Scores: The code attempts to store individual dimension scores, but there's no evidence in the logs that the
store_dimension_score()
method is being called correctly.
The frontend visualizes the Green City Index through:
- Animal Faces: Digital projections that change expressions and colors based on environmental scores
- Color System:
- Green (70-100): Excellent environmental conditions
- Orange (40-69): Moderate environmental conditions
- Red (0-39): Poor environmental conditions
- Background Effects: Dynamic sky effects that change based on time of day and index values
- Python 3.8+
- Supabase account with project set up
- Environment variables for Supabase access:
-
SUPABASE_URL
-
SUPABASE_KEY
-
in the root of the directory create
.env
file with these two environment variables
-
- Clone the repository
- Install dependencies:
pip install -r backend/requirements.txt
- Configure Supabase credentials as environment variables
- Run initial setup:
python -m backend.storage.setup_database
- Execute data collection:
python -m backend.pipeline.green_city_index
- Test Supabase connection:
python -m backend.tests.test_supabase_connection
- Test simulations:
python -m backend.tests.test_simulation
-
Database Connection Errors:
- Verify Supabase credentials are correctly set
- Check if Supabase service is running
-
Missing Data:
- Verify that all collectors are running properly
-
Type Mismatch in Database:
- Ensure Supabase table schemas match expected types:
- Score columns should be
float8
ornumeric
notinteger
- Score columns should be
- Adjust normalization functions if needed
- Ensure Supabase table schemas match expected types: