# rajeshkanna54321/attendance-backend architecture

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

- Interactive diagram: https://gitdiagram.com/rajeshkanna54321/attendance-backend
- Repository: https://github.com/rajeshkanna54321/attendance-backend

## Overview

This is a Django REST backend for geo-fenced, dynamic-QR classroom attendance. Students authenticate, bind a device, then submit a scan; the attendance API checks the device, QR token, and location before recording attendance. Teachers create and manage sessions, display rotating QR tokens, monitor attendance, and export reports. The graph follows the documented capabilities and sampled calls; unsampled URL wiring is not inferred, and deployment infrastructure is omitted.

Main entry points: [`attendance-backend/attendance/models.py`](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/models.py) (Sessions & Scan Data), [`attendance-backend/attendance/views.py`](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py) (Scan Validation), [`attendance-backend/accounts/views.py`](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/views.py) (Account API), [`attendance-backend/accounts/services.py`](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/services.py) (Authentication Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; Devices"]
  node_auth_api["Account API<br/>[views.py]"]
  node_auth_logic["Authentication Services<br/>[services.py]"]
  node_identity_store[("Identity &amp; Device Data<br/>[models.py]")]
end

subgraph group_sessions["Sessions &amp; Scanning"]
  node_session_api["Session Management<br/>[views.py]"]
  node_qr_api["QR Token API<br/>[views.py]"]
  node_scan_api["Scan Validation<br/>[views.py]"]
  node_qr_security["Rotating QR Logic<br/>[qr.py]"]
  node_geo_check["Geofence Calculation<br/>[geo.py]"]
end

subgraph group_records["Attendance Records"]
  node_class_data[("Sessions &amp; Scan Data<br/>[models.py]")]
end

subgraph group_reporting["History &amp; Reports"]
  node_attendance_history["Student History<br/>[views.py]"]
  node_live_attendance["Live Attendance<br/>[views.py]"]
  node_export_api["Report Export API<br/>[views.py]"]
  node_xlsx_builder["Excel Workbook Builder<br/>[excel.py]"]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_email["Email Delivery"]

node_student -->|"authenticates via"| node_auth_api
node_student -->|"submits scan"| node_scan_api
node_teacher -->|"manages sessions"| node_session_api
node_teacher -->|"requests QR"| node_qr_api
node_teacher -->|"views attendance"| node_live_attendance
node_teacher -->|"requests reports"| node_export_api
node_auth_api -->|"calls"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_identity_store
node_auth_api -->|"reads and writes"| node_identity_store
node_auth_logic -->|"sends OTP"| node_email
node_session_api -->|"creates and reads"| node_class_data
node_qr_api -->|"creates token"| node_qr_security
node_scan_api -->|"validates token"| node_qr_security
node_scan_api -->|"calculates distance"| node_geo_check
node_scan_api -->|"checks device"| node_identity_store
node_scan_api -->|"records scan"| node_class_data
node_attendance_history -->|"reads records"| node_class_data
node_live_attendance -->|"reads records"| node_class_data
node_export_api -->|"loads sessions"| node_class_data
node_export_api -->|"builds workbook"| node_xlsx_builder
node_xlsx_builder -->|"reads attendance"| node_class_data

click node_auth_api "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/views.py"
click node_auth_logic "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/services.py"
click node_identity_store "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/models.py"
click node_session_api "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_qr_api "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_scan_api "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_qr_security "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/qr.py"
click node_geo_check "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/geo.py"
click node_class_data "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/models.py"
click node_attendance_history "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_live_attendance "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_export_api "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py"
click node_xlsx_builder "https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/excel.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_auth_api,node_auth_logic,node_identity_store toneBlue
class node_session_api,node_qr_api,node_scan_api,node_qr_security,node_geo_check toneAmber
class node_class_data toneMint
class node_attendance_history,node_live_attendance,node_export_api,node_xlsx_builder toneRose
class node_student,node_teacher,node_email toneIndigo
```

## Components

### Identity & Devices

- [Account API](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/views.py): `attendance-backend/accounts/views.py`
- [Authentication Services](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/services.py): `attendance-backend/accounts/services.py`
- [Identity & Device Data](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/accounts/models.py): `attendance-backend/accounts/models.py`

### Sessions & Scanning

- [Session Management](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [QR Token API](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [Scan Validation](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [Rotating QR Logic](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/qr.py): `attendance-backend/attendance/qr.py`
- [Geofence Calculation](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/geo.py): `attendance-backend/attendance/geo.py`

### Attendance Records

- [Sessions & Scan Data](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/models.py): `attendance-backend/attendance/models.py`

### History & Reports

- [Student History](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [Live Attendance](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [Report Export API](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/views.py): `attendance-backend/attendance/views.py`
- [Excel Workbook Builder](https://github.com/rajeshkanna54321/attendance-backend/blob/main/attendance-backend/attendance/excel.py): `attendance-backend/attendance/excel.py`

### Other components

- **Student**
- **Teacher**
- **Email Delivery**

## Connections

- Student → Account API: authenticates via (evidence: `README.md`)
- Student → Scan Validation: submits scan (evidence: `README.md`)
- Teacher → Session Management: manages sessions (evidence: `README.md`)
- Teacher → QR Token API: requests QR (evidence: `README.md`)
- Teacher → Live Attendance: views attendance (evidence: `README.md`)
- Teacher → Report Export API: requests reports (evidence: `README.md`)
- Account API → Authentication Services: calls (evidence: `attendance-backend/accounts/views.py`)
- Authentication Services → Identity & Device Data: reads and writes (evidence: `attendance-backend/accounts/services.py`)
- Account API → Identity & Device Data: reads and writes (evidence: `attendance-backend/accounts/views.py`)
- Authentication Services → Email Delivery: sends OTP (evidence: `attendance-backend/accounts/services.py`)
- Session Management → Sessions & Scan Data: creates and reads (evidence: `attendance-backend/attendance/views.py`)
- QR Token API → Rotating QR Logic: creates token (evidence: `attendance-backend/attendance/views.py`)
- Scan Validation → Rotating QR Logic: validates token (evidence: `attendance-backend/attendance/views.py`)
- Scan Validation → Geofence Calculation: calculates distance (evidence: `attendance-backend/attendance/views.py`)
- Scan Validation → Identity & Device Data: checks device (evidence: `attendance-backend/attendance/views.py`)
- Scan Validation → Sessions & Scan Data: records scan (evidence: `attendance-backend/attendance/views.py`)
- Student History → Sessions & Scan Data: reads records (evidence: `attendance-backend/attendance/views.py`)
- Live Attendance → Sessions & Scan Data: reads records (evidence: `attendance-backend/attendance/views.py`)
- Report Export API → Sessions & Scan Data: loads sessions (evidence: `attendance-backend/attendance/views.py`)
- Report Export API → Excel Workbook Builder: builds workbook (evidence: `attendance-backend/attendance/views.py`)
- Excel Workbook Builder → Sessions & Scan Data: reads attendance (evidence: `attendance-backend/attendance/excel.py`)
