mitxonline course numbers - #3703
Open
abeglova wants to merge 2 commits into
Open
Conversation
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MITx Online ETL so course numbers come from MITx Online course run metadata (instead of the course readable_id), and ensures ETL re-runs can update persisted course-number data for existing courses.
Changes:
- Derive
course.course_numbersfor MITx Online courses from distinctcourseruns[].course_number, ordered by most recent run. - Update the course loader to
update_or_createtheCoursedetail record so changes (including course numbers) are persisted on subsequent loads. - Adjust/add tests to validate the new course-number behavior and loader update semantics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| learning_resources/etl/mitxonline.py | Builds course_numbers from run-level course_number values ordered by recency. |
| learning_resources/etl/mitxonline_test.py | Updates expectations to match the new run-derived course_numbers behavior. |
| learning_resources/etl/loaders.py | Switches to Course.objects.update_or_create so existing course detail rows can be updated. |
| learning_resources/etl/loaders_test.py | Adds coverage ensuring load_course replaces course_numbers on an existing course. |
Comments suppressed due to low confidence (1)
learning_resources/etl/loaders_test.py:696
- Same as above: prefer
CourseNumberType.<...>.valueforlisting_typeto match the production JSON shape (and avoid the.name/.valuemismatch forcross_listed).
"listing_type": CourseNumberType.primary.name,
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
shanbady
self-requested a review
July 30, 2026 19:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
closes https://github.com/mitodl/hq/issues/12512
Description (What does it do?)
this populates course numbers for mitxonline courses
How can this be tested?
run docker-compose run web ./manage.py backpopulate_mitxonline_data
go to http://open.odl.local:8062/search?q=CTL.SC0x
"Supply Chain Analytics" (https://learn.mit.edu/courses/course-v1:MITxT+CTL.SC0x)
should be the first result