Pydantic Models

These models help serialize API responses containing routine information, providing structured access to period details with proper type validation.

pydantic model routinepy.lib.models.ClassPeriod[source]

Represents a single class period in Class routine.

Show JSON schema
{
   "title": "ClassPeriod",
   "description": "Represents a single class period in Class routine.",
   "type": "object",
   "properties": {
      "classDay": {
         "$ref": "#/$defs/Weekday"
      },
      "timeSlotLabel": {
         "examples": [
            "12:00 PM to 01:30 PM"
         ],
         "title": "Timeslotlabel",
         "type": "string"
      },
      "studentIntake": {
         "examples": [
            "48",
            "49",
            "50"
         ],
         "title": "Studentintake",
         "type": "string"
      },
      "studentSection": {
         "examples": [
            "1",
            "2",
            "3"
         ],
         "title": "Studentsection",
         "type": "string"
      },
      "teacherShortCode": {
         "title": "Teachershortcode",
         "type": "string"
      },
      "teacherFullName": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Teacherfullname"
      },
      "buildingId": {
         "examples": [
            "1",
            "2",
            "3",
            "4"
         ],
         "title": "Buildingid",
         "type": "string"
      },
      "roomNo": {
         "title": "Roomno",
         "type": "string"
      },
      "courseNo": {
         "examples": [
            "CSE 101",
            "CSE 201"
         ],
         "title": "Courseno",
         "type": "string"
      },
      "courseName": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Coursename"
      },
      "shiftTime": {
         "$ref": "#/$defs/ShiftTime"
      }
   },
   "$defs": {
      "ShiftTime": {
         "description": "Shift type of different academic programs.",
         "enum": [
            "Day",
            "Evening"
         ],
         "title": "ShiftTime",
         "type": "string"
      },
      "Weekday": {
         "enum": [
            "sun",
            "mon",
            "tues",
            "wednes",
            "thurs",
            "fri",
            "sat"
         ],
         "title": "Weekday",
         "type": "string"
      }
   },
   "required": [
      "classDay",
      "timeSlotLabel",
      "studentIntake",
      "studentSection",
      "teacherShortCode",
      "buildingId",
      "roomNo",
      "courseNo",
      "shiftTime"
   ]
}

Fields:
field building: str [Required] (alias 'buildingId')
field course_code: str [Required] (alias 'courseNo')
field course_name: str | None = None (alias 'courseName')
field faculty_code: str [Required] (alias 'teacherShortCode')
field faculty_name: str | None = None (alias 'teacherFullName')
field intake: str [Required] (alias 'studentIntake')
field period_time: str [Required] (alias 'timeSlotLabel')
field room: str [Required] (alias 'roomNo')
field section: str [Required] (alias 'studentSection')
field shift_time: ShiftTime [Required] (alias 'shiftTime')
field week_day: Weekday [Required] (alias 'classDay')
pydantic model routinepy.lib.models.FacultyPeriod[source]

Represents a single class period in Faculty routine.

Show JSON schema
{
   "title": "FacultyPeriod",
   "description": "Represents a single class period in Faculty routine.",
   "type": "object",
   "properties": {
      "dayName": {
         "$ref": "#/$defs/Weekday"
      },
      "timeSlotLabel": {
         "examples": [
            "12:00 PM to 01:30 PM"
         ],
         "title": "Timeslotlabel",
         "type": "string"
      },
      "intake": {
         "examples": [
            "48",
            "49",
            "50"
         ],
         "title": "Intake",
         "type": "string"
      },
      "section": {
         "examples": [
            "1",
            "2",
            "3"
         ],
         "title": "Section",
         "type": "string"
      },
      "buildingId": {
         "examples": [
            "1",
            "2",
            "3",
            "4"
         ],
         "title": "Buildingid",
         "type": "string"
      },
      "roomNumber": {
         "title": "Roomnumber",
         "type": "string"
      },
      "courseNumber": {
         "examples": [
            "CSE 101",
            "CSE 201"
         ],
         "title": "Coursenumber",
         "type": "string"
      },
      "shiftName": {
         "$ref": "#/$defs/ShiftTime"
      }
   },
   "$defs": {
      "ShiftTime": {
         "description": "Shift type of different academic programs.",
         "enum": [
            "Day",
            "Evening"
         ],
         "title": "ShiftTime",
         "type": "string"
      },
      "Weekday": {
         "enum": [
            "sun",
            "mon",
            "tues",
            "wednes",
            "thurs",
            "fri",
            "sat"
         ],
         "title": "Weekday",
         "type": "string"
      }
   },
   "required": [
      "dayName",
      "timeSlotLabel",
      "intake",
      "section",
      "buildingId",
      "roomNumber",
      "courseNumber",
      "shiftName"
   ]
}

