# chaitanya07prakash/face-recognition-attendance-system architecture

> Architecture diagram of the GitHub repository chaitanya07prakash/face-recognition-attendance-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chaitanya07prakash/face-recognition-attendance-system
- Repository: https://github.com/chaitanya07prakash/face-recognition-attendance-system

## Overview

This Django system manages workforce identities and locations, enrolls employee face samples, then recognizes people to record shift-aware attendance. The principal browser flow is HR registration followed by webcam or photo enrollment; recognition runs either from a local camera command or a multi-camera capture/async pipeline. Attendance also supports leave, corrections, camera health, and CSV export. The graph uses README-described capabilities where their source was not sampled; links among those unsampled areas are omitted rather than inferred.

Main entry points: [`employees/views.py`](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/views.py) (Employee web UI), [`attendance/services.py`](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/services.py) (Attendance rules), [`attendance/tasks.py`](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/tasks.py) (Async frame processing), [`employees/recognition.py`](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/recognition.py) (Enrollment and matching)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Access and audit"]
  node_rbac["Roles and permissions<br/>[rbac.py]"]
  node_authdata[("Accounts and audit<br/>[models.py]")]
  node_twofa["TOTP 2FA<br/>[services.py]"]
end

subgraph group_workforce["Workforce setup"]
  node_web["Employee web UI<br/>[views.py]"]
  node_locations[("Location hierarchy<br/>[models.py]")]
  node_employee[("Employee profiles<br/>[models.py]")]
  node_employeeform["Registration forms<br/>[forms.py]"]
end

subgraph group_vision["Face recognition"]
  node_recognition["Enrollment and matching<br/>[recognition.py]"]
  node_encodings[("Face samples<br/>[models.py]")]
  node_liveness["Liveness checks<br/>[liveness.py]"]
  node_localcam["Local camera recognition<br/>[run_recognition.py]"]
  node_fleetcmd["Camera fleet launcher"]
  node_capture["Camera capture worker<br/>[camera_worker.py]"]
end

subgraph group_attendance["Attendance operations"]
  node_queue["Celery broker"]
  node_tasks["Async frame processing<br/>[tasks.py]"]
  node_attendance_logic["Attendance rules<br/>[services.py]"]
  node_attdata[("Attendance records<br/>[models.py]")]
  node_attendanceui["Attendance views<br/>[views.py]"]
  node_sweep["Daily attendance sweep"]
  node_export["CSV export"]
end

node_user(("User"))

node_user -->|"uses"| node_web
node_web -->|"validates with"| node_employeeform
node_web -->|"creates and reads"| node_employee
node_web -->|"enrolls through"| node_recognition
node_employeeform -->|"uses hierarchy"| node_locations
node_web -.->|"permission gates"| node_rbac
node_rbac -->|"checks roles"| node_authdata
node_authdata -->|"stores secrets for"| node_twofa
node_recognition -->|"writes samples"| node_encodings
node_localcam -->|"loads and matches"| node_recognition
node_localcam -->|"marks attendance"| node_attendance_logic
node_fleetcmd -->|"launches workers"| node_capture
node_capture -->|"dispatches frames"| node_queue
node_capture -->|"dispatches health"| node_queue
node_queue -.->|"delivers tasks"| node_tasks
node_tasks -->|"matches faces"| node_recognition
node_tasks -.->|"checks liveness"| node_liveness
node_tasks -->|"marks attendance"| node_attendance_logic
node_attendance_logic -->|"reads and writes"| node_attdata
node_attendanceui -->|"uses attendance rules"| node_attendance_logic
node_sweep -->|"applies daily sweep"| node_attendance_logic
node_export -->|"reads for export"| node_attdata

