Inspiration

In 2023, over 60,000 people died from natural disasters globally. Not all of them lacked warning — many lacked access to warning. A cyclone alert on a government website means nothing to a farmer in rural Bangladesh with a 2G connection. A flood warning on a weather app means nothing when your phone has been dead for two hours.

We kept asking the same question: why is disaster preparedness still a privilege?

The technology to save these lives already exists. AI can predict risk patterns. APIs can pull live weather data anywhere on Earth. Service workers can cache critical survival information offline. Nobody had put it all together for the people who need it most. That became StormSense.


What it does

StormSense is an AI-powered disaster preparedness and real-time alert platform built around one principle: it must work when everything else fails.

  • Live risk map — Leaflet.js map with color-coded risk zones updated via OpenWeatherMap, from green (safe) to red (critical)
  • AI Risk Analyst — powered by Claude, returns a structured threat assessment and 48-hour preparedness checklist
  • Alert Center — real-time disaster feed with one-tap AI-generated survival guides
  • Offline Kit — fully cached guides and SOS protocols that work with zero internet
  • SMS Simulator — shows how short, low-literacy-readable alerts reach rural users on basic phones

How we built it

The frontend is React + Vite + Tailwind CSS, deployed on Vercel. The map uses Leaflet.js pulling from the OpenWeatherMap API every 5 minutes. Risk zones are rendered as color-filled polygons scored by a composite formula:

$$\text{Risk Score} = w_1 \cdot P + w_2 \cdot V + w_3 \cdot \Delta T$$

where \( P \) is precipitation rate (mm/hr), \( V \) is wind speed (km/h), and \( \Delta T \) is temperature anomaly from seasonal baseline.

The AI layer uses the Claude API. Every call passes a structured JSON payload — location, live weather snapshot, and disaster type — so Claude never gives generic advice.

For heatwave detection we use the Heat Index:

$$HI = -42.379 + 2.049T + 10.143R - 0.225TR - 6.84 \times 10^{-3}T^2 - 5.48 \times 10^{-2}R^2$$

where \( T \) is temperature in °F and \( R \) is relative humidity. Values above \( 103°F \) trigger High; above \( 124°F \) trigger Critical.

Flood risk classification:

$$\text{Flood Risk} = \begin{cases} \text{Low} & P < 10\ \text{mm/hr} \ \text{Medium} & 10 \leq P < 30\ \text{mm/hr} \ \text{High} & 30 \leq P < 60\ \text{mm/hr} \ \text{Critical} & P \geq 60\ \text{mm/hr} \end{cases}$$

The offline architecture uses a service worker with a versioned cache key:

const CACHE_NAME = 'stormsense-v1';
const ASSETS = ['/', '/offline', '/survival-guides', '/sos'];

self.addEventListener('install', e => {
  e.waitUntil(
    caches.open(CACHE_NAME).then(cache => cache.addAll(ASSETS))
  );
});

Weather charts use Chart.js — a 24-hour temperature trend line and precipitation probability bar chart, both on the same 5-minute refresh cycle.


Challenges we faced

1. Making Claude context-aware, not generic. Passing raw location and live weather JSON as context in every API call transformed Claude from a textbook into an actual analyst. The structured system prompt anchors every response to specific, real conditions.

2. Offline-first is deceptively hard. Service workers are powerful but brittle. Our first build cached the wrong assets and failed silently. We rebuilt around a versioned manifest with a cache-validation ping on load — so the "Offline Ready" badge is truthful, not just optimistic.

3. Low-literacy SMS formatting. 160-character limit. No markdown. No assumed vocabulary. Every word earns its place:

FLOOD RISK HIGH. MOVE TO HIGH GROUND NOW.
BRING WATER + ID. CALL 112.

4. Performance on low-end Android. Leaflet + Chart.js together were too heavy for 512MB RAM devices. Lazy-loading the map only on Dashboard activation and deferring Chart.js until the weather panel is visible cut initial load time by ~60%.


What we learned

  • Prompt engineering is infrastructure — a poorly structured API call produces an answer; a well-structured one produces a decision
  • Offline-first changes how you architect everything from day one — it cannot be bolted on later
  • Designing for constraints is not a limitation — it is the whole point
  • Simplicity saves lives faster than sophistication

What's next for StormSense

Real Twilio SMS integration, a community condition-reporting feature, a teacher mode for disaster preparedness curriculum, and partnerships with Red Cross and local government emergency agencies to become an official alerting channel in underserved regions.

Built With

Share this project:

Updates