Skip to main content
Module ID: SKOLE-ATND | Version: 1.0 | Status: Activ
Products: Parent App (read-only) · Teacher App (mark/edit) · Web App (report)

1. Overview

Scope In

  • Parent: view attendance records per child per month/date range
  • Teacher: mark present/absent/late, update existing records, view class attendance
  • Web Admin: view school-wide attendance, filter by grade/date

Scope Out

  • SMS/FCM notification on absence (planned, not implemented)
  • Bulk import from external timetabling system

2. Requirements

Functional Requirements (FR)

What the module must DO — actions, behaviors, and outcomes.
  • SKOLE-ATND-FR001: The module shall allow parents to view attendance history for their child by roll number for the current month.
  • SKOLE-ATND-FR002: The module shall display attendance details including date, status (present, absent, late, excused), and check-in/check-out times.
  • SKOLE-ATND-FR003: The module shall enable teachers to mark or update attendance records for individual students.
  • SKOLE-ATND-FR004: The module shall allow teachers to filter attendance records by grade and date.
  • SKOLE-ATND-FR005: The module shall scope all attendance records and queries strictly to the skole_id.
  • SKOLE-ATND-FR006: The module shall allow web admins to view an attendance summary per student across the school.

Non-Functional Requirements (NFR)

How well the module must do it — performance, security, and reliability.
  • SKOLE-ATND-NFR001: The module shall behave securely by enforcing data isolation, ensuring parents can only read their own child’s attendance via JWT verification.
  • SKOLE-ATND-NFR002: The module shall perform authentication checks requiring a valid JWT for every attendance-related query.

Constraints

Rules and boundaries — tech choices and platform restrictions.
  • C001: We must use a relational database (PostgreSQL) because attendance records are strictly linked to the students and schools tables.
  • C002: We must maintain the skole_id as the primary multi-tenancy key in the student_attendance table to ensure data separation.

3. Sub-modules / Backlog


4. Logical Implementation

Attendance Status State Machine

Fields: attendance_status (present/absent/late/excused), availability_status (in-school/away), checkedIn_at, CheckedOut_at

Parent API Flow

Teacher API Flow

Error Handling


5. UI Requirements

Parent App — AttendanceScreen

UI States:
  • Loading: skeleton calendar
  • Empty: “No attendance records for this month”
  • Error: retry button with error toast
Key Components:

Teacher App — AttendanceScreen

Key Components:

Web App — Attendance Page


6. Conditional Expressions


7. Internal Module Connections


8. External Connections


9. Database Tables

student_attendance Schema


10. API Endpoints Summary


  • Pagination limit: max 100 records

PARENT-01: List Child’s Attendance

Section 1: Endpoint Summary

Returns paginated list of attendance records for a parent’s child, with filtering by date range and status.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/attendance
  • Authentication: JWT Bearer Token (Parent)
  • Rate Limit: 100 requests per minute

Section 4: Query Parameters

Section 5: Request Body Schema

Empty (GET request)

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

401 - Unauthorized
404 - Student Not Found

Section 8: Implementation Examples

JavaScript:
Python:
cURL:

Section 9: Database Context

Tables:
  • student_attendance (primary)
  • students (join for validation)
Query:
Indices: (parent_id, date), (student_id, date), skole_id

Section 10: Business Logic & Validations

  • Parent_id from JWT must own the student
  • Date range max: 90 days
  • Status enum validation
  • Pagination limit: max 100 records
  • GET /parent-app/attendance/:studentId - Individual detail
  • GET /parent-app/attendance/reports/summary - Summary stats
  • GET /parent-app/attendance/reports/monthly - Monthly view

Section 12: Response Summary Table


PARENT-02: Get Child’s Attendance Detail

Section 1: Endpoint Summary

Get detailed attendance record for a specific date including check-in/out times.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/attendance/:studentId
  • Authentication: JWT (Parent)

Section 3: Path Parameters

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

404 - No Record

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


PARENT-03: Attendance Summary Report

Section 1: Endpoint Summary

