<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: saardhak ram V</title>
    <description>The latest articles on DEV Community by saardhak ram V (@saardhak_ramv_913100e7b8).</description>
    <link>https://dev.to/saardhak_ramv_913100e7b8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4266817%2F82dd7d4e-d2ba-428f-8020-1c3c5e2479de.jpg</url>
      <title>DEV Community: saardhak ram V</title>
      <link>https://dev.to/saardhak_ramv_913100e7b8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saardhak_ramv_913100e7b8"/>
    <language>en</language>
    <item>
      <title>How I Built Shwas: Turning Delhi's Smog into a Number Families Can Feel</title>
      <dc:creator>saardhak ram V</dc:creator>
      <pubDate>Thu, 26 Nov 2026 12:02:14 +0000</pubDate>
      <link>https://dev.to/saardhak_ramv_913100e7b8/ai-machinelearning-webdev-hackathon-mm3</link>
      <guid>https://dev.to/saardhak_ramv_913100e7b8/ai-machinelearning-webdev-hackathon-mm3</guid>
      <description>&lt;p&gt;Shwas (श्वास, Sanskrit for "breathing") is a GenAI air-quality companion that tells a family how many cigarettes' worth of smog each member breathes today, and then helps them bring that number down. I built it for PromptWars: Virtual, Challenge 06 (Urban Air Quality Assistant), using Google Antigravity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; &lt;a href="https://shwas-self.vercel.app" rel="noopener noreferrer"&gt;shwas-self.vercel.app&lt;/a&gt; · &lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/saardhakram/shwas" rel="noopener noreferrer"&gt;github.com/saardhakram/shwas&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: "AQI 342" means nothing at the dinner table
&lt;/h2&gt;

&lt;p&gt;Every winter, Delhi's air turns grey and the news says "AQI 342, Severe". Most families nod and carry on, because a number on a 0–500 scale doesn't tell you what to do. Should Grandpa skip his evening walk? Should the kids play outside after school? Is opening the window at 2 PM a good idea or a bad one?&lt;/p&gt;

&lt;p&gt;The challenge asked for an assistant that suggests low-emission routines, indoor air quality fixes and sustainable alternatives, tailored to a family's location and lifestyle, and that clearly explains the impact of each choice. That last part shaped everything: the impact had to be something people actually feel.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea: count smog in cigarettes
&lt;/h2&gt;

&lt;p&gt;Berkeley Earth estimated that breathing air with 22 µg/m³ of PM2.5 for a full day is roughly as harmful as smoking one cigarette. Shwas uses that conversion as its main unit, because "your 6-year-old smoked 9 cigarettes today" lands in a way "AQI 342" never does.&lt;/p&gt;

&lt;p&gt;People don't spend 24 hours outside, so Shwas adds up where each person actually spends their day:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;cigarettes = sum over places of (PM2.5 at that place × hours there) ÷ (22 × 24)&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;th&gt;Hours&lt;/th&gt;
&lt;th&gt;PM2.5 (µg/m³)&lt;/th&gt;
&lt;th&gt;Cigarettes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Outside (commute, market)&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;1.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;School or office&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;3.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Home, windows open&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;180&lt;/td&gt;
&lt;td&gt;4.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;≈ 9&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Indoor PM2.5 is estimated from the outdoor level and the home's setup: windows facing a road, an air purifier, a kitchen chimney, the cooking fuel. Each choice then has a visible effect. Shutting the windows during the morning peak and running a purifier at night can take that day from about 9 cigarettes to about 5. The app shows this as an awareness estimate, not a medical measurement.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Shwas does
&lt;/h2&gt;

