<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AirAware AI–Building with Generative AI]]></title><description><![CDATA[AirAware AI–Building with Generative AI]]></description><link>https://sornambiga.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 20:10:31 GMT</lastBuildDate><atom:link href="https://sornambiga.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building AirAware AI: How I Built an Urban Air Quality Assistant with Streamlit, Open-Meteo, and Google Gemini]]></title><description><![CDATA[How I built AirAware AI for Hack2Skill PromptWars with Python, Streamlit, Open-Meteo, & Gemini—scoring 96.51/100 and ranking #32 on the leaderboard.]]></description><link>https://sornambiga.hashnode.dev/building-airaware-ai-how-i-built-an-urban-air-quality-assistant-with-streamlit-open-meteo-and-google-gemini</link><guid isPermaLink="true">https://sornambiga.hashnode.dev/building-airaware-ai-how-i-built-an-urban-air-quality-assistant-with-streamlit-open-meteo-and-google-gemini</guid><category><![CDATA[generative ai]]></category><category><![CDATA[Python]]></category><category><![CDATA[google gemini]]></category><category><![CDATA[streamlit]]></category><category><![CDATA[hack2skill]]></category><dc:creator><![CDATA[Sornambiga G]]></dc:creator><pubDate>Wed, 18 Nov 2026 13:21:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/16a475cc-12e4-4495-9cc1-4b09ea4f9888.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Live App:</strong> <a href="https://airaware-ai.streamlit.app/">https://airaware-ai.streamlit.app/</a><strong>GitHub Repository:</strong> <a href="https://github.com/sornambiga-7/AirAware-AI">https://github.com/sornambiga-7/AirAware-AI</a></p>
<hr />
<h2>Introduction: The Problem with Just Showing an AQI Number</h2>
<p>Every winter, cities like New Delhi, Lahore, and Beijing get hit by thick smog. Cold air traps vehicle exhaust, construction dust, heating smoke, and crop or leaf burning close to the ground through temperature inversions. Most weather apps will tell you something like <em>"AQI: 168 — Unhealthy"</em> and leave it at that.</p>
<p>As a college student watching people around me deal with seasonal smog every year, I noticed a gap: a raw AQI number doesn't actually tell a family what to do next. Should kids play outside after school, or wait until tomorrow morning? Is it safe to open windows for fresh air right now, or will that pull smoky air straight into the bedroom? If someone wants to cut down on car emissions by cycling to work, is cycling even safe when PM2.5 is nearly four times higher than the WHO limit?</p>
<p>That is the problem I set out to solve with <strong>AirAware AI</strong>, an Urban Air Quality Assistant I built for <strong>Hack2Skill PromptWars Challenge 6</strong>.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/e9b4b27c-d01a-4027-8304-768f86501c26.png" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: The AirAware AI Live Air Quality Dashboard displaying real-time US EPA AQI (168 · Unhealthy), European AQI, dominant pollutant (PM2.5), and live pollutant concentrations for New Delhi.</em></p>
<hr />
<h2>Why I Built AirAware AI</h2>
<p>When Hack2Skill announced PromptWars Challenge 6 around building an Urban Air Quality Assistant, I didn't want to make another basic dashboard that wraps an LLM prompt around hardcoded demo numbers. I wanted to build an app that a real family could open on a smoggy morning and trust.</p>
<p>That led to three core principles I kept throughout the project:</p>
<ol>
<li><strong>Zero fake numbers:</strong> Real-time air quality data should come directly from a live API. If a reading is missing or null for a particular city, the app must label it <code>UNAVAILABLE</code> instead of guessing or substituting <code>0</code>.</li>
<li><strong>Actionable, affordable advice:</strong> Not every household can afford multiple $300 HEPA air purifiers. Practical advice should include realistic low-cost options—like DIY Corsi-Rosenthal box fans, sealing one sleeping room, and knowing the exact hours when outdoor air is slightly cleaner.</li>
<li><strong>Transparent math:</strong> Whenever the app estimates CO₂e, NOx, or PM2.5 reductions from lifestyle choices, users should be able to see the exact formula and published emission-factor source behind every number.</li>
</ol>
<hr />
<h2>Technologies Used</h2>
<p>I chose a lightweight, Python-first stack that let me iterate fast, keep the codebase modular, and deploy cleanly for free:</p>
<ul>
<li><strong>Python (3.10+, tested on 3.13):</strong> Core language for data fetching, calculations, and application logic.</li>
<li><strong>Streamlit (</strong><code>streamlit&gt;=1.40.0</code><strong>):</strong> Frontend web framework with sidebar navigation, interactive widgets, session state, and built-in caching (<code>@st.cache_data</code>).</li>
<li><strong>Google Gemini (</strong><code>google-genai&gt;=1.0.0</code><strong>):</strong> Powers personalized air quality briefings, hour-by-hour family schedules, budget-tiered indoor air plans, and conversational Q&amp;A.</li>
<li><strong>Open-Meteo Geocoding &amp; Air Quality APIs (</strong><code>requests</code><strong>):</strong> Free, open-access APIs (no API key needed) for global city lookup and live + 48-hour air quality forecasts.</li>
<li><strong>Plotly (</strong><code>plotly&gt;=5.24.0</code><strong>) &amp; Pandas (</strong><code>pandas&gt;=2.2.0</code><strong>):</strong> Interactive radial AQI gauges, hourly forecast trajectories, WHO 2021 guideline comparison bar charts, and emissions breakdowns.</li>
<li><strong>python-dotenv (</strong><code>python-dotenv&gt;=1.0.1</code><strong>):</strong> Clean server-side environment loading for local <code>.env</code> configuration.</li>
<li><strong>pytest &amp; Streamlit</strong> <code>AppTest</code><strong>:</strong> Automated unit tests and end-to-end UI rendering tests across all six modules.</li>
</ul>
<hr />
<h2>Project Architecture &amp; How It Works</h2>
<p>Instead of putting everything into one giant script, I organized the project into clean, single-responsibility modules under <code>src/</code>:</p>
<pre><code class="language-text">AirAware-AI/
├── .streamlit/
│   └── config.toml             # Dark navy &amp; emerald theme + server security config
├── src/
│   ├── config.py               # Env/secret loading, US EPA &amp; EEA bands, WHO 2021 limits
│   ├── air_quality.py          # Open-Meteo Geocoding &amp; Air Quality API client + null safety
│   ├── gemini_assistant.py     # Google Gemini integration + deterministic fallback
│   ├── impact_calculator.py    # Source-cited eco-travel &amp; household impact math engine
│   ├── charts.py               # Interactive Plotly gauges, forecasts, and bar charts
│   └── styles.py               # Custom dark navy &amp; emerald CSS + glassmorphic UI cards
├── tests/
│   ├── test_core.py            # 10 unit tests for API parsing, math, and fallbacks
│   └── test_app_ui.py          # End-to-end Streamlit AppTest UI checks across all 6 pages
├── app.py                      # Main Streamlit dashboard &amp; navigation entry point
├── requirements.txt            # Runtime dependencies
└── .env.example                # Safe environment variable template
</code></pre>
<h3>How the Data Flows</h3>
<ol>
<li><strong>Location Resolution:</strong> A user types any city name (or picks from 10 featured global cities in the sidebar). <code>app.py</code> calls <code>cached_search_cities()</code> (cached for 10 minutes via <code>@st.cache_data(ttl=600)</code>), which queries the Open-Meteo Geocoding API and returns up to 8 matches with coordinates and timezone. If multiple cities share the same name, a disambiguation dropdown lets the user pick the right one.</li>
<li><strong>Live Air Quality &amp; Forecast Fetch:</strong> Once resolved, <code>cached_fetch_air_quality()</code> (cached for 5 minutes via <code>@st.cache_data(ttl=300)</code>) queries the Open-Meteo Air Quality API for current metrics and a 48-hour hourly forecast, bundling everything into an <code>AirQualitySnapshot</code> dataclass.</li>
<li><strong>Forecast Window Analysis:</strong> <code>summarize_forecast_windows()</code> scans the upcoming 24 hourly readings to find the cleanest contiguous 2-hour outdoor window, the peak smog hour, and how many hours stay at or below US AQI 100.</li>
<li><strong>Shared Context Across All Six Modules:</strong> That live <code>AirQualitySnapshot</code>—combined with the user's <strong>Family &amp; Home Profile</strong> from the sidebar (household groups like school children or older adults, health sensitivities like asthma, home type, purifier access, and commute mode)—drives every chart, advisory banner, AI prompt, and eco-travel recommendation. Switching cities automatically clears city-specific AI outputs from <code>st.session_state</code> so stale advice from an old city never lingers.</li>
</ol>
<hr />
<h2>Walking Through All Six Major Features</h2>
<h3>1. Live Air Quality Dashboard</h3>
<p>The landing view gives a complete picture of what is in the air right now. At the top, a data timestamp strip displays the exact local reading time, UTC fetch timestamp, data source, and how many of the 8 tracked pollutants are live.</p>
<p>Below that, an EPA color-coded Plotly radial gauge displays the live <strong>US EPA AQI</strong> alongside an advisory card with immediate outdoor and masking recommendations. Three KPI cards summarize <strong>European AQI</strong>, the <strong>Dominant Pollutant</strong> (automatically selected by highest ratio against WHO 2021 guidelines), and the <strong>Cleanest 24h Window</strong>.</p>
<p>Scrolling down reveals an 8-card pollutant breakdown covering <strong>PM2.5, PM10, NO₂, CO, O₃, SO₂, Dust, and Aerosol Optical Depth (AOD)</strong>—each clearly tagged <code>● LIVE</code> or <code>○ UNAVAILABLE</code>—followed by interactive <strong>24h / 48h US AQI forecast</strong>, <strong>Pollutants vs WHO 2021 Limit</strong>, and <strong>multi-pollutant hourly concentration</strong> charts.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/ae7e4588-85a7-4a1d-b120-626b73eeebfd.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: The 8-pollutant live grid alongside the interactive 24-hour US AQI forecast, WHO 2021 guideline ratio comparison, and multi-pollutant hourly trend charts.</em></p>
<hr />
<h3>2. AI Smart Assistant (Powered by Google Gemini)</h3>
<p>This module turns live readings into clear, household-specific guidance. Users can customize their <strong>Family &amp; Home Profile</strong> in the sidebar (for example: adults + school children, apartment living, public transit commute, or sensitivities like asthma), and then click <strong>Generate Personalized Briefing</strong>.</p>
<p>Gemini analyzes the exact live AQI, pollutant concentrations, WHO ratios, forecast windows, and household profile to produce a structured briefing covering the situation snapshot, tailored protection steps, timing/ventilation strategy, and three realistic low-emission actions. Below the briefing, <strong>Ask AirAware AI Anything</strong> provides quick-start prompt chips and a multi-turn chat interface (<code>st.chat_input</code>) that retains the last 6 conversation turns.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/e23839d2-0b6c-4a67-b21a-707a3d506906.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: The AI Smart Assistant displaying the active household personalization profile, a live Google Gemini briefing grounded in New Delhi's readings, quick prompt chips, and the interactive chat input.</em></p>
<hr />
<h3>3. Smart Daily Routine</h3>
<p>During winter inversions, air quality shifts throughout the day. The <strong>Smart Daily Routine</strong> module translates the next-24-hour Open-Meteo forecast into three scannable timing KPIs: <strong>Best 2-Hr Outdoor Window</strong>, <strong>Peak Smog Window to Avoid</strong>, and <strong>Hours with AQI ≤ 100</strong>.</p>
<p>It pairs the hourly forecast chart with two side-by-side practical columns—<strong>Practical Pollution Precautions Today</strong> (dynamically adapting mask and exercise advice based on live AQI) and <strong>Low-Emission Daily Activities</strong> (trip chaining, clean cooking, avoiding open leaf burning). Clicking <strong>Generate AI Hour-by-Hour Family Schedule</strong> prompts Gemini to map out Morning, Midday, Evening, and Night blocks tied directly to the 24-hour forecast table.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/50b73f15-8c81-4201-a430-eacaa97dccc3.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: Smart Daily Routine highlighting the cleanest 2-hour outdoor window, peak smog hour, safe ventilation count, 24-hour AQI curve, and practical daily precautions.</em></p>
<hr />
<h3>4. Indoor Air Quality Hacks</h3>
<p>Outdoor smog quickly sneaks indoors if windows are opened at the wrong time. This module leads with an automated <strong>Live Ventilation Decision</strong> banner driven directly by live US AQI:</p>
<ul>
<li><strong>AQI ≤ 50:</strong> <code>SAFE TO OPEN WINDOWS</code></li>
<li><strong>AQI 51–100:</strong> <code>SELECTIVE VENTILATION</code></li>
<li><strong>AQI 101–150:</strong> <code>LIMIT OPENING · FILTER INDOORS</code></li>
<li><strong>AQI &gt; 150:</strong> <code>KEEP WINDOWS SEALED</code></li>
</ul>
<p>Below the banner is a 6-card grid of evidence-backed, affordable indoor clean-air solutions: building a <strong>DIY Corsi-Rosenthal Box Filter</strong> (box fan + MERV-13 filters), setting up <strong>One Dedicated Clean-Air Room</strong> for overnight lung recovery, switching to <strong>Wet Mopping Over Dry Sweeping</strong>, <strong>Zero-Smoke Kitchen Habits</strong>, an <strong>Entryway Pollution Trap</strong>, and maintaining <strong>40%–50% Indoor Humidity</strong>. Users can track their preparation with an interactive <strong>Tonight's Clean-Air Home Checklist</strong> (with a live readiness progress bar) and generate a <strong>budget-tiered AI Indoor Clean-Air Plan</strong> (Zero-cost, Low budget, or Moderate budget).</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/8a18cead-028c-4e66-96ff-b6b9e1727acc.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: Indoor Air Quality Hacks featuring the live AQI-driven ventilation banner ("KEEP WINDOWS SEALED" at AQI 168), six affordable clean-air cards, the interactive home readiness checklist, and budget-tiered AI protocol generator.</em></p>
<hr />
<h3>5. Eco-Friendly Travel</h3>
<p>Most carbon calculators blindly rank walking and cycling as the best choices no matter what. In heavy winter smog, however, heavy breathing while cycling unmasked next to traffic dramatically increases inhaled PM2.5.</p>
<p>AirAware AI's <strong>Eco-Friendly &amp; AQI-Safe Travel Planner</strong> evaluates five alternatives—<strong>Metro/Urban Rail, 3-Person Carpool, Public Bus, Cycling, and Walking</strong>—against the user's current commute (Petrol Car, Diesel Car, Motorcycle, or Rideshare), one-way distance, and weekly frequency. When live US AQI exceeds 150, it displays a <strong>Winter Smog Travel Advisory</strong> and automatically ranks enclosed low-emission options (Metro, Carpool, Bus) ahead of exposed active travel, while flagging cycling with a smog safety warning. Every option displays annual <strong>CO₂e, NOx, and PM2.5 savings</strong>, the exact calculation formula, and a Plotly horizontal comparison bar chart.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/d628f841-97af-4d5b-94c9-96e82254d702.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: Eco-Friendly &amp; AQI-Safe Travel Planner adjusting commute rankings for New Delhi's live AQI (168), prioritizing enclosed low-emission transit and showing DEFRA-cited annual CO₂e savings.</em></p>
<hr />
<h3>6. Pollution Impact Tracker</h3>
<p>Individual actions can feel small until you see the actual numbers—and what happens when a neighborhood acts together. The <strong>Pollution Impact Tracker</strong> lets users adjust sliders across four everyday habits:</p>
<ol>
<li>Shifting weekly commute distance to a lower-emission mode</li>
<li>Eliminating weekly vehicle engine idling</li>
<li>Conserving household electricity (with regional grid presets for India, Global, US, and EU grids)</li>
<li>Composting dry leaves and yard waste instead of open burning</li>
</ol>
<p>It computes <strong>Estimated Annual CO₂e Saved</strong>, <strong>Direct PM2.5 Avoided</strong>, <strong>Tailpipe NOx Avoided</strong>, and a linear <strong>1,000-Family Community Scale-Up</strong> for the active city. Every line item appears in an expandable <strong>Transparent Calculation Formulas &amp; Cited Emission Factors</strong> audit panel citing UK DEFRA/DESNZ 2024, US EPA MOVES &amp; AP-42, and IEA/CEA factors.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6afd92b96bb10234cd829df7/bf4d83dc-2561-4c64-bd7e-de2076892154.png" alt="" style="display:block;margin:0 auto" />

