deprecated
Horaire-course Pdf (course horaire)
reccurent* = beginning of each academic session
Goal: Get courses prerequisites
This job will automate the process of updating the unstructuredPrerequisites
Course column at the beginning of each reccurent* time, ensuring that the database reflects the most current prerequisite information accurately and efficiently.
Additionally, this column captures prerequisite details from the PDF that are not provided by the website, such as minimum number of credits and program-specific prerequisites.
Each job will represent a program & session.
Reccurent Cron Job : updateCoursePrerequisitesByProgramAndSession
- Setup a recurring Job:
- Create a new scheduled job/queue named
updateCoursePrerequisitesByProgramAndSession
.
- Configure this job to run at the beginning of each academic session.
- Retrieve Program List:
- begin each job execution by fetching a list of all programs from the database.
- Fetch all the programs from the database.
- If the program is not already created, create the program in the db.
- Initialize Session-Specific Job Queue:
- Use Bull to create a separate job queue specifically for processing prerequisites updates. Each job in this queue represents a program identified by its
programCode
and sessionCode
.
- Process Each Program for prerequisites:
- For each job in the queue, execute the following steps:
- Fetch, parse and filter prerequisites from PDF:
- Retrieve the horaire-ets PDF for the current session using the URL format with the
programCode
and sessionCode
.
- Extract prerequisite details for each course from the PDF.
- Only filter the courses that have prerequisites.
- Update Prerequisites:
- Update Database:
- For each course :
- If course OR prequisiteCourse is not present in
Course
table:
- Record an error log (”Le cours STA206 doit déjà être créé pour le programe genie logiciel 7084”)
- else
- Create new
coursePrerequisite
(courseId, programId, coursePrerequisiteId)
- Log Updates:
- Record detailed updates for each program and course in the logs regarding prerequisites changes.
- Error Handling for Prerequisites Update:
- Implement robust error handling for each critical step (fetching PDF, parsing data, database operations) to ensure system resilience against data mismatches, format changes in the PDF, or other anomalies.
- Logging and Monitoring for Prerequisites Jobs:
- Utilize Bull's dashboard to monitor the prerequisites update jobs in real-time.
- Ensure detailed logging is in place for effective tracking and debugging of the prerequisites update process, particularly noting any errors or critical changes.
Note: There’s no need for hashing the horaire-pdf since it’s going to change each session. Simply compar the horairePdfJSON each time we run the job