Empowering the Golden Hour: High-Reliability Emergency Assistance & Global Rescue Coordination.
ROADSoS is a high-performance, location-based platform designed to provide immediate access to life-saving services during road accidents. By integrating trauma centers, ambulances, police, and vehicle rescue into a single interface, it supports both victims and bystanders in taking rapid, effective action.
- 2D KD-Tree Spatial Indexing ($O(\log N)$): Replaced flat array processing with an in-memory k-dimensional tree for sub-millisecond nearest emergency facility lookup and spatial range queries.
-
Bounded Max-Heap Top-K Selection ($O(N \log K)$): Integrated priority queue candidate selection (
$K=25$ ) on both client and server to eliminate full-array Timsort overhead ($O(N \log N)$). -
Geohash Grid Caching ($O(1)$): Encodes coordinates into 6-character Base32 Geohashes (Z-Order curves) for
$O(1)$ spatial hashing and Redis cache keying (svc:geohash_radius). -
Prefix Trie Autocomplete ($O(L)$): Trie data structure for
$O(L)$ search-as-you-type prefix lookup across 25 supported regional languages. - Probabilistic Bloom Filter ($O(1)$): BitSet-based Bloom filter for instant set membership verification before triggering external API requests.
- Hardware Resource Cleanup: Streamlined the rPPG Vitals Monitor and Geolocation Watcher lifecycle to automatically release active camera
MediaStreamvideo tracks and cancel animation frames upon toggle or component unmount. - Strict WebSocket Routing: Cleaned WebSocket URL host parsing to remove trailing slashes, ensuring strict compliance across Nginx, Cloudflare, and Docker reverse proxies.
- Defensive Geolocation & Haversine Math: Added domain clamping to Haversine distance calculations (
a = min(1.0, max(0.0, a))) to eliminate floating-point edge-case crashes, alongside explicitis not Nonehandling for equator/prime-meridian (0.0) coordinates.
- Gesture-Based Triggers: Added support for motion-activated SOS calls. Users can firmly shake their device to trigger an emergency session.
- 3-Second Safety Window: To prevent false alarms, a high-priority countdown overlay appears with haptic feedback, allowing users to cancel accidental triggers.
- Cross-Platform Compatibility: Optimized for both Android and iOS devices using the
DeviceMotionEventAPI.
- Zero-Friction Emergency Use: Removed user authentication/login requirements. Victims can access all life-saving features instantly without remembering passwords.
- Backend Rate Limiting: Integrated
SlowApiwith Redis to protect the infrastructure from abuse while maintaining open access for legitimate users. - Enhanced Privacy: User profile data (Name, Blood Group, Medical Notes) is stored strictly on the local device, ensuring absolute privacy.
- GPS-Based Localization: The app now detects the user's specific state (e.g., Tamil Nadu, Maharashtra) and automatically suggests or switches to the primary regional language.
- Scheduled Languages Support: Full support for Indian Scheduled Languages (Hindi, Tamil, Telugu, Marathi, etc.) to assist non-English speakers during crises.
- Fast Mirror Timeout: Reduced mirror connection timeouts to 10s (backend) and 3.5s (client fallback race) to fail over seamlessly during OpenStreetMap API congestion.
- Redis Connection Guard: Pub/Sub listeners now cleanly unsubscribe and close on WebSocket disconnect without throwing cancelled task exceptions.
- Trauma Center Prioritization: Specialized accident care facilities are prioritized and highlighted with pulsing "Trauma Center" badges.
- High-Efficiency Parallel Search: Backend splits queries into specific categories and executes them concurrently across multiple global mirrors.
- Real-time Tracking: WebSocket-powered live location sharing allows victims to broadcast their movements to rescue teams via Redis Pub/Sub.
- Bystander Emergency Protocol: A standalone, proactive 3-step checklist (Secure Scene, Assess, Coordinate) to guide first responders.
- GPS Coordination: One-tap location copying to accurately relay coordinates to emergency dispatchers.
- Map Tile Caching: PWA implementation pre-caches OpenStreetMap tiles, ensuring the map remains functional even in zero-network zones.
- Geospatial Cache Headers: Redis caching with rounded coordinate grids (~110m) to ensure nearby users share the same ultra-fast responses.
For a deep dive into the system's inner workings, refer to our end-to-end documentation:
- ๐๏ธ System Architecture: Detailed breakdown of the decoupled frontend/backend, data flow, failover systems, and deployment strategy.
- ๐ก API Reference: Comprehensive documentation of the FastAPI REST endpoints, WebSocket connections, rate limits, and expected payloads.
- Framework: React 18 with TypeScript
- State/Animation: Framer Motion & Lucide Icons
- Mapping: Leaflet with Workbox-powered Tile Caching
- PWA: Fully installable as a mobile app with offline support
- Engine: FastAPI (Python 3.11+)
- Security: SlowApi Rate Limiting (Redis-backed)
- Real-time: WebSockets with Redis Pub/Sub
- Cache: Redis (Geospatial-hashed transient storage)
- Docker & Docker Compose
-
Clone the Repo:
git clone https://github.com/LEVELING2108/RoadSoS.git cd RoadSoS -
Launch the Stack:
docker-compose up --build
-
Access the App:
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8000
- Frontend:
- Reliability: Multi-source backend failover and Redis-backed caching.
- Accuracy: Specialized OSM tagging for Trauma and Rescue identification.
- Offline: PWA map tile caching for "no-signal" scenarios.
- Innovation: Gesture-based SOS triggers, regional language scanning, and parallel search architecture.
ยฉ 2026 ROADSoS Global Network. Built for safety.