Skip to content

[Tagging] Handle tags when importing/exporting courses #182

@yusuf-musleh

Description

@yusuf-musleh

"As a content author, when I export a course/library I want the tag data to be stored in the export. Subsequently when I import a course/library that has tag data in it, I expect that data to be imported as well. When Importing from an external instance, I want the imported tag data to match the Export ID present in my instance and import it accordingly, otherwise those unmatched taxonomy/tags should be dropped hidden."

Acceptance Criteria

  1. When a course with tags is exported to a .tar.gz file, it includes a new tags.csv file with the course tags.
    • This should be exactly the same format as already implemented in feat: export tagged course as csv edx-platform#34091
    • If neither the course itself nor any items in the course have tags, the tags.csv file is not included. (Probably use get_object_tag_counts() to determine this very efficiently.)
    • The format of the the tags.csv file will have to be changed slightly:
      • the "Type" column will have to be the block type (e.g. vertical not "Unit" etc.)
      • the "ID" column should just include the block_id e.g. 1238971 or unit7 not the whole usage key (block-v1:...). This is because the course export format is independent of the course ID.
      • These changes should be made to all versions of the "export tags CSV" code (don't just make these changes for course export).
  2. When a course is imported, if the import contains a tags.csv file, then after the content is imported, all the tags will be applied using the CSV. Invalid block IDs are ignored.
  3. Taxonomy Matching: Taxonomies should be matched based on their [Tagging] An "Export ID" identifies each Taxonomy #183. On import, tags should always be imported as ObjectTags, even if no matching Taxonomy is found, or no matching tag currently exists in the taxonomy. (To prevent data loss.)
    • Scenario 1: Tags in the OLX have a matching Taxonomy (by Export ID) and matching Tags in that Taxonomy (by Value):
      • Tags will be imported and visible in Studio.
      • (Create the ObjectTag as normal, linked to the Taxonomy and Tag)
    • Scenario 2: Tags in the OLX have a matching Taxonomy (by Export ID) but some of the Tags in the OLX are not found in the Taxonomy:
      • Such tag(s) should not be visible in Studio, but iff the Taxonomy is ever updated to include that tag value, the tags will "re-appear".
      • (Create the ObjectTag anyways, linked to the Taxonomy but not linked to the Tag. The value is set in _value.)
    • Scenario 3: Tags in the OLX do not match any Taxonomy (by Export ID):
      • These tags will not be visible in the Studio UI, but should still be exported if the course is exported again. Iff a Taxonomy is ever created/imported with the matching Export ID, the tags will "re-appear".
      • (Still create the ObjectTag instances for these tags, with the Export ID as the _name and the value as the _value.)
    • Scenario 4: Tags in the OLX match a Taxonomy (by Export ID) but the current user does not have permission to view/use that taxonomy [because it's linked to a different org]:
      • Tags will be imported and visible in Studio. Course author will be able to delete them if they want. Course author will not be able to add additional tags from the same taxonomy though, because they don't have permission.

Library import/export will be handled in #184

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions