# hassan-487/facial-detection_attendance-system architecture

> Architecture diagram of the GitHub repository hassan-487/facial-detection_attendance-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hassan-487/facial-detection_attendance-system
- Repository: https://github.com/hassan-487/facial-detection_attendance-system

## Overview

This is a camera-based facial-recognition attendance system with a Flask service, SQLite storage, a kiosk client, and an administrator dashboard. The main workflow captures a face, performs a blink-based liveness check at the kiosk, submits the image for server-side recognition, records attendance, and may alert the administrator for after-hours activity. Enrollment and administrative user/log management are separate workflows. The excerpts show these client-to-service calls and server responsibilities; the README documents the broader capabilities, but the supplied tree has different client filenames than its project-structure example.

Main entry points: [`server.py`](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py) (HTTP API routes), [`admindashboard.py`](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/admindashboard.py) (Admin dashboard), [`attendance_client.py`](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/attendance_client.py) (Attendance kiosk), [`enrollment_client.py`](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/enrollment_client.py) (Enrollment client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client applications"]
  node_kiosk["Attendance kiosk"]
  node_enroll_client["Enrollment client"]
  node_dashboard["Admin dashboard<br/>[admindashboard.py]"]
end

subgraph group_service["Attendance service"]
  node_api["HTTP API routes<br/>[server.py]"]
  node_mode["System mode<br/>[server.py]"]
end

subgraph group_identity["Recognition and identity"]
  node_image["Image decoding<br/>[server.py]"]
  node_embedding["Face embeddings<br/>[server.py]"]
  node_matching["Identity matching<br/>[server.py]"]
  node_security["Credential and embedding security<br/>[server.py]"]
end

subgraph group_records["Records and alerts"]
  node_database[("SQLite records<br/>[server.py]")]
  node_attendance["Attendance logging<br/>[server.py]"]
  node_anomaly["After-hours detection<br/>[server.py]"]
end

node_employee(("Attendance user"))
node_admin(("Administrator"))
node_camera["Camera"]
node_email["Email service"]

node_employee -->|"uses"| node_kiosk
node_camera -->|"captures frames"| node_kiosk
node_kiosk -->|"checks blinks"| node_kiosk
node_kiosk -->|"polls mode"| node_mode
node_kiosk -->|"submits image"| node_api
node_admin -->|"uses"| node_dashboard
node_dashboard -->|"authenticates"| node_api
node_dashboard -->|"sets mode"| node_mode
node_dashboard -->|"requests enrollment"| node_api
node_dashboard -->|"fetches logs"| node_api
node_dashboard -->|"manages users"| node_api
node_camera -->|"captures image"| node_enroll_client
node_enroll_client -->|"submits enrollment"| node_api
node_api -->|"reads mode"| node_mode
node_api -->|"decodes image"| node_image
node_api -->|"requests embedding"| node_embedding
node_embedding -->|"provides vector"| node_matching
node_api -->|"hashes credentials"| node_security
node_api -->|"encrypts embeddings"| node_security
node_api -->|"reads and writes"| node_database
node_api -->|"matches identity"| node_matching
node_api -->|"records match"| node_attendance
node_attendance -->|"inserts log"| node_database
node_api -->|"checks hours"| node_anomaly
node_anomaly -->|"sends alert"| node_email

click node_kiosk "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/attendance_client.py"
click node_enroll_client "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/enrollment_client.py"
click node_dashboard "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/admindashboard.py"
click node_api "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_mode "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_image "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_embedding "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_matching "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_security "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_database "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_attendance "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py"
click node_anomaly "https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.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_kiosk,node_enroll_client,node_dashboard,node_employee toneBlue
class node_api,node_mode toneAmber
class node_image,node_embedding,node_matching,node_security toneMint
class node_database,node_attendance,node_anomaly toneRose
class node_admin,node_camera,node_email toneIndigo
```

## Components

### Client applications

- [Attendance kiosk](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/attendance_client.py): `attendance_client.py`
- [Enrollment client](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/enrollment_client.py): `enrollment_client.py`
- [Admin dashboard](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/admindashboard.py): `admindashboard.py`

### Attendance service

- [HTTP API routes](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [System mode](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`

### Recognition and identity

- [Image decoding](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [Face embeddings](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [Identity matching](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [Credential and embedding security](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`

### Records and alerts

- [SQLite records](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [Attendance logging](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`
- [After-hours detection](https://github.com/hassan-487/facial-detection_attendance-system/blob/main/server.py): `server.py`

### Other components

- **Attendance user**
- **Administrator**
- **Camera**
- **Email service**

## Connections

- Attendance user → Attendance kiosk: uses (evidence: `README.md`)
- Camera → Attendance kiosk: captures frames (evidence: `attendance_client.py`)
- Attendance kiosk → Attendance kiosk: checks blinks (evidence: `attendance_client.py`)
- Attendance kiosk → System mode: polls mode (evidence: `attendance_client.py`)
- Attendance kiosk → HTTP API routes: submits image (evidence: `attendance_client.py`)
- Administrator → Admin dashboard: uses (evidence: `README.md`)
- Admin dashboard → HTTP API routes: authenticates (evidence: `admindashboard.py`)
- Admin dashboard → System mode: sets mode (evidence: `admindashboard.py`)
- Admin dashboard → HTTP API routes: requests enrollment (evidence: `admindashboard.py`)
- Admin dashboard → HTTP API routes: fetches logs (evidence: `admindashboard.py`)
- Admin dashboard → HTTP API routes: manages users (evidence: `admindashboard.py`)
- Camera → Enrollment client: captures image (evidence: `enrollment_client.py`)
- Enrollment client → HTTP API routes: submits enrollment (evidence: `enrollment_client.py`)
- HTTP API routes → System mode: reads mode (evidence: `server.py`)
- HTTP API routes → Image decoding: decodes image (evidence: `server.py`)
- HTTP API routes → Face embeddings: requests embedding (evidence: `server.py`)
- Face embeddings → Identity matching: provides vector (evidence: `server.py`)
- HTTP API routes → Credential and embedding security: hashes credentials (evidence: `server.py`)
- HTTP API routes → Credential and embedding security: encrypts embeddings (evidence: `server.py`)
- HTTP API routes → SQLite records: reads and writes (evidence: `server.py`)
- HTTP API routes → Identity matching: matches identity (evidence: `server.py`)
- HTTP API routes → Attendance logging: records match (evidence: `server.py`)
- Attendance logging → SQLite records: inserts log (evidence: `server.py`)
- HTTP API routes → After-hours detection: checks hours (evidence: `server.py`)
- After-hours detection → Email service: sends alert (evidence: `server.py`)
