8. System-defined automatic tagging#
Context#
One main characteristic of system-defined taxonomies is automatic content tagging. It is necessary to implement this functionality when the associated content is created or edited.
Decision#
Events#
It is necessary to create events for each content for creation/edition: CourseCreation, LibraryCreation, etc.
This events will live in openedx-events.
Receivers#
Auto-tagging receivers will live under openedx.features.tagging,
registered as a receiver with the respective code.
Rejected Options#
Django Signals#
Implement a function to add the tag from the content metadata and register that function
as a Django signal. This works for Django database models, but some of the content lives in Mongo,
outside of the Django models. Also, using openedx-filters is better in the edx context, but if there is
other no-edX project that need to use openedx-tagging, can use the Django Signals approach.
openedx-filters#
Use openedx-filters to create a filter which calls the auto tagging pipeline after content creation/editing. Although this approach works, there are more suitable options. Filters are used to act on the input data and provide means to block the flow. This is not necessary in the auto tagging context. The hooks documentation suggests the use of events hooks to expand functionality.