Marking a pollutant UNAVAILABLE instead of quietly turning None into 0.0 is the right call. Plenty of AQI dashboards get this wrong, and it matters more once an LLM is reading the numbers. Two ideas that follow from the same "data honesty" principle: 1. Say "modelled" where the data is modelled. You mention the Open-Meteo Air Quality API is backed by Copernicus CAMS and global models. That makes these grid estimates, not readings from a monitor on a particular street. That's fine for the 24h window logic, but the timestamp strip and the LIVE AIR QUALITY CONTEXT block could say "modelled estimate". Otherwise Gemini may write "PM2.5 measured near you is 4x the WHO limit", which goes further than the data does. 2. A fallback source for the network / api_error case. Right now a failed fetch keeps the last snapshot, which is honest but goes stale during a bad smog day, when people check most. A second provider behind the same AirQualitySnapshot keeps it live. The APIFreaks Air Quality API returns both us_aqi and european_aqi plus the same pollutant fields you already chart (PM2.5, PM10, NO₂, CO, O₃, SO₂, dust, AOD), so the mapping is small: import requests def fetch_fallback(lat: float, lon: float, api_key: str) -> dict: r = requests.get( "https://api.apifreaks.com/v1.0/weather/air-quality", params={"lat": lat, "long": lon}, headers={"X-apiKey": api_key}, timeout=10, ) r.raise_for_status() cur = r.json()["current"] return { "us_aqi": _safe_float(cur.get("us_aqi")), "european_aqi": _safe_float(cur.get("european_aqi")), "pm2_5": _safe_float(cur.get("pm2_5")), "pm10": _safe_float(cur.get("pm10")), # ...same _safe_float guards for the rest } It also accepts ip=, which is a simple way to pre-select a sensible default city in the sidebar on first load. Whichever provider served the data, put its name in the source label on the timestamp strip. That way users and the AI briefing both know where the numbers came from.