Returns monthly/yearly attendance summary with statistics like percentage, present/absent counts.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/attendance/reports/summary
  • Authentication: JWT (Parent)

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


PARENT-04: Monthly Attendance Report

Section 1: Endpoint Summary

Returns calendar view of attendance data for the full month.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/attendance/reports/monthly
  • Authentication: JWT (Parent)

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACH-01: Mark Attendance

Section 1: Endpoint Summary

Teacher marks attendance for students in their class. Supports single or batch marking with status and timestamps.

Section 2: HTTP Details

  • HTTP Method: POST
  • Endpoint URL: /teachers-app/attendance
  • Authentication: JWT Bearer Token (Staff)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 201)

Section 7: Error Responses

400 - Invalid Status
409 - Records Exist

Section 8: Implementation Examples

JavaScript:
Python:

Section 9: Database Context

Tables:
  • student_attendance (insert new records)
  • staff_student (verify assignment)
Transaction: All-or-nothing insert with conflict detection

Section 10: Business Logic & Validations

Validation:
  • Status from enum: present, absent, late, excused
  • Student must be in teacher’s class (staff_student check)
  • Date must be school day (not weekend/holiday)
  • No duplicate records for same student+date
  • PUT /teachers-app/attendance/:id - Edit record
  • GET /teachers-app/attendance - View records
  • POST /teachers-app/attendance/bulk-upload - Bulk import

Section 12: Response Summary Table


TEACH-02: Edit Attendance Record

Section 1: Endpoint Summary

Teacher updates an individual attendance record (status, times, notes).

Section 2: HTTP Details

  • HTTP Method: PUT
  • Endpoint URL: /teachers-app/attendance/:id
  • Authentication: JWT (Staff)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACH-03: List Class Attendance

Section 1: Endpoint Summary

Teacher retrieves attendance records for their assigned class with filtering by date.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /teachers-app/attendance
  • Authentication: JWT (Staff)

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACH-04: Bulk Upload Attendance

Section 1: Endpoint Summary

Import attendance records from CSV/Excel file for entire class in one operation.

Section 2: HTTP Details

  • HTTP Method: POST
  • Endpoint URL: /teachers-app/attendance/bulk-upload
  • Content-Type: multipart/form-data
  • Authentication: JWT (Staff)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACH-05: Attendance Reports

Section 1: Endpoint Summary

Teacher views attendance reports for their class with statistics and trends.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /teachers-app/attendance/reports
  • Authentication: JWT (Staff)

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-01: Create Attendance Record (Web App)

Section 1: Endpoint Summary

Admin creates attendance records with all details. Supports editing historical records.

Section 2: HTTP Details

  • HTTP Method: POST
  • Endpoint URL: /web-app/attendance
  • Authentication: JWT (Admin)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 201)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-02: List Attendance (Web App)

Section 1: Endpoint Summary

Admin views all attendance records for entire school with advanced filtering.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /web-app/attendance
  • Authentication: JWT (Admin)

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 12: Response Summary Table


ADMIN-03: Update Attendance Record (Web App)

Section 1: Endpoint Summary

Admin updates attendance record details.

Section 2: HTTP Details

  • HTTP Method: PUT
  • Endpoint URL: /web-app/attendance/:id
  • Authentication: JWT (Admin)

Section 6: Response Schema (Success - 200)

Section 12: Response Summary Table


ADMIN-04: Bulk Upload Attendance (Web App)

Section 1: Endpoint Summary

Admin bulk uploads attendance from CSV/Excel file for entire school.

Section 2: HTTP Details

  • HTTP Method: POST
  • Endpoint URL: /web-app/attendance/bulk-upload
  • Content-Type: multipart/form-data
  • Authentication: JWT (Admin)

Section 6: Response Schema (Success - 200)

Section 12: Response Summary Table


ADMIN-05: Attendance Reports (Web App)

Section 1: Endpoint Summary

Admin views school-wide attendance reports with statistics and analysis.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /web-app/attendance/reports
  • Authentication: JWT (Admin)

Section 6: Response Schema (Success - 200)

Section 12: Response Summary Table


12. Summary Table: All 14 Attendance Endpoints