-
Binary "Proceed Outdoors" / "Move Indoors" directive, generated live from the XGBoost forecast against a project-defined 100 µg/m³ threshold
-
Current and predicted PM2.5 with a 7-day trend chart leading into tomorrow's AI-forecasted point.
-
Decision protocol for schools, plus the XGBoost model tuned for Lahore's bimodal winter smog pattern.
-
School alert panel-administrators register to be notified when tomorrow crosses into unsafe territory.
-
smogsense_pipeline
-
smogsense_architecture
Inspiration
Every winter, Lahore's air quality crosses into hazardous territory, and the way most people find out is by checking today's AQI reading once it's already bad. There's no easy way for a school administrator to know, the evening before, whether tomorrow is safe for children to be outside. I wanted to close that specific gap not build a generic pollution dashboard, but give one clear, actionable decision to one specific group of people who make this call every single morning during smog season.
What it does
SmogSense forecasts tomorrow's PM2.5 for central Lahore and converts that forecast directly into a binary decision: Proceed Outdoors or Move Indoors, aimed specifically at school administrators deciding on recess and PE. Instead of showing a raw AQI number and leaving the interpretation to the user, the app shows the current reading, the predicted value for tomorrow, a recent trend chart, and a plain-language advisory, plus an alert system schools can register with to get notified when tomorrow's forecast crosses the unsafe threshold.
How I built it
I pulled ~2.75 years of daily PM2.5 history from OpenAQ for a central Lahore monitoring station, and matched it with historical weather data (temperature, humidity, wind, precipitation) from Open-Meteo. I engineered lag features (yesterday's value, 3-day and 7-day rolling averages), trend features (day-over-day change, 7-day volatility), and a smog-season flag, then trained an XGBoost model. The backend is a FastAPI service (rewritten to pure-Python tree inference to fit within Vercel's serverless size limits), and the frontend is a single-page dashboard, both deployed as independent projects on Vercel.
Challenges I ran into
My first honest surprise came during validation: when I tested the model specifically on a real winter smog season (Dec 2025–Feb 2026) instead of an easier, calmer test window, my regression model's improvement over a naive "tomorrow equals today" baseline dropped from a strong-looking number to just 3%. Rather than hide this, I investigated adding trend/volatility features improved it to 6.6%, but more importantly, I discovered that winter air quality in my data is essentially bimodal: days are either clearly safe or clearly unhealthy, with almost no middle ground. That finding led me to reframe the core model as a binary classifier (Proceed / Move Indoors) instead of a three-tier system, which reached 88.9% accuracy against an 83.3% naive baseline a more honest and more useful result for the actual decision my users need to make.
Deployment turned into its own saga: Hugging Face Spaces required a paid tier for Docker, Render asked for card details, and Railway's free limit was exhausted. I eventually deployed on Vercel, but hit a serverless bundle size limit (582MB, then 550MB) caused by scikit-learn and the full XGBoost package solved by converting my trained trees to a lightweight pure-Python inference function with no ML library dependency at runtime. I also initially deployed frontend and backend as one combined project, which caused repeated routing conflicts (the API swallowing the homepage, endpoints 404ing); splitting them into two independent Vercel projects resolved it cleanly.
Accomplishments that I'm proud of
I'm proud that I caught and fixed my own overclaims before submission, an earlier version of my threshold was labeled as an "EPA/WHO Safety Limit," which wasn't accurate, and I corrected it to honestly read as a project-defined threshold. I'm also proud of validating specifically on winter smog season rather than accepting a flattering but misleading result from an easier test window, and of shipping a fully working, live, end-to-end product (real data in, real model inference, real decision output) within a one-week build window, working solo.
What I learned
I learned that a model's performance can look very different depending on which slice of time you test it on, and that the honest number is the one that matches your actual use case, not the one that looks best. I also learned that the data itself can suggest a better problem framing than the one you started with moving from a three-tier risk scale to a binary decision because that's what Lahore's winter air quality data actually showed, not because I assumed it upfront.
What's next for SmogSense
Beyond this hackathon, I want to expand from one pilot station to full city-wide coverage, integrate official Punjab EPA data feeds once accessible, and add SMS/voice alerts in Urdu/Punjabi so the tool reaches households without smartphones, not just schools with app access. I also plan to build a native Flutter mobile app with true push notifications, and eventually offer the forecast as an open API so other schools, NGOs, and community organizations can build on top of it directly.
Log in or sign up for Devpost to join the conversation.