Empowering Vulnerable Drivers:The RoadSOS Story Our team built RoadSOS, a real-time, geolocated emergency dispatch dashboard tailored for vulnerable drivers, stranded motorists, and accident victims. Here is the story of how a concept born from real-world empathy became a functional reality. What Inspired Us The project was inspired by a sobering reality on our roads: when an accident or sudden vehicle breakdown happens, panic sets in immediately. Motorists frequently struggle to pinpoint their exact geographical coordinates under stress, or they waste critical minutes searching for nearby services while their phone battery drains.We wanted to build an absolute, fail-safe "one-click" dashboard. By hitting a single, prominent broadcast button, a user can instantly stream their identity, telemetry, and exact location to an active database monitor while simultaneously tracking the closest emergency services around them. How We Built The ProjectRoadSOS was developed as a lightweight, lightning-fast full-stack web application designed to run seamlessly on low-resource environments:The Backend Core: Powered by Python and Flask, providing a robust REST API to register incidents and look up nearby fleet resources.The Persistence Layer: Driven by SQLAlchemy and an SQLite database (roadsos.db) to log real-time telemetry streams securely.The Interactive UI: Built using clean semantic HTML5, CSS3 variables, and native JavaScript (Async/Await Fetch API).Geospatial Mapping: Integrated with the Leaflet.js open-source mapping engine to accurately lock onto live browser GPS telemetry and render dynamic, color-coded resource markers.To calculate which rescue assets are closest to a stranded driver, we implemented the Haversine formula directly into our spatial backend node. This formula computes the shortest great-circle distance between two pairs of spherical coordinates:$$d = 2R \arcsin\left(\sqrt{\sin^2\left(\frac{\Delta \phi}{2}\right) + \cos(\phi_1)\cos(\phi_2)\sin^2\left(\frac{\Delta \lambda}{2}\right)}\right)$$Where:$R$ represents the radius of the Earth ($6371.0\text{ km}$).$\phi_1, \phi_2$ are the latitudes of the two points in radians.$\Delta \phi$ is the absolute difference between the latitudes.$\Delta \lambda$ is the absolute difference between the longitudes. The Challenges We Faced Building a real-time system came with significant, hands-on architectural roadblocks:1. The Schema & State Locking ConflictOur biggest hurdle was handling data mutations during active development. We updated our database schemas inside Python to hold more complex properties like username and guardian_name. However, our local database engines kept throwing strict errors:Plaintextsqlite3.OperationalError: table sos has no column named username Because the old database file was actively locked by zombie background compiler processes, our automated schema drops were quietly failing. We had to implement absolute process terminations (Ctrl + C) and hard filesystem purges to force SQLite to rebuild the layout cleanly.2. Ambiguous Client-Side ErrorsDuring frontend-to-backend debugging, the browser repeatedly printed an ambiguous string: undefined.We discovered that when our backend encountered an unhandled exception, it structured the payload using an error property key, while our frontend JavaScript was blindly attempting to parse a missing message key. Rewriting the frontend to implement strict fallback error unpacking completely solved the problem and gave us clear insight into internal system bugs.3. Aggressive Browser Cache PoliciesModern web browsers aggressively cache localized JavaScript scripts to save bandwidth. During development, even after fixing our data mapping loops, the UI stubbornly loaded stale script files from memory. We bypassed this by migrating our telemetry trackers to explicit, cache-busting API routes (like /api/db-live-monitor) to force instantaneous, fresh asset downloads. What We Learned Building RoadSOS taught our team invaluable architectural lessons:Fail-Safe UI Design: We learned never to assume that an API response will arrive flawlessly. Writing bulletproof fallbacks in Javascript (e.g., record.username || 'Anonymous') ensures that even if an input field is missing, the application degrades gracefully instead of crashing the client browser window.Asynchronous Alignment: We mastered aligning backend dictionary keys with frontend template selectors. A single structural typo between Python (s.username) and JavaScript (record.username) can corrupt an entire telemetry stream.The Importance of Clear Exception Paths: Hiding internal application states behind generic errors makes debugging impossible. Exposing real database errors directly into our development notification panels transformed our debugging cycle from hours of guesswork into instantaneous fixes.

Built With

Share this project:

Updates