Fields:
field building: str [Required] (alias 'buildingId')
field course_code: str [Required] (alias 'courseNumber')
field intake: str [Required]
field period_time: str [Required] (alias 'timeSlotLabel')
field room: str [Required] (alias 'roomNumber')
field section: str [Required]
field shift_time: ShiftTime [Required] (alias 'shiftName')
field week_day: Weekday [Required] (alias 'dayName')
pydantic model routinepy.lib.models.TermExam[source]

Represents a single exam period in Exam routine.

Show JSON schema
{
   "title": "TermExam",
   "description": "Represents a single exam period in Exam routine.",
   "type": "object",
   "properties": {
      "program_code": {
         "$ref": "#/$defs/ProgramCode"
      },
      "course_code": {
         "examples": [
            "CSE 101",
            "CSE 201"
         ],
         "title": "Course Code",
         "type": "string"
      },
      "student_intake": {
         "examples": [
            "48",
            "49",
            "50"
         ],
         "title": "Student Intake",
         "type": "string"
      },
      "student_section": {
         "examples": [
            "1",
            "2",
            "3"
         ],
         "title": "Student Section",
         "type": "string"
      },
      "course_faculty": {
         "examples": [
            "AQO",
            "MDI",
            "MMRH"
         ],
         "title": "Course Faculty",
         "type": "string"
      },
      "building": {
         "examples": [
            "1",
            "2",
            "3",
            "4"
         ],
         "title": "Building",
         "type": "string"
      },
      "room_number": {
         "examples": [
            "[\"906\"]"
         ],
         "title": "Room Number",
         "type": "string"
      },
      "total_students": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Total Students"
      },
      "e_date": {
         "examples": [
            "2025-03-12 00:00:00"
         ],
         "title": "E Date",
         "type": "string"
      },
      "slot_label": {
         "examples": [
            "12:00 PM to 01:30 PM"
         ],
         "title": "Slot Label",
         "type": "string"
      }
   },
   "$defs": {
      "ProgramCode": {
         "description": "Program codes representing different academic programs.",
         "enum": [
            "026",
            "001",
            "006",
            "019",
            "005",
            "027",
            "028",
            "020",
            "013",
            "025",
            "021",
            "023",
            "016",
            "004",
            "007",
            "008",
            "009",
            "010",
            "012",
            "014",
            "015",
            "011",
            "018",
            "002",
            "003",
            "017",
            "022",
            "024"
         ],
         "title": "ProgramCode",
         "type": "string"
      }
   },
   "required": [
      "program_code",
      "course_code",
      "student_intake",
      "student_section",
      "course_faculty",
      "building",
      "room_number",
      "e_date",
      "slot_label"
   ]
}

Fields:
Validators:
field building: str [Required]
field course_code: str [Required]
field exam_date: str [Required] (alias 'e_date')
Validated by:
field faculty_code: str [Required] (alias 'course_faculty')
field intake: str [Required] (alias 'student_intake')
field period_time: str [Required] (alias 'slot_label')
field program_code: ProgramCode [Required]
field room: str [Required] (alias 'room_number')
Validated by:
field section: str [Required] (alias 'student_section')
field total_students: str | None = None
validator parse_exam_date  »  exam_date[source]
validator parse_room  »  room[source]
pydantic model routinepy.lib.models.UpdateInfo[source]

Represents a single update metadata of a routine.

Show JSON schema
{
   "title": "UpdateInfo",
   "description": "Represents a single update metadata of a routine.",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "routine": {
         "title": "Routine",
         "type": "string"
      },
      "semester": {
         "title": "Semester",
         "type": "string"
      },
      "semseterCode": {
         "title": "Semsetercode",
         "type": "string"
      },
      "hash": {
         "title": "Hash",
         "type": "string"
      },
      "minorChange": {
         "title": "Minorchange",
         "type": "string"
      },
      "majorChange": {
         "title": "Majorchange",
         "type": "string"
      },
      "updated_at": {
         "title": "Updated At",
         "type": "string"
      },
      "created_at": {
         "title": "Created At",
         "type": "string"
      }
   },
   "required": [
      "id",
      "routine",
      "semester",
      "semseterCode",
      "hash",
      "minorChange",
      "majorChange",
      "updated_at",
      "created_at"
   ]
}

Fields:
field created_at: str [Required]
field hash: str [Required]
field id: str [Required]
field major_change: str [Required] (alias 'majorChange')
field minor_change: str [Required] (alias 'minorChange')
field routine: str [Required]
field semester: str [Required]
field semseter_code: str [Required] (alias 'semseterCode')
field updated_at: str [Required]