How ulugbek-lab/safetruckai works
SafeTruck AI is a local computer-vision PPE incident detection and human-review product. Its principal workflow runs camera frames through person tracking, PPE detection and temporal confirmation, submits confirmed incidents to FastAPI for persistence, then presents them for dashboard analysis and review. The graph also includes the dashboard’s project guide and demo-data capability. Vision-stage links rely on README documentation because the detector source was not excerpted; other links cite the shown caller or documented HTTP/database relationships.
Main entry points: DashboardPage.tsx Dashboard page · main.py Incident API · api.ts HTTP API client · incidents.ts Incident types
Components 24
Vision detection
- Person tracking
main.py - PPE detection
main.py - Worker PPE association
main.py - Evidence and cooldown
main.py
Incident backend
- Incident API
backend/main.py - Dashboard endpoints
backend/dashboard.py - Incident schemas
backend/models.py - Database sessions
backend/database.py
Review dashboard
- App navigation
frontend/src/App.tsx - Dashboard page
frontend/src/pages/DashboardPage.tsx - Dashboard refresh
frontend/src/hooks/useDashboard.ts - HTTP API client
frontend/src/services/api.ts - Demo data
frontend/src/services/demo.ts - Statistics cards
frontend/src/components/StatisticsCards.tsx - Analytics charts
frontend/src/components/AnalyticsCharts.tsx - Incident history
frontend/src/components/IncidentTable.tsx - Incident review
frontend/src/components/IncidentDetails.tsx - Status badge
frontend/src/components/StatusBadge.tsx - Incident types
frontend/src/types/incidents.ts - Dashboard layout
frontend/src/layouts/DashboardLayout.tsx
Project guide
- Project walkthrough
frontend/src/pages/ProjectGuidePage.tsx
Other components
- Safety reviewer
- Local camera
- PostgreSQL
Connections 33
- Local camera → Person tracking: provides frames
README.md - Local camera → PPE detection: provides frames
README.md - Person tracking → Worker PPE association: supplies tracks
README.md - PPE detection → Worker PPE association: supplies detections
README.md - Worker PPE association → Evidence and cooldown: provides evidence
README.md - Evidence and cooldown → Incident API: submits incidents
README.md - Incident API → Dashboard endpoints: registers routes
backend/main.py - Incident API → Incident schemas: validates incidents
backend/main.py - Incident API → Database sessions: creates tables
backend/main.py - Incident API → Database sessions: uses sessions
backend/main.py - Dashboard endpoints → Database sessions: queries sessions
backend/dashboard.py - Dashboard endpoints → Incident schemas: returns schemas
backend/dashboard.py - Database sessions → PostgreSQL: persists records
README.md - Safety reviewer → Dashboard page: reviews incidents
README.md - App navigation → Dashboard layout: renders layout
frontend/src/App.tsx - App navigation → Dashboard page: selects overview
frontend/src/App.tsx - App navigation → Project walkthrough: selects guide
frontend/src/App.tsx - Dashboard page → Dashboard refresh: loads dashboard
frontend/src/pages/DashboardPage.tsx - Dashboard refresh → HTTP API client: requests data
frontend/src/hooks/useDashboard.ts - HTTP API client → Dashboard endpoints: queries endpoints
frontend/src/services/api.ts - Dashboard page → Statistics cards: renders statistics
frontend/src/pages/DashboardPage.tsx - Dashboard page → Analytics charts: renders analytics
frontend/src/pages/DashboardPage.tsx - Dashboard page → Incident history: renders history
frontend/src/pages/DashboardPage.tsx - Dashboard page → Incident review: opens incident
frontend/src/pages/DashboardPage.tsx - Incident history → Status badge: renders status
frontend/src/components/IncidentTable.tsx - Incident review → Status badge: renders status
frontend/src/components/IncidentDetails.tsx - Incident review → HTTP API client: loads and reviews
frontend/src/components/IncidentDetails.tsx - HTTP API client → Demo data: uses demo mode
frontend/src/services/api.ts - Statistics cards → Incident types: uses data types
frontend/src/components/StatisticsCards.tsx - Analytics charts → Incident types: uses data types
frontend/src/components/AnalyticsCharts.tsx - Incident history → Incident types: uses data types
frontend/src/components/IncidentTable.tsx - Incident review → Incident types: uses data types
frontend/src/components/IncidentDetails.tsx - HTTP API client → Incident types: uses data types
frontend/src/services/api.ts