How aya31aidi/drowsiness-detection-system works
This is a real-time driver-drowsiness monitor: camera frames become calibrated, smoothed fatigue indicators and timed alert episodes; alerts are persisted and surfaced in a React dashboard. The README documents detector behavior, API/database fallback, and dashboard capabilities. Some implementation details—especially detector internals and several dashboard pages—are unsampled, so those links are based on README statements or explicit import references rather than inferred call chains.
Main entry points: App.jsx Routed dashboard · facial_detection.py Alert episodes · api.js API client · OverviewPage.jsx Overview analytics
Components 23
Detection runtime
- Face monitoring
facial_detection.py - Fatigue indicators
facial_detection.py - Alert episodes
facial_detection.py - Audio alarm
facial_detection.py - Live camera feed
live_feed.py
Alert services
- Flask API
backend/app.py - Alert persistence
backend/supabase_utils.py - Supabase alerts
Dashboard application
- Routed dashboard
frontend/src/App.jsx - Alert state and refresh
frontend/src/data/AlertsProvider.jsx - API client
frontend/src/data/api.js - Live state client
frontend/src/data/useLiveState.js
Dashboard features
- Overview analytics
frontend/src/pages/OverviewPage.jsx - Alert history
frontend/src/pages/AlertsPage.jsx - Live monitor
frontend/src/pages/LivePage.jsx - System status
frontend/src/pages/SystemPage.jsx - User settings
frontend/src/pages/SettingsPage.jsx - Alert statistics
frontend/src/lib/stats.js - Alert categories
frontend/src/lib/alertKinds.js - CSV export
frontend/src/lib/csv.js
Other components
- Driver
- Webcam
- Dashboard user
Connections 28
- Driver → Webcam: faces
- Webcam → Face monitoring: frames
- Face monitoring → Fatigue indicators: extracts landmarks
facial_detection.py - Fatigue indicators → Alert episodes: thresholds over time
facial_detection.py - Alert episodes → Audio alarm: plays alarm
facial_detection.py - Alert episodes → Flask API: posts alerts
- Alert episodes → Alert persistence: fallback writes
facial_detection.py - Face monitoring → Live camera feed: publishes camera feed
facial_detection.py - Flask API → Alert persistence: delegates storage
backend/app.py - Alert persistence → Supabase alerts: reads and writes alerts
- Dashboard user → Routed dashboard: uses dashboard
- Routed dashboard → Alert state and refresh: wraps routes
frontend/src/App.jsx - Alert state and refresh → API client: loads and deletes alerts
frontend/src/data/AlertsProvider.jsx - API client → Flask API: requests alerts
frontend/src/data/api.js - Routed dashboard → Overview analytics: routes to
frontend/src/App.jsx - Routed dashboard → Alert history: routes to
frontend/src/App.jsx - Routed dashboard → Live monitor: routes to
frontend/src/App.jsx - Routed dashboard → System status: routes to
frontend/src/App.jsx - Routed dashboard → User settings: routes to
frontend/src/App.jsx - Overview analytics → Alert statistics: computes summaries
frontend/src/pages/OverviewPage.jsx - Overview analytics → Alert categories: groups alert types
frontend/src/pages/OverviewPage.jsx - Alert history → CSV export: exports filtered alerts
frontend/src/pages/AlertsPage.jsx - Alert history → Alert categories: filters and labels
frontend/src/pages/AlertsPage.jsx - Live monitor → Live state client: loads live metrics
frontend/src/pages/LivePage.jsx - Live state client → API client: uses API helpers
frontend/src/data/useLiveState.js - Live monitor → Live camera feed: views detector stream
- System status → API client: checks API
frontend/src/pages/SystemPage.jsx - User settings → CSV export: exports alerts
frontend/src/pages/SettingsPage.jsx