Skip to content

[ARCH] Document how we will calculate what the recommended next action is and investigate what it will take to implement these calculations. Also document what data about the recommended next action should be returned and displayed. #757

Open

Description

@thelmick-unicon
No description provided.

Activity

  1. moved this from Needs additional details to Drafting in Competency Criteria and Student Progresson Sep 16, 2026
  2. mgwozdz-unicon commented on Sep 16, 2026

    @mgwozdz-unicon
    Contributor

    I wrote this comment myself with no AI assistance:

    In our interviews with institutions regarding Student Progress, one of the features everyone was most excited about was the idea of providing learners with a "Recommended Next Action". Because of their excitement, I opted to suggest that we keep this feature in scope even though it feels like a stretch for MVP. Learners will see this CBE "Recommended Next Action" in our right hand panel that we'll be adding to their course Progress tab (Figma Link):

    Image

    Following is what I think would make an ideal formula for calculating the learner's recommended next best action within a specific course from a CBE perspective:

    1. Given a course and a learner...
    2. Find the subsections in this course that have Competency Criteria where the learner has no corresponding StudentCompetencyCriteriaStatus row or (their StudentCompetencyCriteriaStatus row has a status not equal to "Demonstrated" and the learner can re-attempt the Subsection).
    3. If there is more than one result, prioritize them in this order:
      1. If there was a result for "their StudentCompetencyCriteriaStatus row has a status not equal to "Demonstrated" and the learner can re-attempt the Subsection" then this has highest priority. If there are multiple of these, then the subsection that comes chronologically first in the course outline should be highest priority.
      2. Otherwise, the subsection that comes chronologically first in the course outline that the learner has not completed yet in the case of no StudentCompetencyStatus row is highest priority.
    4. Ideally, we need the REST API that provides this calculation to return in its response the name of this Subsection, the URL that the learner can use to navigate tot his subsection or enough information to construct the navigation link URL to this subsection, and the CompetencyCriterion rule profile threshold for the Subsection that is selected as the highest priority.

    I think the challenging part of this that will need some research is determining whether it's possible, and if so, how, to calculate whether the learner can re-attempt the Subsection. It sounds to me like attempt logic may be controlled at the component level instead of the subsection level or maybe at both levels in different ways. It should also be noted that for most CBE cases for MVP, we expect the vast majority of subsections to contain exactly one unit with exactly one ORA.

    As an aside, probably mostly unrelated: Ideally, course authors would like this ORA to be re-take-able up to 3 times, but I believe the settings in Open edX currently only allow for unlimited attempts up to a certain date, so course authors may choose whether or not to turn that on or to create 3 separate subsections with the same ORA and just configure an ANY/OR relationship between them all on the Competency Management page.

    Another perspective on what the learner's recommended next best action is within a specific course might actually be that if a learner has not taken a subsection assessment that has a CompetencyCriterion or if they did take it and did not get a StudentCompetencyCriteriaStatus of "Demonstrated", then the learner actually needs to be directed to the static learning content that goes with this subsection. However, it may be difficult for us to predict specifically what learning content this is. We could guess that it is whatever content is in the same Section of the course that comes before the Subsection, but maybe it's not good to start trying to guess how an instructor may have organized their course. Alternatively, we could search for content that contains the same tag as the CompetencyCriterion for the Subsection; however, for MVP we will be disallowing users from associating Competencies to Content as plain tags in order to prevent confusion about what is and isn't being assessed for mastery. Course authors may choose to have a second taxonomy with plain tags that have identical names to those in the Competency taxonomy as a workaround for this MVP limitation, so we could lookup the value (name) of the tag for the CompetencyCriterion and then search for another taxonomy with the same name, but this also feels like a decent sized stretch in regard to assuming how a course author may have set up their course. So by default, I am leaning against any of these more creative approaches for MVP in favor of waiting until more of the foundational pieces are in place to have more confidence that these kinds of calculations follow precisely what the course author intended or should have intended rather than our assumptions about it.

    The output of the research for this ticket will be documented in a subsequent comment.

  3. mgwozdz-unicon commented on Sep 16, 2026

    @mgwozdz-unicon
    Contributor

    I worked through the research and recommendation below with Claude's help, after asking it to investigate the calculation algorithm and ideas I proposed in my comment above, and doing a few rounds of review with it asking about other things (mostly asking it to also consider ordinary problems and LTI lineitems).

    We confirmed that it is possible to inquire about whether or not re-attempts are possible to some degree on ORA and ordinary problem components, but not on LTI lineitem components and not at the subsection level. Therefore, I decided to define whether or not a subsection could be re-attempted as whether or not a subsection contained any components that we're completely sure have attempts left.

    Claude also pointed out that my idea about just having 3 subsections with the same ORA won't help institutions to support the best recommended next action because if the learner masters it on the first ORA, we don't want it recommending they try the second one. So we've now incorporated a check up the competency criteria hierarchy in the calculation as well.

    The most important part is the updated algorithm for calculating recommended next action that came out of this:

    1. Given a course and a learner.
    2. Find every subsection in the course that carries a competency criterion.
    3. Remove from that set:
      • Any subsection the learner can't currently open right now (unreleased, prerequisite-gated, or otherwise unavailable).
      • Any criterion whose enclosing group, or whose competency, already reports "Demonstrated" for this learner, even when that specific criterion has no status row of its own. This is what keeps an already-satisfied OR group (for example, the duplicate-subsection workaround, once one duplicate is demonstrated) from still recommending its untouched siblings.
    4. Split what's left into two groups:
      • Retry candidates: the learner's status on this subsection's criterion isn't "Demonstrated," and the subsection's re-attempt state is retryable. A subsection whose re-attempt state is unknown is not a retry candidate, but it doesn't fall into "not-started" either, since it does have a status row; it simply isn't recommended by this round of the calculation.
      • Not-started candidates: the learner has no status row on this subsection's criterion, and no submission or attempt has been recorded against it yet. This keeps a subsection whose submission is still awaiting grading from being mistaken for one the learner hasn't touched at all.
    5. If any retry candidates exist, recommend the one that comes chronologically first in the course outline. Otherwise, if any not-started candidates exist, recommend the one that comes chronologically first in the course outline. Otherwise, there's no recommendation.
    6. Return, for the selected subsection: its display name, a ready-to-use navigation URL, and every contributing criterion's competency name, status, and rule.
    Claude's full research and recommendation

    This comment documents the research and recommendation that follow from the algorithm proposed above. It covers whether "can the learner re-attempt this subsection" is actually computable, a correctness gap the investigation found in the proposed algorithm, where this calculation should live given this repo's layering rules, a refined version of the algorithm, and the recommended REST API response shape.

    1. Is "can the learner re-attempt the subsection" computable?

    Whether a subsection can be re-attempted depends on its graded component, and how that's computed differs by content type. For MVP, the vast majority of competency-bearing subsections are expected to hold a single graded component, most often an Open Response Assessment (ORA). Two other content types matter enough to cover here too: ordinary problems (capa), and LTI-graded activities, since at least one pilot partner is expected to use LTI.

    ORA. Confirmed: the ORA block has no "exactly N attempts" setting. It supports only two states: a single attempt (the default), or unlimited resubmission up to a due date and optional grace period, gated by one on/off switch plus a few other conditions ORA already evaluates internally (for example, a peer-graded response can never be resubmitted, regardless of that switch). That evaluation is exposed as a function that reads properties off the live block, so it can only be run by loading the specific learner's ORA block through the courseware runtime, not by reading ORA's underlying tables directly. Recommend computing "can re-attempt" for an ORA-backed subsection this way: load the block for the learner and call ORA's own eligibility check, in one small function whose only job is that load-and-call. There's no way to get this answer without the runtime today, and that's a real platform limitation rather than something in scope for this spike to change: edx-ora2, ORA's own repository, is a separate top-level Open edX project that is beyond the scope of this project to change, so it isn't something this work should be filing feature requests against.

    capa (ordinary problems). By contrast, a capa problem block already exposes a plain integer attempt count and limit (attempts, max_attempts) directly on the block's own state, with a simple "used every attempt" comparison between the two. No due-date logic, no separate apps, no runtime dependency beyond the block's already-standard state. This is a meaningfully simpler case than ORA.

    LTI-graded activities. An LTI-graded subsection reports its score to Open edX through LTI's Assignment and Grade Services (a "lineitem"), a one-way channel: the external LTI tool sends a score back whenever it decides the activity is graded, and Open edX has no visibility into whether, or how many times, that tool lets the learner resubmit. Confirmed in the installed LTI consumer package: it tracks an attempt_number concept only for LTI proctoring launches, an unrelated feature about proctoring sessions, not for resubmission eligibility on a graded lineitem. Whether an LTI activity can be retried is a decision the external tool makes entirely on its own; this isn't a case of the check not being built yet, Open edX has no way to know the answer.

    General definition of "re-attemptable". Since different content types track attempts differently, and at least one (LTI) is opaque to Open edX by design, a subsection's re-attempt state is one of three outcomes, not a plain yes or no: retryable (at least one graded component reports a remaining attempt, using its own type's mechanism, as with ORA and capa above), not retryable (every graded component reports its attempts exhausted), or unknown (the component's type doesn't expose this to Open edX at all, as with LTI, or it's a type this feature doesn't have a check for yet). Unknown isn't the same as not retryable: it doesn't assert that the learner has run out of attempts, only that recommending a retry can't be done responsibly without knowing, so it's excluded from what gets recommended (section 7) without claiming something false about the learner's actual state.

    On the workaround mentioned above (three duplicate subsections holding the same ORA, combined by an OR group, as a substitute for "3 attempts"): since the goal is to support re-attempts however the platform currently supports them rather than assume any one authoring pattern, the algorithm needs the real re-attempt check described above regardless of whether a course author uses ORA's own resubmission toggle, the duplicate-subsection workaround, or both. The two compose without any special-casing: for a duplicate-subsection setup, each subsection is a one-shot attempt (resubmission left off), so the check above correctly reports "not retryable" once that subsection's component is graded, and the algorithm naturally moves on to the next un-attempted duplicate.

    One more confirmed fact worth stating plainly: Open edX has no concept of a subsection-level attempt today, only a component-level one. This feature computes a subsection's re-attempt state from its component(s), as described above, and should say so explicitly in its own documentation. MVP expects exactly one graded component per competency-bearing subsection; once a subsection can hold more than one, "any of them reports retryable" is this comment's proposed combining rule, worth reconfirming once that case actually comes up.

    2. A correctness gap found in the proposed algorithm

    Take the exact workaround described above: subsections S1, S2, and S3, each holding the same ORA, combined by one OR group under a competency. A learner attempts S1 and demonstrates it there. The competency is now satisfied. S2 and S3 still have no status row at all, because the learner never touched them.

    As written, step 2 of the proposed algorithm selects any subsection with no status row, so it would select S2 or S3 and recommend the learner redo a competency they've already demonstrated.

    Fix: before ranking candidates, drop any criterion whose enclosing group already reports "Demonstrated" for this learner, and any whose competency already reports "Demonstrated." This means the calculation needs the rolled-up group and competency statuses, not only the individual criterion's own status the original algorithm named.

    3. Two more gaps

    • Whether the subsection can currently be opened. The proposed algorithm never checks whether the learner can currently open the subsection it's about to recommend. This is a different question from anything competency-specific: it's the same, already-existing Open edX mechanism that governs whether any subsection is released yet, gated behind a prerequisite, or hidden from a learner's enrollment track, confirmed directly in openedx-platform's course outline code, and it has nothing to do with competency mastery. Recommending a subsection the learner can't open produces a dead link. Fix: exclude any subsection the learner can't currently open from the candidate set entirely.
    • Pending grading. An ORA submission can sit waiting for staff or peer grading for days. During that window there's no status row yet, so the algorithm as written would treat the subsection as "not started" and recommend it, when the only actual next step is to wait. Fix: treat "a submission already exists for this learner on this ORA" (regardless of whether it's graded yet) as different from "no status row," and exclude it from the "not started" bucket.

    4. Where should this actually be computed?

    This repo (openedx-core) never imports from openedx-platform. Course outline order, subsection display names, and whether a learner can currently open a given subsection all live in openedx-platform's learning_sequences app. Whether a learner can re-attempt a subsection's graded component is also only reachable from openedx-platform, per section 1 above. The only piece of this calculation openedx-core actually owns is: which subsections carry competency criteria, what this learner's status is on each (leaf, group, and competency level), and what threshold applies, once the competency criteria data model lands (tracked in #613, not yet merged).

    Recommendation: don't build this as one endpoint inside openedx-core. openedx-core should expose exactly one new function: a bulk read that, given a learner and a list of subsection ids, returns each subsection's competency criteria, this learner's status at the criterion, group, and competency level, and the resolved rule (threshold) for each criterion. The actual REST endpoint, the outline walk, the accessibility check, and the re-attempt probe from section 1 should all live in a new openedx-platform app, a natural sibling to the grade-signal handler that #642/#643/#701 already plan to add on that side. This keeps openedx-core's public surface to one small, stable data query, while the ranking policy (which is young, and likely to change as pacing and program-level rollup get added later, per this project's own scope notes) stays free to evolve without forcing a version-locked contract between two repos.

    This is a different shape than the existing precedent of openedx-core shipping DRF views that openedx-platform mounts with its own permissions (used for the tagging REST API today), because that precedent works when the view is pure CRUD over openedx-core's own tables. Here, most of the data this endpoint needs is platform-owned, not openedx-core's own, so an honest platform-side endpoint calling into one openedx-core read function is the cleaner boundary.

    5. Recommended REST API response shape

    {
      "next_action": {
        "course_id": "course-v1:Org+Course+Run",
        "url": "https://<learning-mfe>/course/<course_id>/<subsection_id>",
        "subsection": {
          "id": "block-v1:Org+Course+Run+type@sequential+block@abc123",
          "display_name": "Poetry Assignment 1"
        },
        "reason": "retry_available",
        "criteria": [
          {
            "competency_name": "Writing Poetry",
            "status": "AttemptedNotDemonstrated",
            "rule": {
              "rule_type": "Grade",
              "rule_payload": { "op": "gte", "value": 0.75, "scale": "percent" }
            }
          }
        ]
      }
    }

    Design choices, each with its reasoning:

    • url is a full, server-built link, the same way the existing "resume course" endpoint already does it in openedx-platform, rather than raw course and subsection ids for the frontend to assemble itself. Whether a given deployment routes learners to the learning micro-frontend or to legacy courseware is a server-side setting, and the server already owns that branch; making every frontend client re-derive it would copy a deployment decision into each one. The raw subsection.id and display_name are returned alongside it because the frontend needs them separately, to render the recommendation and to log which subsection was recommended, not only to build a link.

    • next_action is null, with a normal 200 OK, when there's nothing to recommend. A 404 is reserved for an actual failure, like an unknown course, not a successful calculation that found nothing to recommend. reason stays present at the top level either way, and says why:

      • all_demonstrated: every competency criterion in the course has been demonstrated by this learner.
      • no_criteria_in_course: the course has no competency criteria defined at all.
      • nothing_openable: undemonstrated criteria exist, but none of their subsections can currently be opened by this learner (all gated, unreleased, or otherwise unavailable).
      • retry_state_unknown: an undemonstrated criterion exists, but its subsection's re-attempt state can't be determined (for example, it's graded by an external LTI tool), so nothing is recommended until that changes.

      For example:

      { "next_action": null, "reason": "all_demonstrated" }
    • reason is a machine-readable code, not English prose, whether or not there's a recommendation. Wording is a frontend concern, and will need translation; the backend shouldn't own display copy.

    • criteria is a list, not a single value. One subsection can carry criteria for more than one competency, each with its own status and threshold, even though the MVP case is expected to be exactly one. Modeling it as a list now avoids a breaking response-shape change later.

    • The threshold is returned as the same rule_type/rule_payload shape the competency criteria data model already defines, not translated into a new shape for this endpoint. Keeping it as-is matches how every other consumer of a resolved rule in this codebase already works with it, for consistency with the ADRs and the rest of the implementation.

    • status uses the same three-value enum the competency criteria data model defines (Demonstrated, AttemptedNotDemonstrated, PartiallyAttempted), not a learner-facing display label. That translation is a presentation decision the frontend should own, since it may vary by screen.

    • The competency is identified by name only (competency_name), not by an id. The underlying model (a tag in a competency taxonomy) has no external, stable identifier today, only an internal integer primary key, and this repo's convention is to never expose that internally-generated id externally. The name is enough for display. If a stable, machine-readable competency identifier turns out to be needed later, that's worth its own follow-up decision rather than defaulting to the primary key now.

    6. On directing the learner to related static learning content instead

    Agree with leaning against this for the MVP. The strongest of the two approaches raised above, matching by tag name across a second, plain-tag taxonomy, depends entirely on an author-side workaround that only exists because competencies can't be tagged directly onto content in the MVP. Building product logic on top of a workaround for a temporary limitation means it inherits every assumption of that workaround, and breaks or needs rework the moment that limitation is lifted. A more durable middle ground, worth keeping as a later, non-MVP idea rather than exploring now: let a course author explicitly attach a "related study material" reference to a competency criterion, and return it in the response only when one is set. That requires no guessing about how an author organized their course, and needs no further design work until it's actually prioritized.

    7. Refined algorithm

    1. Given a course and a learner.
    2. Find every subsection in the course that carries a competency criterion.
    3. Remove from that set:
      • Any subsection the learner can't currently open right now (unreleased, prerequisite-gated, or otherwise unavailable).
      • Any criterion whose enclosing group, or whose competency, already reports "Demonstrated" for this learner, even when that specific criterion has no status row of its own. This is what keeps an already-satisfied OR group (for example, the duplicate-subsection workaround, once one duplicate is demonstrated) from still recommending its untouched siblings.
    4. Split what's left into two groups:
      • Retry candidates: the learner's status on this subsection's criterion isn't "Demonstrated," and the subsection's re-attempt state (section 1) is retryable. A subsection whose re-attempt state is unknown is not a retry candidate, but it doesn't fall into "not-started" either, since it does have a status row; it simply isn't recommended by this round of the calculation, and its criterion is what retry_state_unknown (section 5) reports when nothing else is left to recommend.
      • Not-started candidates: the learner has no status row on this subsection's criterion, and no submission or attempt has been recorded against it yet. This keeps a subsection whose submission is still awaiting grading from being mistaken for one the learner hasn't touched at all.
    5. If any retry candidates exist, recommend the one that comes chronologically first in the course outline. Otherwise, if any not-started candidates exist, recommend the one that comes chronologically first in the course outline. Otherwise, there's no recommendation (section 5 above covers what the response looks like in that case, and why).
    6. Return, for the selected subsection: its display name, a ready-to-use navigation URL, and every contributing criterion's competency name, status, and rule.

    Summary and proposed next steps

  4. moved this from Drafting to Ready for Community Review in Competency Criteria and Student Progresson Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions