Skip to content
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

Annotate ordered channel metadata during content annotation #12880

Closed
Tracked by #11888
rtibbles opened this issue Nov 26, 2024 · 0 comments · Fixed by #12944
Closed
Tracked by #11888

Annotate ordered channel metadata during content annotation #12880

rtibbles opened this issue Nov 26, 2024 · 0 comments · Fixed by #12944
Assignees
Labels
P0 - critical Priority: Release blocker or regression

Comments

@rtibbles
Copy link
Member

rtibbles commented Nov 26, 2024

Current implementation

Currently Kolibri annotates a few different top level metadata fields onto channels after successful import: https://github.com/learningequality/kolibri/blob/develop/kolibri/core/content/utils/annotation.py#L770

Specifically, this function sets the languages of contentnodes in the included languages of the channel: https://github.com/learningequality/kolibri/blob/develop/kolibri/core/content/utils/annotation.py#L818

This is done using a Django many to many Field (M2MField).

Desired changes

For 0.18, we would like to show additional metadata on channel cards - specifically the categories and grade_levels metadata, aggregated across all the resources in the channel.

To achieve this we should add categories and grade_levels comma separated TextFields to the ChannelMetadata model. We will use the TextField to maintain a parallel implementation to the ContentNode model.

However, due to the fact that this could result in an overwhelming amount of metadata, we will be prioritizing the display of this metadata - limiting to the top 3 categories, top 3 grade_levels, and the most common language. This means that our annotation needs to reflect this fact.

To achieve this for the TextFields, we will simply order the categories and grade_levels in the comma separated text_fields by their relative resource counts (with the category or grade_level with the highest number of resources going first in its respective field, descending from there).

To achieve this for the included_languages field, we will need a sorted M2M field implementation. We can either roll our own, or use this package: https://pypi.org/project/django-sortedm2m/3.1.1/ (this is the last version to support Django 3.2) to update the field to a sorted field.

If using the above package, we should carefully follow their instructions for creating the database migration.

Finally, an upgrade function should be implemented using Kolibri's upgrade mechanisms for any old_version less than "0.18.0" to rerun the annotation for every channel. This should be put into the upgrade.py of the core content app, which also contains an exuberance of examples of these kinds of functions: https://github.com/learningequality/kolibri/blob/develop/kolibri/core/content/upgrade.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 - critical Priority: Release blocker or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants