Skip to content

feat: add dim_learner_subsection_grades [FC-0140] - #187

Merged
felipemontoya merged 1 commit into
openedx:mainfrom
eduNEXT:fmo/dim_subsection_grades
Dec 3, 2026
Merged

felipemontoya merged 1 commit into
openedx:mainfrom
eduNEXT:fmo/dim_subsection_grades

Conversation

@felipemontoya

Copy link
Copy Markdown
Member

Summary

Subsection grade statements (earned, from edx.grades.subsection.grade_calculated) already land in grading_events, but no model reads them: dim_learner_most_recent_course_grade keeps only course objects. This adds one record per learner per graded subsection.

  • A view, like dim_student_status: highest, first and count can't be kept by a ReplacingMergeTree materialized view
  • Reads with settings final = 1 instead of FINAL, as dim_course_blocks and fact_video_segments do, so the unit test fixture works
  • Block id via splitByString('/xblock/', object_id)[-1] and the '%@sequential+block@%' filter, as in the navigation and course models
  • Scores stay raw Float32, like course_grade
  • Built from xAPI, not from a PersistentSubsectionGrade sink. We had a conversation with @bmtcril about this but a sink would add a celery dump per grade write on top of bulk regrades. The cost is the usual xAPI one: grades written before Aspects was installed, or whose events were lost, are missing until tracking logs are replayed (transform_tracking_logs)
  • Known limitations, in the column descriptions:
    • a subsection with nothing to score is written as 0 by event-routing-backends (weighted_total_possible = 0)
    • writes in the same second are not ordered for latest_grade
    • only events within the data TTL are covered
  • First consumer: the competency dashboard gradebook (openedx-aspects#387, FC-0140)

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Dec 2, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @felipemontoya!

This repository is currently maintained by @openedx/committers-analytics.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Dec 2, 2026
@felipemontoya felipemontoya changed the title feat: add dim_learner_subsection_grades feat: add dim_learner_subsection_grades [FC-0140] Dec 2, 2026
@bmtcril

bmtcril commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Just a couple of things...

  1. "graded subsection" is inaccurate (models/grading/schema.yml, model description).
    • The LMS writes this event for any subsection with scores, graded or not.
    • event-routing-backends computes the score from weighted_total_earned / weighted_total_possible, not the weighted_graded_* fields.
    • So practice subsections get rows too. The gradebook consumer (openedx-aspects#387) has to join dim_course_blocks.graded to exclude them.
    • Fix: reword the description and add that join note.
  2. Nit: wrong SQL comment (models/grading/dim_learner_subsection_grades.sql:17).
    • It says "earned is also emitted for problem grades". Problem grades use evaluated, the other earned source is course grades (/course/... objects).
    • The filter still works.
    • The unit test's excluded row has the same issue, it uses an earned problem statement which never occurs. A /course/ earned row would test the real case.

@felipemontoya

Copy link
Copy Markdown
Member Author

@bmtcril thanks. I addressed this in a separate commit. I'll squash before merging but I wanted to leave the trace in case you have other comments.

One record per learner and graded subsection from the subsection earned
statements: highest and latest grade, first and last grade time, and the
number of grade writes. A view, read with settings final = 1 like the other
views that dedupe grading or course data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@felipemontoya
felipemontoya force-pushed the fmo/dim_subsection_grades branch from 777c1b9 to 109b7b6 Compare December 3, 2026 21:29
@felipemontoya
felipemontoya merged commit d948cc1 into openedx:main Dec 3, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Contributions Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants