How manny2706/pitwatch-ai works
Pitwatch is a road-surveillance platform spanning a React admin dashboard, Django API and workers, ML inference, and a Flutter mobile client. The main admin workflow is login → protected analytics, reports, or nearby-hazard map → authenticated API requests → displayed results. Backend capabilities also cover report management, async detection, and email escalation; the README describes mobile drowsiness monitoring, but its Dart sources are absent from the supplied tree. Relationships for unsampled backend and mobile features are based on README statements, not source inspection.
Main entry points: App.jsx React dashboard · views.py Reports API · tasks.py Async inference · DashBoardPage.jsx Analytics page
Components 25
Admin dashboard
- React dashboard
FRONTEND/src/App.jsx - Admin login
FRONTEND/src/components/Auth.jsx - Route protection
FRONTEND/src/services/ProtectedRoutes.jsx - Analytics page
FRONTEND/src/pages/DashBoardPage.jsx - Reports page
FRONTEND/src/pages/ReportsPage.jsx - Live map
FRONTEND/src/pages/LiveMap.jsx - API endpoints
FRONTEND/src/services/APIs.js - Dashboard state
FRONTEND/src/services/statSlice.js
Django services
- Accounts API
backend/pitwatch/accounts/views.py - Reports API
backend/pitwatch/reports/views.py - Report records
backend/pitwatch/reports/models.py - Dashboard summary
backend/pitwatch/dashboard/views.py - Report tasks
backend/pitwatch/reports/tasks.py
Detection
- Detection API
backend/pitwatch/ml/views.py - Inference jobs
backend/pitwatch/ml/models.py - Async inference
backend/pitwatch/ml/tasks.py - Model inference
backend/pitwatch/ml/services/model.py - Model assets
ML/PitWatch_YOLOv8_nano_AI_model/main.py
Mobile safety
- Flutter safety app
APP/pitwatch - Drowsiness monitor
APP/pitwatch
Other components
- Admin / analyst
- Mobile user
- Email provider
- PostgreSQL
- Redis / Celery
Connections 27
- Admin / analyst → React dashboard: uses
- React dashboard → Admin login: routes to
FRONTEND/src/App.jsx - React dashboard → Route protection: protects routes
FRONTEND/src/App.jsx - React dashboard → Analytics page: routes to
FRONTEND/src/App.jsx - React dashboard → Reports page: routes to
FRONTEND/src/App.jsx - React dashboard → Live map: routes to
FRONTEND/src/App.jsx - Admin login → Accounts API: authenticates
FRONTEND/src/components/Auth.jsx - Analytics page → Dashboard summary: requests summary
FRONTEND/src/pages/DashBoardPage.jsx - Analytics page → Dashboard state: updates
FRONTEND/src/pages/DashBoardPage.jsx - Reports page → Reports API: fetches reports
- Live map → Reports API: nearby lookup
- Accounts API → PostgreSQL: reads account data
- Reports API → Report records: reads and updates
- Dashboard summary → Report records: summarizes
- Reports API → Email provider: sends notifications
- Reports API → Report tasks: queues maintenance
- Report tasks → Redis / Celery: runs asynchronously
- Detection API → Async inference: queues detection
- Detection API → Model inference: runs inference
- Async inference → Model inference: calls
backend/pitwatch/ml/tasks.py - Async inference → Inference jobs: updates job
backend/pitwatch/ml/tasks.py - Async inference → Report records: creates detected report
backend/pitwatch/ml/tasks.py - Async inference → Redis / Celery: dispatched through
- Model inference → Model assets: uses weights
- Mobile user → Flutter safety app: uses
- Flutter safety app → Drowsiness monitor: monitors driver
- Drowsiness monitor → Reports API: posts emergency context