-
Notifications
You must be signed in to change notification settings - Fork 28
feat: provide openedx_learning djangoapp and CompetencyTaxonomy model #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ormsbee
merged 1 commit into
openedx:main
from
jesperhodge:jesperhodge/feat--640-cbe-app-foundation
Aug 27, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,4 @@ | |
| """ | ||
|
|
||
| # The version for the entire repository | ||
| __version__ = "1.2.0" | ||
| __version__ = "1.3.0" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Learning App | ||
| ============ | ||
|
|
||
| The ``openedx_learning`` app holds models and APIs for what learners are meant to achieve | ||
| and how they get there. Its sibling ``openedx_content`` holds the material itself. | ||
|
|
||
| Like ``openedx_content``, it is one Django app split into applets. Its first applet is | ||
| ``cbe``, for Competency-Based Education; Learning Pathways are expected to follow. | ||
|
|
||
| In the layering that ``.importlinter`` enforces, this app sits above ``openedx_content`` | ||
| and ``openedx_tagging``. It may build on either of them; neither may import it. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """ | ||
| Learning-domain features for Open edX Core. | ||
| """ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """ | ||
| This module aggregates all applet Django Admin modules. | ||
| """ | ||
| # pylint: disable=wildcard-import | ||
|
|
||
| from .applets.cbe.admin import * |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """ | ||
| This is the public API for learning-domain features in Open edX Core. | ||
| """ | ||
| # This wildcard import is okay because the applet api module declares __all__. | ||
| # pylint: disable=wildcard-import | ||
| from .applets.cbe.api import * |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """ | ||
| The applets that make up the openedx_learning Django app. | ||
| """ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Competency-Based Education Applet | ||
| ================================= | ||
|
|
||
| The ``cbe`` applet models learner mastery of competencies. A competency is a tag; a | ||
| competency taxonomy is a taxonomy whose tags are competencies rather than ordinary labels. | ||
|
|
||
| ``CompetencyTaxonomy`` marks a taxonomy as one of those. It is a Django multi-table | ||
| inheritance subclass of ``openedx_tagging``'s ``Taxonomy``, so the two share a primary key: | ||
| a competency taxonomy is the same taxonomy, not a copy of one. Creating one writes both | ||
| rows in a single transaction, and deleting either row removes both. | ||
|
|
||
| Ask whether a taxonomy is competency-enabled through ``openedx_learning.api``, not by | ||
| reaching for ``taxonomy.competencytaxonomy``. ``is_competency_taxonomy()`` answers for one | ||
| taxonomy; put a queryset through ``select_competency_taxonomies()`` first when checking a | ||
| list, so the whole list costs one query instead of one per row. Keeping the check here is | ||
| what lets ``openedx_tagging`` stay a generic tagging library that never learns CBE exists. | ||
|
|
||
| The criteria, rule profile, and learner status tables this applet still needs are designed | ||
| in ``docs/openedx_learning/decisions/``. ``openedx_tagging`` ADR 0013 covers how | ||
| ``openedx-platform`` calls ``is_competency_taxonomy()`` to report a taxonomy's type to | ||
| Studio. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """ | ||
| The CBE (Competency-Based Education) applet. | ||
| """ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """ | ||
| Django Admin pages for CBE models. | ||
| """ | ||
| from django.contrib import admin | ||
|
|
||
| from .models import CompetencyTaxonomy | ||
|
|
||
| __all__ = [ | ||
| "CompetencyTaxonomyAdmin", | ||
| ] | ||
|
|
||
|
|
||
| class CompetencyTaxonomyAdmin(admin.ModelAdmin): | ||
| """ | ||
| The CompetencyTaxonomy model admin. | ||
| """ | ||
| list_display = ["name", "export_id", "enabled"] | ||
| list_filter = ["enabled"] | ||
|
|
||
|
|
||
| admin.site.register(CompetencyTaxonomy, CompetencyTaxonomyAdmin) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| """ | ||
| Public API for Competency-Based Education (CBE). | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| from django.db.models import QuerySet | ||
|
|
||
| from openedx_tagging.models import Taxonomy | ||
|
|
||
| __all__ = [ | ||
| "is_competency_taxonomy", | ||
| "select_competency_taxonomies", | ||
| ] | ||
|
|
||
|
|
||
| def is_competency_taxonomy(taxonomy: Taxonomy) -> bool: | ||
| """ | ||
| Return True if ``taxonomy`` is competency-enabled, i.e. has a CompetencyTaxonomy row. | ||
|
|
||
| Costs one query per call unless ``taxonomy`` came from a queryset passed through | ||
| :func:`select_competency_taxonomies`. Returns False for an unsaved ``taxonomy``. | ||
| """ | ||
| # "competencytaxonomy" is the accessor Django generates for the multi-table-inheritance | ||
| # link from Taxonomy to CompetencyTaxonomy. | ||
| return hasattr(taxonomy, "competencytaxonomy") | ||
|
|
||
|
|
||
| def select_competency_taxonomies(taxonomies: QuerySet[Taxonomy]) -> QuerySet[Taxonomy]: | ||
| """ | ||
| Return ``taxonomies`` with each CompetencyTaxonomy row joined in. | ||
|
|
||
| Pair this with :func:`is_competency_taxonomy` when checking more than one taxonomy, | ||
| so the check costs no additional query per row. | ||
| """ | ||
| return taxonomies.select_related("competencytaxonomy") |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| """ | ||
| Models for Competency-Based Education (CBE). | ||
| """ | ||
| from openedx_tagging.models import Taxonomy | ||
|
|
||
| __all__ = [ | ||
| "CompetencyTaxonomy", | ||
| ] | ||
|
|
||
|
|
||
| class CompetencyTaxonomy(Taxonomy): | ||
| """ | ||
| Marks a Taxonomy as competency-enabled, so CBE features apply to its tags. | ||
|
|
||
| A taxonomy listed in this table: | ||
|
|
||
| - can be displayed in the competency criteria association view. | ||
| - can be displayed in the competency progress tracking views. | ||
| - can also be displayed in the existing generic taxonomy views. | ||
| - constrains its associated content objects to those supported for progress | ||
| tracking, and to ones that could logically be used to demonstrate mastery of | ||
| the competency (for example, associating both a course and one assignment | ||
| within that same course would be ambiguous). | ||
|
|
||
| A taxonomy *not* listed here: | ||
|
|
||
| - is only displayed in the existing generic taxonomy views. | ||
| - is not displayed in competency criteria association views. | ||
| - is not displayed in competency progress tracking views. | ||
| - has no competency-specific constraints on its associated content objects. | ||
|
|
||
| Creating a competency taxonomy creates both the parent ``Taxonomy`` row and this | ||
| row in one transaction; deleting either row removes both. | ||
|
|
||
| .. no_pii: | ||
| """ | ||
|
|
||
| class Meta: | ||
| verbose_name = "Competency Taxonomy" | ||
| verbose_name_plural = "Competency Taxonomies" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| """ | ||
| App Config for our umbrella openedx_learning app. | ||
| """ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class LearningConfig(AppConfig): | ||
| """ | ||
| Initialization for all applets must happen in here. | ||
| """ | ||
|
|
||
| name = "openedx_learning" | ||
| verbose_name = "Open edX Core > Learning" | ||
| default_auto_field = "django.db.models.BigAutoField" | ||
| label = "openedx_learning" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Generated by Django 5.2.16 on 2026-08-06 19:25 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ('oel_tagging', '0020_tag_depth_and_lineage'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='CompetencyTaxonomy', | ||
| fields=[ | ||
| ('taxonomy_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='oel_tagging.taxonomy')), | ||
| ], | ||
| options={ | ||
| 'verbose_name': 'Competency Taxonomy', | ||
| 'verbose_name_plural': 'Competency Taxonomies', | ||
| }, | ||
| bases=('oel_tagging.taxonomy',), | ||
| ), | ||
| ] |
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """ | ||
| This module aggregates all applet model modules. | ||
| """ | ||
|
|
||
| # pylint: disable=wildcard-import | ||
|
|
||
| from .applets.cbe.models import * |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """ | ||
| Models that we want callers to extend or make foreign keys to. | ||
|
|
||
| This is also the stable import point for the model class itself, for callers that | ||
| need to create competency taxonomies directly. | ||
| """ | ||
|
|
||
| # pylint: disable=unused-import | ||
| from .models import CompetencyTaxonomy |
Empty file.
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
Empty file.
Empty file.
Empty file.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).