click node_web "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/views.py"
click node_rbac "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/rbac.py"
click node_authdata "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/models.py"
click node_twofa "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/services.py"
click node_locations "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/locations/models.py"
click node_employee "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/models.py"
click node_employeeform "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/forms.py"
click node_recognition "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/recognition.py"
click node_encodings "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/models.py"
click node_liveness "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/liveness.py"
click node_localcam "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/run_recognition.py"
click node_fleetcmd "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/run_camera_fleet.py"
click node_capture "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/camera_worker.py"
click node_tasks "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/tasks.py"
click node_attendance_logic "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/services.py"
click node_attdata "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/models.py"
click node_attendanceui "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/views.py"
click node_sweep "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/apply_daily_attendance_sweep.py"
click node_export "https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/export_attendance_csv.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rbac,node_authdata,node_twofa,node_user toneBlue
class node_web,node_locations,node_employee,node_employeeform toneAmber
class node_recognition,node_encodings,node_liveness,node_localcam,node_fleetcmd,node_capture toneMint
class node_queue,node_tasks,node_attendance_logic,node_attdata,node_attendanceui,node_sweep,node_export toneRose
```

## Components

### Access and audit

- [Roles and permissions](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/rbac.py): `accounts/rbac.py`
- [Accounts and audit](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/models.py): `accounts/models.py`
- [TOTP 2FA](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/accounts/services.py): `accounts/services.py`

### Workforce setup

- [Employee web UI](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/views.py): `employees/views.py`
- [Location hierarchy](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/locations/models.py): `locations/models.py`
- [Employee profiles](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/models.py): `employees/models.py`
- [Registration forms](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/forms.py): `employees/forms.py`

### Face recognition

- [Enrollment and matching](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/recognition.py): `employees/recognition.py`
- [Face samples](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/models.py): `employees/models.py`
- [Liveness checks](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/employees/liveness.py): `employees/liveness.py`
- [Local camera recognition](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/run_recognition.py): `attendance/management/commands/run_recognition.py`
- [Camera fleet launcher](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/run_camera_fleet.py): `attendance/management/commands/run_camera_fleet.py`
- [Camera capture worker](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/camera_worker.py): `attendance/camera_worker.py`

### Attendance operations

- **Celery broker**
- [Async frame processing](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/tasks.py): `attendance/tasks.py`
- [Attendance rules](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/services.py): `attendance/services.py`
- [Attendance records](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/models.py): `attendance/models.py`
- [Attendance views](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/views.py): `attendance/views.py`
- [Daily attendance sweep](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/apply_daily_attendance_sweep.py): `attendance/management/commands/apply_daily_attendance_sweep.py`
- [CSV export](https://github.com/chaitanya07prakash/face-recognition-attendance-system/blob/main/attendance/management/commands/export_attendance_csv.py): `attendance/management/commands/export_attendance_csv.py`

### Other components

- **User**

## Connections

- User → Employee web UI: uses
- Employee web UI → Registration forms: validates with (evidence: `employees/views.py`)
- Employee web UI → Employee profiles: creates and reads (evidence: `employees/views.py`)
- Employee web UI → Enrollment and matching: enrolls through (evidence: `employees/views.py`)
- Registration forms → Location hierarchy: uses hierarchy (evidence: `employees/forms.py`)
- Employee web UI → Roles and permissions: permission gates
- Roles and permissions → Accounts and audit: checks roles (evidence: `accounts/rbac.py`)
- Accounts and audit → TOTP 2FA: stores secrets for (evidence: `accounts/services.py`)
- Enrollment and matching → Face samples: writes samples (evidence: `employees/recognition.py`)
- Local camera recognition → Enrollment and matching: loads and matches (evidence: `attendance/management/commands/run_recognition.py`)
- Local camera recognition → Attendance rules: marks attendance (evidence: `attendance/management/commands/run_recognition.py`)
- Camera fleet launcher → Camera capture worker: launches workers (evidence: `attendance/management/commands/run_camera_fleet.py`)
- Camera capture worker → Celery broker: dispatches frames (evidence: `attendance/camera_worker.py`)
- Camera capture worker → Celery broker: dispatches health (evidence: `attendance/camera_worker.py`)
- Celery broker → Async frame processing: delivers tasks
- Async frame processing → Enrollment and matching: matches faces (evidence: `attendance/tasks.py`)
- Async frame processing → Liveness checks: checks liveness
- Async frame processing → Attendance rules: marks attendance (evidence: `attendance/tasks.py`)
- Attendance rules → Attendance records: reads and writes (evidence: `attendance/services.py`)
- Attendance views → Attendance rules: uses attendance rules (evidence: `attendance/views.py`)
- Daily attendance sweep → Attendance rules: applies daily sweep (evidence: `attendance/management/commands/apply_daily_attendance_sweep.py`)
- CSV export → Attendance records: reads for export (evidence: `attendance/management/commands/export_attendance_csv.py`)
