feat: provide openedx_learning djangoapp and CompetencyTaxonomy model - #712
Conversation
|
Thanks for the pull request, @jesperhodge! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
kdmccormick
left a comment
There was a problem hiding this comment.
two stylistic comments, but otherwise this looks good to me.
@ormsbee let me know if you'd like to do a pass before I approve and merge.
| # The accessor Django generates for the multi-table-inheritance link from Taxonomy to | ||
| # CompetencyTaxonomy. Deliberately private: callers use the functions below rather than | ||
| # spelling this out, so a model rename is a one-line change here and nowhere else. | ||
| _COMPETENCY_TAXONOMY_RELATION = "competencytaxonomy" |
There was a problem hiding this comment.
i think that this is unnecessarily indirect, and as an abstraction it's leaky. you cannot stop callers from accessing taxonomy.competencytaxonomy directly, so renaming the CompetencyTaxonomy model would be a breaking change--we'd best treat it that way rather than pretending that all references to .competencytaxonomy will go through the two functions below.
I would just use the "competencytaxonomy" string literal in the function below, as is idiomatic in django code. mypy is sometimes actually smart enough to do type checking on expressions like taxonomies.select_related("competencytaxonomy"), but when it's been abstracted out to taxonomies.select_related(_COMPETENCY_TAXONOMY_RELATION), it will never be able to do any static analysis.
| help_text=_( | ||
| "When both an organization-scoped and a taxonomy-scoped rule profile " | ||
| "could apply to a criterion, this decides which one is assigned: false " | ||
| "assigns the organization's, true assigns this taxonomy's." |
There was a problem hiding this comment.
could you add a note stating that this isn't yet used anywhere? bonus points if you add a comment linking to a task or epic issue that would implement it.
There was a problem hiding this comment.
We do not have a task or epic that would implement this since it's out of scope. Epic 6 is what most closely relates to it though, but we don't currently have Epic level Github Issues, so that's a handful of issues. The one most closely related is probably #631 though.
There was a problem hiding this comment.
If it's out of scope for Willow, then can we omit the field for now @mgwozdz-unicon ?
There was a problem hiding this comment.
I think it would be fine to omit the field for now.
|
@kdmccormick: No need to block on me. Thank you. |
|
A couple of things from going through this: READMEs. Every other top-level Django app in this repo (
A couple smaller things Claude surfaced while I was reviewing this: Question ( Nit ( |
|
@mgwozdz-unicon thanks for the review! I made changes to address all your comments. One exception: Claude figured out that this is not correct - I wonder why Claude surfaced this erroneous point. Could you share what model and effort level you ran it with, and what your prompt was? Did Claude use the /code-review skill for this? |
mgwozdz-unicon
left a comment
There was a problem hiding this comment.
Thanks for addressing all of these. I've reviewed it again and this looks good to me.
On your question: Sonnet 5, high reasoning effort. I didn't use the /code-review skill here, my prompt included a specific list of questions plus an open "anything else worth flagging?", and that didn't happen to trigger it to use the skill (though I've found on my other projects that it often does), but I didn't force it to use the skill afterward either. This particular point came out of that open-ended last question rather than a targeted look at that one method. Going forward I'll make a point of invoking /code-review explicitly for these.
It's called out separately from my own points since it came straight from Claude as a flag to double-check rather than a verified finding. This time it was wrong on the specific exception type, but right that it was worth a test rather than an assumption.
bradenmacdonald
left a comment
There was a problem hiding this comment.
From a quick look, LGTM! I didn't do a thorough review.
|
@kdmccormick bump - I addressed your comments, could you check this again? |
|
Hi @ormsbee it seems Kyle is out of office. Could you take this over? I fixed everything mentioned in Kyle's comments. |
|
@jesperhodge: @kdmccormick is back today, and plans to review this PR. |
kdmccormick
left a comment
There was a problem hiding this comment.
two small nits but if you agree with those, then good to go 👍🏻
|
|
||
| # The default MTI reverse accessor. django-stubs cannot see dynamically added | ||
| # accessors, so these tests reach it by name; that name is the ADR-0013 contract. | ||
| RELATION = "competencytaxonomy" |
There was a problem hiding this comment.
again, this is strangely indirect. just access .competencytaxonomy like app code would. if we messed up, then there'll be an AttributeError.
| @@ -0,0 +1,11 @@ | |||
| Learning App | |||
There was a problem hiding this comment.
Please bump the version to 1.3.0 https://github.com/openedx/openedx-core/blob/main/src/openedx_core/__init__.py
Going forward: do a patch bump for every bugfix, a minor bump for every backwards-compatible feature, and a major bump for every breaking change. (We'll soon have tooling set up to do this automatically based on conventional commits -- we're testing that out on other repos first).
|
@jesperhodge: I see that you've made the requested changes. Please resolve the conflicts, and I'll merge. If you could also squash your commits and give a revised commit message, that would be appreciated (otherwise, I just have to take a stab at it). Thank you. |
78c605f to
2ff6cb0
Compare
This PR adds a way to mark a taxonomy as holding competencies rather than ordinary tags, so that competency-based education (CBE) features can later be built on top of it. * Adds a new Django app, openedx_learning, and its first sub-package, cbe. This is a new home for learning-side features. It follows the same layout as the existing openedx_content app: one Django app, split into subfolders for readability. * Adds one model, CompetencyTaxonomy. Marking a taxonomy as a competency taxonomy means creating one of these. It does not copy the taxonomy or replace it; it points at the existing taxonomy and adds a single extra setting to it. * Adds a small public API so other code can ask 'is this taxonomy a competency taxonomy?' without needing to know how that link is stored. * Wires it all up: app registration, the database migration, a Django admin page, and a rule that keeps the dependency pointing one way (the CBE code may use the tagging code, never the reverse).
2ff6cb0 to
d4b259d
Compare
AI-first work.
This was coded with human-in-the-loop. I created the initial instructions; Claude Code created a plan, I (Jesper) reviewed the plan and edited as needed; Claude Code implemented, and I reviewed the implementation and tested.
Related links
Implements #640.
What this does
Open edX already has "taxonomies", which are just collections of tags. This PR adds a way
to mark a taxonomy as holding competencies rather than ordinary tags, so that
competency-based education (CBE) features can later be built on top of it.
openedx_learning, and its first sub-package,cbe. This is anew home for learning-side features. It follows the same layout as the existing
openedx_contentapp: one Django app, split into subfolders for readability.CompetencyTaxonomy. Marking a taxonomy as a competency taxonomy meanscreating one of these. It does not copy the taxonomy or replace it; it points at the
existing taxonomy and adds a single extra setting to it.
without needing to know how that link is stored.
rule that keeps the dependency pointing one way (the CBE code may use the tagging code,
never the reverse).
There is no REST API and no user interface here. This is the groundwork that the follow-up
tickets #641 and #642 are waiting on.
Depends on work in edx-platform
openedx-core is a library, so this app only becomes active once edx-platform lists it in
its settings. That platform-side work is tracked in openedx/openedx-platform#38958.
How to test
This runs entirely inside this repo against a local SQLite file, so you do not need
devstack, tutor, or MySQL.
manage.pydefaults to theprojects.devsettings, which arealready configured to use SQLite at
./dev.db, so there is nothing to configure.1. Set up a virtualenv (skip if you already have one for this repo):
python3 -m venv .venv .venv/bin/pip install -r requirements/dev.txt .venv/bin/pip install -e ..venv/is already in.gitignore.2. Create the database and a login.
The first command creates
dev.dband applies all migrations, including the newopenedx_learning.0001_initial.3. Start the server.
4. Add a competency taxonomy through the admin.
Open http://127.0.0.1:8000/admin/ and log in. You should see a section called
Open edX Core > Learning containing Competency Taxonomies. Click Add, fill in
Name(for exampleNursing) andExport id(for examplenursing-v1), and save.You should land back on a list showing the columns Name, Export id, Enabled, and Taxonomy
overrides org.
5. Confirm it wrote to both tables.
You should get your row back, something like
1|Nursing|0.That join returning a result is the thing worth seeing: one save through the admin created
a row in the existing tagging table and a linked row in the new CBE table. That is the
link this PR is really about.
Cleaning up:
rm dev.dband re-run step 2 to start over.