Skip to main content

SKOLE-STUD — Student Management Module

Module ID: SKOLE-STUD | Version: 1.0 | Status: Active
Products: Teacher App (assigned students) · Web App (full CRUD) · Parent App (own child profile)

1. Overview

Scope In

  • Full student CRUD for web admin (create, update, archive)
  • Teacher: view list of assigned students, view individual student detail
  • Parent: view their child’s profile (read via Auth response)
  • Guardian and address management per student

Scope Out

  • Academic transcripts / grades
  • Timetable assignment

2. Requirements

Functional Requirements (FR)

What the module must DO — actions, behaviors, and outcomes.
  • SKOLE-STUD-FR001: The module shall allow admins to create student records with comprehensive personal, academic, and contact information.
  • SKOLE-STUD-FR002: The module shall enable admins to update student info and change their enrollment status.
  • SKOLE-STUD-FR003: The module shall allow admins to archive students, capturing both an archive reason and the date.
  • SKOLE-STUD-FR004: The module shall provide student filtering by grade, status, and name.
  • SKOLE-STUD-FR005: The module shall allow teachers to view only their list of assigned students.
  • SKOLE-STUD-FR006: The module shall enable admins to manage student guardian and address records.
  • SKOLE-STUD-FR007: The module shall allow admins to reset a student’s parent PIN for application access.
  • SKOLE-STUD-FR008: The module shall enforce that a student’s roll number is unique within its school.

Non-Functional Requirements (NFR)

How well the module must do it — performance, security, and reliability.
  • SKOLE-STUD-NFR001: The module shall perform multi-tenant isolation by scoping all student queries strictly to the skole_id.
  • SKOLE-STUD-NFR002: The module shall behave predictably by allowing archived students to be filtered out of default lists to maintain registry cleanliness.
  • SKOLE-STUD-NFR003: The module shall ensure that student detail retrieval is performant to support real-time application features like attendance marking.

Constraints

Rules and boundaries — tech choices and platform restrictions.
  • C001: We must treat the student registry as the core dependency for all other academic modules (Attendance, Diary, Activities).
  • C002: We must use a junction table (staff_student) for staff assignments to support many-to-many relationships where needed.

3. Sub-modules / Backlog


4. Logical Implementation

Student Status State Machine

Teacher Assigned Students Flow

Admin Student Listing


5. UI Requirements

Teacher App

Components:

Web App

Parent App


6. Conditional Expressions


7. Internal Module Connections


8. Database Tables


9. API Endpoints Summary


10. Detailed Endpoint Documentation (12-Section Format)

PARENT-01: List Parent’s Children

Section 1: Endpoint Summary

Returns all children/students linked to a parent account. Essential for multi-child family support, providing quick access to all enrolled children.

Section 2: HTTP Details

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

Section 3: Path Parameters

None

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 - No Students

Section 8: Implementation Examples

JavaScript:
Python:
cURL:

Section 9: Database Context

Primary Table: students Join Tables: student_guardian, student_address Query Pattern:
Indices: parent_id, skole_id, status

Section 10: Business Logic & Validations

Validation:
  • JWT must contain valid parent_id
  • Query must be scoped to parent’s school (skole_id)
  • Status filter validates against enum: [active, inactive, archived]
Business Logic:
  1. Extract parent_id from JWT
  2. Load parent’s skole_id for school isolation
  3. Build dynamic WHERE clause based on filters
  4. Query students with guardian and address joins
  5. Return paginated results
  • GET /parent-app/student/:id - Get specific child detail
  • PUT /parent-app/student/:id - Update child info
  • GET /parent-app/student/search - Search children

Section 12: Response Summary Table


PARENT-02: Get Child Detail

Section 1: Endpoint Summary

Fetches complete profile of a specific child including personal info, guardians, address, and academic details.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/student/:id
  • Authentication: JWT Bearer Token (Parent)

Section 3: Path Parameters

Section 5: Request Body Schema

Empty (GET request)

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

404 - Student Not Found
403 - Access Denied

Section 8: Implementation Examples

JavaScript:

Section 9: Database Context

Query joins: students + student_guardian + student_address

Section 10: Business Logic & Validations

Verify parent_id has access to this student_id.
  • GET /parent-app/student - List all children
  • PUT /parent-app/student/:id - Update child

Section 12: Response Summary Table


PARENT-03: Update Child Info

Section 1: Endpoint Summary

Parents can update child’s profile information (emergency contact, address, medical info).

Section 2: HTTP Details

  • HTTP Method: PUT
  • Endpoint URL: /parent-app/student/:id
  • Authentication: JWT Bearer Token (Parent)

Section 3: Path Parameters

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

400 - Validation Error

Section 8: Implementation Examples

JavaScript:

Section 9: Database Context

Updates: students, student_guardian, student_address tables

Section 10: Business Logic & Validations

Verify parent access, validate blood group enum, check school isolation.
  • GET /parent-app/student/:id - Get current info
  • PATCH endpoints for partial updates

Section 12: Response Summary Table


PARENT-04: Archive Child Record

Section 1: Endpoint Summary

Parents can remove/archive a child from their profile (when child transfers schools).

Section 2: HTTP Details

  • HTTP Method: DELETE
  • Endpoint URL: /parent-app/student/:id
  • Authentication: JWT Bearer Token (Parent)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 9: Database Context

Sets status = ‘archived’, records archive_reason and archive_date

Section 12: Response Summary Table


PARENT-05: Search Children

Section 1: Endpoint Summary

Search children by name, roll number, or class with fuzzy matching support.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /parent-app/student/search
  • Authentication: JWT Bearer Token (Parent)

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACHER-01: List Assigned Students

