You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.pyThe text was updated successfully, but these errors were encountered: