How rabbi-2529/face-tracking-cctv works
This is a Django CCTV employee-movement tracking system. Its main flow is camera video through per-camera vision workers, face analysis and tracking, a Redis stream, and an aggregator that records detections, presence intervals, and validated movements for the live board and reports. Separate product branches cover employee enrolment and consent, alerts, movement review, role-based access and scoped tracking requests, audit, and API access. The README documents several runtime links; sampled source confirms some internal calls. Unsampled implementations and links are shown only where documented.
Main entry points: runner.py Camera workers · pipeline.py Face pipeline · views.py Tracking views and reports · permissions.py Role permissions
Components 31
Vision processing
- Camera workers
vision/runner.py - Face pipeline
vision/pipeline.py - Face detection
vision/detect/scrfd.py - Face alignment
vision/align.py - Quality gate
vision/quality.py - Face embeddings
vision/embed/arcface.py - Track matching
vision/track/tracker.py - Identity gallery
vision/gallery.py - Event stream
vision/bus.py
Tracking and response
- Movement aggregator
apps/tracking/aggregator.py - Detection, presence and movement
apps/tracking/models.py - Movement review
apps/tracking/review_views.py - Alert evaluation
apps/alerts/engine.py - Alert rules and records
apps/alerts/models.py - Live tracking board
apps/tracking/consumers.py - Tracking views and reports
apps/tracking/views.py - Watchlist
apps/watchlist/models.py
Access and governance
- Face enrolment
apps/employees/enrollment.py - Employee and consent records
apps/employees/models.py - Role permissions
apps/common/permissions.py - Role matrix
apps/common/roles.py - Data scoping
apps/common/scoping.py - Tracking requests
apps/accounts/models.py - Audit trail
apps/common/audit.py
Office and interfaces
- Zones and adjacency
apps/org/models.py - Camera configuration
apps/cameras/models.py - REST API
apps/api
Other components
- CCTV cameras
- Portal users
- PostgreSQL and pgvector
- Redis
Connections 40
- CCTV cameras → Camera workers: provides video
README.md - Camera workers → Face pipeline: analyses frames
README.md - Face pipeline → Face detection: detects faces
vision/pipeline.py - Face pipeline → Face alignment: aligns faces
vision/pipeline.py - Face pipeline → Quality gate: checks quality
vision/pipeline.py - Face pipeline → Face embeddings: creates embeddings
vision/pipeline.py - Camera workers → Track matching: tracks faces
README.md - Camera workers → Identity gallery: matches identities
- Face enrolment → Face pipeline: analyses photos
vision/pipeline.py - Face enrolment → Employee and consent records: stores enrolment
apps/employees/enrollment.py - Employee and consent records → Identity gallery: supplies identities
- Camera workers → Event stream: publishes events
README.md - Event stream → Movement aggregator: streams events
README.md - Movement aggregator → Detection, presence and movement: writes tracking layers
README.md - Movement aggregator → Zones and adjacency: validates transitions
README.md - Movement aggregator → Alert evaluation: evaluates signals
apps/tracking/aggregator.py - Alert evaluation → Alert rules and records: records alerts
apps/alerts/engine.py - Movement aggregator → Live tracking board: broadcasts occupancy
README.md - Detection, presence and movement → Movement review: supplies flagged movements
README.md - Detection, presence and movement → Tracking views and reports: supplies history
README.md - Detection, presence and movement → PostgreSQL and pgvector: persists records
README.md - Event stream → Redis: uses stream
README.md - Camera configuration → Camera workers: configures sources
- Portal users → Face enrolment: submits enrolment
- Portal users → Tracking views and reports: views tracking
README.md - Portal users → Live tracking board: opens live board
README.md - Portal users → REST API: uses API
README.md - Role permissions → Role matrix: checks actions
apps/common/permissions.py - Role permissions → Data scoping: authorizes data scope
README.md - Tracking views and reports → Role permissions: checks access
README.md - Tracking views and reports → Data scoping: filters rows
README.md - Tracking views and reports → Tracking requests: requests approval
README.md - Tracking views and reports → Audit trail: records access
README.md - Live tracking board → Role permissions: checks access
apps/tracking/consumers.py - Live tracking board → Data scoping: filters visibility
apps/tracking/consumers.py - Movement review → Role permissions: checks access
apps/tracking/review_views.py - Movement review → Audit trail: records actions
apps/tracking/review_views.py - Alert evaluation → Audit trail: broadcast audit
- REST API → Role permissions: checks access
- Watchlist → Live tracking board: supports live matching
apps/tracking/consumers.py