Section 1: Endpoint Summary

Teachers retrieve list of students assigned to their classes.

Section 2: HTTP Details

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

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 9: Database Context

Query via staff_student junction table:

Section 10: Business Logic & Validations

Load students only through staff_student assignments (many-to-many).
  • GET /teachers-app/student/:id - Student detail
  • POST /teachers-app/student - Create new student
  • PUT /teachers-app/student/:id - Update student

Section 12: Response Summary Table


TEACHER-02: Get Student Detail

Section 1: Endpoint Summary

Fetch complete profile of a student assigned to teacher’s class.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /teachers-app/student/:id
  • Authentication: JWT Bearer Token (Staff)

Section 3: Path Parameters

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

403 - Not In Class

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACHER-03: Update Student Info

Section 1: Endpoint Summary

Teachers can update student information like attendance status or academic notes.

Section 2: HTTP Details

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

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


TEACHER-04: Create Student Record

Section 1: Endpoint Summary

Teachers can create new student records in their assigned classes (for late admissions or transfers).

Section 2: HTTP Details

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

Section 5: Request Body Schema

Section 6: Response Schema (Success - 201)

Section 7: Error Responses

400 - Duplicate Roll Number

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-01: List All Students (Web App)

Section 1: Endpoint Summary

Admin view of all students in school with advanced filtering, sorting, and pagination.

Section 2: HTTP Details

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

Section 4: Query Parameters

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:
Python:

Section 9: Database Context

Dynamic WHERE clause builder:
Indices: skole_id, status, class, section, (first_name, last_name)

Section 10: Business Logic & Validations

Validation:
  • Admin must belong to school (skole_id match)
  • Status, class, section must be valid enums
  • Pagination: skip >= 0, take <= 100
  • Search applies fuzzy matching
Business Logic:
  1. Build dynamic WHERE filters
  2. Apply school isolation
  3. Count total records matching filters
  4. Fetch paginated results
  5. Return with pagination metadata
  • GET /web-app/student/:id - Student detail
  • POST /web-app/student - Create student
  • PUT /web-app/student/:id - Update student
  • POST /web-app/student/bulk-upload - Bulk import

Section 12: Response Summary Table


ADMIN-02: Get Student Detail (Web App)

Section 1: Endpoint Summary

Complete admin view of student profile with all linked data: guardians, addresses, staff assignments, academic info.

Section 2: HTTP Details

  • HTTP Method: GET
  • Endpoint URL: /web-app/student/:id
  • Authentication: JWT Bearer Token (Admin)

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-03: Create Student

Section 1: Endpoint Summary

Admin creates new student record with comprehensive profile including guardians, address, and class assignment.

Section 2: HTTP Details

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

Section 5: Request Body Schema

Section 6: Response Schema (Success - 201)

Section 7: Error Responses

400 - Duplicate Roll Number
400 - Invalid Class

Section 8: Implementation Examples

JavaScript:
Python:

Section 9: Database Context

Inserts into:
  • students table
  • student_guardian table
  • student_address table
Transactions: All three inserts wrapped in transaction for consistency

Section 10: Business Logic & Validations

Validation:
  • Roll number unique within class
  • Class exists and belongs to school
  • Guardian phone valid format
  • DOB must be in past
  • Gender from enum
  • Required fields present
Business Logic:
  1. Validate roll number uniqueness in class
  2. Check class exists in school
  3. Create student record
  4. Create guardians record
  5. Create address record
  6. Return new student ID
  • GET /web-app/student - List students
  • PUT /web-app/student/:id - Update student
  • DELETE /web-app/student/:id - Delete student

Section 12: Response Summary Table


ADMIN-04: Update Student

Section 1: Endpoint Summary

Admin updates student profile including personal details, guardians, and addresses.

Section 2: HTTP Details

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

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-05: Delete Student

Section 1: Endpoint Summary

Admin permanently deletes student record (soft delete: archives with reason).

Section 2: HTTP Details

  • HTTP Method: DELETE
  • Endpoint URL: /web-app/student/:id
  • Authentication: JWT Bearer Token (Admin)

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 8: Implementation Examples

JavaScript:

Section 12: Response Summary Table


ADMIN-06: Bulk Upload Students

Section 1: Endpoint Summary

Admin imports multiple students at once from CSV/Excel file. Supports complex guardian and address data with validation.

Section 2: HTTP Details

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

Section 5: Request Body Schema

Section 6: Response Schema (Success - 200)

Section 7: Error Responses

413 - File Too Large
400 - Invalid Format
422 - Validation Failures

Section 8: Implementation Examples

JavaScript (FormData):
Python:
cURL:

Section 9: Database Context

Process:
  1. Parse file (CSV/Excel reader)
  2. Validate all rows first
  3. If dry_run=true, stop here
  4. Wrap inserts in transaction
  5. Create students, guardians, addresses atomically
Indices: For batch inserts, may disable temporarily then rebuild

Section 10: Business Logic & Validations

Pre-validation:
  • File format: CSV or Excel only
  • File size: max 10MB
  • Column headers match expected schema
Row validations:
  • Required fields: first_name, last_name, roll_no, class_id, dob
  • Roll number unique within class
  • Class exists in school
  • Phone format valid (or null)
  • DOB in past
  • Gender from enum
Transaction handling:
  • All rows: all-or-nothing (atomic)
  • If any row fails: rollback all
  • Return detailed error list for partial failures
  • POST /web-app/student - Single student creation
  • GET /web-app/student - List students

Section 12: Response Summary Table


| 422 ❌ | Validation failed | VALIDATION_FAILED | Row errors |