# ans108/smart-attendance-system architecture

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

- Interactive diagram: https://gitdiagram.com/ans108/smart-attendance-system
- Repository: https://github.com/ans108/smart-attendance-system

## Overview

FaceAttend is a local face-based attendance system with a Flask dashboard. Its main workflow captures camera frames, recognizes registered faces, applies attendance timing rules, and records marks in SQLite; registration enrolls new users and their face prototypes. The dashboard also supports attendance records, administration, analytics, schedule configuration, and CSV export. The graph retains the documented registration and recognition stages, but some internal call details and UI route wiring are unsampled, so documented links use README evidence.

Main entry points: [`app.py`](https://github.com/ans108/smart-attendance-system/blob/main/app.py) (Flask Routes), [`attendance.py`](https://github.com/ans108/smart-attendance-system/blob/main/attendance.py) (Live Recognition), [`database.py`](https://github.com/ans108/smart-attendance-system/blob/main/database.py) (SQLite Store), [`face_register.py`](https://github.com/ans108/smart-attendance-system/blob/main/face_register.py) (Face Enrollment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Dashboard"]
  node_flask["Flask Routes<br/>[app.py]"]
  node_admin["Admin Login<br/>[admin_auth.py]"]
  node_dashboard["Dashboard UI"]
  node_ui_js["UI Utilities<br/>[app.js]"]
end

subgraph group_identity["Face Identity"]
  node_registration["Face Enrollment<br/>[face_register.py]"]
  node_recognition["Recognition Engine"]
  node_live["Live Recognition<br/>[attendance.py]"]
end

subgraph group_attendance["Attendance"]
  node_rules["Time Policy<br/>[time_policy.py]"]
end

subgraph group_storage["Persistence"]
  node_sqlite[("SQLite Store<br/>[database.py]")]
end

node_visitor(("Dashboard User"))
node_camera(("Camera"))

node_visitor -->|"uses dashboard"| node_flask
node_flask -->|"renders pages"| node_dashboard
node_dashboard -.->|"uses utilities"| node_ui_js
node_flask -->|"authenticates admins"| node_admin
node_flask -->|"starts recognition"| node_live
node_flask -->|"starts enrollment"| node_registration
node_camera -->|"provides frames"| node_live
node_live -->|"gets face matches"| node_recognition
node_registration -->|"generates embeddings"| node_recognition
node_registration -->|"saves user prototypes"| node_sqlite
node_live -->|"loads identities"| node_sqlite
node_live -->|"classifies arrivals"| node_rules
node_live -->|"marks attendance"| node_sqlite
node_flask -->|"queries records"| node_sqlite
node_flask -->|"configures schedule"| node_rules

click node_flask "https://github.com/ans108/smart-attendance-system/blob/main/app.py"
click node_admin "https://github.com/ans108/smart-attendance-system/blob/main/admin_auth.py"
click node_dashboard "https://github.com/ans108/smart-attendance-system/tree/main/templates"
click node_ui_js "https://github.com/ans108/smart-attendance-system/blob/main/static/js/app.js"
click node_registration "https://github.com/ans108/smart-attendance-system/blob/main/face_register.py"
click node_recognition "https://github.com/ans108/smart-attendance-system/blob/main/recognition_engine.py"
click node_live "https://github.com/ans108/smart-attendance-system/blob/main/attendance.py"
click node_rules "https://github.com/ans108/smart-attendance-system/blob/main/time_policy.py"
click node_sqlite "https://github.com/ans108/smart-attendance-system/blob/main/database.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_flask,node_admin,node_dashboard,node_ui_js,node_visitor toneBlue
class node_registration,node_recognition,node_live toneAmber
class node_rules toneMint
class node_sqlite toneRose
class node_camera toneIndigo
```

## Components

### Web Dashboard

- [Flask Routes](https://github.com/ans108/smart-attendance-system/blob/main/app.py): `app.py`
- [Admin Login](https://github.com/ans108/smart-attendance-system/blob/main/admin_auth.py): `admin_auth.py`
- [Dashboard UI](https://github.com/ans108/smart-attendance-system/tree/main/templates): `templates`
- [UI Utilities](https://github.com/ans108/smart-attendance-system/blob/main/static/js/app.js): `static/js/app.js`

### Face Identity

- [Face Enrollment](https://github.com/ans108/smart-attendance-system/blob/main/face_register.py): `face_register.py`
- [Recognition Engine](https://github.com/ans108/smart-attendance-system/blob/main/recognition_engine.py): `recognition_engine.py`
- [Live Recognition](https://github.com/ans108/smart-attendance-system/blob/main/attendance.py): `attendance.py`

### Attendance

- [Time Policy](https://github.com/ans108/smart-attendance-system/blob/main/time_policy.py): `time_policy.py`

### Persistence

- [SQLite Store](https://github.com/ans108/smart-attendance-system/blob/main/database.py): `database.py`

### Other components

- **Dashboard User**
- **Camera**

## Connections

- Dashboard User → Flask Routes: uses dashboard (evidence: `README.md`)
- Flask Routes → Dashboard UI: renders pages (evidence: `README.md`)
- Dashboard UI → UI Utilities: uses utilities
- Flask Routes → Admin Login: authenticates admins (evidence: `app.py`)
- Flask Routes → Live Recognition: starts recognition (evidence: `app.py`)
- Flask Routes → Face Enrollment: starts enrollment (evidence: `README.md`)
- Camera → Live Recognition: provides frames (evidence: `README.md`)
- Live Recognition → Recognition Engine: gets face matches (evidence: `attendance.py`)
- Face Enrollment → Recognition Engine: generates embeddings (evidence: `face_register.py`)
- Face Enrollment → SQLite Store: saves user prototypes (evidence: `face_register.py`)
- Live Recognition → SQLite Store: loads identities (evidence: `attendance.py`)
- Live Recognition → Time Policy: classifies arrivals (evidence: `attendance.py`)
- Live Recognition → SQLite Store: marks attendance (evidence: `attendance.py`)
- Flask Routes → SQLite Store: queries records (evidence: `app.py`)
- Flask Routes → Time Policy: configures schedule (evidence: `README.md`)
