Naalya Handbook
School features

Enrollment

The row that puts a student in a class for one academic year. How staff and guardians create it, how it changes, and which modules read it.

An enrollment puts one student in one class (and usually a stream) for one campus year. There is at most one per student per campus year. Grading, CBT, payment targeting and guardian campus access all read it, so its rules are strict.

The row

FieldNotes
studentId, campusId, campusAcademicYearId, classIdUnique on student and campus year
streamIdNullable. Subjects need it
statusOne of 12, below
dateEnrolled
reference{enrollmentNo}/{year}. The student's lifelong enrollmentNo is minted on their first enrollment

Subjects live in student_x_subject, one per enrollment and subject, with an isCompulsory flag.

Statuses: pending, active, revoked, expired, suspended, transferred, graduated, dropped, withdrawn, rejected, cancelled, excluded. There is no transition table: create stores what the body sends (default pending), confirm sets active, and PATCH writes any status, including back to active.

Staff create

POST /enrollment needs create on enrollment. The Hub wizard is at .../students/$studentId/enrol and sends active unless the reviewer picks Pending. The service checks, in order:

A-level rules. An active A-level row needs a stream, a combination and a subsidiary. Combinations are A-level only; electives are O-level only. A combination needs a stream, and the subsidiary must be one the combination allows.

Electives. Each must be offered to the stream, and there can't be more than the class allows.

Year. Unlocked, on this campus, and the current or a future year (never a past one, even unlocked).

No duplicate. Any existing row for that student and year, whatever its status, is refused with its reference and status.

After insert. Compulsory subjects are added, linked guardians get campus access, and any combination or electives are attached.

Confirm sets active, and needs a stream (plus a combination and subsidiary on A-level).

Guardian request

POST /enrollment/me/children/:studentId (enrollMyChild) needs a guardian token, not the enrollment permission. The guardian can suggest a stream or combination; the server picks the class and year.

CheckRefusal
A verified link to the childYou are not a verified guardian of this student
A next class existsThe child has finished the final class, or no next class could be worked out
A campus year is unlocked and openForEnrolment (the highest one is used)Enrolment is not open for this campus yet
Not already enrolled that yearThis student is already enrolled for that academic year

The new row is pending. GET .../eligibility returns the same answer in advance (graduating, no_next_class, no_prior_enrollment, not_open, already_enrolled) so the screen can explain instead of failing. The Hub sends a combination only, never a stream, and shows Request sent on success.

Staff create ignores openForEnrolment; guardian requests depend on it.

Changing a row

ActionRouteWhat it does
EditPATCH /enrollment/:idWrites campus, student, year, class, stream, date or status. No A-level, forward-only or transition checks. Changing class does not rebuild subjects
EndSame route, from the End buttonSends one status: Graduated, Transferred, Withdrawn, Dropped out, Suspended, Excluded, Expired or Cancelled. Kept in history
Move streamPATCH /enrollment/:id/streamMoves within the class and rebuilds subjects (below)
Swap an electivePOST /enrollment/:id/subjects/swapO-level only (below)
DeleteDELETE /enrollment/:idSoft delete. Refreshes guardian campus access

Every change refuses a locked year. There is no class-move route: a new year is a new enrollment.

Subjects

  • Compulsory subjects come from the school's subject_x_class rows marked compulsory, plus NCDC curriculum bands (empty until that data lands). They need a stream. Adding them twice is harmless.
  • Electives must be offered to the stream; a duplicate is a 409.
  • A compulsory subject can't be removed (Cannot remove a compulsory subject). It only goes when the subject is taken off the stream or deleted.

Swapping an elective checks the old subject is an active elective and the new one is offered to the stream and not already active. It starts the new row, then sets endedAt on the old one. It does not touch grades, and it does not check the elective minimum or maximum, or the enrollment's status.

Moving stream:

If the row has a combination and an active subsidiary, the combination is checked against the new stream first. A refusal stops the move.

The new stream is saved. The stream is not checked to belong to the same class.

Subjects offered on the old stream but not the new one are ended. Shared ones stay.

Compulsory subjects for the new stream are added, then the combination is re-applied. A refusal at that point leaves the new stream in place.

POST stream/:streamId/sync-compulsory backfills compulsory subjects for a whole stream after subject changes.

Reading it

Lists are cursor-paginated and search reference only. campusAcademicYearId is required unless studentId is given: enrollment is the one sanctioned exemption, for a person's history (see Request scoping). GET stream/:streamId/roster returns every status for that stream and year.

ReaderUses
GradingThe stream's active enrollments as the roster
ClassroomlistRoster for the class teacher
CBTAn active enrollment in the exam's year, taking the subject, with a stream
Payment chargesThe student's latest active enrollment for targeting
GuardiansCampus access for every linked guardian

Where to go next

On this page