How karthikeyan230207/ai-powered-mobile-urban-sensing-using-public-buses works
This repository implements a transit-roadway defect sensing and incident-management product: video is analyzed for defects, detections are enriched into incidents, and a web dashboard supports monitoring and incident management. The backend and mobile sensor are also present, but their detailed runtime wiring is not shown in the excerpts. The graph preserves these product areas while leaving uncertain connections dashed; most backend implementation details and several intelligence stages were not sampled.
Main entry points: main.py Backend API · incident.py Incident builder · App.jsx Dashboard app · api.js API client
Components 26
Video sensing
- Video processor
ai/video_processor.py - AI detector
ai/ai_detector.py - Detection engine
ai/detection_engine.py - Defect detectors
ai/detectors - Object detector
ai/detectors/object_detector.py
Incident intelligence
- Incident builder
intelligence/incident.py - Severity scoring
intelligence/severity.py - Location priority
intelligence/priority.py - GPS provider
intelligence/gps.py - Geo utilities
intelligence/geo_utils.py - Intelligence config
intelligence/config.py
Backend services
- Backend API
backend/app/main.py - Incident models
backend/app/models.py - Database access
backend/app/database.py - Realtime events
backend/app/realtime/event_manager.py - WebSocket connections
backend/app/realtime/connection_manager.py - Incident adapter
backend/app/realtime/incident_adapter.py
Operations dashboard
- Dashboard app
dashboard/src/App.jsx - Incident state
dashboard/src/hooks/useIncidents.js - Dashboard stats
dashboard/src/hooks/useDashboardStats.js - Live incident hook
dashboard/src/hooks/useIncidentWebSocket.js - API client
dashboard/src/services/api.js - Dashboard pages
dashboard/src/pages
Mobile sensor
- Mobile sensor app
mobile-sensor/src/App.jsx
Other components
- Video source
- Transit operator
Connections 29
- Video source → Video processor: supplies frames
- Video processor → AI detector: detects frames
ai/video_processor.py - AI detector → Detection engine: delegates detection
ai/ai_detector.py - Detection engine → Defect detectors: runs detectors
ai/detection_engine.py - Detection engine → Object detector: runs detector
ai/detection_engine.py - Video processor → Incident builder: builds incidents
ai/video_processor.py - GPS provider → Geo utilities: uses geometry
intelligence/gps.py - GPS provider → Intelligence config: reads settings
intelligence/gps.py - Severity scoring → Intelligence config: reads scoring rules
intelligence/severity.py - Incident builder → Severity scoring: scores detections
- Incident builder → Location priority: assesses location
- Incident builder → GPS provider: uses location
- Incident builder → Backend API: submits incidents
- Backend API → Database access: persists records
- Backend API → Incident models: uses schemas
- Backend API → Realtime events: publishes events
- Realtime events → WebSocket connections: dispatches events
- Realtime events → Incident adapter: adapts incidents
- Dashboard app → Incident state: loads incidents
dashboard/src/App.jsx - Dashboard app → Dashboard stats: loads statistics
dashboard/src/App.jsx - Dashboard app → Live incident hook: handles live events
dashboard/src/App.jsx - Dashboard app → Dashboard pages: renders pages
dashboard/src/App.jsx - Incident state → API client: requests incidents
dashboard/src/hooks/useIncidents.js - Dashboard stats → API client: requests statistics
dashboard/src/hooks/useDashboardStats.js - Live incident hook → API client: gets socket URL
dashboard/src/hooks/useIncidentWebSocket.js - Live incident hook → Backend API: receives live events
- API client → Backend API: calls API
- Transit operator → Dashboard app: manages incidents
- Transit operator → Mobile sensor app: uses sensor app