How joshishreekar/campusshieldai works
CampusShield is a campus safety and emergency-management application. Users authenticate in the React client, then submit SOS/complaints or manage incidents; FastAPI routes persist incident records, while department queues, history, evidence, analytics, and notifications support response. A parallel camera workflow captures video and produces candidate AI alerts for staff review. The README describes additional planned capabilities, but explicitly says several workflows remain incomplete; paths and connections for unsampled features are therefore shown only where supported, with no assumed calls.
Main entry points: main.py API application · camera_runtime.py Camera runtime · session.py PostgreSQL data · Dashboard.jsx Dashboard views
Components 27
Web client
- Role dashboards
frontend/src/App.jsx - Session context
frontend/src/context/AuthContext.jsx - Auth requests
frontend/src/services/authService.js - Dashboard views
frontend/src/pages/Dashboard.jsx - Reporter workflow
frontend/src/pages/ReporterDashboard.jsx - Incident requests
frontend/src/services/incidentService.js - Live updates client
frontend/src/context/WebSocketContext.jsx
Backend API
- API application
backend/app/main.py - Authentication
backend/app/api/routes/auth.py - Identity validation
backend/app/api/deps.py - PostgreSQL data
backend/app/db/session.py
Incident operations
- Incident handling
backend/app/api/routes/incidents.py - Department management
backend/app/api/routes/departments.py - User management
backend/app/api/routes/users.py - Incident analytics
backend/app/api/routes/analytics.py - Evidence handling
backend/app/api/routes/evidence.py - Notifications API
backend/app/api/routes/notifications.py - WebSocket endpoint
backend/app/api/routes/websocket.py - Recipient dispatch
backend/app/services/websocket_manager.py
Camera AI
- Camera runtime
backend/app/services/camera_runtime.py - Camera management
backend/app/api/routes/cameras.py - YOLO detection
ai_engine/detectors/yolo_detector.py - Fire smoke detection
ai_engine/detectors/fire_smoke_detector.py - Fall detection
ai_engine/detectors/fall_detector.py - Fighting analysis
ai_engine/detectors/fighting_analyzer.py
Other components
- Campus user
- Authorized staff
Connections 35
- Campus user → Role dashboards: uses
frontend/src/App.jsx - Role dashboards → Session context: provides session
frontend/src/App.jsx - Session context → Auth requests: calls
frontend/src/context/AuthContext.jsx - Role dashboards → Dashboard views: routes to
frontend/src/App.jsx - Dashboard views → Reporter workflow: renders
frontend/src/pages/Dashboard.jsx - Reporter workflow → Incident requests: submits incidents
frontend/src/pages/ReporterDashboard.jsx - Incident requests → Incident handling: HTTP requests
frontend/src/services/incidentService.js - Auth requests → Authentication: HTTP requests
frontend/src/services/authService.js - API application → Authentication: registers
backend/app/main.py - API application → Incident handling: registers
backend/app/main.py - API application → Department management: registers
backend/app/main.py - API application → User management: registers
backend/app/main.py - API application → Incident analytics: registers
backend/app/main.py - API application → Evidence handling: registers
backend/app/main.py - API application → Notifications API: registers
backend/app/main.py - API application → WebSocket endpoint: registers
backend/app/main.py - API application → Camera management: registers
backend/app/main.py - Authentication → PostgreSQL data: reads writes
backend/app/api/routes/auth.py - Authentication → Identity validation: uses identity
backend/app/api/routes/auth.py - Incident handling → PostgreSQL data: reads writes
backend/app/api/routes/incidents.py - Incident handling → Recipient dispatch: sends updates
backend/app/api/routes/incidents.py - Department management → PostgreSQL data: reads writes
backend/app/api/routes/departments.py - User management → PostgreSQL data: reads writes
- Incident analytics → PostgreSQL data: queries
backend/app/api/routes/analytics.py - Evidence handling → PostgreSQL data: stores metadata
backend/app/api/routes/evidence.py - WebSocket endpoint → Recipient dispatch: manages connections
- Live updates client → WebSocket endpoint: opens socket
frontend/src/context/WebSocketContext.jsx - Dashboard views → Live updates client: consumes updates
frontend/src/pages/Dashboard.jsx - API application → Camera runtime: starts stops
backend/app/main.py - Camera management → Camera runtime: controls streams
backend/app/api/routes/cameras.py - Camera runtime → YOLO detection: detects objects
- Camera runtime → Fire smoke detection: detects hazards
- Camera runtime → Fall detection: possible integration
- Camera runtime → Fighting analysis: possible integration
- Authorized staff → Dashboard views: reviews alerts