arumoy-shome / UWNerdist

Got free time? Check out what classes are going on at the UW campus that interest you!
MIT License
1 stars 1 forks source link

Populate Subject Table #42

Closed arumoy-shome closed 7 years ago

arumoy-shome commented 7 years ago

This is a subset of the tasks which will be handled by ActiveJob for updating the db at the beginning of each academic term. One dilemma I have is which endpoint to use, we have two options:

  1. codes/subjects returns all the subjects taught at the University. This list is extensive however not all subjects are taught each term (I am guessing) and so we need to remove all subjects not taught in the current term before retrieving the schedules. One solution for this would be the grab all subjects from the terms/{term_id}/courses and merge the two lists before getting the schedules. This method involves two API calls. Alternatively, we can just ask for schedule for all subjects and reject the subjects for which the API returns no results, this is simpler and involves only 1 API call. 2. terms/{term_id}/courses as mentioned before returns a list of courses taught in a term, each course includes it's corresponding subject. This list will not be extensive however it will already be filtered by the subjects taught.

From initial observations, I am leaning towards second option since it involves no additional filtering and it won't be that hard to update the db when the list changes next term, we can simply add the missing subjects. However, there is a potential sync issue with this approach. When we add the courses model, it will be associated with a subject. In this method, if the list of subjects changes every term, only the courses under currently taught subjects will be updated. Not sure if it's an issue at the moment but seems like something we should avoid. Have to use endpoint 1. Explanation 👇.

Goal here is to just save the code e.g. 'CS', 'SYDE' etc and the description e.g. 'Computer Science', 'System Design Engineering'.

arumoy-shome commented 7 years ago

Just realized we can't use the 2nd endpoint because the title returned is the class name, not the subject name. 🤦‍♂️