Impact Explanation
Air pollution is a critical environmental crisis and a global inequality issue. According to the WHO, environmental toxins are responsible for 1 in 8 deaths globally, yet the people most affected—outdoor laborers, gig workers, and families in industrial zones—often lack access to understandable data about their environment. Complex AQI tables (e.g., "PM2.5 at 45µg/m³") mean little to a non-expert, leaving vulnerable populations exposed to invisible environmental toxins without warning.
InHale democratizes environmental awareness and atmospheric safety by turning abstract data into visceral survival tools.
- Bridging the Literacy Gap: Our "Living Lung" visualization transcends language barriers. A user doesn’t need to read English or understand environmental science to know that red, wheezing lungs mean danger. This makes the tool instantly accessible to marginalized communities with lower literacy rates.
- Protecting the Unprotected: Outdoor workers cannot afford to check an app every hour. Our Background Watchdog ensures that delivery drivers and laborers receive "tap-on-shoulder" alerts before their immediate environment turns hazardous, protecting those who cannot work from the safety of an air-conditioned office.
- Quantifying the Invisible: By converting environmental pollution into a "Cigarette Equivalency" metric (AQI ÷ 22), we provide an instant, culturally understood metric of harm. Telling a user they are "smoking 5 cigarettes today" drives immediate behavioral change—like wearing a mask—that a simple number never could.
Inspiration
In an era of rapid environmental change, we often check the weather before deciding what to wear, but we rarely check the air quality before deciding to breathe. In 2025, air pollution has become a silent, invisible killer. We were shocked to learn that breathing the air in many major cities is essentially equivalent to smoking multiple cigarettes a day due to environmental degradation.
The inspiration for InHale struck when we realized that raw numbers like "AQI 150" are abstract and easy to ignore. We wanted to build something that made the invisible visible and the abstract personal. We didn't just want an app that displays data; we wanted an "Environmental and Atmospheric Bodyguard" that actively watches over your health, even when you aren't looking at your screen.
What it does
InHale is a real-time environmental health monitoring system that transforms complex atmospheric data into actionable insights.
- The Living Dashboard: Instead of boring charts, InHale features a "Living Lung" visualization. Using Framer Motion, the lungs change color (from healthy green to toxic red) and breathing patterns (from deep breaths to rapid wheezing) based on the live AQI of your immediate environment.
- The "Cigarette" Metric: We mathematically convert environmental pollution into a metric everyone understands: “Breathing this air for 24 hours is equivalent to smoking X cigarettes.”
- AI-Powered Health Advice: Powered by Google Gemini, InHale analyzes the specific dominant environmental pollutant (like PM2.5 vs. Ozone) and generates specific, context-aware medical advice for that exact moment.
- Background Watchdog: This is the core safety feature. Users can set a "Danger Threshold" (e.g., AQI > 100) and a "Check Interval" (e.g., every 4 hours). InHale runs a background process that wakes up, checks the user's location and environmental quality, and sends a system notification if the air turns toxic—even if the app is idle.
- Travel Mode: Users can switch from GPS tracking to "Manual Mode," allowing them to search for any city globally to check if the environment is safe for travel.
How we built it
We engineered InHale using the MERN Stack (MongoDB, Express.js, React, Node.js) for a robust, full-stack architecture capable of processing real-time environmental data.
- Frontend: Built with React and Vite for blazing-fast performance. We used Framer Motion for the complex lung animations and Glassmorphism CSS for a modern, clean UI.
- Backend: A Node.js/Express server handles API requests and manages user sessions via Google OAuth 2.0. We used MongoDB Atlas to persist user preferences (Danger Thresholds, Notification Intervals, and Manual Location choices).
- Data & AI Pipeline: We integrated the WAQI API for real-time environmental sensor data. For the intelligence layer, we built a custom service using the Google Gemini API (
gemini-1.5-flash) to generate dynamic health advice. - The "Watchdog" Engine: We implemented a custom interval timer in React using
useRefto maintain state consistency across render cycles, ensuring the app checks environmental pollution levels strictly according to the user's preferences.
Challenges we ran into
The biggest hurdle was the "State Synchronization" in our background Watchdog engine. Initially, our notification timer would capture the "stale" state of the user's settings. A user would change their interval from 1 hour to 4 hours, but the running timer would still fire every hour because of closure issues in React's useEffect. We had to refactor the logic to use useRef, allowing the interval to "peek" at the latest settings without resetting the timer cycle unnecessarily.
Another significant challenge was the Unit Conversion Logic. We store user preferences in mixed units (Minutes vs. Hours). We encountered a bug where selecting "4 Hours" was interpreted by the backend as "4 Minutes," leading to notification spam. We fixed this by implementing a strict unit normalization layer in the frontend before the math logic runs: $$T_{minutes} = T_{input} \times 60$$
Finally, handling the "First Run" Experience was tricky. We wanted new users to get an immediate alert if the environment was bad, rather than waiting for the first timer cycle to finish. We had to build a specific "Instant Trigger" logic that bypasses the timer if lastNotifiedAt is null in the database.
Accomplishments that we're proud of
- The "Living Lungs": We are incredibly proud of the visualization. Seeing the lungs "wheeze" rapidly when the AQI hits 150+ creates an immediate emotional response to environmental danger that raw numbers never could.
- Robust Persistence: We successfully built a system where a user can log in from any device, and their specific "Safety Thresholds" and "Location Preferences" travel with them.
- Instant AI Response: Integrating Google Gemini to give non-generic advice. Instead of just saying "Air is bad," our app now says, "Avoid jogging on Gangapur Road; PM2.5 levels are critically high."
- Real-Time Math: Successfully implementing the cigarette equivalency formula dynamically: $$\text{Cigarettes} = \frac{\text{AQI}}{22}$$
What we learned
- The Power of References: We learned that in complex timing operations within React,
useRefis often superior touseStatefor mutable variables that shouldn't trigger re-renders but need to be accessed instantly inside intervals. - User Psychology: We learned that users ignore numbers but react to visuals. Shifting our focus from data tables to the "Lungs" animation completely changed the feel of the application and how users perceive their environment.
- GenAI Integration: We learned how to prompt-engineer Google Gemini to return JSON-compatible, short, punchy advice rather than long, academic paragraphs.
What's next for InHale
- Hardware Integration: We plan to build a custom ESP32-based IoT sensor that connects to InHale, allowing users to measure their indoor environment and air quality in their own homes.
- Community Reporting: Adding a feature where users can report local pollution sources (like burning trash), creating a crowdsourced heatmap of environmental hotspots.
- React Native Port: Converting the web app into a native mobile app to allow for background push notifications even when the browser is closed.
Log in or sign up for Devpost to join the conversation.