SaafSaans:每個數字均經計算而非猜測的家庭霧霾應對計劃
SaafSaans: a family smog plan where every number is worked out, not guessed
SaafSaans 為家庭制定冬季空氣污染應對計劃,按住址、家庭成員健康狀況和日常習慣,提供外出時段、室內空氣改善及交通選擇建議。Gemini 負責挑選並解釋合適的改變,所有數字則由經測試的程式碼計算;若 Gemini 無法使用,確定性排序器仍可提供數字和範本文字。應用程式支援英語、印地語和泰盧固語。
SaafSaans: a family smog plan where every number is worked out, not guessed
PromptWars Virtual, Challenge 6: Urban Air Quality Assistant
Try it: https://saafsaans-382086946715.asia-south1.run.app
Code: https://github.com/aravind-showcasemetech/saafsaans

The home page: today's air for Kukatpally, Hyderabad, and what the app will do for your family.
Every winter the same advice goes around: "the air is bad, stay indoors". It is true, and it is not
much use. It does not tell a family in Kukatpally whether the grandmother's 6 am walk is the worst
or the best time of her day, whether a bedroom purifier is worth buying, or what taking the metro
actually changes.
Challenge 6 asked for a GenAI assistant that helps families and communities through winter smog:
low-emission routines, indoor air hacks and sustainable alternatives, tailored to where they live
and how they live, while clearly explaining the direct impact of their choices. That last line
is where I put most of the work.
What SaafSaans does
You tell it where you live and who is at home: ages, anyone with asthma or a heart condition, a
pregnancy, who commutes and how, the bedroom size, whether you burn incense or mosquito coils.
It then walks you through today's plan, one full screen at a time, each named after part of the
brief:
- Your air today: the live AQI on India's CPCB scale, in words, with what that band means for the people in your home.
- A low-emission daily routine: the next 48 hours, hour by hour, with the cleanest and dirtiest windows marked, and what moving one walk changes.
- Indoor air hacks: how outdoor air gets into a room, a purifier size calculator, and the smoke you make indoors.
- Sustainable alternatives: the same trip by car and by metro, in kilometres and kg of CO2.
- The impact of your choices: each person's numbers, updating as you tick changes on and off.
- Share it with your community: a WhatsApp message for your housing society, with a "homes taking part" total.
Every screen says what it shows and what you can do, and ends with one clear action. The whole app
works in English, Hindi and Telugu.

How a plan is made: Gemini picks and explains, tested code computes every number.
The rule behind it: Gemini decides, code computes
Language models are good at reading a situation and explaining it kindly. They are bad at
arithmetic, and worse, they are confident about numbers they made up. For an app about what your
family breathes, that is not acceptable.
So SaafSaans splits the work:
- Gemini chooses which changes fit this family and writes one or two plain sentences on why, in the family's language. It is never allowed to write a number: if a reply contains a digit in any script, our own template text replaces it. It never gives health advice either.
- Tested code computes every number: a 24-hour exposure model for each family member, a single-room indoor air model, purifier sizing, and transport emissions.
- Every factor has a published source: India's National AQI from CPCB, breathing rates from the US EPA Exposure Factors Handbook, the cigarette comparison from Berkeley Earth, purifier sizing from AHAM and the US EPA, and India-specific transport factors from the India GHG Program. Where I had to choose a value inside a published range, the app labels it "Estimate".
If Gemini is slow or unavailable, a deterministic ranker returns the same numbers with plain
template text, so the app never depends on the model to work.
Things the numbers taught me
The next 48 hours, with the cleanest and dirtiest windows marked.
- Morning is usually the worst time for a walk in winter. Research on Indian cities, including Hyderabad, finds PM2.5 lowest in the late afternoon, when the air mixes higher. SaafSaans reads the live forecast, names today's windows, and shows what moving a walk changes for each person, even when the gain is small.
- Shutting the windows alone does surprisingly little. In the room model it only brings a bedroom from about 92% of outdoor PM2.5 to about 81%. A purifier of the right size with the windows shut takes it to roughly 21%. That one comparison changed how I think about winter nights.
Indoor air hacks: how outdoor air gets in, and the purifier size your room needs.
- One mosquito coil releases as much PM2.5 as burning 75 to 137 cigarettes (Liu et al., 2003).
- Hyderabad is not Delhi. On the night I checked, Kukatpally read 82 (Satisfactory) while Dwarka in Delhi read 181 (Moderately polluted). So the Hyderabad demo is about the sensitive people at home, a child with asthma and a grandmother, because CPCB's own statement for those bands names them.
Under the hood
Browser, Google Cloud Run in Mumbai, and Google's Gemini, Air Quality, Places and Routes APIs.
SaafSaans is one TypeScript codebase: a small Hono server on Google Cloud Run in Mumbai, serving a
plain TypeScript front end and a JSON API. The same calculation code runs on the server and in the
browser, so the family totals update the moment you tick a change, with no extra request.
Google technology, end to end:
- Gemini API: chooses and explains the changes, as schema-checked JSON, in English, Hindi and Telugu.
- Google Maps Platform Air Quality API: live AQI on India's CPCB index, a 48-hour hourly forecast, and health recommendations for children, older adults, pregnancy, and lung and heart conditions.
- Places API (New): location search. Routes API: commute distances.
- Cloud Run hosts it, Secret Manager keeps the API keys on the server, and Cloud Build with Artifact Registry builds and stores the container on every deploy.
- Google Fonts: Anek and Noto Sans, so Telugu and Hindi headings look as good as English ones.
Safety and privacy: no accounts and no database; nicknames never leave the browser; locations
are rounded to about 1 km; a strict Content Security Policy and security headers; per-IP rate
limits; every input validated; and the model's output treated as untrusted.
How I built it
I wrote the spec before any code: the brief mapped to features, the impact model, a list of every
sourced figure, a design direction, and a rules file for the coding agent. I developed SaafSaans
with Google Antigravity, phase by phase: the calculations first, with hand-worked reference
values as tests, then live Google data, then Gemini, then the screens, translations and hardening.
The most useful habit was reviewing every phase against the spec before moving on. Those
reviews caught real bugs that tests had missed: a ranking that was hard-coded to pass its own test,
numbers typed into text instead of computed, a browser and server that disagreed on field names so
every card showed "NaN", and a phone layout that silently hid its own overflow.
Quality, measured: 150 unit and server tests, including hand-worked reference values for every
formula; 45 Playwright end-to-end tests with zero axe accessibility violations in all three
languages; Lighthouse accessibility 100 on the live site; and CI that runs the checks, a Docker
smoke test, npm audit and a secret scan on every push.
The same plan in Telugu, on a phone.
Try it
Open https://saafsaans-382086946715.asia-south1.run.app, tap Try a Hyderabad family, then
switch to తెలుగు or हिन्दी. Untick the bedroom purifier and watch the family totals change.
I would love feedback, especially from people who read Telugu and Hindi, and from anyone who knows
air quality better than I do.
#PromptWars #BuildWithAI #GoogleAntigravity #Gemini #GoogleCloud
來源:DEV Community · dev.to



