AWS Builder Center
BreatheSafe: A Serverless AQI Advisory System for Indian Schools

BreatheSafe: A Serverless AQI Advisory System for Indian Schools

Built for Bharat Builds Tour: Environmental Hacks (Track 1 — Air), BreatheSafe turns raw AQI numbers into a clear GO / CAUTION / NO-GO call that Indian school principals can act on in seconds — running entirely on serverless AWS.

Final year -Information science and Engineering | Software Developer Trainee at CBA

The Problem

During India's high-pollution months — stubble burning in the north, winter temperature inversions, and year-round urban traffic — millions of schoolchildren in cities like Delhi-NCR, Mumbai, Kolkata, Lucknow, Patna, and Bengaluru are outdoors for assembly, PE, and recess exactly when air quality is often at its worst.
Three problems compound this:
  1. News apps show city-wide averages from hours earlier, missing hyper-local morning smog spikes.
  1. A raw number like "PM2.5: 185 µg/m³" gives a principal no actionable guidance — is it safe for a 7-year-old to be outside for 20 minutes?
  1. Most quick AQI integrations expose third-party API keys directly in browser JavaScript, which gets the key rate-limited or stolen within days.

What I Built

BreatheSafe turns live AQI data into a plain GO / CAUTION / NO-GO call for schools, each paired with a concrete action checklist — cap outdoor PE to 20 minutes, move assembly indoors, mandate N95 masks for commuting.
It does two jobs:
  • An interactive nationwide map (built with Leaflet.js) where anyone can look up a city or station and see today's reading plus a same-day forecast.
  • A fully automated morning alert: every day at 6:30 AM IST, it evaluates air quality and emails principals a formatted advisory, with zero manual checking.
The forecast itself runs an Exponentially Weighted Moving Average (α = 0.35) over recent readings — deliberately simple, since a trained ML model would need dependencies AWS Lambda's inline editor doesn't ship with, and a transparent formula is one a principal can actually trust.

Architecture

[embed: node/54f8573b-52e3]
Every request — a visitor on the dashboard or the daily cron job — passes through the same Lambda function, so there is exactly one place the forecast and decision logic lives. The API Gateway path keeps the AQICN API token off the client entirely; the EventBridge path needs no client at all. Both read and write the same S3 cache, so a slow upstream provider degrades to "last known data" instead of a broken page.

Decision Logic (India CPCB Standard)

Projected AQI
Decision
Category
School Action
0–100
GO
Good / Satisfactory
Normal outdoor activity, PE, and assemblies
101–200
CAUTION
Moderate / Poor
Outdoor sports capped at 20 min; assembly moves indoors; sensitive students stay inside
201+
NO-GO
Hazardous / Severe
All outdoor activity cancelled; windows sealed; purifiers on; N95 masks recommended for commuting

What I Learned

I'm a BE student in Information Science and Engineering, and this was my first time deploying anything on AWS end to end. A few things that stuck:
  • Zero-token security isn't a nice-to-have — it's close to the default once every client request is routed through Lambda instead of calling a third-party API straight from the browser.
  • S3 as a cache/fallback layer is a cheap way to make a system resilient: if the upstream AQI provider times out, the dashboard still shows "cached (last known data)" instead of breaking.
  • Keeping the forecast to plain EWMA math instead of reaching for a Python ML library was the right call under a 4-day clock — Lambda's inline editor has no numpy/pandas, and a formula a principal can intuit beats a black box anyway.
  • The whole thing runs for about $0.02/month at the hackathon's traffic — that's most of serverless's appeal on a student budget.

Try It

Built for Bharat Builds Tour: Environmental Hacks, Track 1 (Air).
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article