&lt;p&gt;Onboarding takes about a minute: pick a language, a city, the family members (age and health flags such as asthma or a heart condition), and the home and daily routine. Everything after that is personal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Today: a Daily Air Plan.&lt;/strong&gt; Gemini writes a timeline for the day: when to keep windows shut, the cleanest window to air out the house, how to commute, when the kids can play outside. Every item shows how many cigarettes it saves, and ticking it off counts the day's number down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shwas Scan.&lt;/strong&gt; Take a photo of the kitchen, bedroom or balcony. Gemini Vision marks pollution sources such as an incense stick, a stove with no chimney or a window facing traffic, and each one gets a fix with its impact. The savings numbers come from code, not from the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean Routes.&lt;/strong&gt; A Google Map compares car, auto, two-wheeler, walking and metro by time, cigarettes inhaled and CO₂. It recommends the option that is cleanest for you &lt;em&gt;and&lt;/em&gt; for the city, so it won't push a car when the metro is nearly as clean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask Shwas.&lt;/strong&gt; A chat assistant with voice input that knows the family's profile and the forecast: "Can Grandpa walk at 6 PM?" It gives short, practical answers, never diagnoses, and suggests a doctor for symptoms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community.&lt;/strong&gt; Housing societies and schools form groups with a join code, see a weekly leaderboard of cigarettes saved, report local smoke such as garbage burning, and share a "we saved 4 cigarettes today" card on WhatsApp.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Six languages:&lt;/strong&gt; English, Hindi, Telugu, Tamil, Bengali and Marathi. The elderly and non-English-speaking families most exposed to smog can use it too.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it was built
&lt;/h2&gt;

&lt;p&gt;I designed the screens in &lt;strong&gt;Google Stitch&lt;/strong&gt; and built the whole app in &lt;strong&gt;Google Antigravity&lt;/strong&gt;, working one feature at a time with its agent and testing each one in the browser before moving on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3ta5mllzscl2f4sdcu1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3ta5mllzscl2f4sdcu1.png" alt="Shwas architecture: the web app calls Vercel API functions, which alone hold the Gemini key; GitHub Actions runs the LightGBM model and writes forecasts to Supabase" width="799" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The browser talks directly to Google Maps, Open-Meteo and Supabase. Anything that needs the Gemini key goes through Vercel serverless functions, so the key never reaches the browser.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; React, Vite, TypeScript and Tailwind, with i18next for the six languages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI:&lt;/strong&gt; the Gemini API, server-side only, with retries, a fallback model and a rule-based backup plan&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maps:&lt;/strong&gt; Google Maps JavaScript API and Routes, with Leaflet and OpenStreetMap as an automatic backup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; Open-Meteo for live air quality and weather; Supabase (Postgres) with row-level security for profiles and community data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ML:&lt;/strong&gt; Python, pandas, LightGBM and SHAP, run by GitHub Actions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tests:&lt;/strong&gt; 75 Vitest unit tests and 6 Python tests&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The ML forecast: 37% more accurate than the baselines
&lt;/h2&gt;

&lt;p&gt;The Daily Air Plan is only as good as its timing, so Shwas runs its own model to predict PM2.5 for each of the next 48 hours.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; 2.5 years of hourly PM2.5 (May 2024 to November 2026) for three Delhi locations: Anand Vihar, R.K. Puram and ITO. That's 21,912 rows each, plus weather: wind, temperature, humidity, rain and boundary layer height.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Features:&lt;/strong&gt; past readings (1, 3, 6 and 24 hours back), 6/12/24-hour averages, the hour, weekday and month, the weather at the target hour, and flags for Diwali, the October–November stubble-burning season and weekends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; LightGBM, with the forecast horizon (1–48 hours) as an input.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A fair test:&lt;/strong&gt; the data is split by time only, with a 48-hour gap between periods. The model was tested on the latest winter (November 2025 to February 2026), which it never saw in training.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;MAE (µg/m³)&lt;/th&gt;
&lt;th&gt;RMSE (µg/m³)&lt;/th&gt;
&lt;th&gt;AQI category correct&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Shwas ML (LightGBM)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;23.4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;33.2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;74.1%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same hour yesterday&lt;/td&gt;
&lt;td&gt;37.1&lt;/td&gt;
&lt;td&gt;53.0&lt;/td&gt;
&lt;td&gt;64.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Persistence (next hour = now)&lt;/td&gt;
&lt;td&gt;45.2&lt;/td&gt;
&lt;td&gt;62.0&lt;/td&gt;
&lt;td&gt;57.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The model beats the strongest baseline by 36.9% on average error, and it wins at every range: 1–6 hours, 7–12, 13–24 and 25–48. The most important input, by SHAP, is &lt;strong&gt;boundary layer height&lt;/strong&gt;: the invisible "lid" that sinks on cold winter nights and traps smog close to the ground. That's the physics of Delhi's winter showing up in the data.&lt;/p&gt;

