AWS Builder Center
Building BreatheSafe Dispatcher: Pollution-Aware Delivery Routing On AWS

Building BreatheSafe Dispatcher: Pollution-Aware Delivery Routing On AWS

BreatheSafe Dispatcher is a hackathon project that helps delivery platforms reduce rider PM2.5 exposure in Delhi/NCR by choosing cleaner stores, safer routes, and practical rider prompts while keeping deliveries under SLA.

The Problem

Delhi/NCR faces severe PM2.5 pollution during winter, and delivery riders are one of the groups most exposed to it. They spend long hours outdoors, often during traffic-heavy and high-pollution windows. Most delivery dispatch systems optimize for speed, but the fastest route is not always the safest route for the rider.
BreatheSafe Dispatcher tries to solve one focused problem: can a delivery platform reduce rider pollution exposure with only a small delay? The app compares fastest, cleaner, and recommended dispatch options for a live order, then picks the choice that reduces exposure while staying under the delivery promise.

What I Built

The project is a React web app with views for dispatch, rider route, consumer app, safety prompts, and metrics. The dispatch page shows a live order going to Jangpura Extension and compares options from hubs like Lajpat Rider Hub and Saket Cleaner Hub.
For example, the fastest route takes 13 minutes but has higher rider exposure. A cleaner route takes slightly longer but reduces polluted kilometers. The recommended option balances both: it stays under SLA and cuts rider exposure by around 26%.
The frontend stack:
text
React
TypeScript
Vite
Leaflet + OpenStreetMap
Recharts
Run locally:
Bash
npm install
npm run dev
Build:
Bash
npm run build

The ML Baseline

For the PM2.5 baseline, I used a small Python scikit-learn Ridge model. It uses sample Delhi/NCR pollution data and features like current PM2.5, time, traffic, demand, construction activity, and inversion risk.
The model is not meant to be a production pollution forecast. It is a hackathon baseline to make the dispatch decision more realistic and measurable.
Train the model:
Bash
pip install -r requirements.txt
npm run ml:train
The model writes forecast values into:
text
src/mlPredictions.json
Current validation:
text
Ridge RMSE: 2.28
Same-as-now baseline RMSE: 12.12
Improvement vs baseline: 81.2%
AWS Architecture


How I Used AWS

The app is deployed on AWS Amplify from GitHub. Amplify gave me a live URL quickly, which was important for a hackathon demo.
I also added a small serverless backend:
  • AWS Amplify hosts the React frontend.
  • Amazon API Gateway exposes the  /recommendation  endpoint.
  • AWS Lambda returns the dispatch recommendation.
  • Amazon EventBridge schedules the PM2.5 refresh Lambda.
  • Amazon CloudWatch stores Lambda logs.
The deployed API is configured in the frontend using:
text
VITE_RECOMMENDATION_API_URL=https://f1tivjhtne.execute-api.ap-southeast-2.amazonaws.com/recommendation
The AWS flow is:
text
GitHub -> AWS Amplify -> React frontend
React frontend -> API Gateway -> Lambda recommendation
EventBridge -> Lambda refresh hook
Lambda -> CloudWatch logs

What Fought Back

The hardest part was keeping the project realistic without making it too complex. It was tempting to add live routing, real pollution APIs, authentication, and database storage, but that would have made the demo harder to finish. I kept the scope smaller: one clear order, three dispatch options, visible rider impact, and measurable tradeoffs.
On AWS, Amplify was smooth for deployment, but connecting the frontend to API Gateway and Lambda required careful environment variable setup. EventBridge was useful for representing scheduled PM2.5 refresh, but it was less obvious to explain compared to Lambda. CloudWatch helped confirm that the backend was actually running.
Overall, AWS serverless worked well for this kind of prototype. I could show a real deployed frontend, a real API, scheduled backend logic, and logs without managing servers.

What Comes Next

A production version would connect live CPCB or air-quality feeds, real route APIs, and actual delivery platform data. It could also learn rider exposure over a full shift and recommend rest-zone breaks after repeated high-risk runs.
My hope is that BreatheSafe grows into a practical rider-safety tool: small dispatch changes, real environmental benefit, and less pollution exposure for people who spend their workday outdoors.
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