Inspiration
I know people with heart complications, and cardiac arrest is becoming an increasingly critical global health issue. The statistics are sobering: survival chances drop 7-10% per minute without CPR, and ambulances typically take 8-12+ minutes to arrive. But trained responders nearby could reach victims in under 4 minutes—that gap is literally the difference between life and death.
If we can save even one more life, this project is worth it.
When I saw this challenge, I knew I had to build something that could make a real difference in those critical first minutes.
What it does
RapidResponse is an AI-powered emergency response simulation that demonstrates how intelligent proximity matching can save lives during cardiac emergencies. Here's how it works:
Emergency Detection - When a cardiac emergency occurs (simulated by placing a marker on the map), the system immediately springs into action.
Intelligent Proximity Matching - The system searches for medically-trained responders (paramedics, doctors, nurses, CPR-certified citizens) within an escalating radius (300m → 400m → 600m), computing actual route distances for all candidates.
Smart Dispatch - Instead of just picking the closest responders by straight-line distance, it calculates real road routes and dispatches the 2 responders with the shortest actual travel distance.
Emergency Route Optimization - Responders follow roads but can take shortcuts when they save significant time (>30% distance savings), simulating real emergency vehicle privileges.
Audio Briefing - Using AWS Polly, the system provides hands-free audio briefings with critical patient information (allergies, blood type, medical history, emergency contacts) so responders can prepare while en route.
Real-time Visualization - A 3D map of Zurich shows responders moving along optimized routes with Uber-style blue line visualization, updating in real-time at 50 km/h.
How we built it
Tech Stack:
- Frontend: React + TypeScript + Vite
- 3D Mapping: MapLibre GL JS with Maptiler (3D buildings, terrain)
- State Management: Zustand
- Routing: OSRM with custom emergency vehicle optimization
- AI/TTS: AWS Polly for audio briefings
- Styling: Tailwind CSS
- Deployment: Vercel
Key Algorithms:
Route-Based Selection - Computes actual routes for all responders within radius, then selects the 2 with shortest travel distance: $$\text{Best Responders} = \text{argmin}_{r \in R} \left( \text{RouteDistance}(r, e) \right)$$
Emergency Route Optimization - Looks ahead 10 waypoints and takes shortcuts when beneficial: $$\text{Take Shortcut if: } \frac{d_{\text{road}} - d_{\text{direct}}}{d_{\text{road}}} > 0.3$$
Radius Escalation - Automatically expands search if insufficient responders found, with delays to allow route computation.
Data:
- Generated 75 mock responders with realistic Zurich coordinates
- Created 10 detailed patient profiles with medical histories
- Used real Zurich geography and road networks
Challenges we ran into
1. Routing Service Reliability The OSRM public server kept timing out, causing the entire simulation to hang. I implemented a 3-second timeout with graceful fallback to direct routing, ensuring the system never freezes.
2. Race Conditions on Reset When users reset the simulation while async route computations were running, old operations would complete and dispatch the wrong responders for the new emergency. I solved this by tracking emergency IDs and validating them before any state updates.
3. Route-Based vs. Distance-Based Selection Initially selecting by straight-line distance was fast but unrealistic—a responder 250m away across a river might take longer than one 400m away with direct road access. Computing actual routes for all candidates was computationally expensive but necessary for accuracy.
4. Balancing Realism with Emergency Privileges Emergency vehicles don't follow normal traffic rules, but they can't drive through buildings either. Finding the right balance required iterative tuning—following roads but allowing shortcuts when they save >30% distance.
5. Managing Async State in Real-Time Systems Coordinating route computation, responder dispatch, audio briefing generation, and animation while handling user resets taught me the importance of proper async state management and cancellation.
Accomplishments that we're proud of
- Route-based dispatch algorithm that computes actual travel distances for all candidates before selection—more accurate than simple proximity matching
- Emergency vehicle routing optimization that balances realism with emergency privileges
- Smooth real-time animation at 50 km/h with Uber-style route visualization
- Audio briefing system that provides hands-free patient information using AWS Polly
- Robust error handling with timeouts, fallbacks, and race condition prevention
- Clean, type-safe codebase following TypeScript best practices
- Deployed live demo on Vercel for judges to test interactively
What we learned
Real-time geospatial algorithms - Proximity matching with escalating radii requires careful balance between response time and responder availability.
Emergency routing is different - Traditional routing follows roads strictly, but emergency vehicles need intelligent shortcut detection while staying realistic.
Audio matters in emergencies - In high-stress situations, hands-free information delivery is crucial. Text-to-speech briefings make the system practical for real-world use.
Race conditions are subtle - Managing state when users can reset simulations while async operations are in flight requires careful tracking of operation validity.
Actual routes matter - Straight-line distance is a poor proxy for travel time in urban environments. Computing real routes is computationally expensive but essential for accuracy.
What's next for RapidResponse
Short-term:
- Integration with 144 dispatch - Connect with Switzerland's emergency dispatch system
- Mobile app - React Native version for actual responder use
- Push notifications - Real-time alerts to nearby responders
- Two-way communication - Allow responders to accept/decline and communicate with dispatch
Medium-term:
- Machine learning for availability prediction - Learn responder availability patterns to improve dispatch accuracy
- Traffic-aware routing - Integrate real-time traffic data for more accurate ETAs
- Multi-emergency coordination - Handle multiple simultaneous emergencies with optimal responder allocation
- Integration with wearables - Automatic emergency detection from Apple Watch, Fitbit, etc.
Long-term:
- Expand beyond cardiac arrest - Support other medical emergencies (stroke, severe allergic reactions, trauma)
- Responder training platform - Integrated CPR/first aid guidance and certification tracking
- Analytics dashboard - Track response times, outcomes, and system performance
- Scale to other Swiss cities - Expand beyond Zurich to Geneva, Basel, Bern, etc.
The ultimate goal: integrate this system into Switzerland's existing emergency infrastructure to save lives in those critical first minutes before the ambulance arrives.
Built With
- amazon-web-services
- cloud
- css
- gl
- javascript
- maplibre
- maptiler
- osrm
- polly
- react
- tailwind
- tts
- typescript
- vercel
- vite
- zustand
Log in or sign up for Devpost to join the conversation.