AWS Builder Center

Off the Heat: a serverless heat-safe shift planner on AWS

How we built an Android and web app that tells construction supervisors which hours are safe for outdoor work in extreme heat, and turns the plan into a Hindi voice note, using SAM, Lambda, API Gateway, DynamoDB, Polly and EventBridge.

Applied AI Builder that can actually do stuff
Outdoor workers in Rajasthan keep working through dangerous afternoon heat because nobody turns the weather forecast into a shift decision. Heat forecasts exist, but site-level instructions don't. Off the Heat is our entry to the WeMakeDevs x AWS environmental hackathon, Heat and Water track.

Demo video

What it does

A site supervisor sets up their site once: location, shift hours, and whether the work is in direct sun. The app then fetches the hourly forecast for the site, scores every shift hour into one of five heat-risk bands, and shows:
  • an hour-by-hour timeline with the band name and temperature written out, not only coloured
  • a stop-work window, the longest run of dangerous hours in the shift
  • a plan for the supervisor
  • a fixed, human-reviewed heat-stroke message on dangerous days
  • a short Hindi voice note that the supervisor shares to the crew's WhatsApp group

Keeping the safety decisions deterministic

The risk engine is plain Python. It computes the heat index with the US National Weather Service formula, sets each band from the heat index and air temperature, and finds the stop window. The plan text is built from templates, and an output check rejects any plan that contains a number not produced by the engine. We did not put an AI model in the decision path, because a supervisor needs the same answer every time for the same forecast.

How AWS is used

  • AWS SAM and SAM CLI: one  template.yaml  defines the whole stack, and  sam build  and  sam deploy  deploy it.
  • AWS Lambda: two functions.  api  handles the HTTP routes and returns JSON.  planner  builds plans and voice notes asynchronously, so no request waits on it.
  • Amazon API Gateway (HTTP API): the public entry point for  /api , throttled because the API is public.
  • Amazon CloudFront: one HTTPS domain for the web app, the APK download and the API, with origin access control on the private S3 bucket.
  • Amazon S3: a private bucket for the web build and APK, and another for voice notes. The API signs time-limited links to the MP3s.
  • Amazon DynamoDB: three on-demand tables for sites, plans and cooling points.
  • Amazon Polly: the neural  Kajal  voice with the  hi-IN  language code, so numbers are read in Hindi.
  • Amazon EventBridge Scheduler: runs the planner every day at 06:00 IST for every site, so the plan is ready when the supervisor opens the app.
  • Amazon CloudWatch Logs: Lambda logs, with API errors recorded against the site.

Two design choices that mattered

  • Async planning. API Gateway cuts requests at 30 seconds, so  api  saves a pending plan, invokes  planner  asynchronously and returns at once. The app polls until the plan is ready.
  • No retries for the planner. A retry could build or voice the same plan twice, so the planner's retry count is zero, and a failed run is marked  failed  and logged.

What we'd do next

Native-speaker review of the Hindi text, real supervisor interviews, and replay of more heat days. We are not claiming more than the data supports.

Credits

Weather data by Open-Meteo, licensed under CC BY 4.0. Heat index from the US National Weather Service. Temperature cut-offs follow India Meteorological Department heatwave criteria.
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