&lt;p&gt;A GitHub Actions job runs the model twice an hour and saves the next 48 hours to Supabase. The Today screen shows "Shwas Forecast (ML)" with the model's error, and switches to the Open-Meteo forecast if the ML data is ever more than 6 hours old.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two honest caveats.&lt;/strong&gt; The training data is Open-Meteo/Copernicus modelled PM2.5 at those locations, not readings from the physical CPCB sensors. And during testing the model saw the weather that actually happened, while live predictions use weather forecasts, so real-world error will be somewhat higher than 23 µg/m³.&lt;/p&gt;

&lt;h2&gt;
  
  
  What broke, and how I fixed it
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;What was happening&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini "high demand" (503)&lt;/td&gt;
&lt;td&gt;The model was overloaded at busy times, and the app gave up on the first failure.&lt;/td&gt;
&lt;td&gt;Retry once, then switch to a fallback model; keep a rule-based plan so the screen is never empty.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free-tier limit (429)&lt;/td&gt;
&lt;td&gt;5 requests a minute per model, and the Today screen was sending 4 plan requests per page load.&lt;/td&gt;
&lt;td&gt;Exactly one request per load, a 6-hour server cache, and going straight to the fallback model on 429.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A retired model&lt;/td&gt;
&lt;td&gt;The fallback model returned "no longer available to new users" (404).&lt;/td&gt;
&lt;td&gt;Switched to current models and made them configurable.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slow chat answers&lt;/td&gt;
&lt;td&gt;Newer Gemini models think before answering, so one call used the whole 20-second budget.&lt;/td&gt;
&lt;td&gt;Minimal thinking, a short output limit and a compact context (8 forecast points instead of 24).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Savings that added up to more than the total&lt;/td&gt;
&lt;td&gt;Each plan item was counted as if it lasted 24 hours, so a 0.9-cigarette day could "save" 2.1.&lt;/td&gt;
&lt;td&gt;Every item has a duration in hours, and total savings are capped at 70% of the day's number.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vercel crashes&lt;/td&gt;
&lt;td&gt;Every API call failed with &lt;code&gt;ERR_MODULE_NOT_FOUND&lt;/code&gt;: Node ES modules need &lt;code&gt;.js&lt;/code&gt; extensions on imports.&lt;/td&gt;
&lt;td&gt;Explicit extensions, shared server code moved to &lt;code&gt;api/_lib&lt;/code&gt;, and browser-only code split out of the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google directions failing silently&lt;/td&gt;
&lt;td&gt;The routes request asked for a field called &lt;code&gt;polyline&lt;/code&gt;; the library calls it &lt;code&gt;path&lt;/code&gt;.&lt;/td&gt;
&lt;td&gt;One-word fix, found in the browser console.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A GitHub schedule that never ran&lt;/td&gt;
&lt;td&gt;Hourly jobs at a busy minute (:05) were skipped for hours.&lt;/td&gt;
&lt;td&gt;Two off-peak schedules (:17 and :47) and a 6-hour freshness window.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most of these only appeared when I tested the real app in a browser and read the server logs. The unit tests (75 of them) all passed the whole time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The unit matters more than the data.&lt;/strong&gt; The same PM2.5 number became useful once it was a cigarette count with a saving next to every action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never trust the model's maths.&lt;/strong&gt; Gemini writes the plan, the scan findings and the answers. Every number a family acts on (cigarettes, savings, CO₂) is computed in code, tested, and capped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design for the AI being busy.&lt;/strong&gt; Free tiers have limits, models get overloaded and models get retired. Fallback models, caching and a rule-based plan kept the app useful every time Gemini wasn't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the real thing.&lt;/strong&gt; Most bugs only showed up on the live site or in server logs: duplicate requests, a missing file extension, a renamed field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Be honest about the ML.&lt;/strong&gt; A baseline comparison, a time-based split and stated caveats are worth more than a big accuracy claim.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live app:&lt;/strong&gt; &lt;a href="https://shwas-self.vercel.app" rel="noopener noreferrer"&gt;shwas-self.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code and README:&lt;/strong&gt; &lt;a href="https://github.com/saardhakram/shwas" rel="noopener noreferrer"&gt;github.com/saardhakram/shwas&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge:&lt;/strong&gt; &lt;a href="https://promptwars.in/promptwarsVirtual.html" rel="noopener noreferrer"&gt;PromptWars: Virtual&lt;/a&gt;, Challenge 06: Urban Air Quality Assistant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you live with winter smog, open it, set up your family, and see what your number is today. Then see how far your plan can bring it down.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>webdev</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
