The algorithm that shows you who it left behind
An interactive web app that turns a research framework for menstrual-health climate vulnerability into a live, clickable decision-support tool. Built for the "Tech for Humanity" hackathon.
-
Vulnerability Map — Districts are scored using 18 formulas from the MHCVI research paper (exposure × sensitivity × capacity) and colored green→red. Click any district to see its pillar breakdown.
-
Field-Note Translator — Type a plain-English observation ("the well ran dry and girls walk 3km for water") and watch the AI convert it into model inputs. The map recolors in real time.
-
Efficiency ↔ Equity Slider — Drag one slider to redistribute a fixed budget. Efficiency floods cheap urban districts; Equity redirects to remote high-vulnerability communities.
-
Price of Equity — The tool confesses exactly who a pure-efficiency algorithm would abandon, and what it costs to protect them. In dignity-days and school-years.
-
Simulate Cyclone — Click a button to spike vulnerability across the map with a shockwave animation, then watch it decay (F12 dynamic risk).
-
Model Weights — Adjust the α/β/γ pillar weights to see how vulnerability rankings change.
src/
main.jsx — entry point
App.jsx — four-screen layout, state management
model.js — F1–F18 as pure functions
data.js — multi-region dataset (4 regions × 6 districts)
components/
Map.jsx — SVG map colored by V_i
FieldNote.jsx — text input → calls /api/translate
Allocation.jsx — ε slider + funding view
PriceOfEquity.jsx — PoE display + abandoned-districts list
PillarPanel.jsx — click-to-expand breakdown (Recharts)
WeightSliders.jsx — α/β/γ pillar weight controls
HonestyBadge.jsx — corner disclaimer
Tutorial.jsx — onboarding walkthrough
test-model.js — verification script (run with node)
functions/
api/
translate.js — Cloudflare Worker: proxies OpenRouter API (key stays server-side)
| Layer | Choice |
|---|---|
| Frontend | React 19 + Vite 8 |
| Styling | Tailwind CSS 4 |
| Animation | Framer Motion |
| Charts | Recharts |
| Backend | Cloudflare Pages Functions (Workers) |
| AI | OpenRouter API (free model, proxied through Worker) |
| Deploy | Cloudflare Pages + Wrangler |
npm install
npm run dev # Vite dev server only (no API proxy)
npm run dev:full # Vite + Wrangler (full stack with API)- Get a free key at openrouter.ai (50 req/day free tier)
- Create
.dev.varsin the project root (gitignored):This is only needed forOPENROUTER_API_KEY=sk-or-v1-...npm run dev:full. In production, the key lives in Cloudflare dashboard.
# Login to Cloudflare (browser opens)
npx wrangler login
# Deploy — creates the project automatically
npm run deploy- Go to dash.cloudflare.com → Workers & Pages → mhcvi-live → Settings → Environment variables
- Add
OPENROUTER_API_KEYwith your key (encrypt it) - Deploy again to pick it up:
npm run deploy:prod
| Command | What it does |
|---|---|
npm run dev |
Vite only (frontend, no API) |
npm run dev:full |
Full stack locally with Wrangler |
npm run build |
Build to dist/ |
npm run deploy |
Build + deploy preview to Cloudflare Pages |
npm run deploy:prod |
Build + deploy to production branch |
node src/test-model.jsPrints all intermediate values for 2 hard-coded districts. Compare to spreadsheet.
All data is fake-but-realistic — the model is specified, not calibrated. Each region has 6 districts with distinct hazard profiles:
- South Asian Delta — cyclones, flooding, salinity intrusion
- East African Drought Belt — water scarcity, heat, displacement
- Pacific Small Island States — sea-level rise, remoteness, freshwater loss
- Heat-Stressed Megacity — extreme heat, water insecurity, price shocks
Each region has 2–3 high-vulnerability/remote districts AND 2–3 low-vulnerability/urban districts to make the Efficiency↔Equity slider visually meaningful.
Built on: "Prioritizing Under Constraint: A Mathematical Framework for Targeting Menstrual Health Resources in Climate-Vulnerable Communities" (MHCVI & Resource Allocation Model).