PromptWars Virtual Challenge 06 — Vayu (Urban Air Quality Assistant)
Live link: vayu-aqi.netlify.app
GitHub: github.com/HeyItsKrishna/vayu
The problem: an AQI number is not a plan
Every winter, the same question comes up in Hyderabad and Delhi: the AQI is 287 — so what? Can the kids play outside? Should an asthmatic parent walk in the evening? Is the metro worth it over the car today?
An AQI number alone answers none of that. The advice people actually need depends on who is in the family and how bad the air is — and it needs to explain why each choice helps, in plain language. That is what I built: a web app that turns a city and an AQI reading into a personalised, low-emission day plan for a real family.
What I built
Pick a city, set the AQI, and add your family profile — children, elderly, asthma, pregnancy, heart sensitivity, and more. The app then generates a day plan: a low-emission routine, indoor air-quality hacks, and sustainable alternatives, with the direct impact of each choice explained.
It starts with Hyderabad by default (AQI 118, Moderate), with quick-pick chips for Delhi, Mumbai, Bengaluru, Chennai and Kolkata. But it is not a fixed dropdown: a search box covers a built-in directory of 42 Indian and world cities, with live suggestions showing each city's AQI band, region and indicative reading. Type something that is not there and it says exactly "City not found — try another spelling" and keeps your current city loaded.
Three things were added after the first version. Live AQI: the app fetches current PM2.5 and PM10 from Open-Meteo for the selected city and converts them to Indian CPCB AQI, labelled as a CAMS model estimate — never a ground-station reading — with a refresh button and a manual override that restores the live value. A location detector: one tap finds the nearest city in the directory and loads its live AQI, with no auto-prompt, and the location is never stored or sent anywhere else. And a symptoms section under the plan that adapts to the band and the family profile — what to watch for, precautions, and clear triggers for when to see a doctor — with a general-information-only disclaimer on every view.
Rules first, Gemini second
The most important design decision was the split of responsibilities. A deterministic rule engine computes every number — the AQI band, the plan, and the impact stats. Gemini 3.5 Flash-Lite only explains and personalises; it never invents a number.
That matters because a health-adjacent app must not hallucinate. The rule engine uses the Indian CPCB scale for every city (0–50 Good through 401–500 Hazardous), and the prompt sent to Gemini is built from the engine's computed stats and actions, with a strict instruction not to alter them. The app shows the exact prompt it sends, so the AI layer is fully inspectable. With no API key, it falls back to a deterministic plain-language summary and still works 100% locally.
Two edge cases shaped the engine. First, AQI above 500: the slider caps at 500, the number input accepts up to 999, and anything over 500 displays as "500+ — Beyond Index" and clamps to the Hazardous band with the most protective guidance — no invented band above 500. Second, honesty about the data: the city presets are indicative late-November values, labelled as such, never presented as live sensor readings, and impact figures are planning estimates. The app also never gives a medical diagnosis; asthma and heart profiles remind you to keep prescribed medication ready and consult a doctor if symptoms worsen.
Design: the whole app changes colour with the air
I wanted the severity to be felt, not just read. The entire application re-themes with the AQI band, using only the exact Google colours: Green #34A853 for Good, Yellow #FBBC05 for Moderate, Red #EA4335 for Hazardous, with Blue #4285F4 for primary buttons and accents. It is a bold, animated look — solid colours, thick ink borders, hard offset shadows, oversized Archivo headlines, a scrolling AQI ticker — with no frosted glass, no backdrop blur, and no cursor-following orb. The one playful touch is a small ring that ripples out from each click, tinted to the current band colour.
How I verified it
I did not trust the build tool's own test report. I ran the rule engine independently in Node: 43 checks, all passing, including every CPCB boundary (50/51, 100/101, 200/201, 300/301, 400/401, 500), the 650 AQI clamp to "500+ — Beyond Index", plans that genuinely adapt — a clean-air plan, a Delhi 287 plan with children and asthma (N95, move play indoors), and a 650 plan that opens with stay-indoors emergency guidance — plus the CPCB conversion of live PM2.5/PM10 readings (12→20, 35→58, 120→300), nearest-city detection, and symptoms that adapt to band and family profile. That verification caught a real bug: the build had used the wrong Open-Meteo address, which would have made live AQI silently fall back to presets forever. It was fixed to the correct host and confirmed against the live API (Hyderabad 63, Moderate; Delhi 329, Very Unhealthy). I also checked the files for the exact Google hexes, zero backdrop-filter / rgba / hsla, the exact "City not found" string, and no API key anywhere — the key, when entered, lives in sessionStorage only.
What is still unproven: a live Gemini call with a real key — the summary falls back to the deterministic text until one is entered. That is the last check, on the deployed link, before I call this done.
What I would build next
Voice: the same family profile and rule engine, asked aloud — "is it safe for my asthmatic mother to walk in Gachibowli this evening?" — with a spoken plan back. That is the direction I am taking into the Build with Google Gemini hackathon.
Built with plain HTML, CSS and JavaScript — no build step, no framework. Rule engine: rule-engine.js. Gemini layer: gemini.js (gemini-3.5-flash-lite). Architecture, prompt design and setup are documented in the repo README.

