Attendance
One-line: Daily student attendance per class, with history, calendar, and a student self-view.
What it does
Attendance lets a school record who was present, absent, late, or excused for each class, one day at a time. A class teacher marks the whole class in a single action, and the school can then review attendance history by class, by student, or as a calendar that merges in holidays. Students (and, on the roadmap, parents) can see their own attendance and percentages.
Who uses it
- Class teachers — mark attendance for their assigned class, mainly on the mobile app (
MyClassesScreen,MarkAttendanceScreen). - School admins / office staff — review grids, per-student calendars, and reports in admin-web at
/attendance. - Students — view their own attendance (
GET /api/attendance/me) on mobile (MyAttendanceScreen). - Branch sub-admins — restricted to attendance for classes/students in their own school units.
Key concepts
- Attendance session — one
attendance_sessionsrow per class per day (v2 model), optionally finalized. - Attendance record — one
attendance_recordsrow per student per session, holding the status and an optional note. - Statuses —
present,absent,late,excused. - Legacy vs v2 — a flat
attendancetable coexists with the newer session-based model; both are live.
How it works
- Mark by class + date —
POST /api/attendance/markupserts all student records at once and returns a summary (present/absent/late counts). Re-marking is allowed so corrections overwrite prior values. - History — fetch by class (
/class/<class_id>), by student (/student/<student_id>), or filter bydate,from_date/to_date,academic_year_id, with pagination. - Student self-view —
GET /api/attendance/mereturns the student’s own totals and monthly breakdown. - Calendar —
/api/attendance/calendar-holidaysmerges attendance with the holidays table, tagging each datepresent,absent,holiday, orweekend.
Rules & edge cases
- Future dates blocked —
get_or_create_sessionrejects anysession_dateafter today; holiday dates are rejected too. - Skipped rows are reported —
upsert_recordssaves valid rows and returns askippedlist of{ student_id, reason }for students not in the class or with an invalid status. Nothing is silently dropped. - Teacher scope — a class teacher can only mark their assigned class (
class_teacherscheck). - Branch scope — branch-restricted sub-admins can only touch classes/students in their units (
core.branch_scope); self-views stay unscoped. - Plan gating — the module requires the
attendanceplan feature to be enabled for the tenant. - Tenant scoping — all data is isolated per
tenant_id.
Where it lives
- Backend:
server/modules/attendance/(models.py,routes.py,session_routes.py,services.py,session_services.py), prefix/api/attendance. - Admin-web: page
/attendance,admin-web/src/services/attendanceService.ts,admin-web/src/components/attendance/. - Mobile:
client/modules/attendance/. - Plan feature key:
attendance.