feat: Implement taxonomy sample data generation - #1
Conversation
The following sample tags will be generated: - 10 Tags for the disabled taxonomy - 5000 Tags for the flat taxonomy - 4^x Tags with 3 levels for the hierarchical taxonomy - 2 Tags with 2 levels for two level taxonomy - 5 Tags for the multi org taxonomy Whenever the generate script is run, it clears the existing tags and creates fresh new ones
Include toggle-able Open Canada Taxonomy data in the generate script from: https://open.canada.ca/data/en/dataset/6093c709-2a0d-4c23-867e-27987a79212c/resource/0a120b15-9708-4d8a-8af2-2431c4540c0b
| create_taxonomy, get_taxonomies_for_org, | ||
| set_taxonomy_orgs, tag_content_object, get_content_tags, | ||
| resync_object_tags | ||
| ) |
There was a problem hiding this comment.
Hmm, I guess I forgot to point out that we already have an import-export API for taxonomies that can import JSON files? 😬 https://github.com/openedx/openedx-learning/tree/main/openedx_tagging/core/tagging/import_export
Not a big deal, but it would have been nice to re-use the existing import code and JSON file format. No need to change now though, we need to wrap this up.
There was a problem hiding this comment.
Oh my bad 😅 didn't know we had that. I can address that in a future ticket for sure.
bradenmacdonald
left a comment
There was a problem hiding this comment.
Generally looks great, thanks! I'll try to test this tomorrow; didn't get time today. If you can make the path customizeable in the meantime, that will make it easier for me to test since I don't use devstack.
d1bc0e4 to
32431b3
Compare
bradenmacdonald
left a comment
There was a problem hiding this comment.
Looks great and seems to have worked well! A couple notes:
|
BTW I also had to change the default user name, because there are no standard users on Tutor devstacks. So the first time I ran it, I saw an error about UserDoesNotExist, but I fixed it easily by changing the variable. |
Oh I see, I thought |
bradenmacdonald
left a comment
There was a problem hiding this comment.
👍
- I tested this: imported it into my devstack
- I read through the code
- I checked for accessibility issues: n/a
- Includes documentation: README
|
@pomegranited @rpenido @ChrisChV Please check out this nice work from @yusuf-musleh! I'd like everyone working on the taxonomy project to import these taxonomies/courses/tags into their devstack please. In FAL-3531 we will soon put these onto the sandbox too. |
Description
Implements generating sample taxonomy data to be used for testing and development. Repeating what is already mentioned in the README:
Running this script will do the following:
Note: This script is designed to be idempotent. Meaning that the end state is the same every time you run it. So if you make modifications to the sample courses on Studio or the Taxonomy data in the shell and run this script again, it will reset all your changes.
Related Tickets:
Testing Instructions
Similar to what is mentioned in the README:
To begin, clone this repo inside a directory so it can be accessed from within the devstack (eg:
/edx/src/)Set the
TAXONOMY_SAMPLE_PATHvariable inside thegenerate.pyfile to point to the cloned repo inside your devstack/tutor environment, eg:/edx/src/taxonomy-sample-data(Optional) If you would not like to include taxonomy data from real world examples, such as:
Then set the following flags to
Falseingenerate.pyaccordingly:To run the script, enter the LMS shell (
make lms-shell) and run the following command:python manage.py cms shell < /path/to/taxonomy-sample-data/generate.pyThe script should run to completion, you'll notice it tagging the courses + components in the logs of the script
Private-ref: FAL-3516