Attendance System¶
A dual-mode attendance system for K-12 (daily, section-based) and Higher Education (subject-based per semester). Trainers mark, learners view, admins see analytics, and parents give consent for face recognition. Recognition methods include face, face_group, manual, and QR.
How it works¶
K-12 vs Higher Ed¶
| Aspect | K-12 | Higher Education |
|---|---|---|
| Unit | Section (class) | Subject + Academic Level |
| Frequency | Daily | Per class session |
| Trainer | Class trainer marks all | Subject trainer marks own |
| Learner view | Calendar + streaks | Subject-wise percentages |
| Targeting | Class → Section | Program → Branch → Semester → Section |
Trainer marking¶
K-12: at /admin/attendance, pick the assigned section (pre-loaded from user context) and a date (defaults to today), then mark each learner Present / Absent / Late / Excused, with optional bulk actions. Submit posts to /attendance/section/{section_id}.
Higher Ed: on the College tab, pick academic level (Semester 1, 2…) then section. The system shows subjects this trainer teaches; clicking a subject lists enrolled learners to mark. Submit posts to /attendance/subject/mark-bulk.
Learner dashboard (/attendance)¶
K-12 learners see a monthly calendar (green present, red absent, amber late, blue excused), a stats panel (attendance rate, days present/absent/late, streak), and month navigation. College learners get a smart-detection view that tries the college endpoint first and falls back to K-12: an enrollment selector (program, branch, semester tabs) and a subject-wise table (subject, total classes, present, absent, attendance %) with color coding (green ≥75%, yellow 50-75%, red <50%) and per-subject date-by-date detail.
Face enrollment (/admin/face-enrollment)¶
Three tabs:
- Dashboard: total learners, consent pending/accepted/rejected, enrollment rate.
- Learners: table (name, roll number, class/semester, parent, consent status, enrolled) with status/search filters and a bulk "send consent requests" action.
- Enrollment wizard: pick a learner, capture a photo (camera) or upload, preview, submit to
/attendance/enroll-face, which returnsembedding_version,quality_score,enrolled_at.
Parental consent¶
Admin: select learners → "Send Consent Requests"
→ POST /attendance/consent/request { student_ids } → SMS/Email to parents
Parent: opens consent link → views learner info, school logo, consent text
(data collection, purpose, security, retention, rights)
→ Accept or Reject → POST /attendance/consent/{id}/accept (or /reject)
Admin: dashboard shows updated counts; enrolled learners can use face attendance
Consent requirements vary by institution: required for K-12 schools and PU colleges; universities and degree colleges may not require it.
Endpoints¶
K-12 attendance:
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /attendance/section/{section_id} |
Mark section attendance |
| GET | /attendance/my-calendar |
Learner calendar |
| GET | /attendance/my-stats |
Learner stats |
| GET | /attendance/dashboard/trainer |
Trainer dashboard |
| GET | /attendance/stats/{section_id} |
Section stats |
College attendance:
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /attendance/subject/mark-bulk |
Bulk mark |
| GET | /attendance/subject/level/{id}/learners |
Learners for marking |
| GET | /attendance/subject/dashboard/learner |
Learner dashboard |
| GET | /attendance/subject/learner/{id}/history |
Subject history |
| GET | /attendance/subject/stats/{id}/level/{id} |
Subject stats |
Face enrollment:
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /attendance/enroll-face |
Enroll face |
| PUT | /attendance/enroll-face/{id} |
Update enrollment |
| DELETE | /attendance/enroll-face/{id} |
Delete enrollment |
Consent:
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /attendance/consent/check-required |
Check if needed |
| POST | /attendance/consent/request |
Request from parents |
| GET | /attendance/consent/dashboard |
Admin dashboard |
| POST | /attendance/consent/{id}/accept |
Parent accepts |
| POST | /attendance/consent/{id}/reject |
Parent rejects |
Where it lives¶
Routes: /admin/attendance, /attendance, /admin/face-enrollment.