These microservices already exist in the backend/services/ directory and handle the core integration logic:
- Device registration (IMEI, serial)
- Vehicle pairing
- Heartbeat monitoring
- Firmware OTA updates
- Geofence management
- Session lifecycle management
- Telemetry ingestion via Kafka
- Real-time event publishing
- Session replay storage
- Behavior analysis engine
- Event detection (overspeed, harsh brake)
- Real-time driver scoring
- Risk classification
- Face embedding enrollment
- Cosine similarity verification
- Quality assessment
- Anti-proxy detection
- Multi-source video aggregation
- Chain of custody
- Privacy engine (blurring)
- Clip extraction
- Rate limiting (Redis)
- Circuit breaker
- WebSocket support
- Health monitoring
Candidate scans QR from mobile app. Biometric captures fingerprint/face.
/api/v1/sessions/check-in
โ Assigns vehicle & devices
โ Returns session_id
Driver Verification Service enrolls face embeddings. Continuous verification during test.
/api/v1/verification/enroll
โ cosine_similarity threshold: 0.85
โ Stored in PostgreSQL with pgvector
All devices paired to vehicle. Test session activated.
/api/v1/devices/{device_id}/pair
โ Activates telemetry streaming
โ MQTT topics: surakshapath/{device_id}/telemetry
OBD sends speed, RPM, acceleration. GPS sends location. Camera sends face frames.
wss://api.surakshapath.in/ws/telemetry/{session_id}
โ Published to Kafka topic: telemetry.raw
โ Driving Monitor consumes & analyzes
Driving Monitor Service analyzes telemetry windows, detects events, computes score.
Session ends. Final score calculated. Results published via Kafka.
/api/v1/sessions/{session_id}/complete
โ Evidence clips extracted from S3
โ Score card generated
If passed, license issued via Sarathi API. Pushed to DigiLocker.
https://sarathi.parivahan.gov.in/api/v1/license/issue
โ License number generated
โ Pushed to DigiLocker API
Key Integration Points
- MQTT Broker: Eclipse Mosquitto at edge for device communication
- Kafka Topics: telemetry.raw, session.events, verification.events
- WebSocket: Real-time dashboard updates via gateway
- PostgreSQL: All persistent data with pgvector for embeddings
- Redis: Session cache, rate limiting, pub/sub
- S3: Video evidence storage with lifecycle policies
Latency Budget
| Device โ Edge | <50ms |
| Edge โ Cloud | <100ms |
| AI Inference | <200ms |
| Dashboard Update | <500ms |
Device Communication (MQTT)
Kafka Event Schema
WebSocket Messages
Face Verification API
| Component | Status | Location / Technology | Notes |
|---|---|---|---|
| API Gateway | โ Built | backend/gateway/ - FastAPI |
Rate limiting, circuit breaker, WebSocket |
| Device Management | โ Built | backend/services/device-management-service/ |
Registration, pairing, heartbeat, geofence |
| Test Session Service | โ Built | backend/services/test-session-service/ |
Session lifecycle, Kafka integration |
| Driving Monitor | โ Built | backend/services/driving-monitor/ |
Behavior analysis, scoring algorithm |
| Face Verification | โ Built | backend/services/driver-verification-service/ |
Enrollment, cosine similarity, pgvector ready |
| Evidence Collection | โ Built | backend/services/evidence-collection/ |
Multi-source aggregation, privacy engine |
| Kafka Producer/Consumer | โ Built | backend/shared/events/ |
Shared event schemas, producer client |
| Mobile App (React Native) | โ Built | mobile/src/ |
Test screens, verification, results |
| Edge MQTT Broker | โ Partial | Docker (Mosquitto) | Config ready, needs edge deployment scripts |
| AI Inference (TensorRT) | โ Partial | ai-ml/ |
Models exist, Jetson deployment needed |
| Parivahan/Sarathi API | โ Planned | Government API integration | Requires MoU with state transport dept |
| DigiLocker Push | โ Planned | NAD/DigiLocker API | Requires government partnership |
โ๏ธ Cloud (AWS)
- EKS: Kubernetes for all microservices
- RDS PostgreSQL: Primary database with pgvector
- ElastiCache Redis: Caching, rate limiting
- MSK (Kafka): Event streaming
- S3: Video evidence storage
- CloudFront: CDN for mobile assets
๐ข Edge (Per RTO)
- NVIDIA Jetson AGX: AI inference
- Mosquitto: Local MQTT broker
- Redis: Local cache
- NVR: Local video recording
- 4G/5G Router: Failover connectivity