Skip to content

mitxonline course numbers - #3703

Open
abeglova wants to merge 2 commits into
mainfrom
ab/mitxonline-course-numbers
Open

mitxonline course numbers#3703
abeglova wants to merge 2 commits into
mainfrom
ab/mitxonline-course-numbers

Conversation

@abeglova

@abeglova abeglova commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@abeglova
abeglova marked this pull request as ready for review July 30, 2026 02:21
Copilot AI review requested due to automatic review settings July 30, 2026 02:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_numbers for MITx Online courses from distinct courseruns[].course_number, ordered by most recent run.
  • Update the course loader to update_or_create the Course detail 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.<...>.value for listing_type to match the production JSON shape (and avoid the .name/.value mismatch for cross_listed).
            "listing_type": CourseNumberType.primary.name,

Comment thread learning_resources/etl/loaders_test.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@shanbady
shanbady self-requested a review July 30, 2026 19:03

@shanbady shanbady left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants