How ay178/sos works
RoadSoS AI coordinates an emergency response from a mobile SOS flow: incident intake and creation, AI severity assessment, hospital ranking, ambulance dispatch, and alerts to hospitals and family. Hospital staff manage capacity and incoming alerts; families can follow a shareable tracking page, while users can sign in and maintain medical profiles. The README documents the end-to-end workflow and several capabilities whose source was not sampled; those links are shown as documented rather than inferred from imports.
Main entry points: 001_schema.sql Postgres data · page.tsx SOS app · route.ts Ambulance dispatch · notify.ts Alert messaging
Components 24
Emergency response
- SOS app
app/page.tsx - Live tracking
app/tracking/[id]/page.tsx - Medical profile UI
app/page.tsx - Sign-in
app/auth/page.tsx
Response services
- Incident intake
app/api/sos/route.ts - Severity analysis
app/api/analyze/route.ts - Hospital ranking
app/api/trs/route.ts - TRS engine
lib/trs.ts - Ambulance dispatch
app/api/dispatch/route.ts - Alert messaging
lib/notify.ts - Profile service
app/api/profile/route.ts - Inference service
inference_server.py - Severity model
model/roadsos_accident_severity_model.keras
Care operations
- Hospital dashboard
app/hospital/page.tsx
Data and identity
- Supabase clients
lib/supabase.ts - Browser client
utils/supabase/client.ts - Server client
utils/supabase/server.ts - Postgres data
supabase/migrations/001_schema.sql - Domain types
types/index.ts
Other components
- SOS reporter
- Claude AI
- Twilio
- Family contact
- Hospital staff
Connections 26
- SOS reporter → SOS app: starts SOS
README.md - SOS app → Incident intake: creates incident
README.md - Incident intake → Postgres data: writes incident
app/api/sos/route.ts - SOS app → Severity analysis: requests analysis
README.md - Severity analysis → Claude AI: analyzes severity
README.md - SOS app → Hospital ranking: requests ranking
app/page.tsx - Hospital ranking → Postgres data: reads hospitals
app/api/trs/route.ts - Hospital ranking → TRS engine: ranks hospitals
app/api/trs/route.ts - SOS app → Ambulance dispatch: requests dispatch
README.md - Ambulance dispatch → Postgres data: reads and updates
app/api/dispatch/route.ts - Ambulance dispatch → TRS engine: scores selected hospital
app/api/dispatch/route.ts - Ambulance dispatch → Alert messaging: sends alerts
app/api/dispatch/route.ts - Alert messaging → Twilio: sends SMS and WhatsApp
lib/notify.ts - Alert messaging → Family contact: alerts family
lib/notify.ts - Alert messaging → Hospital staff: alerts hospital
lib/notify.ts - Family contact → Live tracking: follows incident
README.md - Hospital staff → Hospital dashboard: manages capacity
README.md - Hospital dashboard → Postgres data: updates hospital data
app/hospital/page.tsx - Medical profile UI → Profile service: manages profile
- Profile service → Postgres data: upserts profile
app/api/profile/route.ts - Sign-in → Supabase clients: uses auth client
README.md - Supabase clients → Browser client: re-exports client
lib/supabase.ts - Browser client → Postgres data: connects to data
- Supabase clients → Postgres data: creates service connection
- Server client → Postgres data: creates server connection
- Inference service → Severity model: loads model