# shreyanshfs/attendance_ai_running architecture

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

- Interactive diagram: https://gitdiagram.com/shreyanshfs/attendance_ai_running
- Repository: https://github.com/shreyanshfs/attendance_ai_running

## Overview

Smart Attendance System is a Flask application for camera-based, liveness-verified attendance, with admin and student dashboards, account access, and absence notifications. The main workflow sends camera frames to the application’s recognition orchestration, verifies identity and liveness, then marks attendance and updates student records. Separate branches provide dashboard and authentication APIs, student statistics, and WhatsApp alerts. The README documents dashboard, gamification, and anti-spoofing capabilities; some routes and integrations are unsampled, so only documented or indexed relationships are shown.

Main entry points: [`main.py`](https://github.com/shreyanshfs/attendance_ai_running/blob/main/main.py) (Flask Application), [`static/js/dashboard.js`](https://github.com/shreyanshfs/attendance_ai_running/blob/main/static/js/dashboard.js) (Dashboard Client), [`routes.py`](https://github.com/shreyanshfs/attendance_ai_running/blob/main/routes.py) (Admin API), [`auth_routes.py`](https://github.com/shreyanshfs/attendance_ai_running/blob/main/auth_routes.py) (Auth API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and Access"]
  node_adminui["Admin Dashboard<br/>[dashboard.html]"]
  node_studentui["Student Dashboard"]
  node_dashboardjs["Dashboard Client<br/>[dashboard.js]"]
  node_api["Admin API<br/>[routes.py]"]
  node_studentapi["Student API<br/>[student_routes.py]"]
  node_authroutes["Auth API<br/>[auth_routes.py]"]
  node_auth["Auth Service<br/>[auth_service.py]"]
  node_app["Flask Application<br/>[main.py]"]
end

subgraph group_vision["Attendance Verification"]
  node_camera["Camera Orchestrator<br/>[main.py]"]
  node_recognition["Face Recognition"]
  node_liveness["Liveness Checks"]
  node_spoof["Spoof Detection<br/>[ensemble_spoof.py]"]
end

subgraph group_domain["Attendance Domain"]
  node_attendance["Attendance Service"]
end

subgraph group_data["Persistence and Alerts"]
  node_records[("Attendance Records<br/>[models.py]")]
  node_config["Runtime Configuration<br/>[config.py]"]
  node_whatsapp["WhatsApp Service"]
end

node_browser(("User Browser"))
node_waapi{{"WhatsApp API"}}

node_browser -->|"uses"| node_adminui
node_browser -->|"uses"| node_studentui
node_adminui -.->|"loads"| node_dashboardjs
node_studentui -.->|"loads"| node_dashboardjs
node_dashboardjs -.->|"requests"| node_api
node_dashboardjs -.->|"requests"| node_studentapi
node_browser -->|"authenticates"| node_authroutes
node_app -->|"registers"| node_api
node_app -->|"registers"| node_authroutes
node_app -->|"registers"| node_studentapi
node_authroutes -->|"uses"| node_auth
node_api -->|"uses"| node_attendance
node_api -->|"uses"| node_recognition
node_studentapi -->|"queries"| node_records
node_camera -->|"processes frames"| node_recognition
node_camera -->|"marks attendance"| node_attendance
node_recognition -->|"checks liveness"| node_liveness
node_recognition -->|"checks spoofing"| node_spoof
node_attendance -->|"updates"| node_records
node_attendance -->|"sends alerts"| node_whatsapp
node_authroutes -->|"sends OTP"| node_whatsapp
node_whatsapp -->|"sends messages"| node_waapi
node_app -->|"loads settings"| node_config

click node_adminui "https://github.com/shreyanshfs/attendance_ai_running/blob/main/templates/dashboard.html"
click node_studentui "https://github.com/shreyanshfs/attendance_ai_running/blob/main/templates/student_dashboard.html"
click node_dashboardjs "https://github.com/shreyanshfs/attendance_ai_running/blob/main/static/js/dashboard.js"
click node_api "https://github.com/shreyanshfs/attendance_ai_running/blob/main/routes.py"
click node_studentapi "https://github.com/shreyanshfs/attendance_ai_running/blob/main/student_routes.py"
click node_authroutes "https://github.com/shreyanshfs/attendance_ai_running/blob/main/auth_routes.py"
click node_auth "https://github.com/shreyanshfs/attendance_ai_running/blob/main/auth_service.py"
click node_app "https://github.com/shreyanshfs/attendance_ai_running/blob/main/main.py"
click node_camera "https://github.com/shreyanshfs/attendance_ai_running/blob/main/main.py"
click node_recognition "https://github.com/shreyanshfs/attendance_ai_running/blob/main/face_recognition_service.py"
click node_liveness "https://github.com/shreyanshfs/attendance_ai_running/blob/main/liveness_detection.py"
click node_spoof "https://github.com/shreyanshfs/attendance_ai_running/blob/main/spoof_detection/ensemble_spoof.py"
click node_attendance "https://github.com/shreyanshfs/attendance_ai_running/blob/main/attendance_service.py"
click node_records "https://github.com/shreyanshfs/attendance_ai_running/blob/main/models.py"
click node_config "https://github.com/shreyanshfs/attendance_ai_running/blob/main/config.py"
click node_whatsapp "https://github.com/shreyanshfs/attendance_ai_running/blob/main/whatsapp_service.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_adminui,node_studentui,node_dashboardjs,node_api,node_studentapi,node_authroutes,node_auth,node_app,node_browser toneBlue
class node_camera,node_recognition,node_liveness,node_spoof toneAmber
class node_attendance,node_waapi toneMint
class node_records,node_config,node_whatsapp toneRose
```

## Components

### Web and Access

- [Admin Dashboard](https://github.com/shreyanshfs/attendance_ai_running/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Student Dashboard](https://github.com/shreyanshfs/attendance_ai_running/blob/main/templates/student_dashboard.html): `templates/student_dashboard.html`
- [Dashboard Client](https://github.com/shreyanshfs/attendance_ai_running/blob/main/static/js/dashboard.js): `static/js/dashboard.js`
- [Admin API](https://github.com/shreyanshfs/attendance_ai_running/blob/main/routes.py): `routes.py`
- [Student API](https://github.com/shreyanshfs/attendance_ai_running/blob/main/student_routes.py): `student_routes.py`
- [Auth API](https://github.com/shreyanshfs/attendance_ai_running/blob/main/auth_routes.py): `auth_routes.py`
- [Auth Service](https://github.com/shreyanshfs/attendance_ai_running/blob/main/auth_service.py): `auth_service.py`
- [Flask Application](https://github.com/shreyanshfs/attendance_ai_running/blob/main/main.py): `main.py`

### Attendance Verification

- [Camera Orchestrator](https://github.com/shreyanshfs/attendance_ai_running/blob/main/main.py): `main.py`
- [Face Recognition](https://github.com/shreyanshfs/attendance_ai_running/blob/main/face_recognition_service.py): `face_recognition_service.py`
- [Liveness Checks](https://github.com/shreyanshfs/attendance_ai_running/blob/main/liveness_detection.py): `liveness_detection.py`
- [Spoof Detection](https://github.com/shreyanshfs/attendance_ai_running/blob/main/spoof_detection/ensemble_spoof.py): `spoof_detection/ensemble_spoof.py`

### Attendance Domain

- [Attendance Service](https://github.com/shreyanshfs/attendance_ai_running/blob/main/attendance_service.py): `attendance_service.py`

### Persistence and Alerts

- [Attendance Records](https://github.com/shreyanshfs/attendance_ai_running/blob/main/models.py): `models.py`
- [Runtime Configuration](https://github.com/shreyanshfs/attendance_ai_running/blob/main/config.py): `config.py`
- [WhatsApp Service](https://github.com/shreyanshfs/attendance_ai_running/blob/main/whatsapp_service.py): `whatsapp_service.py`

### Other components

- **User Browser**
- **WhatsApp API**

## Connections

- User Browser → Admin Dashboard: uses (evidence: `README.md`)
- User Browser → Student Dashboard: uses (evidence: `README.md`)
- Admin Dashboard → Dashboard Client: loads
- Student Dashboard → Dashboard Client: loads
- Dashboard Client → Admin API: requests
- Dashboard Client → Student API: requests
- User Browser → Auth API: authenticates (evidence: `README.md`)
- Flask Application → Admin API: registers (evidence: `main.py`)
- Flask Application → Auth API: registers (evidence: `main.py`)
- Flask Application → Student API: registers (evidence: `main.py`)
- Auth API → Auth Service: uses (evidence: `auth_routes.py`)
- Admin API → Attendance Service: uses (evidence: `routes.py`)
- Admin API → Face Recognition: uses (evidence: `routes.py`)
- Student API → Attendance Records: queries (evidence: `student_routes.py`)
- Camera Orchestrator → Face Recognition: processes frames (evidence: `main.py`)
- Camera Orchestrator → Attendance Service: marks attendance (evidence: `main.py`)
- Face Recognition → Liveness Checks: checks liveness (evidence: `face_recognition_service.py`)
- Face Recognition → Spoof Detection: checks spoofing (evidence: `face_recognition_service.py`)
- Attendance Service → Attendance Records: updates (evidence: `attendance_service.py`)
- Attendance Service → WhatsApp Service: sends alerts (evidence: `attendance_service.py`)
- Auth API → WhatsApp Service: sends OTP (evidence: `auth_routes.py`)
- WhatsApp Service → WhatsApp API: sends messages (evidence: `whatsapp_service.py`)
- Flask Application → Runtime Configuration: loads settings (evidence: `main.py`)
