Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve courseupdate script.... again #107

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

nsandler1
Copy link
Member

@nsandler1 nsandler1 commented Mar 9, 2023

I know what you're thinking: more changes to the courseupdate script?! Really?
That's ok. These changes are the final changes because this pr actually enables this script to do what it should've done all along. Here's everything this pr changes from the script we knew and loved:

  • removed semester argument
  • iterate through umdio's courses to collect any missing courses
  • iterate through professors (via umdio's professors/ endpoint) and add a ProfessorCourse relationship for all courses that a professor taught during any semester. Previously, a course would only be created if it was taught by the professor during the semester specified as a command-line argument and the only ProfessorCourse relationship to be added would be the one during the specified semester. This created pending professors with no courses which either made it difficult to disambiguate with similar professors or meant that we'd verify a professor with no courses (that's gross).

@nsandler1
Copy link
Member Author

This PR is ready for review

@tybug
Copy link
Contributor

tybug commented May 29, 2023

I will note that this relies on the hidden assumption that any courses we care about are taught by at least one professor, and can therefore be reached from the list of professors.

This invariant does not always hold: for instance, CMSC499A (undergraduate research) does not have any associated professors. Classes like this are not reachable by the current script and would not be created if they didn't already exist.

I do think iterating through professors is the correct way to go about this, as it removes any semester-specific ambiguity. However, per above, I think we also need to iterate through the list of courses to check for any new courses.

I would recommend something like the following:

  • iterate through /courses to create any new courses
  • then iterate through /professors to create new professors and assign ProfessorCourse relationships

@nsandler1
Copy link
Member Author

I will note that this relies on the hidden assumption that any courses we care about are taught by at least one professor, and can therefore be reached from the list of professors.

This invariant does not always hold: for instance, CMSC499A (undergraduate research) does not have any associated professors. Classes like this are not reachable by the current script and would not be created if they didn't already exist.

I do think iterating through professors is the correct way to go about this, as it removes any semester-specific ambiguity. However, per above, I think we also need to iterate through the list of courses to check for any new courses.

I would recommend something like the following:

  • iterate through /courses to create any new courses
  • then iterate through /professors to create new professors and assign ProfessorCourse relationships

You raise a good point, but if there's no professor, why would it be useful to have those courses on our site anyway? Users can't review a course unless its associated with professors. Also, do these classes have reported grades? If so, we can read those in from the grade import script but if not then there's really no reason to have those courses on our site.

@tybug
Copy link
Contributor

tybug commented May 30, 2023

I'd push back against suggesting that if a course can't be reviewed, having it on planetterp isn't useful. Reviews aren't the only reason we would want to have a course. E.g., I've historically used planetterp to look up course codes to see what course people are talking about in discussions; the UMD discord bot relies on the planetterp api for this very sort of course lookup, in fact.

Right now, the grade import script does not create new courses, but rejects any data without an existing course. Are you suggesting that the grade import script should create courses that don't exist? Because otherwise, that grade data is going to get dropped.

@nsandler1
Copy link
Member Author

nsandler1 commented Jun 2, 2023

Good point, I hadn't thought of that. I've been convinced that those courses are important.

Yes, I'm saying that the grade import script should add courses that don't exist. I've wanted that for a while now! Instead of adding unknown courses directly from the grade data, we could query umdio to maintain consistent sources. And we could extend this to professors too! Would be an easy change. Let me know your thoughts.

I initially didn't want to go through the courses then go through the professors because I really like how fast the script is. But, accuracy is more important than speed so I agree this is the better change. It doesn't make sense to bring the grade data script into this anyway.

@nsandler1
Copy link
Member Author

ready for review again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants