Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cors-lau.vercel.app/docs/llms.txt

Use this file to discover all available pages before exploring further.

The Scheduler API lets you assemble a conflict-free weekly timetable from the course sections recommended by the Predictions engine. Every write operation validates three constraints: the assigned instructor’s declared availability windows, the instructor’s existing schedule (no double-booking), and the room’s occupancy. Conflict errors return a descriptive 400 message explaining exactly which resource is conflicted.
Day patterns use the institutional abbreviation set: M Monday, T Tuesday, W Wednesday, R Thursday, F Friday, S Saturday, U Sunday. Combine characters for multi-day patterns, e.g. "MWF" or "TR".

GET /scheduler/

Returns all schedule entries currently in the timetable, with each entry’s assigned doctor embedded.

Responses

id
integer
Auto-assigned entry ID.
course_code
string
Course identifier, e.g. "CSC243".
section_name
string
Section display name, e.g. "Introduction to OOP".
doctor_id
integer
ID of the assigned instructor. null if unassigned.
day
string
Day pattern string, e.g. "MWF" or "TR".
start_time
string
24-hour start time, e.g. "08:00".
duration_mins
integer
Session length in minutes, e.g. 60 for MWF sections or 90 for TR sections.
room
string
Room identifier, e.g. "B101". "TBD" if not yet assigned.
doctor
object
Minimal doctor record embedded for display.
curl https://your-cors-instance.com/scheduler/ \
  -H "Authorization: Bearer eyJ..."

POST /scheduler/

Creates a new schedule entry. Before persisting, the endpoint runs all three conflict checks: instructor availability windows, instructor double-booking, and room occupancy.

Request body

course_code
string
required
The course to schedule, e.g. "CSC243".
section_name
string
required
A human-readable section label, e.g. "Introduction to OOP".
doctor_id
integer
default:"0"
ID of the instructor to assign. Pass 0 to leave the section unassigned. Conflict checks are skipped for unassigned entries.
day
string
required
Day pattern using institutional abbreviations, e.g. "MWF" or "TR".
start_time
string
required
24-hour start time in HH:MM format, e.g. "08:00".
duration_mins
integer
required
Session duration in minutes. Typical values: 60 for MWF, 90 for TR.
room
string
default:"\"TBD\""
Room identifier, e.g. "B101". Pass "TBD" to skip room conflict checking.

Responses

Returns the created ScheduleEntryResponse with the embedded doctor object.
curl -X POST https://your-cors-instance.com/scheduler/ \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "course_code": "CSC243",
    "section_name": "Introduction to OOP",
    "doctor_id": 3,
    "day": "MWF",
    "start_time": "08:00",
    "duration_mins": 60,
    "room": "B101"
  }'

PATCH /scheduler/

Partially updates an existing schedule entry. You may update any combination of doctor_id, room, duration_mins, day, and start_time. All three conflict checks are re-run against the resolved effective values after the patch, excluding the entry itself.

Path parameters

entry_id
integer
required
ID of the schedule entry to update.

Request body

Send only the fields you want to change as a JSON object.
doctor_id
integer
New instructor assignment.
room
string
New room assignment.
duration_mins
integer
New session duration in minutes.
day
string
New day pattern.
start_time
string
New start time in HH:MM format.

Responses

Returns the updated ScheduleEntryResponse.
curl -X PATCH https://your-cors-instance.com/scheduler/1 \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{"room": "C202", "start_time": "10:00"}'

DELETE /scheduler/

Removes a schedule entry from the timetable.

Path parameters

entry_id
integer
required
ID of the schedule entry to delete.

Responses

status
string
"deleted" on success.
curl -X DELETE https://your-cors-instance.com/scheduler/1 \
  -H "Authorization: Bearer eyJ..."

GET /scheduler/export

Downloads the complete timetable as an XLSX file. The response streams the file directly; no JSON body is returned.
  • Filename: cors_final_schedule.xlsx
  • Sheet name: Final Schedule
  • Columns: Days Pattern, Course Code, Section Name, Instructor, Start Time, End Time, Room
The exported end time accounts for LAU’s institutional break logic:
  • MWF sections with duration_mins = 60 → effective duration 50 minutes
  • TR sections with duration_mins = 90 → effective duration 75 minutes
curl https://your-cors-instance.com/scheduler/export \
  -H "Authorization: Bearer eyJ..." \
  -o cors_final_schedule.xlsx
The Content-Disposition header in the response is attachment; filename=cors_final_schedule.xlsx. Browsers will trigger an automatic file download.

GET /scheduler/doctors

Returns all faculty records stored in the database.
curl https://your-cors-instance.com/scheduler/doctors \
  -H "Authorization: Bearer eyJ..."

POST /scheduler/doctors

Creates a new faculty record.

Request body

name
string
required
Full name of the faculty member, e.g. "Dr. Alice Smith".
allowed_courses
string
JSON-encoded array of course codes this doctor is qualified to teach, e.g. '["CSC243","CSC301"]'.
available_days
string
Day pattern string indicating when the doctor is available, e.g. "MWF".
available_times
string
Time range string, e.g. "08:00-14:00".

Responses

Returns the created DoctorResponse with its assigned id.
curl -X POST https://your-cors-instance.com/scheduler/doctors \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Dr. Alice Smith",
    "allowed_courses": "[\"CSC243\",\"CSC301\"]",
    "available_days": "MWF",
    "available_times": "08:00-14:00"
  }'