How er-sampoorn/rsai works
RoadSense is a crowd-sourced road-hazard monitoring and municipal response platform. Drivers’ phone telemetry is analyzed locally, reported through the events API, spatially deduplicated and stored; citizens and municipal staff then view hazards, personal reports, live maps and analytics. Authentication and audit trails support account and administrative workflows. The README documents additional map, rewards and native-sensor capabilities; excerpts confirm only selected route and page wiring, so uncertain connections are omitted.
Main entry points: supabase.ts Supabase Client · tracker/page.tsx Sensor Tracker · auth.ts Auth Services · dashboard/page.tsx Admin Dashboard
Components 20
Detection and Reporting
- Sensor Tracker
web/app/tracker/page.tsx - Detection Engine
web/lib/detection.ts - iOS Sensor Bridge
web/lib/ios-bridge
Events and Identity
- Events API
web/app/api/events/route.ts - Nearby Events API
web/app/api/events/nearby/route.ts - Supabase Client
web/lib/supabase.ts - RoadSense Data
backend/migrations - Auth Context
web/contexts/AuthContext.tsx - Auth Services
web/lib/auth.ts - Admin Audit
web/lib/auth.ts
Citizen Experience
- Hazard Map
web/app/map/page.tsx - My Reports
web/app/my-reports/page.tsx - Rewards
web/app/rewards/page.tsx - Road News API
web/app/api/news/route.ts
Municipal Operations
- Analytics
web/app/analytics/page.tsx - Admin Dashboard
web/app/dashboard/page.tsx
Other components
- Driver
- Phone Sensors
- Supabase
- Times Now RSS
Connections 20
- Driver → Sensor Tracker: starts tracking
- Phone Sensors → Sensor Tracker: sensor readings
- Sensor Tracker → Detection Engine: processes readings
- iOS Sensor Bridge → Sensor Tracker: native sensors
- Sensor Tracker → Events API: submits detections
- Events API → Supabase Client: queries and writes
- Supabase Client → Supabase: database access
- Supabase → RoadSense Data: stores events and profiles
- Auth Context → Auth Services: loads profiles
- Auth Services → Supabase Client: uses client
- Auth Services → Supabase: auth and audit writes
- Hazard Map → Nearby Events API: loads nearby hazards
- Nearby Events API → Supabase Client: queries events
- My Reports → Supabase Client: loads user reports
- Analytics → Supabase Client: loads event data
- Admin Dashboard → Supabase Client: reads and subscribes
- Admin Dashboard → Admin Audit: records admin actions
- Admin Audit → Supabase: writes audit entries
- Rewards → Supabase Client: uses event data
- Road News API → Times Now RSS: fetches headlines