Clean Period: moving school PE out of polluted hours, without cancelling a single class
On smoggy days Indian schools can only stay open or close. We built a serverless app on AWS that reads a school's real timetable and tomorrow's hourly air forecast, then moves outdoor periods to the cleanest hours. Replayed on last winter's real Delhi air, it cut children's inhaled dose by 22%.
The question that started it
Every winter, Delhi's air turns grey and schools face one choice: stay open or close. But that framing misses how pollution actually harms a child.
What matters is the inhaled dose: how dirty the air is, how hard the child is breathing, and for how long.
Plain text
dose (µg) = PM2.5 (µg/m³) × exposure factor × breathing rate (m³/min) × minutes
Two facts make that formula interesting:
- A child running in PE breathes almost 9× as much air per minute as a child sitting in class. (US EPA Exposure Factors Handbook, ages 6 to under 11: 0.042 vs 0.0048 m³/min.)
- Delhi's air is not equally bad all day. Last winter, the typical school-day PM2.5 in Vasant Vihar was 136 µg/m³ at 8 a.m. and 66 µg/m³ at 1 p.m., about half.
So a PE period at 8 a.m. can be the biggest single slice of a child's whole school-day dose. Move that same period to 1 p.m. and the class does exactly the same things, just with far less pollution in their lungs.
That's Clean Period: same periods, cleaner air.
👉 Live: https://main.d32sdayd4hpv2r.amplifyapp.com
👉 Code: https://github.com/Anumehajain78/clean-period
What a teacher does
- Find the school's town and enter a class timetable. Three ways in: fill the school day (start time, period length, break), add periods one by one, or take a photo of the printed timetable. AI reads it, and the teacher checks every row.
- Click "Make plan for tomorrow." The app fetches tomorrow's hourly PM2.5 forecast, computes the dose of every period, and finds the order with the lowest total dose.
- See before and after. The school day is drawn as a strip of period blocks over the hourly air colours, so you can see PE move out of a red hour into a green one.
- Send parents a notice in Hindi and English, with a copy button.
- Look ahead: This week plans each coming school day and marks the cleanest day for outdoor events like sports day.
- Look back: Last winter replays last winter's real air at your own school's location against your timetable, to show what it would have saved.
On a day when every school hour is Very Poor or worse, there is no clean hour to move to. The school then chooses: move outdoor periods indoors (yoga, games in the hall) or cancel the outdoor activity and keep the class in its room. The app shows the estimated dose cut for each option.
Does it actually work?
We replayed every school day of last winter (1 Nov 2025 to 31 Jan 2026) on real hourly air data for Vasant Vihar, New Delhi, using a typical Class VI timetable with PE or games three days a week. We skipped weekends, the Delhi DoE winter vacation and gazetted holidays.
| |
|---|---|
Season dose cut (total dose before vs after) | 22% |
Mean of daily cuts | 17% |
School days | 50 |
"All indoors" days | 1 |
The weekday breakdown is the most honest part of the result:
Day | Average cut | Why |
|---|---|---|
Monday | 31% | PE moves out of 8 a.m. |
Friday | 26% | Games moves out of the morning |
Wednesday | 23% | PE moves out of the morning |
Tuesday | 2% | Only indoor yoga can move |
Thursday | 0% | Nothing outdoors to move |
Days with outdoor sport gain a lot; days without gain nothing. The plan never invents a change that doesn't help.
The same timetable replayed on Lucknow's air for the same winter gave a 29% season cut.
Architecture: fully serverless on AWS (ap-south-1, Mumbai)
Plain text
Browser (React on AWS Amplify)│▼Amazon API Gateway (HTTP API, CORS locked to the site)│▼AWS Lambda (Python 3.12) ── 7 functions├── plan · forecast · insights ──► Open-Meteo air data (CAMS) ──► cached in DynamoDB├── notice · extract ───────────► Amazon Bedrock (Amazon Nova Pro)└── schools · nightly ──────────► Amazon DynamoDB (one table, TTL, GSI)Amazon EventBridge Scheduler ── 19:00 Asia/Kolkata ──► nightly LambdaGitHub Actions ── OIDC role ──► sam deploy + Amplify publish on every push
AWS service | What it does in Clean Period |
|---|---|
AWS Amplify Hosting | Serves the React site |
Amazon API Gateway | Public HTTP API; CORS allows only our site |
AWS Lambda | plan (dose engine and optimiser), forecast , insights (this week, last winter), notice , extract (photo reading), schools , nightly |
Amazon DynamoDB | Forecast cache (3 h), history cache (30 days), saved schools, nightly results, all in one table with TTL |
Amazon EventBridge Scheduler | Builds tomorrow's plan for every saved school at 7 p.m. IST |
Amazon Bedrock (Nova Pro) | Reads timetable photos; words the Hindi and English parent notice |
AWS SAM / CloudFormation | Everything as code in one template |
AWS IAM + GitHub OIDC | Deploys from GitHub with a short-lived role; no stored keys |
Amazon CloudWatch | Logs, including each nightly run's summary |
Our one design rule: code decides, AI only writes
We wanted parents and principals to be able to trust every number. So:
- The plan never depends on a model. The dose engine and optimiser are plain Python: no AI, no AWS calls, covered by 265 tests. The optimiser respects real school rules: a teacher can't be in two classes at once, the ground holds a limited number of classes, and assembly, recess and exams never move. For a single class, a test proves it finds the same answer as trying every possible order.
- AI only handles text. Amazon Nova Pro does two jobs: reading a photo of a timetable, and rewording the parent notice.
- Code checks every AI answer. The notice is first written by code from the plan's facts. Nova then improves the wording, but the app rejects the AI text if it contains any number or time that isn't in the plan, drops a moved period, or misses the dose cut. In that case parents get the code-written version. Photo readings go through the same discipline: rows with impossible times or no subject are dropped, and the teacher confirms the rest.
On a real printed timetable, Nova Pro read all 50 periods across 5 days correctly, including which ones were PE, games, assembly and recess.
What we learned building it
1. Plan for model availability, not just model choice. We designed the notice around Claude on Bedrock. On deploy day our account returned "not available for this account," and Claude's AWS Marketplace subscription failed on a payment check. Because AI only words text in our design, swapping to Amazon Nova Pro, sold by AWS directly so our credits applied, took one evening, not a rewrite.
2. Ask models for the format they're good at. Our first prompt asked for JSON with English and Hindi fields. About half the time Nova wrote the Hindi as
\uXXXX escape codes, roughly six tokens per letter, and hit the token limit. Switching to two plain sections ( [EN] and [HI] ) took us from about half to 5 in 5 successful notices on the live API, each in about 2 seconds.3. Measure where the time goes. The first live notice took 28 seconds, dangerously close to API Gateway's 30-second limit. Timing logs showed the SDK's client setup, not the model, was eating the time on a 256 MB Lambda. Removing that SDK in favour of boto3's Converse API brought it to about 2 seconds.
4. OIDC is worth it, and read your CloudTrail. GitHub Actions deploys with a short-lived role instead of stored keys. Our first deploy was refused. CloudTrail showed GitHub now sends the repo identity with numeric IDs (
owner@id/repo@id ). Trusting that exact identity is also safer: a deleted and re-created repo with the same name can't deploy.5. Be honest about uncertainty. Every number in the app is labelled an estimate, with its source. We state our limits openly: the forecast is area-level (about 45 km), the indoor factor is an assumption, CPCB bands are defined for 24-hour averages, and this reduces exposure; it does not make a severe day safe.
Try it
- Search your town, then fill a school day or upload a timetable photo
- Click Make plan for tomorrow, then open This week and Last winter
Built for Environmental Hacks 2026 (WeMakeDevs × AWS), Track 01: Air, School safety on bad days.
Team: Riyanshi Jain (lead, frontend) · Anumeha Jain (backend) · Rakshit Jain (frontend features, AWS deployment)
Air data: Open-Meteo Air Quality API (CC BY 4.0), CAMS Global from Copernicus. Breathing rates: US EPA Exposure Factors Handbook (2011). Air bands: CPCB National AQI.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article