SaafHawa — Know Your Air. In Your Language.
AI for Civic Innovation Hackathon 2026 Code for Pakistan × Grey Software × Scrimba × FAST NUCES Islamabad
Theme alignment
SaafHawa addresses two of the three hackathon themes:
- Technology for Civic Good — uses AI to tackle a daily public-health challenge (air pollution) and improve how life-protecting guidance reaches ordinary citizens.
- Open Data & Access to Information — takes public, open air-quality data that most people can't interpret and makes it transparent, actionable, and accessible in the language they actually think in.
Inspiration
Pakistan's cities sit near the top of every "most polluted air" list in the world, and the people who pay the price are the ones least equipped to read the data — parents deciding on a school run, an elderly relative breathing through a smoggy morning, a pregnant woman, a delivery rider working outdoors all day, anyone with asthma or pollen allergy.
Public AQI data already exists. The gap isn't measurement — it's interpretation. Today the answer to "is the air safe for my child right now?" is a three-digit number and a color, in English, with no idea what to actually do. SaafHawa closes that last mile: it takes the open data citizens already pay for and turns it into a clear, personal, bilingual decision — what to do, why it matters, in the language people actually think in.
What it does
SaafHawa is an AI layer on top of public air-quality data. You tell it who's in your home; it reads today's local AQI and turns it into a clear, plain-language decision in English and Urdu — a one-line verdict, 3–4 concrete steps, and the why. It also answers everyday questions ("is it safe to walk to school now?") grounded in your air level and household. If the network or an API fails, a graceful offline fallback still delivers useful bilingual guidance, so advice always loads.
The problem & why it matters
- Citizens can see an AQI number but get no guidance on what to do, so daily health decisions are made blind.
- One-size-fits-all: a toddler, an asthmatic grandparent, and a healthy adult need different advice; existing tools give one.
- Language barrier: guidance is English-only when most caregivers think in Urdu.
- Air pollution is a public-health crisis; the people most at risk are the least served by the data that already exists.
How the solution works
- User picks an area (Lahore / Karachi) and sets a household profile.
- Backend pulls live AQI from open air-quality data (WAQI), with an honest EPA health category and a fallback air source.
- The AQI + category + household context is sent to an LLM, which returns a bilingual verdict JSON (verdict, steps, why — EN + Urdu).
- Results are cached; a deterministic rule-based plan covers any outage.
- The frontend renders the verdict in both languages; an ask-anything chat handles follow-ups.
(Architecture and request-flow diagrams are in the repo assets/.)
Who benefits
Caregivers in air-sensitive households across Lahore, Karachi & Islamabad — families with young children, elderly members, pregnant members, people with pollen/environmental allergies or heart/lung conditions, and outdoor workers.
Potential impact & scalability
- Impact: converts open data most people can't act on into a clear, per-person, bilingual decision — protecting the citizens most vulnerable to polluted air.
- Scales by city: works for any location with a public AQI station — extends across Pakistan and beyond with no code change, just configuration.
- Scales by reach: planned WhatsApp/SMS delivery puts guidance on any phone, no app or smartphone required — critical for low-income and rural users.
- Scales by language: the bilingual layer generalizes to additional local languages.
- Scales by cost: built entirely on a free stack (open AQI API, free-tier LLM, SQLite), so running cost stays near zero as usage grows.
AI component
- Tools / models: a large language model (Groq, Llama 3.3 70B via an OpenAI-compatible API) for interpretation and bilingual generation; structured JSON-mode output enforcing the verdict schema.
- Why AI is appropriate: turning a raw pollution number into safe, personalized, plain-language advice for a specific household — in two languages — is a reasoning + natural-language-generation problem that rules or templates can't cover at the needed nuance and fluency, especially for natural Urdu.
- How AI improves the solution: existing apps stop at displaying data; AI interprets it per person, in local language, instantly — the entire value-add. It also powers the grounded ask-anything assistant.
Tech stack ("Built with")
FastAPI · Python · Groq (Llama 3.3 70B) · WAQI / aqicn open air data · SQLite · HTML / Tailwind CSS · Pydantic.
Challenges we ran into
- Urdu Nastaliq rendering. Most rendering paths don't shape RTL Urdu correctly — letters render disconnected or left-to-right. We had to go through HarfBuzz/Raqm to get the script to actually look like Urdu, both in our backend's font output and the frontend.
- Making the LLM output safe to put in a UI. Free-form prose is unusable; we locked the model to JSON mode against a strict schema so the frontend can render the verdict, steps, and why without parsing surprises.
- Natural Urdu, not "translated English." Early prompts produced Urdu that read like a literal translation — technically correct, unnatural for a caregiver. Took several iterations of system-prompt constraints to get sentences that feel native.
- Keeping advice flowing when things break. Open AQI APIs go down, free-tier LLMs hit rate limits, and Pakistani Wi-Fi is unreliable. We built a chain — cache → primary source → secondary source → last-known-good — plus a deterministic rule-based plan, so the app never shows a blank screen during a demo.
- Parallel work without collisions. Two people building backend and frontend in the same week needed a single source of truth. We froze the JSON contract on Day 1 in
models.py; everything else flowed from that.
Accomplishments that we're proud of
- A working end-to-end product, not a slide deck: live AQI → AI interpretation → bilingual output → graceful fallback, all three endpoints tested.
- Urdu output that reads natural, not machine-translated — actually useful to the people we're building for.
- Offline-safe by design: even with zero API keys and no internet, the app still returns useful bilingual guidance. Demo-proof.
- Per-household personalization you can see working — toggle a profile on stage and the plan visibly changes. The AI's value is legible to a non-technical judge in five seconds.
- A genuinely zero-cost civic stack: open AQI data, free-tier LLM, SQLite. Anyone in Pakistan can fork this and run it for their own city.
What we learned
- Civic tech isn't about more data — it's about interpretation. The AQI was already public; the gap was making it actionable in the right language for the right person.
- Designing for failure is the product. In Pakistan's network reality, "what happens when an API dies" is the feature that decides if a system is real or a demo.
- JSON-mode + a strict schema is what makes LLMs deployable. Without it you get prose; with it you get a contract.
- Urdu in tech is still under-served. Building right means treating it as a first-class output, not a translation toggle bolted onto an English UI.
- Freeze the contract first. Two people can ship a working product in a week if the data shape between them is locked on day one.
What's next for SaafHawa
- Live low-cost sensor integration
- WhatsApp / SMS delivery
- next-day forecast
- more cities
- additional local languages.


Log in or sign up for Devpost to join the conversation.