This is a submission for the MLH x DEV Writing Challenge.

What I Built

Every winter, millions of families and urban residents across metropolitan cities like Delhi-NCR, Lahore, Beijing, and Salt Lake City wake up engulfed in toxic winter smog.

The invisible culprit behind this seasonal emergency is atmospheric thermal inversion: as the earth's surface cools rapidly at night, a heavy lid of cold air traps vehicular exhaust, industrial particulates, and biomass smoke near the ground. Airborne fine particulates ($PM_{2.5}$) frequently surge past $350\ \mu\text{g/m}^3$—forcing toxic soot deep into human lung alveoli.

To combat this public health challenge, I built AuraAir — an intelligent, context-aware Urban Air Quality and Winter Smog Defense Assistant designed to help households, commuters, and community leaders make science-grounded decisions during severe smog episodes.

GitHub logo swatiicfai / PromptWars-Challenge-6

GenAI Urban Air Quality & Winter Smog Defense Assistant built with Google Gemini 2.0 Flash for PromptWars Virtual (Challenge 6).

AuraAir – Urban Air Quality & Winter Smog Defense Assistant

PromptWars Virtual: [Challenge 6] Urban Air Quality Assistant
An intelligent, context-aware GenAI application engineered to help families and urban communities navigate severe winter thermal inversions, minimize toxic particulate exposure ($PM_{2.5}$), and adopt high-impact low-emission lifestyles.

Live Demo Demo Video CI Pipeline Tests Passing Linting GenAI Accessibility Repo Size License

🔗 Quick Links

🌟 Chosen Vertical & Problem Context

Chosen Vertical: Urban Air Quality & Public Health Assistant (PromptWars Challenge 6)

Urban winter smog presents an acute public health crisis across major metropolitan centers. Cold air thermal inversions trap ground-level vehicular soot, industrial emissions, and particulate matter beneath warmer upper layers, concentrating $PM_{2.5}$ to hazardous levels ($> 300\ \mu\text{g/m}^3$).

AuraAir solves this by providing:

  1. Dynamic Dual-Standard Telemetry & Live Context Decision Engine: Computes both US EPA AQI and Indian CPCB NAQI classifications across $PM_{2.5}$, $PM_{10}$…

Key Capabilities

  1. Dual EPA AQI & Indian CPCB NAQI Engine: Deterministic linear sub-index calculation bridging EPA and Indian National Air Quality Index (NAQI) standards across $PM_{2.5}$, $PM_{10}$, and $NO_2$, complete with monotonic inter-bracket interpolation.
  2. 24-Hour Diurnal Thermal Inversion Forecaster: Predicts the diurnal boundary-layer inversion cycle, identifying morning and evening smog trap peaks ($06:00 - 09:30$ and $19:00 - 23:00$) alongside the midday convective ventilation dip ($12:30 - 15:30$) when solar heating dilutes ground-level pollution.
  3. Live Context Decision Engine: Instant, reactive verdicts for Ventilate Now, N95 Mask Required, and Outdoor Cardio Safe adapting dynamically to location, AQI, persona sensitivity, and time of day.
  4. 5 Persona-Tailored Schedules: Customized routines for Families with Young Children, Elderly & Asthmatics, Daily Commuters, Outdoor Workers/Athletes, and Community RWAs, exportable as downloadable daily action plans.
  5. Indoor Air Quality (IAQ) DIY Blueprints: Low-cost, science-backed mitigation guides including the DIY Corsi-Rosenthal MERV-13 box fan ($<\$35$), wet-baffle passive filtration, kitchen combustion compartmentalization, and nocturnal CAM phytoremediation plants (Sansevieria).
  6. Quantifiable Health & Carbon Impact Engine: Computes exact avoided $PM_{2.5}$ lung deposition ($\mu\text{g}$) using ICRP respiratory minute ventilation rates ($V_E$), translates particulate mass into Berkeley Earth cigarette equivalents, and measures commute $CO_2e$ savings against IPCC/Defra transport factors.

Demo

Experience AuraAir live in your browser:

Partner Technologies

AuraAir is powered by Google Gemini through the Interactions API (POST /v1/interactions), integrated with strict security and zero-data-leakage architecture:

1. Context-Chained GenAI Assistant (Gemini Interactions API)

  • Model Orchestration: Utilizes primary reasoning with automatic fallback on HTTP 404/429 errors to guarantee zero user downtime.
  • Context-Chained Prompt Assembly: The assistant chains live city telemetry, EPA/NAQI category, pollutant readings, diurnal inversion phase, and the user's active persona into structured system instructions.
  • Multi-Turn Memory & Cache: Maintains bounded conversational history with LRU session caching (using conversation fingerprints) and client-side 600ms rate serialization to eliminate duplicate network overhead.
  • Intelligent Offline Heuristic Fallback: If an API key is omitted or the user is offline, AuraAir seamlessly switches to an internal deterministic expert engine providing medically-grounded advice with zero network dependencies.

2. Defense-in-Depth Security & Privacy

  • Strict Content Security Policy (CSP): Enforces default-src 'self'; script-src 'self'; style-src 'self'; object-src 'none' with zero 'unsafe-eval' or 'unsafe-inline', preventing script injection.
  • Volatile Credential Isolation: Optional Gemini API keys are held strictly in browser sessionStorage (purged automatically when the browser tab closes) and passed solely via the x-goog-api-key header with store: false to ensure queries are never stored server-side.
  • Prompt Injection Guardrails: User queries are isolated inside <user_scenario> XML wrappers, while a 5-pass fixed-point regex sanitizer strips nested pseudo-protocols, inline event handlers, and injected boundary tags.

3. Progressive Web App (PWA) & Zero-Dependency Web Architecture

  • PWA Service Worker (sw.js): Cache-first offline shell caching allowing full offline utility for all telemetry, inversion forecasts, impact math, and routine exports.
  • High-Performance Codebase: Built with vanilla, standards-compliant JavaScript (UMD pattern), responsive glassmorphic CSS, and zero external npm or CDN runtime bloat (< 400 KB total repository footprint).
  • WCAG 2.1 AA/AAA Accessibility: Includes high-contrast AAA toggle, patterned colorblind mode, aria-live polite screen-reader announcements, and full WAI-ARIA keyboard navigation (ArrowLeft/ArrowRight/Home/End).

Hackathon Experience

Building AuraAir during the hackathon was an intense, rewarding deep dive into environmental data science, respiratory physiology, and responsible AI system design.

What I Learned

  1. Deterministic Science Beats LLM Hallucinations for Critical Math: Rather than asking an AI model to guess breakpoint formulas or calculate minute ventilation doses, calculating EPA/NAQI tables, ICRP inhalation physics, and Defra emission factors in deterministic JavaScript modules guarantees 100% reproducible scientific accuracy. The LLM shines best at contextual reasoning, empathetic communication, and tailored behavioral guidance.
  2. Engineering for Constrained Environments: Designing for zero runtime dependencies, a sub-10 MB repo size, and full offline PWA functionality forced clean architectural decisions. Moving all Service Worker lifecycle hooks into modular scripts eliminated CSP inline warnings and gave the app instant sub-100ms first paint times.
  3. Automated Quality Assurance: To ensure stability across rapid hackathon iterations, I built a zero-dependency test suite in Node.js executing 265 automated unit, integration, and security tests across 14 suites—verifying everything from breakpoint gap bridging to XSS sanitization and dark-mode contrast ratios.

A huge thank you to Google for Developers and Hack2Skill for organizing this challenge and fostering a community dedicated to building practical, AI-driven solutions for real-world environmental and public health impact!