Inspiration
Poseidon Surge was inspired by the devastating flash floods and Glacial Lake Outburst Floods (GLOFs) that struck Rasuwa, Nepal, in August 2026. Witnessing how quickly mountain valleys flood—and how easily phone lines and internet connections break down during a crisis—highlighted a critical gap in both early warning visualization and low-bandwidth emergency coordination. We wanted to build a single platform that models terrain-aware flood risk in real time while handling incoming voice calls and text commands when people cannot load a web dashboard.
What it does
Poseidon Surge is a multi-channel flood response and missing-person coordination platform:
- Live Flood Desk & Terrain Modeling (
/dashboard): An interactive hydrological map that lets responders click any location to inspect the nearest river's live discharge, statistical return period (2-year to 100-year flood severity), and simulated HAND (Height Above Nearest Drainage) water-fill extent over real elevation tiles—plus a Replay: Nepal Aug 2026 mode simulating the Rasuwa GLOF event. - AI Emergency Voice Dispatcher (
Vapi+POST /api/postsms): A live telephony voice agent (HydroRescue Dispatch) that fields incoming phone calls so callers can check if a loved one is safe (check_missing_person) or report someone missing (report_missing_person) hands-free, writing directly to the shared emergency registry withREG-xxxxxtracking IDs. - Offline Helpline & SMS Simulator (
/sms-simulator): Designed for low-connectivity conditions, the platform parses structured SMS commands (SEARCH,MISSING,FOUND,STATUS,HELP) through a shared core engine (src/core/sms) and includes an interactive SMS Simulator on the site so responders and judges can test the full messaging pipeline in real time. - Missing People Registry, Community Relief & Admin Desk (
/missing,/communities,/admin): A unified registry where records are never deleted (only moved frommissingtofoundwith an event audit trail and automatic initial-masking for minors under 18), paired with community relief listings (shelters, medical, food/water, rescue) and an admin review workflow.
How we built it
We engineered a modular, full-stack TypeScript application deployed on Vercel:
- Frontend & Mapping: Built with Next.js 16 (App Router), React 19, CSS Modules, and Leaflet / React-Leaflet, rendering real-time HAND inundation overlays on AWS Terrarium DEM elevation tiles (
/api/dem) alongside GSAP motion transitions. - Hydrological & Terrain Engine (
src/model/): Fetches live river discharge forecasts from Open-Meteo and historical streamflow baselines from GEOGLOWS v2, fits a Gumbel extreme-value distribution to calculate return periods and flood severity, and applies Manning's equation stage-discharge rating curves to translate excess flow into estimated flood depth (meters) across the terrain. - Backend, Auth & Database: Powered by Next.js Route Handlers & Server Actions, Drizzle ORM on Supabase Postgres, Clerk authentication with role-based access (
user/admin), and Vitest + PGlite for isolated in-memory Postgres integration tests. - AI Telephony Agent (
vapi/): Built with Vapi, Gemini 2 Multimodal`, ElevenLabs voice synthesis 2.5 and, and Scribe` real-time transcription, connected toPOST /api/postsmswith E.164 phone normalization (libphonenumber-js) and configurable per-caller rate limiting.
How We Used ElevenLabs
We utilized the ElevenLabs API to power the voice of our autonomous emergency dispatcher, moving far beyond static text-to-speech to create a real-time, interactive conversational agent.
- ElevenLabs Turbo v2.5 Model: In a live emergency, latency costs lives. We utilized the Turbo v2.5 model for its ultra-low latency inference, allowing our voice agent to respond to panicked callers in real-time without awkward robotic pauses.
- Voice Tuning & Customization: We selected highly articulate voices (Callum and Will) and specifically engineered their parameters for high-stress triage. We set Stability to 90%, Style to 0%, and Speed to 1.25x. This completely stripped the natural expressive emotion from the model, creating a clinical, "zero-emotion" dispatcher tone that remains incredibly clear and authoritative over noisy phone lines.
- Conversational AI Integration: We piped the ElevenLabs API through Vapi and Gemini 1.5 Flash to handle dynamic interruptions and deterministic tool-calling (database queries), creating a fully autonomous voice agent capable of holding two-way emergency conversations.
Challenges we ran into
- Voice AI Tool-Calling Reliability & Latency: Getting a live voice model to collect a missing person's name, age, location, and description naturally—without looping questions or hallucinating a saved report before the webhook finishes—required tightening both the system prompt and the tool schemas (
check_missing_person,report_missing_person) so partial caller answers still move forward cleanly. - Serverless Webhook Resilience: On Vercel's read-only serverless filesystem, writing a local JSON backup (
data/helpline-reports.json) after saving a voice report to Postgres initially caused500errors onPOST /api/postsmseven though the database insert succeeded. Guarding the file mirror and making Postgres the source of truth fixed production calls immediately. - Fast Terrain & Streamflow Calculations in the Browser/Edge: Computing Gumbel return periods, Manning depth curves, and Terrarium DEM height-above-drainage grids without a heavy Python GIS backend required writing a lightweight, cached TypeScript modeling pipeline (
src/model/) with pre-computed climatology and static replay fixtures for Nepal.
What we learned
Designing for Voice AI is fundamentally different from text chat: prompts have to optimize for spoken pacing, concise confirmations, and strict tool boundaries so callers in distress get clear answers fast. We also learned how much reliability you gain by keeping domain logic (SMS command parsing, Vapi tool execution, and hydrological math) as pure, database-testable TypeScript modules backed by in-memory Postgres tests.
Accomplishments that we're proud of
- End-to-End Live Voice Hotline: Real callers can dial the Vapi phone number, speak with HydroRescue Dispatch, and see newly reported missing-person records (
REG-xxxxx) appear immediately on the live web registry. - Real Hydrology & Terrain Modeling in Pure TypeScript: Combining Open-Meteo, GEOGLOWS historical distributions, Gumbel return periods, Manning's equation, and AWS Terrarium DEM tiles into a responsive Flood Desk without external GIS servers.
- Privacy-Safe, Audit-Logged Registry: Enforcing non-destructive
missing → foundstate transitions, automatic minor-name masking in public search results, and full event history across web, SMS simulator, and voice inputs.
What's next for Poseidon Surge
- Live Carrier SMS Hookup: Connect the
POST /api/smsendpoint (currently wired behindsrc/core/smsandsrc/sms/types.ts) to live Twilio/Textbelt carrier numbers and partner with Nepalese telecom providers (such as NTC and Ncell) for resilient alert delivery during blackouts. - 2D Volumetric Terrain & Satellite Integration: Expand the Flood Desk with 2D DEM extrusion and Sentinel-1 SAR / Copernicus DEM GLO-30 data feeds for higher-resolution GLOF early warning in Himalayan valleys.
- Automated Dispatch Escalation: Wire real-time Gumbel severity thresholds from the Flood Desk directly into outbound voice and SMS alerts for registered community shelters.