Air Quality Monitoring Dashboard
For the City of Kolkata
City-Wide Air Quality Map
City Average AQI
0
UNKNOWN
Health Advisory
Loading...
Select a station from the "City Overview" map to see detailed trends.
Customize AQI Levels & Advisories
Select a station from the "City Overview" map to see detailed trends.
`; }; const renderOverview = () => { const fieldMap = document.getElementById('field-map'); fieldMap.innerHTML = ''; let aqiSum = 0, stationCount = 0; sourceData.stations.forEach(station => { const latestReading = sourceData.readings .filter(r => r.StationID === station.StationID) .sort((a, b) => b.Timestamp - a.Timestamp)[0]; if (latestReading) { aqiSum += latestReading.AQI; stationCount++; const aqiInfo = getAqiInfo(latestReading.AQI); const dot = document.createElement('div'); dot.className = 'station-dot'; dot.style.left = `${station.Lon}%`; dot.style.top = `${station.Lat}%`; dot.style.backgroundColor = aqiInfo.color; dot.textContent = latestReading.AQI; dot.onclick = () => showStationDetails(station.StationID); dot.innerHTML += `${station.StationName}`; fieldMap.appendChild(dot); } }); const cityAvgAqi = stationCount > 0 ? Math.round(aqiSum / stationCount) : 0; const cityAqiInfo = getAqiInfo(cityAvgAqi); document.getElementById('city-avg-aqi').textContent = cityAvgAqi; document.getElementById('city-aqi-level').textContent = cityAqiInfo.name; document.getElementById('city-aqi-card').style.backgroundColor = cityAqiInfo.color; document.getElementById('health-advisory-text').textContent = cityAqiInfo.advice; }; const showStationDetails = (stationId) => { const station = sourceData.stations.find(s => s.StationID === stationId); const allReadings = sourceData.readings.filter(r => r.StationID === stationId).sort((a,b)=> a.Timestamp - b.Timestamp); const latestReading = allReadings[allReadings.length - 1]; const view = document.getElementById('station-detail-view'); if (!station || !latestReading) { view.innerHTML = `No data available for this station.
`; return; } let tableHTML = `| Pollutant | Value (µg/m³) |
|---|---|
| ${p} | ${latestReading[p] || 'N/A'} |
