Skip to content

Commit

Permalink
docs: System taxonomy creation doc updated with Dynamic tags approach
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Jul 20, 2023
1 parent 62501cd commit 36e32ac
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions docs/decisions/0012-system-taxonomy-creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ We have two ways to handle Tags creation and validation for System-defined Taxon
#. If the tags don't change over the time, you can create all on a fixture (e.g Languages).
#. If the tags change over the time, you can create all on a migration. If you edit, delete, or add new tags, you should also do it in a migration.

**Free-form tags**
**Dynamic tags**

This taxonomy depends on a core data model, but simplifies the creation of Tags by allowing free-form tags,
but we can validate the tags using the ``validate_object_tag`` method. For example we can put the ``AuthorSystemTaxonomy`` associated with
the ``User`` model and use the ``ID`` field as tags. Also we can validate if an ``User`` still exists or has been deleted over time.
Closed Taxonomies that depends on a core data model. Ex. AuthorTaxonomy with Users as Tags

#. Tags are created on the fly when new ObjectTags are added.
#. On Tag.external_id we store an identifier from the instance (eg. User.pk).
#. On Tag.value we store an human readable representation of the instance
(eg. User.username).
#. Resync the tags to re-fetch the value.


Rejected Options
-----------------

Tags created by Auto-generated from the codebase
Free-form tags
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Taxonomies that depend on a core data model could create a Tag for each eligible object.
Maintaining this dynamic list of available Tags is cumbersome: we'd need triggers for creation, editing, and deletion.
And if it's a large list of objects (e.g. Users), then copying that list into the Tag table is overkill.
It is better to dynamically generate the list of available Tags, and/or dynamically validate a submitted object tag than
to store the options in the database.
Open Taxonomy that depends on a core data model, but simplifies the creation of Tags by allowing free-form tags,

Rejected because it has been seen that using dynamic tags provides more functionality and more advantages.

.. _document number 0013: https://github.com/openedx/openedx-learning/blob/main/docs/decisions/0013-system-taxonomy-auto-tagging.rst

0 comments on commit 36e32ac

Please sign in to comment.