<p><em>Caption: The Transparent Pollution Impact Tracker showing annual CO₂e, PM2.5, and NOx reductions, the 1,000-family community scale-up, habit breakdown chart, and fully cited calculation formulas.</em></p>
<hr />
<h2>Google Gemini API Integration</h2>
<p>For the AI layer (<code>src/gemini_assistant.py</code>), I used Google's official <code>google-genai</code> Python SDK with <code>gemini-3.8-flash</code> as the primary model.</p>
<p>A few engineering decisions made the Gemini integration much more reliable:</p>
<ul>
<li><strong>Strict Grounding via</strong> <code>SYSTEM_INSTRUCTION</code> <strong>&amp;</strong> <code>build_live_context_block()</code><strong>:</strong> Before every Gemini request, I serialize the live <code>AirQualitySnapshot</code>—city name, coordinates, local timestamp, US/EU AQI, every live pollutant with its WHO ratio, and explicit <code>"Unavailable (not reported by API)"</code> lines for missing fields—into a structured context block alongside the user's <code>FamilyProfile</code>. The system instruction explicitly forbids inventing or estimating missing sensor readings and requires a medical disclaimer reminder whenever AQI is high (&gt;150) or respiratory sensitivities are present.</li>
<li><strong>Automatic Model Fallback &amp; In-Process Caching:</strong> <code>src/config.py</code> defines an ordered fallback chain (<code>gemini-3.8-flash</code> → <code>gemini-3.7-flash</code> → <code>gemini-3.5-flash</code> → <code>gemini-3.5-flash-lite</code>). If a model returns a <code>404</code> or deprecation error, the client automatically tries the next model and caches the first working model in <code>_RESOLVED_GEMINI_MODEL</code> so subsequent calls don't waste round trips.</li>
<li><strong>Key Hygiene &amp; Error Sanitization:</strong> <code>get_gemini_api_key()</code> reads strictly from environment variables or <code>st.secrets</code> on the server side and rejects placeholder strings from <code>.env.example</code>. If an API exception occurs, regex filters redact any key patterns before storing user-facing status messages so secrets can never leak to the UI or logs.</li>
<li><strong>Graceful Deterministic Fallback:</strong> If <code>GEMINI_API_KEY</code> is missing, rate-limited (HTTP 429), or unreachable, the app never crashes. Instead, it falls back to clearly-labeled <strong>Live-Data Rule Guidance (Non-AI Fallback)</strong> functions grounded in the same live Open-Meteo snapshot, so every page remains genuinely useful even without an API key.</li>
</ul>
<hr />
<h2>Open-Meteo API Integration</h2>
<p>I selected <strong>Open-Meteo</strong> (<code>src/air_quality.py</code>) because both its <strong>Geocoding API</strong> and <strong>Air Quality API</strong> (backed by Copernicus CAMS and global atmospheric models) are completely free, require zero API key setup, and cover cities worldwide.</p>
<p>Key implementation details:</p>
<ul>
<li><strong>Two-Step Resolution:</strong> <code>search_cities()</code> validates inputs (requiring at least 2 characters), queries <code>geocoding-api.open-meteo.com/v1/search</code>, and converts results into <code>GeoLocation</code> objects with coordinates, admin regions, and timezones.</li>
<li><strong>Strict Null Safety (</strong><code>_safe_float()</code><strong>):</strong> API responses sometimes return <code>null</code>, <code>NaN</code>, or omit a field entirely. <code>_safe_float()</code> converts valid numbers cleanly while preserving <code>None</code> for missing values. Each <code>PollutantReading</code> tracks an explicit <code>available: bool</code> flag so the dashboard and Gemini prompts never confuse missing data with <code>0.0</code>.</li>
<li><strong>Hourly Forecast Alignment:</strong> <code>_build_hourly_dataframe()</code> anchors the 48-hour forecast starting from the city's current local hour (<code>anchor.floor("h")</code>) rather than midnight UTC, so <code>summarize_forecast_windows()</code> always analyzes the actual <em>upcoming</em> 24 hours when finding the cleanest 2-hour contiguous block.</li>
<li><strong>Structured Error Handling:</strong> Timeouts, connection drops, HTTP errors, empty search matches, and malformed payloads raise a typed <code>AirQualityServiceError</code> with a category (<code>invalid_input</code>, <code>not_found</code>, <code>network</code>, <code>api_error</code>). If a new search fails, the app displays a friendly banner while preserving the last valid snapshot on screen.</li>
</ul>
<hr />
<h2>Development Experience &amp; Challenges</h2>
<p>Building AirAware AI taught me a lot about the gap between a quick prototype and a resilient web app. A few real challenges I ran into:</p>
<ol>
<li><strong>Handling missing or partial API data gracefully:</strong> Not every coordinate returns all 8 pollutants or complete hourly arrays. Early on, a single <code>None</code> value could break a Plotly chart or crash a WHO-ratio division. Adding strict <code>None</code> guards across <code>air_quality.py</code>, <code>charts.py</code>, and <code>styles.py</code> fixed this cleanly and turned data honesty into a core feature.</li>
<li><strong>Preventing LLM hallucinations on live data:</strong> Without strict formatting in the prompt, an LLM can easily mention generic "average Delhi PM2.5" numbers from training data instead of today's live reading. Passing a structured <code>LIVE AIR QUALITY CONTEXT</code> block and enforcing strict grounding rules solved this.</li>
<li><strong>Making eco-travel advice realistic during severe smog:</strong> At first, my travel planner simply sorted modes by lowest CO₂e—which put cycling at #1 even when outdoor AQI was 180+. Adding an <code>is_active_exposed</code> flag on transport modes and a live-AQI suitability ranker made the recommendations much smarter and safer for winter smog.</li>
<li><strong>Styling Streamlit without breaking responsiveness:</strong> Streamlit's default styling is clean, but I wanted a cohesive dark navy &amp; emerald theme with glassmorphic cards, JetBrains Mono monospace numbers, and clear color-coded pills. Injecting scoped custom CSS (<code>src/styles.py</code>) paired with <code>.streamlit/config.toml</code> and <code>@media (max-width: 640px)</code> rules gave the app a polished dashboard feel while keeping it readable on smaller screens.</li>
</ol>
<hr />
<h2>Testing &amp; Deployment</h2>
<p>To make sure everything worked reliably before submitting and deploying, I built an automated test suite using <code>pytest</code>:</p>
<ul>
<li><code>tests/test_core.py</code> <strong>(10 unit tests):</strong> Verifies US EPA and European AQI boundary classifications, short-input rejection, mocked Open-Meteo geocoding and air quality parsing, strict preservation of <code>None</code>/<code>available=False</code> pollutants, empty forecast handling, timestamp formatting, smog-aware travel ranking (confirming enclosed transit outranks exposed cycling at AQI 230), transparent household impact math against hand-calculated expected totals, and Gemini fallback behavior when <code>GEMINI_API_KEY</code> is unset.</li>
<li><code>tests/test_app_ui.py</code> <strong>(2 end-to-end UI tests):</strong> Uses Streamlit's <code>AppTest</code> framework with mocked Open-Meteo responses to render all six navigation pages without exceptions and test clicking the "Generate Personalized Briefing" button end-to-end.</li>
</ul>
<p>For deployment, I hosted the app on <strong>Streamlit Community Cloud</strong>:</p>
<ol>
<li>Pushed the clean repository to GitHub (with <code>.env</code> excluded via <code>.gitignore</code>).</li>
<li>Connected <code>app.py</code> on Streamlit Community Cloud.</li>
<li>Configured <code>GEMINI_API_KEY</code>, <code>GEMINI_MODEL</code>, and <code>DEFAULT_CITY</code> securely under <strong>App Settings → Secrets</strong> (<code>st.secrets</code>).</li>
</ol>
<p>Because Open-Meteo requires no API key, live AQI monitoring worked immediately out of the box, and Gemini went live as soon as the secret was added.</p>
<hr />
<h2>AI Evaluation Score &amp; Leaderboard Achievement</h2>
<p>Submitting AirAware AI to <strong>Hack2Skill PromptWars Challenge 6</strong> was a huge milestone for me:</p>
<ul>
<li><strong>AI Evaluation Score:</strong> <strong>96.51 / 100</strong></li>
<li><strong>Leaderboard Position:</strong> <strong>#32</strong></li>
</ul>
<p>Seeing a project I built from scratch score <strong>96.51/100</strong> and place <strong>32nd</strong> on the leaderboard felt really rewarding—especially because the feedback validated the exact things I cared most about: real-time data integrity, grounded Gemini personalization, thoughtful UX, and transparent calculations.</p>
<hr />
<h2>What I Learned</h2>
<p>Working through AirAware AI end-to-end gave me practical lessons I couldn't get from classroom assignments alone:</p>
<ul>
<li><strong>Grounding makes Generative AI genuinely useful:</strong> Pairing an LLM with live external APIs and structured user context transforms generic advice into something people can actually act on.</li>
<li><strong>Always design for failure modes:</strong> APIs time out, keys expire, quotas get hit, and fields come back <code>null</code>. Building fallback layers, error sanitization, and clear UI status pills (<code>● Open-Meteo Live</code>, <code>● Gemini API Ready</code>) makes an app feel dependable.</li>
<li><strong>Transparency builds trust:</strong> Showing data timestamps, <code>LIVE</code> vs <code>UNAVAILABLE</code> badges, and exact emission formulas with citations takes very little extra code, yet makes a huge difference in credibility.</li>
<li><strong>Modular code pays off quickly:</strong> Separating API logic, Gemini prompting, impact math, Plotly charts, and styling made writing <code>pytest</code> tests and debugging UI tweaks much easier.</li>
</ul>
<hr />
<h2>Conclusion</h2>
<p>AirAware AI started as a challenge project to help families navigate winter smog more safely, and it turned into one of the most complete, rewarding Python and Generative AI apps I have built as a student. By combining live <strong>Open-Meteo</strong> atmospheric data, grounded <strong>Google Gemini</strong> coaching, interactive <strong>Plotly</strong> visualizations, and transparent <strong>DEFRA / US EPA / IEA</strong> environmental math inside a clean <strong>Streamlit</strong> app, it bridges the gap between raw pollution numbers and everyday decisions.</p>
<p>Feel free to try out the live app for your own city or explore the code on GitHub—I'd love to hear your thoughts and feedback!</p>
<ul>
<li><strong>Try AirAware AI Live:</strong> <a href="https://airaware-ai.streamlit.app/">https://airaware-ai.streamlit.app/</a></li>
<li><strong>Explore the Source Code on GitHub:</strong> <a href="https://github.com/sornambiga-7/AirAware-AI">https://github.com/sornambiga-7/AirAware-AI</a></li>
</ul>
]]></content:encoded></item></channel></rss>