SKOLE-ATND | Version: 1.0 | Status: ActivProducts: Parent App (read-only) · Teacher App (mark/edit) · Web App (report)
1. Overview
| Field | Value |
|---|---|
| Module Name | Attendance |
| Module Code | ATND |
| Business Value | Allows parents to monitor their child’s daily attendance history. Teachers mark and edit daily attendance records. Admins can view attendance reports through the web portal. |
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
studentsandschoolstables. - C002: We must maintain the
skole_idas the primary multi-tenancy key in thestudent_attendancetable to ensure data separation.
3. Sub-modules / Backlog
| ID | Sub-module | Priority | Status | Estimate | Linked FR |
|---|---|---|---|---|---|
SKOLE-ATND-SM001 | Parent attendance viewer | P0 | Done | 1d | FR001–FR002 |
SKOLE-ATND-SM002 | Teacher attendance marking | P0 | Done | 3d | FR003–FR004 |
SKOLE-ATND-SM003 | Web admin attendance report | P1 | Done | 2d | FR005–FR006 |
4. Logical Implementation
Attendance Status State Machine
attendance_status (present/absent/late/excused), availability_status (in-school/away), checkedIn_at, CheckedOut_at
Parent API Flow
Teacher API Flow
Error Handling
| Scenario | HTTP | Message |
|---|---|---|
Missing roll_no | 400 | ”roll_no is required” |
Missing skole_id | 400 | ”skole_id is required” |
| Record not found | 404 | ”Attendance record not found” |
5. UI Requirements
Parent App — AttendanceScreen
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ATND-UI001 | AttendanceScreen | /attendance | Monthly calendar view with color-coded attendance per day |
- Loading: skeleton calendar
- Empty: “No attendance records for this month”
- Error: retry button with error toast
| ID | Component | Props |
|---|---|---|
SKOLE-ATND-UC001 | AttendanceCalendar | records[], selectedMonth, onMonthChange |
SKOLE-ATND-UC002 | AttendanceLegend | — (shows color key) |
SKOLE-ATND-UC003 | ChildSelector | children[], selectedChild, onChange |
Teacher App — AttendanceScreen
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ATND-UI002 | AttendanceScreen | /attendance | Date-picker + student list with attendance status toggle per student |
| ID | Component | Props |
|---|---|---|
SKOLE-ATND-UC004 | StudentAttendanceRow | student, status, onStatusChange |
SKOLE-ATND-UC005 | DatePicker | selected, onChange |
SKOLE-ATND-UC006 | GradeFilter | grades[], selected, onChange |
SKOLE-ATND-UC007 | BulkSubmitButton | onSubmit, loading |
Web App — Attendance Page
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ATND-UI003 | Attendance Page | /:skoleId/attendance | Table view with filters for grade, student, date range |
6. Conditional Expressions
| ID | Expression | Trigger | True Action | False Action |
|---|---|---|---|---|
SKOLE-ATND-CE001 | attendance_status === 'present' | Calendar cell render | Green cell | Check other statuses |
SKOLE-ATND-CE002 | attendance_status === 'absent' | Calendar cell render | Red cell | Check late/excused |
SKOLE-ATND-CE003 | attendance_status === 'late' | Calendar cell render | Amber cell | Show excused color |
SKOLE-ATND-CE004 | roll_no absent in query | GET /parent-app/attendance | Return 400 | Proceed with query |
SKOLE-ATND-CE005 | records.length === 0 | Parent app screen | Show empty state | Render calendar |
SKOLE-ATND-CE006 | selectedChild changes | Parent app | Re-fetch attendance | — |
7. Internal Module Connections
| Direction | Module | Data / Event | Condition |
|---|---|---|---|
| ATND → AUTH | Authentication | JWT skole_id used to scope query | Every request |
| ATND → STUD | Students | student_id foreign key links to students | Every attendance record |
| DASH → ATND | Dashboard | Summary attendance stats shown on parent dashboard | On dashboard load |
8. External Connections
| ID | Service | Purpose | Failure Behavior |
|---|---|---|---|
SKOLE-ATND-EX001 | PostgreSQL (Prisma) | Read/write student_attendance | 500 error |
9. Database Tables
| ID | Table | Role |
|---|---|---|
SKOLE-ATND-TB001 | student_attendance | Daily records per student |
student_attendance Schema
| Column | Type | Notes |
|---|---|---|
id | Int PK | Auto-increment |
skole_id | VarChar(15) | School tenant key |
student_id | Int | FK → students.id |
date | Date | Attendance date |
attendance_status | VarChar(20) | present/absent/late/excused |
availability_status | VarChar(100) | in-school/away |
checkedIn_at | Timestamp | Check-in time |
CheckedOut_at | Timestamp | Check-out time |
created_at | Timestamp | Record creation |
updated_at | Timestamp | Last update |
10. API Endpoints Summary
| ID | Method | Route | Auth | Description |
|---|---|---|---|---|
| PARENT-01 | GET | /parent-app/attendance | JWT | GET child’s attendance records |
| PARENT-02 | GET | /parent-app/attendance/:studentId | JWT | Get specific child’s detail |
| PARENT-03 | GET | /parent-app/attendance/reports/summary | JWT | Attendance summary report |
| PARENT-04 | GET | /parent-app/attendance/reports/monthly | JWT | Monthly attendance report |
| TEACH-01 | POST | /teachers-app/attendance | JWT | Mark attendance for students |
| TEACH-02 | PUT | /teachers-app/attendance/:id | JWT | Edit attendance record |
| TEACH-03 | GET | /teachers-app/attendance | JWT | Get class attendance list |
| TEACH-04 | POST | /teachers-app/attendance/bulk-upload | JWT | Bulk upload attendance |
| TEACH-05 | GET | /teachers-app/attendance/reports | JWT | Attendance reports |
| ADMIN-01 | POST | /web-app/attendance | JWT | Admin: create record |
| ADMIN-02 | GET | /web-app/attendance | JWT | Admin: list attendance |
| ADMIN-03 | PUT | /web-app/attendance/:id | JWT | Admin: update record |
| ADMIN-04 | POST | /web-app/attendance/bulk-upload | JWT | Admin: bulk upload |
| ADMIN-05 | GET | /web-app/attendance/reports | JWT | Admin: view reports |
- 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| studentId | UUID | No | First child | Filter by child |
| from_date | Date | No | 30 days ago | Start date (ISO 8601) |
| to_date | Date | No | Today | End date (ISO 8601) |
| status | String | No | - | Filter: present, absent, late, excused |
| take | Integer | No | 20 | Page size |
| skip | Integer | No | 0 | Offset |
Section 5: Request Body Schema
Empty (GET request)Section 6: Response Schema (Success - 200)
Section 7: Error Responses
401 - UnauthorizedSection 8: Implementation Examples
JavaScript:Section 9: Database Context
Tables:- student_attendance (primary)
- students (join for validation)
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
Section 11: Related Endpoints
- 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
| Status | Scenario | Error Code | Message |
|---|---|---|---|
| 200 ✅ | Success | - | Records retrieved |
| 401 ❌ | Unauthorized | UNAUTHORIZED | Invalid token |
| 404 ❌ | Not found | NOT_FOUND | Student not found |
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| studentId | UUID | Yes | Child/Student ID |
Section 4: Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| date | Date | No | Specific date (defaults to today) |
Section 6: Response Schema (Success - 200)
Section 7: Error Responses
404 - No RecordSection 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
| 404 ❌ | No record | NOT_FOUND |
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| studentId | UUID | No | Filter by child |
| month | Integer | No | Month 1-12 |
| year | Integer | No | Year (default: current) |
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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 StatusSection 8: Implementation Examples
JavaScript:Section 9: Database Context
Tables:- student_attendance (insert new records)
- staff_student (verify assignment)
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
Section 11: Related Endpoints
- 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
| Status | Scenario | Error Code | Message |
|---|---|---|---|
| 201 ✅ | Success | - | Records marked |
| 400 ❌ | Invalid | INVALID_STATUS | Status invalid |
| 409 ❌ | Conflict | RECORDS_EXIST | Records exist |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
| 404 ❌ | Not found | NOT_FOUND |
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| date | Date | No | Single day |
| class_id | UUID | No | Filter by class |
| from_date | Date | No | Date range start |
| to_date | Date | No | Date range end |
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 201 ✅ | Success | - |
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| student_id | UUID | No | Filter by student |
| class_id | UUID | No | Filter by class |
| from_date | Date | No | Date range |
| to_date | Date | No | Date range |
| status | String | No | Filter by status |
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
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
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
12. Summary Table: All 14 Attendance Endpoints
| ID | Endpoint | Method | Description | Status |
|---|---|---|---|---|
| PARENT-01 | /parent-app/attendance | GET | List attendance | ✅ Documented |
| PARENT-02 | /parent-app/attendance/:studentId | GET | Detail view | ✅ Documented |
| PARENT-03 | /parent-app/attendance/reports/summary | GET | Summary stats | ✅ Documented |
| PARENT-04 | /parent-app/attendance/reports/monthly | GET | Monthly calendar | ✅ Documented |
| TEACH-01 | /teachers-app/attendance | POST | Mark attendance | ✅ Documented |
| TEACH-02 | /teachers-app/attendance/:id | PUT | Edit record | ✅ Documented |
| TEACH-03 | /teachers-app/attendance | GET | List class records | ✅ Documented |
| TEACH-04 | /teachers-app/attendance/bulk-upload | POST | Bulk upload | ✅ Documented |
| TEACH-05 | /teachers-app/attendance/reports | GET | Reports | ✅ Documented |
| ADMIN-01 | /web-app/attendance | POST | Create record | ✅ Documented |
| ADMIN-02 | /web-app/attendance | GET | List all | ✅ Documented |
| ADMIN-03 | /web-app/attendance/:id | PUT | Update record | ✅ Documented |
| ADMIN-04 | /web-app/attendance/bulk-upload | POST | Bulk upload | ✅ Documented |
| ADMIN-05 | /web-app/attendance/reports | GET | Reports | ✅ Documented |