From 0ae4e51868baa79a1777a8eaf0861a594cb66a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Redrejo?= Date: Thu, 23 Sep 2021 21:03:39 +0200 Subject: [PATCH 1/8] build the labels withs their ids from a template --- CHANGELOG.md | 6 + Makefile | 7 +- idforlabels.py | 56 ++++++ le_utils/resources/labelslookup.json | 179 +++++++++++++++++++ le_utils/resources/labelstemplatelookup.json | 128 +++++++++++++ 5 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 idforlabels.py create mode 100644 le_utils/resources/labelslookup.json create mode 100644 le_utils/resources/labelstemplatelookup.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 36cafb9..8b3a832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Release History =============== +0.1.23 Sep 23, 2021 +------------------- + - Added new labelslookup.json constants + - Added labelstemplatelookup.json and idforlabels.py + - Added build-label target for Makefile release + 0.1.22 Oct 3, 2019 ------------------- diff --git a/Makefile b/Makefile index 2c6173a..b46d8c9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean clean-test clean-pyc clean-build test release +.PHONY: clean clean-test clean-pyc clean-build test release build-labels clean: clean-build clean-pyc clean-test @@ -23,6 +23,9 @@ clean-test: ## remove test and coverage artifacts test: pytest -s -release: clean +build-labels: + python idforlabels.py + +release: clean build-labels python setup.py sdist twine upload dist/*.tar.gz diff --git a/idforlabels.py b/idforlabels.py new file mode 100644 index 0000000..50d2c66 --- /dev/null +++ b/idforlabels.py @@ -0,0 +1,56 @@ +""" +idforlabels +Builds or rebuilds the labelslooup.json assigning ids to the labels that do not have it +""" +import json +import os + +from uuid import uuid4 + +try: + FileNotFoundError +except NameError: + FileNotFoundError = IOError + + +def handle_array(templates, labels, previous=None): + for template in templates: + if labels.get(template, None) is None: + if previous is not None: + labels[template] = "{}.{}".format(previous, uuid4().hex) + else: + labels[template] = uuid4().hex + return labels + + +def handle_object(element, label, previous=None): + for key in element.keys(): + to_handle = element[key] + handler = handle_object if isinstance(to_handle, dict) else handle_array + new_key = ( + uuid4().hex if previous is None else "{}.{}".format(previous, uuid4().hex) + ) + key_label = label.get(key, [new_key, dict()]) + label[key] = [key_label[0], handler(to_handle, key_label[1], key_label[0])] + return label + + +if __name__ == "__main__": + templates_file = os.path.join("le_utils", "resources", "labelstemplatelookup.json") + with open(templates_file) as json_templates_file: + templates = json.load(json_templates_file) + + labels_file = os.path.join("le_utils", "resources", "labelslookup.json") + try: + with open(labels_file) as json_labels_file: + labels = json.load(json_labels_file) + except FileNotFoundError: + labels = {} + + for label_type in templates.keys(): + to_handle = templates[label_type] + handler = handle_object if isinstance(to_handle, dict) else handle_array + labels[label_type] = handler(to_handle, labels.get(label_type, dict())) + + with open(labels_file, "w") as json_labels_file: + json.dump(labels, json_labels_file, sort_keys=True, indent=2) diff --git a/le_utils/resources/labelslookup.json b/le_utils/resources/labelslookup.json new file mode 100644 index 0000000..7082607 --- /dev/null +++ b/le_utils/resources/labelslookup.json @@ -0,0 +1,179 @@ +{ + "AccessibilityCategories": { + "ALL": "0e205076533a485e98c8a0890447b696", + "ALT_TEXT": "6edfe5adebc94c43ae05a670622f6391", + "AUDIO_DESCRIPTION": "2ed6fc791b404950abb11a556ea2b7fc", + "CAPTIONS_SUBTITLES": "3145e0db927c4f2b91a4ed5fddb3fa3d", + "HIGH_CONTRAST": "f6f2d4f922094cad8ceaa55cf4975b3c", + "SIGN_LANGUAGE": "7c754e64ff9d4994bf4dbba6aa40af28", + "TAGGED_PDF": "9c1e5444318446a5b7596694200e8983" + }, + "ContentLevels": { + "BASIC_SKILLS": "03a8055f751a46239434f34e01a64203", + "LOWER_PRIMARY": "8cd5d69b5f2b411dae2f430c359b570b", + "LOWER_SECONDARY": "e635f0de294b408bafc42cfda3fafef5", + "PRESCHOOL": "319e5689f7f54c9eb6ec17941d3b3fa4", + "PROFESSIONAL": "b99ff4ead74f4469b8af02fb312b4cad", + "TERTIARY": "1264c0843fd44e8593f0b58f1aca902d", + "UPPER_PRIMARY": "54d7e726bf3448e1850a65357a076728", + "UPPER_SECONDARY": "45bc24f1ee474781a5d8415ca228da29", + "WORK_SKILLS": "da8b1c64676241609f76d2a5e6bd7c0e" + }, + "ContentNodeResourceType": { + "ACTIVITY": "63b7413f79ab45e0a48064804defb8c5", + "BOOK": "7522e4a7e7b74579ba86d85e71414d09", + "EXERCISE": "8614b3c4db2c46bfa32f6d057294fd71", + "GAME": "71fe15d91e0b4bf58d0a29e86ae891a5", + "GUIDE": "8422054f183a465797ad52bc8b8b053a", + "LESSON": "704bb2420a4a4860a96ef6fc4aea51f4", + "LESSON_PLAN": "4daad0fce2024f5f8f1a9b9879de32a5", + "MEDIA": "8cc1f54835194760ab622e58247f52c0", + "TEXTBOOK": "bdafc033e97a4f5784f4363f05971c8b", + "TUTORIAL": "46abe613a63143d48a1404827da56c64" + }, + "LearningActivities": { + "CREATE": "17d062f35c4348c987719a6524f89932", + "EXPLORE": "c9365aaac4474c8ca2a3da8a13752d4d", + "LISTEN": "20447e73ce6e4003af2e7fc22acf3288", + "PRACTICE": "66c03d5c3b0947c393c49b2e9496d6cf", + "READ": "4693173af6b24873add7fcb9804db217", + "REFLECT": "a5501d91983643eea017c7d678e9ba50", + "TOPIC": "465ab9f045ea4269a7e0963da80a7ff9", + "WATCH": "f8c842150dc8427489a65eb76c3f2031" + }, + "Needs": { + "MATERIALS": [ + "c206162250de40e2b5702e3cc04ae53e", + { + "INTERNET": "c206162250de40e2b5702e3cc04ae53e.8d765fe61abe46b680aa4df1b2b5167f", + "OTHER_SUPPLIES": "c206162250de40e2b5702e3cc04ae53e.955c8a0962fb45b5899a6797f7acc926", + "PAPER_PENCIL": "c206162250de40e2b5702e3cc04ae53e.0da2a9c4214b4ee08382bfd553cf0900", + "SPECIAL_SOFTWARE": "c206162250de40e2b5702e3cc04ae53e.0f32c0054e51477da0c11805eb0e0764" + } + ], + "PEOPLE": [ + "66fa3d11a59f442d9a257bc1869b7da6", + { + "PEERS": "66fa3d11a59f442d9a257bc1869b7da6.232bd66f300f4eb0b21b3982de37180e", + "TEACHER": "66fa3d11a59f442d9a257bc1869b7da6.6791d250858c463088c14ab1ce99c23f" + } + ] + }, + "Subjects": { + "BASIC_SKILLS": [ + "6d3b7861e638487ba4303cd543dd0581", + { + "DIGITAL_LITERACY": "6d3b7861e638487ba4303cd543dd0581.43be17ba7e26432aa10a9b2e0cfc530b", + "LEARNING_SKILLS": "6d3b7861e638487ba4303cd543dd0581.24b06fe5e683459b88b030969cf51296", + "LITERACY": "6d3b7861e638487ba4303cd543dd0581.25e5b0689d0844f9ae801e9c80c283d6", + "LOGIC_AND_CRITICAL_THINKING": "6d3b7861e638487ba4303cd543dd0581.4063242f6f67422abc27b2597ae4c77f", + "NUMERACY": "6d3b7861e638487ba4303cd543dd0581.e1612982253a4e028a8d835ee9b64b1c" + } + ], + "DAILY_LIFE": [ + "f1e25b65c9d748c3b6fe2eecad85ab3e", + { + "CURRENT_EVENTS": "f1e25b65c9d748c3b6fe2eecad85ab3e.be655385ac4b4173be7758f093e1ff73", + "DIVERSITY": "f1e25b65c9d748c3b6fe2eecad85ab3e.3e72426fddb6491a81f3b2659a33af04", + "ENTREPRENEURSHIP": "f1e25b65c9d748c3b6fe2eecad85ab3e.c0f900b710f547fcb3c9714632ee386a", + "ENVIRONMENT": "f1e25b65c9d748c3b6fe2eecad85ab3e.97ef4763e3db4e21bcd762adb7724c2d", + "FINANCIAL_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.a523fd358b334adbb383c694c14ca8c3", + "MEDIA_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.7036a283eb3649889f7ee5393720c69e", + "MENTAL_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.784ec282fd314590b12316d24fbce728", + "PUBLIC_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.3dbcf19c7607498db7dd66713bee3af9" + } + ], + "FOR_TEACHERS": [ + "589f063c20d14faf8a928d82bfab3eed", + { + "GUIDES": "589f063c20d14faf8a928d82bfab3eed.e239a6fd85274530ae55b15b295e005c", + "LESSON_PLANS": "589f063c20d14faf8a928d82bfab3eed.bc7931965ea64643afd1d46c4c6da5c7" + } + ], + "SCHOOL": [ + "3ced84a428ab4048958cc7713af5d3fa", + { + "ARTS": [ + "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7", + { + "DANCE": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.95ae416c1f194c01b04f0a03f3449045", + "DRAMA": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.fdea8ee7a8da4282948b4242ed6a7841", + "MUSIC": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.d0938586ee1049f287fdc2ccfd0a2a00", + "VISUAL_ART": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.9e562febd47942dab880e0f8037e5d94" + } + ], + "COMPUTER_SCIENCE": [ + "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034", + { + "MECHANICAL_ENGINEERING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.28a888a257dc489393d7c4a6e4bde4fc", + "PROGRAMMING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.fd077423606b41cca5317e234b9bfbef", + "WEB_DESIGN": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.ae9d6939851e438d8470f684854f00c1" + } + ], + "HISTORY": [ + "3ced84a428ab4048958cc7713af5d3fa.e37f0959c6854be3a53f731eddc1e971", + {} + ], + "LANGUAGE_LEARNING": [ + "3ced84a428ab4048958cc7713af5d3fa.86a02dd1ca354db39e7c6c942f3eef22", + {} + ], + "LITERATURE": [ + "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f", + { + "LITERATURE": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.2e469d2681334b278828c1131e099a2c", + "LOGIC_AND_CRITICAL_THINKING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.494d4ed12afb4b79b3fefc952df98df7", + "READING_COMPREHENSION": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.373c0f9b3b12443f8a85507d57c4f21c", + "WRITING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.cbecb74e31f04ebd84c5a133cac1f18f" + } + ], + "MATHEMATICS": [ + "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c", + { + "ALGEBRA": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.762323bbb9f64fb0b7da658d4fa8475c", + "ARITHMETIC": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.e0cb18f633764f96b65ffb779133bc50", + "CALCULUS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.23b6eb16013749a184083167dfadeb1f", + "GEOMETRY": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.898ba3a152b447a7ad31afad57868a30", + "STATISTICS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.a2a262da642e4782a501fb74b883f1fb" + } + ], + "SCIENCES": [ + "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c", + { + "ASTRONOMY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.67ef21db1c7b487282847573b6d22374", + "BIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.99619e134bf543338b8deafa9e579f0f", + "CHEMISTRY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.950ebf20f59044c0bfcb3d4f73516554", + "EARTH_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.11d97cd7532b4890ad7706510bad0b79", + "PHYSICS": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.2533d6a3ae6448b7a0bc1579fd7e5a1d" + } + ], + "SOCIAL_SCIENCES": [ + "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d", + { + "ANTHROPOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.7681e83023e34782ba84d480447d1326", + "CIVIC_EDUCATION": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.9978b69b668144759bc28e4f1acab17b", + "POLITICAL_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.24d8ff3e3c3a4068a3a33c8aded57350", + "SOCIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.82e0c3b935384e839f5a6571019dfd8a" + } + ] + } + ], + "WORK": [ + "95fbee6f510f43fa9a433c7d3c1a8e82", + { + "PROFESSIONAL_SKILLS": [ + "95fbee6f510f43fa9a433c7d3c1a8e82.b79c609ab411484a9e692609f2da31c0", + {} + ], + "TECHNICAL_AND_VOCATIONAL_TRAINING": [ + "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9", + { + "INDUSTRY_AND_SECTOR_SPECIFIC": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.f54a961eaaae474c977d01d483e5d469", + "SKILLS_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.64e0129f43fc4495bec2d4ab4f50ad6f", + "TOOLS_AND_SOFTWARE_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.3b8e7a6ea7c746ee94307a2cff14aa0a" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/le_utils/resources/labelstemplatelookup.json b/le_utils/resources/labelstemplatelookup.json new file mode 100644 index 0000000..9a795d0 --- /dev/null +++ b/le_utils/resources/labelstemplatelookup.json @@ -0,0 +1,128 @@ +{ + "ContentLevels": [ + "PRESCHOOL", + "LOWER_PRIMARY", + "UPPER_PRIMARY", + "LOWER_SECONDARY", + "UPPER_SECONDARY", + "TERTIARY", + "PROFESSIONAL", + "BASIC_SKILLS", + "WORK_SKILLS" + ], + "ContentNodeResourceType": [ + "LESSON", + "TUTORIAL", + "ACTIVITY", + "EXERCISE", + "MEDIA", + "BOOK", + "GAME", + "GUIDE", + "TEXTBOOK", + "LESSON_PLAN" + ], + "LearningActivities": [ + "CREATE", + "LISTEN", + "REFLECT", + "PRACTICE", + "READ", + "WATCH", + "EXPLORE", + "TOPIC" + ], + "AccessibilityCategories": [ + "ALL", + "SIGN_LANGUAGE", + "AUDIO_DESCRIPTION", + "TAGGED_PDF", + "ALT_TEXT", + "HIGH_CONTRAST", + "CAPTIONS_SUBTITLES" + ], + "Subjects": { + "SCHOOL": { + "MATHEMATICS": [ + "ARITHMETIC", + "ALGEBRA", + "GEOMETRY", + "CALCULUS", + "STATISTICS" + ], + "SCIENCES": [ + "BIOLOGY", + "CHEMISTRY", + "PHYSICS", + "EARTH_SCIENCE", + "ASTRONOMY" + ], + "LITERATURE": [ + "LITERATURE", + "READING_COMPREHENSION", + "WRITING", + "LOGIC_AND_CRITICAL_THINKING" + ], + "SOCIAL_SCIENCES": [ + "POLITICAL_SCIENCE", + "SOCIOLOGY", + "ANTHROPOLOGY", + "CIVIC_EDUCATION" + ], + "ARTS": [ + "VISUAL_ART", + "MUSIC", + "DANCE", + "DRAMA" + ], + "COMPUTER_SCIENCE": [ + "PROGRAMMING", + "MECHANICAL_ENGINEERING", + "WEB_DESIGN" + ], + "LANGUAGE_LEARNING": [], + "HISTORY": [] + }, + "BASIC_SKILLS": [ + "LITERACY", + "NUMERACY", + "DIGITAL_LITERACY", + "LOGIC_AND_CRITICAL_THINKING", + "LEARNING_SKILLS" + ], + "WORK": { + "PROFESSIONAL_SKILLS": [], + "TECHNICAL_AND_VOCATIONAL_TRAINING": [ + "TOOLS_AND_SOFTWARE_TRAINING", + "SKILLS_TRAINING", + "INDUSTRY_AND_SECTOR_SPECIFIC" + ] + }, + "DAILY_LIFE": [ + "PUBLIC_HEALTH", + "ENTREPRENEURSHIP", + "FINANCIAL_LITERACY", + "CURRENT_EVENTS", + "ENVIRONMENT", + "MEDIA_LITERACY", + "DIVERSITY", + "MENTAL_HEALTH" + ], + "FOR_TEACHERS": [ + "GUIDES", + "LESSON_PLANS" + ] + }, + "Needs": { + "PEOPLE": [ + "TEACHER", + "PEERS" + ], + "MATERIALS": [ + "PAPER_PENCIL", + "INTERNET", + "SPECIAL_SOFTWARE", + "OTHER_SUPPLIES" + ] + } +} \ No newline at end of file From fe9162ed375ba25cf5cd1b71bb5043c8db5ccc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Redrejo?= Date: Thu, 23 Sep 2021 21:23:13 +0200 Subject: [PATCH 2/8] reorder module --- idforlabels.py | 1 - 1 file changed, 1 deletion(-) diff --git a/idforlabels.py b/idforlabels.py index 50d2c66..4346f4f 100644 --- a/idforlabels.py +++ b/idforlabels.py @@ -4,7 +4,6 @@ """ import json import os - from uuid import uuid4 try: From f49c1bf23d8f726e44a1cc9eb25f74dfdbfed8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Redrejo?= Date: Thu, 23 Sep 2021 21:25:12 +0200 Subject: [PATCH 3/8] fix linting error --- le_utils/resources/labelslookup.json | 204 +++++++++++++-------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/le_utils/resources/labelslookup.json b/le_utils/resources/labelslookup.json index 7082607..ef79b79 100644 --- a/le_utils/resources/labelslookup.json +++ b/le_utils/resources/labelslookup.json @@ -1,175 +1,175 @@ { "AccessibilityCategories": { - "ALL": "0e205076533a485e98c8a0890447b696", - "ALT_TEXT": "6edfe5adebc94c43ae05a670622f6391", - "AUDIO_DESCRIPTION": "2ed6fc791b404950abb11a556ea2b7fc", - "CAPTIONS_SUBTITLES": "3145e0db927c4f2b91a4ed5fddb3fa3d", - "HIGH_CONTRAST": "f6f2d4f922094cad8ceaa55cf4975b3c", - "SIGN_LANGUAGE": "7c754e64ff9d4994bf4dbba6aa40af28", + "ALL": "0e205076533a485e98c8a0890447b696", + "ALT_TEXT": "6edfe5adebc94c43ae05a670622f6391", + "AUDIO_DESCRIPTION": "2ed6fc791b404950abb11a556ea2b7fc", + "CAPTIONS_SUBTITLES": "3145e0db927c4f2b91a4ed5fddb3fa3d", + "HIGH_CONTRAST": "f6f2d4f922094cad8ceaa55cf4975b3c", + "SIGN_LANGUAGE": "7c754e64ff9d4994bf4dbba6aa40af28", "TAGGED_PDF": "9c1e5444318446a5b7596694200e8983" - }, + }, "ContentLevels": { - "BASIC_SKILLS": "03a8055f751a46239434f34e01a64203", - "LOWER_PRIMARY": "8cd5d69b5f2b411dae2f430c359b570b", - "LOWER_SECONDARY": "e635f0de294b408bafc42cfda3fafef5", - "PRESCHOOL": "319e5689f7f54c9eb6ec17941d3b3fa4", - "PROFESSIONAL": "b99ff4ead74f4469b8af02fb312b4cad", - "TERTIARY": "1264c0843fd44e8593f0b58f1aca902d", - "UPPER_PRIMARY": "54d7e726bf3448e1850a65357a076728", - "UPPER_SECONDARY": "45bc24f1ee474781a5d8415ca228da29", + "BASIC_SKILLS": "03a8055f751a46239434f34e01a64203", + "LOWER_PRIMARY": "8cd5d69b5f2b411dae2f430c359b570b", + "LOWER_SECONDARY": "e635f0de294b408bafc42cfda3fafef5", + "PRESCHOOL": "319e5689f7f54c9eb6ec17941d3b3fa4", + "PROFESSIONAL": "b99ff4ead74f4469b8af02fb312b4cad", + "TERTIARY": "1264c0843fd44e8593f0b58f1aca902d", + "UPPER_PRIMARY": "54d7e726bf3448e1850a65357a076728", + "UPPER_SECONDARY": "45bc24f1ee474781a5d8415ca228da29", "WORK_SKILLS": "da8b1c64676241609f76d2a5e6bd7c0e" - }, + }, "ContentNodeResourceType": { - "ACTIVITY": "63b7413f79ab45e0a48064804defb8c5", - "BOOK": "7522e4a7e7b74579ba86d85e71414d09", - "EXERCISE": "8614b3c4db2c46bfa32f6d057294fd71", - "GAME": "71fe15d91e0b4bf58d0a29e86ae891a5", - "GUIDE": "8422054f183a465797ad52bc8b8b053a", - "LESSON": "704bb2420a4a4860a96ef6fc4aea51f4", - "LESSON_PLAN": "4daad0fce2024f5f8f1a9b9879de32a5", - "MEDIA": "8cc1f54835194760ab622e58247f52c0", - "TEXTBOOK": "bdafc033e97a4f5784f4363f05971c8b", + "ACTIVITY": "63b7413f79ab45e0a48064804defb8c5", + "BOOK": "7522e4a7e7b74579ba86d85e71414d09", + "EXERCISE": "8614b3c4db2c46bfa32f6d057294fd71", + "GAME": "71fe15d91e0b4bf58d0a29e86ae891a5", + "GUIDE": "8422054f183a465797ad52bc8b8b053a", + "LESSON": "704bb2420a4a4860a96ef6fc4aea51f4", + "LESSON_PLAN": "4daad0fce2024f5f8f1a9b9879de32a5", + "MEDIA": "8cc1f54835194760ab622e58247f52c0", + "TEXTBOOK": "bdafc033e97a4f5784f4363f05971c8b", "TUTORIAL": "46abe613a63143d48a1404827da56c64" - }, + }, "LearningActivities": { - "CREATE": "17d062f35c4348c987719a6524f89932", - "EXPLORE": "c9365aaac4474c8ca2a3da8a13752d4d", - "LISTEN": "20447e73ce6e4003af2e7fc22acf3288", - "PRACTICE": "66c03d5c3b0947c393c49b2e9496d6cf", - "READ": "4693173af6b24873add7fcb9804db217", - "REFLECT": "a5501d91983643eea017c7d678e9ba50", - "TOPIC": "465ab9f045ea4269a7e0963da80a7ff9", + "CREATE": "17d062f35c4348c987719a6524f89932", + "EXPLORE": "c9365aaac4474c8ca2a3da8a13752d4d", + "LISTEN": "20447e73ce6e4003af2e7fc22acf3288", + "PRACTICE": "66c03d5c3b0947c393c49b2e9496d6cf", + "READ": "4693173af6b24873add7fcb9804db217", + "REFLECT": "a5501d91983643eea017c7d678e9ba50", + "TOPIC": "465ab9f045ea4269a7e0963da80a7ff9", "WATCH": "f8c842150dc8427489a65eb76c3f2031" - }, + }, "Needs": { "MATERIALS": [ - "c206162250de40e2b5702e3cc04ae53e", + "c206162250de40e2b5702e3cc04ae53e", { - "INTERNET": "c206162250de40e2b5702e3cc04ae53e.8d765fe61abe46b680aa4df1b2b5167f", - "OTHER_SUPPLIES": "c206162250de40e2b5702e3cc04ae53e.955c8a0962fb45b5899a6797f7acc926", - "PAPER_PENCIL": "c206162250de40e2b5702e3cc04ae53e.0da2a9c4214b4ee08382bfd553cf0900", + "INTERNET": "c206162250de40e2b5702e3cc04ae53e.8d765fe61abe46b680aa4df1b2b5167f", + "OTHER_SUPPLIES": "c206162250de40e2b5702e3cc04ae53e.955c8a0962fb45b5899a6797f7acc926", + "PAPER_PENCIL": "c206162250de40e2b5702e3cc04ae53e.0da2a9c4214b4ee08382bfd553cf0900", "SPECIAL_SOFTWARE": "c206162250de40e2b5702e3cc04ae53e.0f32c0054e51477da0c11805eb0e0764" } - ], + ], "PEOPLE": [ - "66fa3d11a59f442d9a257bc1869b7da6", + "66fa3d11a59f442d9a257bc1869b7da6", { - "PEERS": "66fa3d11a59f442d9a257bc1869b7da6.232bd66f300f4eb0b21b3982de37180e", + "PEERS": "66fa3d11a59f442d9a257bc1869b7da6.232bd66f300f4eb0b21b3982de37180e", "TEACHER": "66fa3d11a59f442d9a257bc1869b7da6.6791d250858c463088c14ab1ce99c23f" } ] - }, + }, "Subjects": { "BASIC_SKILLS": [ - "6d3b7861e638487ba4303cd543dd0581", + "6d3b7861e638487ba4303cd543dd0581", { - "DIGITAL_LITERACY": "6d3b7861e638487ba4303cd543dd0581.43be17ba7e26432aa10a9b2e0cfc530b", - "LEARNING_SKILLS": "6d3b7861e638487ba4303cd543dd0581.24b06fe5e683459b88b030969cf51296", - "LITERACY": "6d3b7861e638487ba4303cd543dd0581.25e5b0689d0844f9ae801e9c80c283d6", - "LOGIC_AND_CRITICAL_THINKING": "6d3b7861e638487ba4303cd543dd0581.4063242f6f67422abc27b2597ae4c77f", + "DIGITAL_LITERACY": "6d3b7861e638487ba4303cd543dd0581.43be17ba7e26432aa10a9b2e0cfc530b", + "LEARNING_SKILLS": "6d3b7861e638487ba4303cd543dd0581.24b06fe5e683459b88b030969cf51296", + "LITERACY": "6d3b7861e638487ba4303cd543dd0581.25e5b0689d0844f9ae801e9c80c283d6", + "LOGIC_AND_CRITICAL_THINKING": "6d3b7861e638487ba4303cd543dd0581.4063242f6f67422abc27b2597ae4c77f", "NUMERACY": "6d3b7861e638487ba4303cd543dd0581.e1612982253a4e028a8d835ee9b64b1c" } - ], + ], "DAILY_LIFE": [ - "f1e25b65c9d748c3b6fe2eecad85ab3e", + "f1e25b65c9d748c3b6fe2eecad85ab3e", { - "CURRENT_EVENTS": "f1e25b65c9d748c3b6fe2eecad85ab3e.be655385ac4b4173be7758f093e1ff73", - "DIVERSITY": "f1e25b65c9d748c3b6fe2eecad85ab3e.3e72426fddb6491a81f3b2659a33af04", - "ENTREPRENEURSHIP": "f1e25b65c9d748c3b6fe2eecad85ab3e.c0f900b710f547fcb3c9714632ee386a", - "ENVIRONMENT": "f1e25b65c9d748c3b6fe2eecad85ab3e.97ef4763e3db4e21bcd762adb7724c2d", - "FINANCIAL_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.a523fd358b334adbb383c694c14ca8c3", - "MEDIA_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.7036a283eb3649889f7ee5393720c69e", - "MENTAL_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.784ec282fd314590b12316d24fbce728", + "CURRENT_EVENTS": "f1e25b65c9d748c3b6fe2eecad85ab3e.be655385ac4b4173be7758f093e1ff73", + "DIVERSITY": "f1e25b65c9d748c3b6fe2eecad85ab3e.3e72426fddb6491a81f3b2659a33af04", + "ENTREPRENEURSHIP": "f1e25b65c9d748c3b6fe2eecad85ab3e.c0f900b710f547fcb3c9714632ee386a", + "ENVIRONMENT": "f1e25b65c9d748c3b6fe2eecad85ab3e.97ef4763e3db4e21bcd762adb7724c2d", + "FINANCIAL_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.a523fd358b334adbb383c694c14ca8c3", + "MEDIA_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.7036a283eb3649889f7ee5393720c69e", + "MENTAL_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.784ec282fd314590b12316d24fbce728", "PUBLIC_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.3dbcf19c7607498db7dd66713bee3af9" } - ], + ], "FOR_TEACHERS": [ - "589f063c20d14faf8a928d82bfab3eed", + "589f063c20d14faf8a928d82bfab3eed", { - "GUIDES": "589f063c20d14faf8a928d82bfab3eed.e239a6fd85274530ae55b15b295e005c", + "GUIDES": "589f063c20d14faf8a928d82bfab3eed.e239a6fd85274530ae55b15b295e005c", "LESSON_PLANS": "589f063c20d14faf8a928d82bfab3eed.bc7931965ea64643afd1d46c4c6da5c7" } - ], + ], "SCHOOL": [ - "3ced84a428ab4048958cc7713af5d3fa", + "3ced84a428ab4048958cc7713af5d3fa", { "ARTS": [ - "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7", + "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7", { - "DANCE": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.95ae416c1f194c01b04f0a03f3449045", - "DRAMA": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.fdea8ee7a8da4282948b4242ed6a7841", - "MUSIC": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.d0938586ee1049f287fdc2ccfd0a2a00", + "DANCE": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.95ae416c1f194c01b04f0a03f3449045", + "DRAMA": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.fdea8ee7a8da4282948b4242ed6a7841", + "MUSIC": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.d0938586ee1049f287fdc2ccfd0a2a00", "VISUAL_ART": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.9e562febd47942dab880e0f8037e5d94" } - ], + ], "COMPUTER_SCIENCE": [ - "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034", + "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034", { - "MECHANICAL_ENGINEERING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.28a888a257dc489393d7c4a6e4bde4fc", - "PROGRAMMING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.fd077423606b41cca5317e234b9bfbef", + "MECHANICAL_ENGINEERING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.28a888a257dc489393d7c4a6e4bde4fc", + "PROGRAMMING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.fd077423606b41cca5317e234b9bfbef", "WEB_DESIGN": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.ae9d6939851e438d8470f684854f00c1" } - ], + ], "HISTORY": [ - "3ced84a428ab4048958cc7713af5d3fa.e37f0959c6854be3a53f731eddc1e971", + "3ced84a428ab4048958cc7713af5d3fa.e37f0959c6854be3a53f731eddc1e971", {} - ], + ], "LANGUAGE_LEARNING": [ - "3ced84a428ab4048958cc7713af5d3fa.86a02dd1ca354db39e7c6c942f3eef22", + "3ced84a428ab4048958cc7713af5d3fa.86a02dd1ca354db39e7c6c942f3eef22", {} - ], + ], "LITERATURE": [ - "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f", + "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f", { - "LITERATURE": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.2e469d2681334b278828c1131e099a2c", - "LOGIC_AND_CRITICAL_THINKING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.494d4ed12afb4b79b3fefc952df98df7", - "READING_COMPREHENSION": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.373c0f9b3b12443f8a85507d57c4f21c", + "LITERATURE": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.2e469d2681334b278828c1131e099a2c", + "LOGIC_AND_CRITICAL_THINKING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.494d4ed12afb4b79b3fefc952df98df7", + "READING_COMPREHENSION": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.373c0f9b3b12443f8a85507d57c4f21c", "WRITING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.cbecb74e31f04ebd84c5a133cac1f18f" } - ], + ], "MATHEMATICS": [ - "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c", + "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c", { - "ALGEBRA": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.762323bbb9f64fb0b7da658d4fa8475c", - "ARITHMETIC": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.e0cb18f633764f96b65ffb779133bc50", - "CALCULUS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.23b6eb16013749a184083167dfadeb1f", - "GEOMETRY": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.898ba3a152b447a7ad31afad57868a30", + "ALGEBRA": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.762323bbb9f64fb0b7da658d4fa8475c", + "ARITHMETIC": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.e0cb18f633764f96b65ffb779133bc50", + "CALCULUS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.23b6eb16013749a184083167dfadeb1f", + "GEOMETRY": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.898ba3a152b447a7ad31afad57868a30", "STATISTICS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.a2a262da642e4782a501fb74b883f1fb" } - ], + ], "SCIENCES": [ - "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c", + "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c", { - "ASTRONOMY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.67ef21db1c7b487282847573b6d22374", - "BIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.99619e134bf543338b8deafa9e579f0f", - "CHEMISTRY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.950ebf20f59044c0bfcb3d4f73516554", - "EARTH_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.11d97cd7532b4890ad7706510bad0b79", + "ASTRONOMY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.67ef21db1c7b487282847573b6d22374", + "BIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.99619e134bf543338b8deafa9e579f0f", + "CHEMISTRY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.950ebf20f59044c0bfcb3d4f73516554", + "EARTH_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.11d97cd7532b4890ad7706510bad0b79", "PHYSICS": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.2533d6a3ae6448b7a0bc1579fd7e5a1d" } - ], + ], "SOCIAL_SCIENCES": [ - "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d", + "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d", { - "ANTHROPOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.7681e83023e34782ba84d480447d1326", - "CIVIC_EDUCATION": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.9978b69b668144759bc28e4f1acab17b", - "POLITICAL_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.24d8ff3e3c3a4068a3a33c8aded57350", + "ANTHROPOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.7681e83023e34782ba84d480447d1326", + "CIVIC_EDUCATION": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.9978b69b668144759bc28e4f1acab17b", + "POLITICAL_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.24d8ff3e3c3a4068a3a33c8aded57350", "SOCIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.82e0c3b935384e839f5a6571019dfd8a" } ] } - ], + ], "WORK": [ - "95fbee6f510f43fa9a433c7d3c1a8e82", + "95fbee6f510f43fa9a433c7d3c1a8e82", { "PROFESSIONAL_SKILLS": [ - "95fbee6f510f43fa9a433c7d3c1a8e82.b79c609ab411484a9e692609f2da31c0", + "95fbee6f510f43fa9a433c7d3c1a8e82.b79c609ab411484a9e692609f2da31c0", {} - ], + ], "TECHNICAL_AND_VOCATIONAL_TRAINING": [ - "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9", + "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9", { - "INDUSTRY_AND_SECTOR_SPECIFIC": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.f54a961eaaae474c977d01d483e5d469", - "SKILLS_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.64e0129f43fc4495bec2d4ab4f50ad6f", + "INDUSTRY_AND_SECTOR_SPECIFIC": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.f54a961eaaae474c977d01d483e5d469", + "SKILLS_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.64e0129f43fc4495bec2d4ab4f50ad6f", "TOOLS_AND_SOFTWARE_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.3b8e7a6ea7c746ee94307a2cff14aa0a" } ] From 1bd78eeab6b0e63b24d9770b19257218c39c1029 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Mon, 27 Sep 2021 19:09:19 -0700 Subject: [PATCH 4/8] Update to create flat JSON, and create short unique, predictable ids. --- Makefile | 2 +- idforlabels.py | 55 ---- le_utils/resources/labelslookup.json | 266 +++++++------------ le_utils/resources/labelstemplatelookup.json | 8 +- scripts/idforlabels.py | 96 +++++++ 5 files changed, 199 insertions(+), 228 deletions(-) delete mode 100644 idforlabels.py create mode 100644 scripts/idforlabels.py diff --git a/Makefile b/Makefile index b46d8c9..03a0c13 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ test: pytest -s build-labels: - python idforlabels.py + python scripts/idforlabels.py release: clean build-labels python setup.py sdist diff --git a/idforlabels.py b/idforlabels.py deleted file mode 100644 index 4346f4f..0000000 --- a/idforlabels.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -idforlabels -Builds or rebuilds the labelslooup.json assigning ids to the labels that do not have it -""" -import json -import os -from uuid import uuid4 - -try: - FileNotFoundError -except NameError: - FileNotFoundError = IOError - - -def handle_array(templates, labels, previous=None): - for template in templates: - if labels.get(template, None) is None: - if previous is not None: - labels[template] = "{}.{}".format(previous, uuid4().hex) - else: - labels[template] = uuid4().hex - return labels - - -def handle_object(element, label, previous=None): - for key in element.keys(): - to_handle = element[key] - handler = handle_object if isinstance(to_handle, dict) else handle_array - new_key = ( - uuid4().hex if previous is None else "{}.{}".format(previous, uuid4().hex) - ) - key_label = label.get(key, [new_key, dict()]) - label[key] = [key_label[0], handler(to_handle, key_label[1], key_label[0])] - return label - - -if __name__ == "__main__": - templates_file = os.path.join("le_utils", "resources", "labelstemplatelookup.json") - with open(templates_file) as json_templates_file: - templates = json.load(json_templates_file) - - labels_file = os.path.join("le_utils", "resources", "labelslookup.json") - try: - with open(labels_file) as json_labels_file: - labels = json.load(json_labels_file) - except FileNotFoundError: - labels = {} - - for label_type in templates.keys(): - to_handle = templates[label_type] - handler = handle_object if isinstance(to_handle, dict) else handle_array - labels[label_type] = handler(to_handle, labels.get(label_type, dict())) - - with open(labels_file, "w") as json_labels_file: - json.dump(labels, json_labels_file, sort_keys=True, indent=2) diff --git a/le_utils/resources/labelslookup.json b/le_utils/resources/labelslookup.json index ef79b79..4917481 100644 --- a/le_utils/resources/labelslookup.json +++ b/le_utils/resources/labelslookup.json @@ -1,179 +1,111 @@ { "AccessibilityCategories": { - "ALL": "0e205076533a485e98c8a0890447b696", - "ALT_TEXT": "6edfe5adebc94c43ae05a670622f6391", - "AUDIO_DESCRIPTION": "2ed6fc791b404950abb11a556ea2b7fc", - "CAPTIONS_SUBTITLES": "3145e0db927c4f2b91a4ed5fddb3fa3d", - "HIGH_CONTRAST": "f6f2d4f922094cad8ceaa55cf4975b3c", - "SIGN_LANGUAGE": "7c754e64ff9d4994bf4dbba6aa40af28", - "TAGGED_PDF": "9c1e5444318446a5b7596694200e8983" + "ALT_TEXT": "cuhrmh", + "AUDIO_DESCRIPTION": "cwDcsY", + "CAPTIONS_SUBTITLES": "da2iCe", + "HIGH_CONTRAST": "br&HYl", + "SIGN_LANGUAGE": "b1hGk&", + "TAGGED_PDF": "crDF4W" }, "ContentLevels": { - "BASIC_SKILLS": "03a8055f751a46239434f34e01a64203", - "LOWER_PRIMARY": "8cd5d69b5f2b411dae2f430c359b570b", - "LOWER_SECONDARY": "e635f0de294b408bafc42cfda3fafef5", - "PRESCHOOL": "319e5689f7f54c9eb6ec17941d3b3fa4", - "PROFESSIONAL": "b99ff4ead74f4469b8af02fb312b4cad", - "TERTIARY": "1264c0843fd44e8593f0b58f1aca902d", - "UPPER_PRIMARY": "54d7e726bf3448e1850a65357a076728", - "UPPER_SECONDARY": "45bc24f1ee474781a5d8415ca228da29", - "WORK_SKILLS": "da8b1c64676241609f76d2a5e6bd7c0e" - }, - "ContentNodeResourceType": { - "ACTIVITY": "63b7413f79ab45e0a48064804defb8c5", - "BOOK": "7522e4a7e7b74579ba86d85e71414d09", - "EXERCISE": "8614b3c4db2c46bfa32f6d057294fd71", - "GAME": "71fe15d91e0b4bf58d0a29e86ae891a5", - "GUIDE": "8422054f183a465797ad52bc8b8b053a", - "LESSON": "704bb2420a4a4860a96ef6fc4aea51f4", - "LESSON_PLAN": "4daad0fce2024f5f8f1a9b9879de32a5", - "MEDIA": "8cc1f54835194760ab622e58247f52c0", - "TEXTBOOK": "bdafc033e97a4f5784f4363f05971c8b", - "TUTORIAL": "46abe613a63143d48a1404827da56c64" + "BASIC_SKILLS": "tZV2y", + "LOWER_PRIMARY": "b9nfAn", + "LOWER_SECONDARY": "cTB&Zu", + "PRESCHOOL": "d53IF9", + "PROFESSIONAL": "4rj&2", + "TERTIARY": "bKBl54", + "UPPER_PRIMARY": "brWPPJ", + "UPPER_SECONDARY": "cxOxlD", + "WORK_SKILLS": "drnG58" }, "LearningActivities": { - "CREATE": "17d062f35c4348c987719a6524f89932", - "EXPLORE": "c9365aaac4474c8ca2a3da8a13752d4d", - "LISTEN": "20447e73ce6e4003af2e7fc22acf3288", - "PRACTICE": "66c03d5c3b0947c393c49b2e9496d6cf", - "READ": "4693173af6b24873add7fcb9804db217", - "REFLECT": "a5501d91983643eea017c7d678e9ba50", - "TOPIC": "465ab9f045ea4269a7e0963da80a7ff9", - "WATCH": "f8c842150dc8427489a65eb76c3f2031" + "CREATE": "c7fP3a", + "EXPLORE": "d4NYxq", + "LISTEN": "WPRwV", + "PRACTICE": "c9ATW4", + "READ": "bzRtvr", + "REFLECT": "dCoWsm", + "WATCH": "c53M6c" }, "Needs": { - "MATERIALS": [ - "c206162250de40e2b5702e3cc04ae53e", - { - "INTERNET": "c206162250de40e2b5702e3cc04ae53e.8d765fe61abe46b680aa4df1b2b5167f", - "OTHER_SUPPLIES": "c206162250de40e2b5702e3cc04ae53e.955c8a0962fb45b5899a6797f7acc926", - "PAPER_PENCIL": "c206162250de40e2b5702e3cc04ae53e.0da2a9c4214b4ee08382bfd553cf0900", - "SPECIAL_SOFTWARE": "c206162250de40e2b5702e3cc04ae53e.0f32c0054e51477da0c11805eb0e0764" - } - ], - "PEOPLE": [ - "66fa3d11a59f442d9a257bc1869b7da6", - { - "PEERS": "66fa3d11a59f442d9a257bc1869b7da6.232bd66f300f4eb0b21b3982de37180e", - "TEACHER": "66fa3d11a59f442d9a257bc1869b7da6.6791d250858c463088c14ab1ce99c23f" - } - ] + "INTERNET": "cfjB0R.cdGFA5", + "MATERIALS": "cfjB0R", + "OTHER_SUPPLIES": "cfjB0R.d4Uvx6", + "PAPER_PENCIL": "cfjB0R.cH#ig5", + "PEERS": "Ti5WR.cAsjNo", + "PEOPLE": "Ti5WR", + "SPECIAL_SOFTWARE": "cfjB0R.mhgPB", + "TEACHER": "Ti5WR.ch#A9l" + }, + "ResourceType": { + "ACTIVITY": "cpJLQx", + "BOOK": "dr5pZC", + "EXERCISE": "db5560", + "GAME": "d0o6Fw", + "GUIDE": "dBtI2b", + "LESSON": "bCz8L8", + "LESSON_PLAN": "cHbILa", + "MEDIA": "bgStlE", + "TEXTBOOK": "cwRiL", + "TUTORIAL": "dboes" }, "Subjects": { - "BASIC_SKILLS": [ - "6d3b7861e638487ba4303cd543dd0581", - { - "DIGITAL_LITERACY": "6d3b7861e638487ba4303cd543dd0581.43be17ba7e26432aa10a9b2e0cfc530b", - "LEARNING_SKILLS": "6d3b7861e638487ba4303cd543dd0581.24b06fe5e683459b88b030969cf51296", - "LITERACY": "6d3b7861e638487ba4303cd543dd0581.25e5b0689d0844f9ae801e9c80c283d6", - "LOGIC_AND_CRITICAL_THINKING": "6d3b7861e638487ba4303cd543dd0581.4063242f6f67422abc27b2597ae4c77f", - "NUMERACY": "6d3b7861e638487ba4303cd543dd0581.e1612982253a4e028a8d835ee9b64b1c" - } - ], - "DAILY_LIFE": [ - "f1e25b65c9d748c3b6fe2eecad85ab3e", - { - "CURRENT_EVENTS": "f1e25b65c9d748c3b6fe2eecad85ab3e.be655385ac4b4173be7758f093e1ff73", - "DIVERSITY": "f1e25b65c9d748c3b6fe2eecad85ab3e.3e72426fddb6491a81f3b2659a33af04", - "ENTREPRENEURSHIP": "f1e25b65c9d748c3b6fe2eecad85ab3e.c0f900b710f547fcb3c9714632ee386a", - "ENVIRONMENT": "f1e25b65c9d748c3b6fe2eecad85ab3e.97ef4763e3db4e21bcd762adb7724c2d", - "FINANCIAL_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.a523fd358b334adbb383c694c14ca8c3", - "MEDIA_LITERACY": "f1e25b65c9d748c3b6fe2eecad85ab3e.7036a283eb3649889f7ee5393720c69e", - "MENTAL_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.784ec282fd314590b12316d24fbce728", - "PUBLIC_HEALTH": "f1e25b65c9d748c3b6fe2eecad85ab3e.3dbcf19c7607498db7dd66713bee3af9" - } - ], - "FOR_TEACHERS": [ - "589f063c20d14faf8a928d82bfab3eed", - { - "GUIDES": "589f063c20d14faf8a928d82bfab3eed.e239a6fd85274530ae55b15b295e005c", - "LESSON_PLANS": "589f063c20d14faf8a928d82bfab3eed.bc7931965ea64643afd1d46c4c6da5c7" - } - ], - "SCHOOL": [ - "3ced84a428ab4048958cc7713af5d3fa", - { - "ARTS": [ - "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7", - { - "DANCE": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.95ae416c1f194c01b04f0a03f3449045", - "DRAMA": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.fdea8ee7a8da4282948b4242ed6a7841", - "MUSIC": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.d0938586ee1049f287fdc2ccfd0a2a00", - "VISUAL_ART": "3ced84a428ab4048958cc7713af5d3fa.72814a6bb2cd4a7da13c748390a637a7.9e562febd47942dab880e0f8037e5d94" - } - ], - "COMPUTER_SCIENCE": [ - "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034", - { - "MECHANICAL_ENGINEERING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.28a888a257dc489393d7c4a6e4bde4fc", - "PROGRAMMING": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.fd077423606b41cca5317e234b9bfbef", - "WEB_DESIGN": "3ced84a428ab4048958cc7713af5d3fa.8627bbcf6c9e440387acf662c5d73034.ae9d6939851e438d8470f684854f00c1" - } - ], - "HISTORY": [ - "3ced84a428ab4048958cc7713af5d3fa.e37f0959c6854be3a53f731eddc1e971", - {} - ], - "LANGUAGE_LEARNING": [ - "3ced84a428ab4048958cc7713af5d3fa.86a02dd1ca354db39e7c6c942f3eef22", - {} - ], - "LITERATURE": [ - "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f", - { - "LITERATURE": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.2e469d2681334b278828c1131e099a2c", - "LOGIC_AND_CRITICAL_THINKING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.494d4ed12afb4b79b3fefc952df98df7", - "READING_COMPREHENSION": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.373c0f9b3b12443f8a85507d57c4f21c", - "WRITING": "3ced84a428ab4048958cc7713af5d3fa.424e560f3b35495c9c0dabf41e267a8f.cbecb74e31f04ebd84c5a133cac1f18f" - } - ], - "MATHEMATICS": [ - "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c", - { - "ALGEBRA": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.762323bbb9f64fb0b7da658d4fa8475c", - "ARITHMETIC": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.e0cb18f633764f96b65ffb779133bc50", - "CALCULUS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.23b6eb16013749a184083167dfadeb1f", - "GEOMETRY": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.898ba3a152b447a7ad31afad57868a30", - "STATISTICS": "3ced84a428ab4048958cc7713af5d3fa.762c6236392f45bfbbfa0752e1f9ff6c.a2a262da642e4782a501fb74b883f1fb" - } - ], - "SCIENCES": [ - "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c", - { - "ASTRONOMY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.67ef21db1c7b487282847573b6d22374", - "BIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.99619e134bf543338b8deafa9e579f0f", - "CHEMISTRY": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.950ebf20f59044c0bfcb3d4f73516554", - "EARTH_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.11d97cd7532b4890ad7706510bad0b79", - "PHYSICS": "3ced84a428ab4048958cc7713af5d3fa.017a100b35324bb9a7d7212a8321331c.2533d6a3ae6448b7a0bc1579fd7e5a1d" - } - ], - "SOCIAL_SCIENCES": [ - "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d", - { - "ANTHROPOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.7681e83023e34782ba84d480447d1326", - "CIVIC_EDUCATION": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.9978b69b668144759bc28e4f1acab17b", - "POLITICAL_SCIENCE": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.24d8ff3e3c3a4068a3a33c8aded57350", - "SOCIOLOGY": "3ced84a428ab4048958cc7713af5d3fa.0551b4cc59414809b6df451d114aab8d.82e0c3b935384e839f5a6571019dfd8a" - } - ] - } - ], - "WORK": [ - "95fbee6f510f43fa9a433c7d3c1a8e82", - { - "PROFESSIONAL_SKILLS": [ - "95fbee6f510f43fa9a433c7d3c1a8e82.b79c609ab411484a9e692609f2da31c0", - {} - ], - "TECHNICAL_AND_VOCATIONAL_TRAINING": [ - "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9", - { - "INDUSTRY_AND_SECTOR_SPECIFIC": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.f54a961eaaae474c977d01d483e5d469", - "SKILLS_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.64e0129f43fc4495bec2d4ab4f50ad6f", - "TOOLS_AND_SOFTWARE_TRAINING": "95fbee6f510f43fa9a433c7d3c1a8e82.882cab866f49481a9888b54fdf9e92c9.3b8e7a6ea7c746ee94307a2cff14aa0a" - } - ] - } - ] + "ALGEBRA": "p&dep.bblteS.drpKXi", + "ANTHROPOLOGY": "p&dep.ctZs6B.c8HSSg", + "ARITHMETIC": "p&dep.bblteS.2d3O2", + "ARTS": "p&dep.dMPOKy", + "ASTRONOMY": "p&dep.Jwimc.WMX&I", + "BASIC_SKILLS": "3hB92", + "BIOLOGY": "p&dep.Jwimc.br5gFI", + "CALCULUS": "p&dep.bblteS.dXgpNS", + "CHEMISTRY": "p&dep.Jwimc.d5hK4i", + "CIVIC_EDUCATION": "p&dep.ctZs6B.b&ZRDw", + "COMPUTER_SCIENCE": "p&dep.t6U3d", + "CURRENT_EVENTS": "cKga4t.cpTY7w", + "DAILY_LIFE": "cKga4t", + "DANCE": "p&dep.dMPOKy.bU6Aon", + "DIGITAL_LITERACY": "3hB92.bBpD5O", + "DIVERSITY": "cKga4t.b6eieL", + "DRAMA": "p&dep.dMPOKy.dflbK2", + "EARTH_SCIENCE": "p&dep.Jwimc.bKf1LD", + "ENTREPRENEURSHIP": "cKga4t.PHE2D", + "ENVIRONMENT": "cKga4t.boZVcq", + "FINANCIAL_LITERACY": "cKga4t.cgcil1", + "FOR_TEACHERS": "bKIpQL", + "GEOMETRY": "p&dep.bblteS.ShT6u", + "GUIDES": "bKIpQL.cUuuC&", + "HISTORY": "p&dep.bNbmkp", + "INDUSTRY_AND_SECTOR_SPECIFIC": "VT1kL.ckX7et.#TwHM", + "LANGUAGE_LEARNING": "p&dep.cn24wo", + "LEARNING_SKILLS": "3hB92.wNyNV", + "LESSON_PLANS": "bKIpQL.UHULh", + "LITERACY": "3hB92.cgu720", + "LITERATURE": "p&dep.Qgsp#.b2ovSe", + "LOGIC_AND_CRITICAL_THINKING": "3hB92.dkzVgX", + "MATHEMATICS": "p&dep.bblteS", + "MECHANICAL_ENGINEERING": "p&dep.t6U3d.dZm4cL", + "MEDIA_LITERACY": "cKga4t.c6I2x6", + "MENTAL_HEALTH": "cKga4t.pZ8zW", + "MUSIC": "p&dep.dMPOKy.btqcqM", + "NUMERACY": "3hB92.c1jGqN", + "PHYSICS": "p&dep.Jwimc.bh5yfp", + "POLITICAL_SCIENCE": "p&dep.ctZs6B.ctVB8#", + "PROFESSIONAL_SKILLS": "VT1kL.d6FA9G", + "PROGRAMMING": "p&dep.t6U3d.bWu0U1", + "PUBLIC_HEALTH": "cKga4t.OHvRm", + "READING_AND_WRITING": "p&dep.Qgsp#", + "READING_COMPREHENSION": "p&dep.Qgsp#.bhUTDV", + "SCHOOL": "p&dep", + "SCIENCES": "p&dep.Jwimc", + "SKILLS_TRAINING": "VT1kL.ckX7et.d&xa&j", + "SOCIAL_SCIENCES": "p&dep.ctZs6B", + "SOCIOLOGY": "p&dep.ctZs6B.dVNbTt", + "STATISTICS": "p&dep.bblteS.MCZxM", + "TECHNICAL_AND_VOCATIONAL_TRAINING": "VT1kL.ckX7et", + "TOOLS_AND_SOFTWARE_TRAINING": "VT1kL.ckX7et.dwmwig", + "VISUAL_ART": "p&dep.dMPOKy.dIviQH", + "WEB_DESIGN": "p&dep.t6U3d.cNTlX9", + "WORK": "VT1kL", + "WRITING": "p&dep.Qgsp#.cr#oHX" } } \ No newline at end of file diff --git a/le_utils/resources/labelstemplatelookup.json b/le_utils/resources/labelstemplatelookup.json index 9a795d0..b8f3b4a 100644 --- a/le_utils/resources/labelstemplatelookup.json +++ b/le_utils/resources/labelstemplatelookup.json @@ -10,7 +10,7 @@ "BASIC_SKILLS", "WORK_SKILLS" ], - "ContentNodeResourceType": [ + "ResourceType": [ "LESSON", "TUTORIAL", "ACTIVITY", @@ -29,11 +29,9 @@ "PRACTICE", "READ", "WATCH", - "EXPLORE", - "TOPIC" + "EXPLORE" ], "AccessibilityCategories": [ - "ALL", "SIGN_LANGUAGE", "AUDIO_DESCRIPTION", "TAGGED_PDF", @@ -57,7 +55,7 @@ "EARTH_SCIENCE", "ASTRONOMY" ], - "LITERATURE": [ + "READING_AND_WRITING": [ "LITERATURE", "READING_COMPREHENSION", "WRITING", diff --git a/scripts/idforlabels.py b/scripts/idforlabels.py new file mode 100644 index 0000000..1eac930 --- /dev/null +++ b/scripts/idforlabels.py @@ -0,0 +1,96 @@ +""" +idforlabels +Builds or rebuilds the labelslooup.json assigning ids to the labels that do not have it +""" +from __future__ import unicode_literals + +import json +import os +import string +from hashlib import md5 +from uuid import UUID +from uuid import uuid3 + +try: + FileNotFoundError +except NameError: + FileNotFoundError = IOError + + +root_label = md5() +root_label.update("Kolibri labels") + +root_namespace = UUID(hex=root_label.hexdigest()) + + +CHARACTERS = string.letters + string.digits + "#" + "&" + + +def _from_uuid(uuid): + """ + :params uuid: UUID + :returns: character string that represents the UUID + """ + data = int(uuid.hex[:8], 16) + res = [] + while data > 0 or not res: + res += CHARACTERS[(data & 0x3F)] + data >>= 6 + res.reverse() + return "".join(res) + + +def generate_identifier(namespace, label): + return uuid3(namespace, label.encode("utf-8")) + + +def generate_key(identifier, previous=None): + key = _from_uuid(identifier) + if previous is None: + return key + return "{}.{}".format(previous, key) + + +def handle_array(labels, namespace, previous=None): + output = {} + for label in labels: + identifier = generate_identifier(namespace, label) + output[label] = generate_key(identifier, previous) + return output + + +def handle_object(element, namespace, previous=None): + output = {} + for key, value in element.items(): + handler = handle_object if isinstance(value, dict) else handle_array + identifier = generate_identifier(namespace, key) + new_key = generate_key(identifier, previous) + output[key] = new_key + output.update(handler(value, namespace, new_key)) + return output + + +if __name__ == "__main__": + templates_file = os.path.join( + os.path.dirname(__file__), + "..", + "le_utils", + "resources", + "labelstemplatelookup.json", + ) + with open(templates_file) as json_templates_file: + templates = json.load(json_templates_file) + + output_file = os.path.join( + os.path.dirname(__file__), "..", "le_utils", "resources", "labelslookup.json" + ) + + output = {} + + for label_type, labels in templates.items(): + handler = handle_object if isinstance(labels, dict) else handle_array + namespace = generate_identifier(root_namespace, label_type) + output[label_type] = handler(labels, namespace) + + with open(output_file, "w") as json_labels_file: + json.dump(output, json_labels_file, sort_keys=True, indent=2) From 18cad05f0196c0315b2c946fb36be4b59ea3766b Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 30 Sep 2021 13:17:28 -0700 Subject: [PATCH 5/8] Generate Python and JS code from JSON spec. --- Makefile | 2 +- js/index.js | 18 ++ js/labels/AccessibilityCategories.js | 11 + js/labels/LearningActivities.js | 12 ++ js/labels/Levels.js | 14 ++ js/labels/Needs.js | 13 ++ js/labels/ResourceType.js | 15 ++ js/labels/Subjects.js | 62 ++++++ js/labels/index.js | 18 ++ le_utils/constants/labels/__init__.py | 5 + .../labels/accessibility_categories.py | 30 +++ .../constants/labels/learning_activities.py | 33 +++ le_utils/constants/labels/levels.py | 39 ++++ le_utils/constants/labels/needs.py | 36 ++++ le_utils/constants/labels/resource_type.py | 42 ++++ le_utils/constants/labels/subjects.py | 183 +++++++++++++++++ le_utils/resources/labelslookup.json | 111 ---------- package.json | 31 +++ scripts/generate_labels.py | 189 ++++++++++++++++++ scripts/idforlabels.py | 96 --------- .../labels.json | 2 +- 21 files changed, 753 insertions(+), 209 deletions(-) create mode 100644 js/index.js create mode 100644 js/labels/AccessibilityCategories.js create mode 100644 js/labels/LearningActivities.js create mode 100644 js/labels/Levels.js create mode 100644 js/labels/Needs.js create mode 100644 js/labels/ResourceType.js create mode 100644 js/labels/Subjects.js create mode 100644 js/labels/index.js create mode 100644 le_utils/constants/labels/__init__.py create mode 100644 le_utils/constants/labels/accessibility_categories.py create mode 100644 le_utils/constants/labels/learning_activities.py create mode 100644 le_utils/constants/labels/levels.py create mode 100644 le_utils/constants/labels/needs.py create mode 100644 le_utils/constants/labels/resource_type.py create mode 100644 le_utils/constants/labels/subjects.py delete mode 100644 le_utils/resources/labelslookup.json create mode 100644 package.json create mode 100644 scripts/generate_labels.py delete mode 100644 scripts/idforlabels.py rename le_utils/resources/labelstemplatelookup.json => spec/labels.json (99%) diff --git a/Makefile b/Makefile index 03a0c13..cbb9066 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ test: pytest -s build-labels: - python scripts/idforlabels.py + python scripts/generate_labels.py release: clean build-labels python setup.py sdist diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..fa7fc89 --- /dev/null +++ b/js/index.js @@ -0,0 +1,18 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +import Needs from "./labels/Needs"; +import AccessibilityCategories from "./labels/AccessibilityCategories"; +import ResourceType from "./labels/ResourceType"; +import Levels from "./labels/Levels"; +import Subjects from "./labels/Subjects"; +import LearningActivities from "./labels/LearningActivities"; + +export default { + Needs: Needs, + AccessibilityCategories: AccessibilityCategories, + ResourceType: ResourceType, + Levels: Levels, + Subjects: Subjects, + LearningActivities: LearningActivities, +}; diff --git a/js/labels/AccessibilityCategories.js b/js/labels/AccessibilityCategories.js new file mode 100644 index 0000000..3cdea92 --- /dev/null +++ b/js/labels/AccessibilityCategories.js @@ -0,0 +1,11 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + AUDIO_DESCRIPTION: "cwDcsY", + ALT_TEXT: "cuhrmh", + CAPTIONS_SUBTITLES: "da2iCe", + HIGH_CONTRAST: "br&HYl", + TAGGED_PDF: "crDF4W", + SIGN_LANGUAGE: "b1hGk&", +}; diff --git a/js/labels/LearningActivities.js b/js/labels/LearningActivities.js new file mode 100644 index 0000000..54c0041 --- /dev/null +++ b/js/labels/LearningActivities.js @@ -0,0 +1,12 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + READ: "bzRtvr", + CREATE: "c7fP3a", + PRACTICE: "c9ATW4", + WATCH: "c53M6c", + REFLECT: "dCoWsm", + EXPLORE: "d4NYxq", + LISTEN: "WPRwV", +}; diff --git a/js/labels/Levels.js b/js/labels/Levels.js new file mode 100644 index 0000000..571c341 --- /dev/null +++ b/js/labels/Levels.js @@ -0,0 +1,14 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + UPPER_SECONDARY: "dn4KHz", + WORK_SKILLS: "dp73Sn", + LOWER_PRIMARY: "by0beT", + LOWER_SECONDARY: "svpsy", + UPPER_PRIMARY: "bSQdiJ", + PRESCHOOL: "b#GEd", + BASIC_SKILLS: "chRJoI", + PROFESSIONAL: "dnezU7", + TERTIARY: "b&jDyf", +}; diff --git a/js/labels/Needs.js b/js/labels/Needs.js new file mode 100644 index 0000000..3299e4d --- /dev/null +++ b/js/labels/Needs.js @@ -0,0 +1,13 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + PEERS: "Ti5WR.cAsjNo", + SPECIAL_SOFTWARE: "cfjB0R.mhgPB", + OTHER_SUPPLIES: "cfjB0R.d4Uvx6", + PAPER_PENCIL: "cfjB0R.cH#ig5", + PEOPLE: "Ti5WR", + MATERIALS: "cfjB0R", + INTERNET: "cfjB0R.cdGFA5", + TEACHER: "Ti5WR.ch#A9l", +}; diff --git a/js/labels/ResourceType.js b/js/labels/ResourceType.js new file mode 100644 index 0000000..889a277 --- /dev/null +++ b/js/labels/ResourceType.js @@ -0,0 +1,15 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + MEDIA: "bgStlE", + TEXTBOOK: "cwRiL", + LESSON_PLAN: "cHbILa", + GAME: "d0o6Fw", + BOOK: "dr5pZC", + TUTORIAL: "dboes", + ACTIVITY: "cpJLQx", + LESSON: "bCz8L8", + GUIDE: "dBtI2b", + EXERCISE: "db5560", +}; diff --git a/js/labels/Subjects.js b/js/labels/Subjects.js new file mode 100644 index 0000000..7b572be --- /dev/null +++ b/js/labels/Subjects.js @@ -0,0 +1,62 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +export default { + LOGIC_AND_CRITICAL_THINKING: "3hB92.dkzVgX", + CALCULUS: "p&dep.bblteS.dXgpNS", + NUMERACY: "3hB92.c1jGqN", + READING_COMPREHENSION: "p&dep.Qgsp#.bhUTDV", + TECHNICAL_AND_VOCATIONAL_TRAINING: "VT1kL.ckX7et", + LEARNING_SKILLS: "3hB92.wNyNV", + PROGRAMMING: "p&dep.t6U3d.bWu0U1", + WRITING: "p&dep.Qgsp#.cr#oHX", + ANTHROPOLOGY: "p&dep.ctZs6B.c8HSSg", + LESSON_PLANS: "bKIpQL.UHULh", + SOCIAL_SCIENCES: "p&dep.ctZs6B", + LITERATURE: "p&dep.Qgsp#.b2ovSe", + MATHEMATICS: "p&dep.bblteS", + DAILY_LIFE: "cKga4t", + CHEMISTRY: "p&dep.Jwimc.d5hK4i", + PHYSICS: "p&dep.Jwimc.bh5yfp", + FOR_TEACHERS: "bKIpQL", + ARTS: "p&dep.dMPOKy", + MENTAL_HEALTH: "cKga4t.pZ8zW", + DANCE: "p&dep.dMPOKy.bU6Aon", + WORK: "VT1kL", + SCIENCES: "p&dep.Jwimc", + CIVIC_EDUCATION: "p&dep.ctZs6B.b&ZRDw", + TOOLS_AND_SOFTWARE_TRAINING: "VT1kL.ckX7et.dwmwig", + ASTRONOMY: "p&dep.Jwimc.WMX&I", + EARTH_SCIENCE: "p&dep.Jwimc.bKf1LD", + COMPUTER_SCIENCE: "p&dep.t6U3d", + SOCIOLOGY: "p&dep.ctZs6B.dVNbTt", + CURRENT_EVENTS: "cKga4t.cpTY7w", + BIOLOGY: "p&dep.Jwimc.br5gFI", + POLITICAL_SCIENCE: "p&dep.ctZs6B.ctVB8#", + DRAMA: "p&dep.dMPOKy.dflbK2", + MUSIC: "p&dep.dMPOKy.btqcqM", + MECHANICAL_ENGINEERING: "p&dep.t6U3d.dZm4cL", + DIGITAL_LITERACY: "3hB92.bBpD5O", + WEB_DESIGN: "p&dep.t6U3d.cNTlX9", + LITERACY: "3hB92.cgu720", + ENTREPRENEURSHIP: "cKga4t.PHE2D", + GUIDES: "bKIpQL.cUuuC&", + HISTORY: "p&dep.bNbmkp", + VISUAL_ART: "p&dep.dMPOKy.dIviQH", + ENVIRONMENT: "cKga4t.boZVcq", + SCHOOL: "p&dep", + STATISTICS: "p&dep.bblteS.MCZxM", + SKILLS_TRAINING: "VT1kL.ckX7et.d&xa&j", + ALGEBRA: "p&dep.bblteS.drpKXi", + GEOMETRY: "p&dep.bblteS.ShT6u", + DIVERSITY: "cKga4t.b6eieL", + FINANCIAL_LITERACY: "cKga4t.cgcil1", + PUBLIC_HEALTH: "cKga4t.OHvRm", + INDUSTRY_AND_SECTOR_SPECIFIC: "VT1kL.ckX7et.#TwHM", + MEDIA_LITERACY: "cKga4t.c6I2x6", + READING_AND_WRITING: "p&dep.Qgsp#", + LANGUAGE_LEARNING: "p&dep.cn24wo", + BASIC_SKILLS: "3hB92", + PROFESSIONAL_SKILLS: "VT1kL.d6FA9G", + ARITHMETIC: "p&dep.bblteS.2d3O2", +}; diff --git a/js/labels/index.js b/js/labels/index.js new file mode 100644 index 0000000..b47f36e --- /dev/null +++ b/js/labels/index.js @@ -0,0 +1,18 @@ +// -*- coding: utf-8 -*- +// Generated by scripts/generate_labels.py + +import Needs from "./Needs"; +import AccessibilityCategories from "./AccessibilityCategories"; +import ResourceType from "./ResourceType"; +import Levels from "./Levels"; +import Subjects from "./Subjects"; +import LearningActivities from "./LearningActivities"; + +export default { + Needs: Needs, + AccessibilityCategories: AccessibilityCategories, + ResourceType: ResourceType, + Levels: Levels, + Subjects: Subjects, + LearningActivities: LearningActivities, +}; diff --git a/le_utils/constants/labels/__init__.py b/le_utils/constants/labels/__init__.py new file mode 100644 index 0000000..f2fad37 --- /dev/null +++ b/le_utils/constants/labels/__init__.py @@ -0,0 +1,5 @@ +""" +The constants defined in the submodules of this module are intended +only to provide additional user metadata about content, and have no impact +on their functional roles in any Kolibri tools or platforms. +""" diff --git a/le_utils/constants/labels/accessibility_categories.py b/le_utils/constants/labels/accessibility_categories.py new file mode 100644 index 0000000..7fb4986 --- /dev/null +++ b/le_utils/constants/labels/accessibility_categories.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# AccessibilityCategories + +AUDIO_DESCRIPTION = "cwDcsY" +ALT_TEXT = "cuhrmh" +CAPTIONS_SUBTITLES = "da2iCe" +HIGH_CONTRAST = "br&HYl" +TAGGED_PDF = "crDF4W" +SIGN_LANGUAGE = "b1hGk&" + +choices = ( + (AUDIO_DESCRIPTION, "Audio Description"), + (ALT_TEXT, "Alt Text"), + (CAPTIONS_SUBTITLES, "Captions Subtitles"), + (HIGH_CONTRAST, "High Contrast"), + (TAGGED_PDF, "Tagged Pdf"), + (SIGN_LANGUAGE, "Sign Language"), +) + +ACCESSIBILITYCATEGORIESLIST = [ + AUDIO_DESCRIPTION, + ALT_TEXT, + CAPTIONS_SUBTITLES, + HIGH_CONTRAST, + TAGGED_PDF, + SIGN_LANGUAGE, +] diff --git a/le_utils/constants/labels/learning_activities.py b/le_utils/constants/labels/learning_activities.py new file mode 100644 index 0000000..61aafb7 --- /dev/null +++ b/le_utils/constants/labels/learning_activities.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# LearningActivities + +READ = "bzRtvr" +CREATE = "c7fP3a" +PRACTICE = "c9ATW4" +WATCH = "c53M6c" +REFLECT = "dCoWsm" +EXPLORE = "d4NYxq" +LISTEN = "WPRwV" + +choices = ( + (READ, "Read"), + (CREATE, "Create"), + (PRACTICE, "Practice"), + (WATCH, "Watch"), + (REFLECT, "Reflect"), + (EXPLORE, "Explore"), + (LISTEN, "Listen"), +) + +LEARNINGACTIVITIESLIST = [ + READ, + CREATE, + PRACTICE, + WATCH, + REFLECT, + EXPLORE, + LISTEN, +] diff --git a/le_utils/constants/labels/levels.py b/le_utils/constants/labels/levels.py new file mode 100644 index 0000000..fda2314 --- /dev/null +++ b/le_utils/constants/labels/levels.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# Levels + +UPPER_SECONDARY = "dn4KHz" +WORK_SKILLS = "dp73Sn" +LOWER_PRIMARY = "by0beT" +LOWER_SECONDARY = "svpsy" +UPPER_PRIMARY = "bSQdiJ" +PRESCHOOL = "b#GEd" +BASIC_SKILLS = "chRJoI" +PROFESSIONAL = "dnezU7" +TERTIARY = "b&jDyf" + +choices = ( + (UPPER_SECONDARY, "Upper Secondary"), + (WORK_SKILLS, "Work Skills"), + (LOWER_PRIMARY, "Lower Primary"), + (LOWER_SECONDARY, "Lower Secondary"), + (UPPER_PRIMARY, "Upper Primary"), + (PRESCHOOL, "Preschool"), + (BASIC_SKILLS, "Basic Skills"), + (PROFESSIONAL, "Professional"), + (TERTIARY, "Tertiary"), +) + +LEVELSLIST = [ + UPPER_SECONDARY, + WORK_SKILLS, + LOWER_PRIMARY, + LOWER_SECONDARY, + UPPER_PRIMARY, + PRESCHOOL, + BASIC_SKILLS, + PROFESSIONAL, + TERTIARY, +] diff --git a/le_utils/constants/labels/needs.py b/le_utils/constants/labels/needs.py new file mode 100644 index 0000000..7087b9c --- /dev/null +++ b/le_utils/constants/labels/needs.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# Needs + +PEERS = "Ti5WR.cAsjNo" +SPECIAL_SOFTWARE = "cfjB0R.mhgPB" +OTHER_SUPPLIES = "cfjB0R.d4Uvx6" +PAPER_PENCIL = "cfjB0R.cH#ig5" +PEOPLE = "Ti5WR" +MATERIALS = "cfjB0R" +INTERNET = "cfjB0R.cdGFA5" +TEACHER = "Ti5WR.ch#A9l" + +choices = ( + (PEERS, "Peers"), + (SPECIAL_SOFTWARE, "Special Software"), + (OTHER_SUPPLIES, "Other Supplies"), + (PAPER_PENCIL, "Paper Pencil"), + (PEOPLE, "People"), + (MATERIALS, "Materials"), + (INTERNET, "Internet"), + (TEACHER, "Teacher"), +) + +NEEDSLIST = [ + PEERS, + SPECIAL_SOFTWARE, + OTHER_SUPPLIES, + PAPER_PENCIL, + PEOPLE, + MATERIALS, + INTERNET, + TEACHER, +] diff --git a/le_utils/constants/labels/resource_type.py b/le_utils/constants/labels/resource_type.py new file mode 100644 index 0000000..7f4a817 --- /dev/null +++ b/le_utils/constants/labels/resource_type.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# ResourceType + +MEDIA = "bgStlE" +TEXTBOOK = "cwRiL" +LESSON_PLAN = "cHbILa" +GAME = "d0o6Fw" +BOOK = "dr5pZC" +TUTORIAL = "dboes" +ACTIVITY = "cpJLQx" +LESSON = "bCz8L8" +GUIDE = "dBtI2b" +EXERCISE = "db5560" + +choices = ( + (MEDIA, "Media"), + (TEXTBOOK, "Textbook"), + (LESSON_PLAN, "Lesson Plan"), + (GAME, "Game"), + (BOOK, "Book"), + (TUTORIAL, "Tutorial"), + (ACTIVITY, "Activity"), + (LESSON, "Lesson"), + (GUIDE, "Guide"), + (EXERCISE, "Exercise"), +) + +RESOURCETYPELIST = [ + MEDIA, + TEXTBOOK, + LESSON_PLAN, + GAME, + BOOK, + TUTORIAL, + ACTIVITY, + LESSON, + GUIDE, + EXERCISE, +] diff --git a/le_utils/constants/labels/subjects.py b/le_utils/constants/labels/subjects.py new file mode 100644 index 0000000..5a37704 --- /dev/null +++ b/le_utils/constants/labels/subjects.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# Generated by scripts/generate_labels.py +from __future__ import unicode_literals + +# Subjects + +LOGIC_AND_CRITICAL_THINKING = "3hB92.dkzVgX" +CALCULUS = "p&dep.bblteS.dXgpNS" +NUMERACY = "3hB92.c1jGqN" +READING_COMPREHENSION = "p&dep.Qgsp#.bhUTDV" +TECHNICAL_AND_VOCATIONAL_TRAINING = "VT1kL.ckX7et" +LEARNING_SKILLS = "3hB92.wNyNV" +PROGRAMMING = "p&dep.t6U3d.bWu0U1" +WRITING = "p&dep.Qgsp#.cr#oHX" +ANTHROPOLOGY = "p&dep.ctZs6B.c8HSSg" +LESSON_PLANS = "bKIpQL.UHULh" +SOCIAL_SCIENCES = "p&dep.ctZs6B" +LITERATURE = "p&dep.Qgsp#.b2ovSe" +MATHEMATICS = "p&dep.bblteS" +DAILY_LIFE = "cKga4t" +CHEMISTRY = "p&dep.Jwimc.d5hK4i" +PHYSICS = "p&dep.Jwimc.bh5yfp" +FOR_TEACHERS = "bKIpQL" +ARTS = "p&dep.dMPOKy" +MENTAL_HEALTH = "cKga4t.pZ8zW" +DANCE = "p&dep.dMPOKy.bU6Aon" +WORK = "VT1kL" +SCIENCES = "p&dep.Jwimc" +CIVIC_EDUCATION = "p&dep.ctZs6B.b&ZRDw" +TOOLS_AND_SOFTWARE_TRAINING = "VT1kL.ckX7et.dwmwig" +ASTRONOMY = "p&dep.Jwimc.WMX&I" +EARTH_SCIENCE = "p&dep.Jwimc.bKf1LD" +COMPUTER_SCIENCE = "p&dep.t6U3d" +SOCIOLOGY = "p&dep.ctZs6B.dVNbTt" +CURRENT_EVENTS = "cKga4t.cpTY7w" +BIOLOGY = "p&dep.Jwimc.br5gFI" +POLITICAL_SCIENCE = "p&dep.ctZs6B.ctVB8#" +DRAMA = "p&dep.dMPOKy.dflbK2" +MUSIC = "p&dep.dMPOKy.btqcqM" +MECHANICAL_ENGINEERING = "p&dep.t6U3d.dZm4cL" +DIGITAL_LITERACY = "3hB92.bBpD5O" +WEB_DESIGN = "p&dep.t6U3d.cNTlX9" +LITERACY = "3hB92.cgu720" +ENTREPRENEURSHIP = "cKga4t.PHE2D" +GUIDES = "bKIpQL.cUuuC&" +HISTORY = "p&dep.bNbmkp" +VISUAL_ART = "p&dep.dMPOKy.dIviQH" +ENVIRONMENT = "cKga4t.boZVcq" +SCHOOL = "p&dep" +STATISTICS = "p&dep.bblteS.MCZxM" +SKILLS_TRAINING = "VT1kL.ckX7et.d&xa&j" +ALGEBRA = "p&dep.bblteS.drpKXi" +GEOMETRY = "p&dep.bblteS.ShT6u" +DIVERSITY = "cKga4t.b6eieL" +FINANCIAL_LITERACY = "cKga4t.cgcil1" +PUBLIC_HEALTH = "cKga4t.OHvRm" +INDUSTRY_AND_SECTOR_SPECIFIC = "VT1kL.ckX7et.#TwHM" +MEDIA_LITERACY = "cKga4t.c6I2x6" +READING_AND_WRITING = "p&dep.Qgsp#" +LANGUAGE_LEARNING = "p&dep.cn24wo" +BASIC_SKILLS = "3hB92" +PROFESSIONAL_SKILLS = "VT1kL.d6FA9G" +ARITHMETIC = "p&dep.bblteS.2d3O2" + +choices = ( + (LOGIC_AND_CRITICAL_THINKING, "Logic And Critical Thinking"), + (CALCULUS, "Calculus"), + (NUMERACY, "Numeracy"), + (READING_COMPREHENSION, "Reading Comprehension"), + (TECHNICAL_AND_VOCATIONAL_TRAINING, "Technical And Vocational Training"), + (LEARNING_SKILLS, "Learning Skills"), + (PROGRAMMING, "Programming"), + (WRITING, "Writing"), + (ANTHROPOLOGY, "Anthropology"), + (LESSON_PLANS, "Lesson Plans"), + (SOCIAL_SCIENCES, "Social Sciences"), + (LITERATURE, "Literature"), + (MATHEMATICS, "Mathematics"), + (DAILY_LIFE, "Daily Life"), + (CHEMISTRY, "Chemistry"), + (PHYSICS, "Physics"), + (FOR_TEACHERS, "For Teachers"), + (ARTS, "Arts"), + (MENTAL_HEALTH, "Mental Health"), + (DANCE, "Dance"), + (WORK, "Work"), + (SCIENCES, "Sciences"), + (CIVIC_EDUCATION, "Civic Education"), + (TOOLS_AND_SOFTWARE_TRAINING, "Tools And Software Training"), + (ASTRONOMY, "Astronomy"), + (EARTH_SCIENCE, "Earth Science"), + (COMPUTER_SCIENCE, "Computer Science"), + (SOCIOLOGY, "Sociology"), + (CURRENT_EVENTS, "Current Events"), + (BIOLOGY, "Biology"), + (POLITICAL_SCIENCE, "Political Science"), + (DRAMA, "Drama"), + (MUSIC, "Music"), + (MECHANICAL_ENGINEERING, "Mechanical Engineering"), + (DIGITAL_LITERACY, "Digital Literacy"), + (WEB_DESIGN, "Web Design"), + (LITERACY, "Literacy"), + (ENTREPRENEURSHIP, "Entrepreneurship"), + (GUIDES, "Guides"), + (HISTORY, "History"), + (VISUAL_ART, "Visual Art"), + (ENVIRONMENT, "Environment"), + (SCHOOL, "School"), + (STATISTICS, "Statistics"), + (SKILLS_TRAINING, "Skills Training"), + (ALGEBRA, "Algebra"), + (GEOMETRY, "Geometry"), + (DIVERSITY, "Diversity"), + (FINANCIAL_LITERACY, "Financial Literacy"), + (PUBLIC_HEALTH, "Public Health"), + (INDUSTRY_AND_SECTOR_SPECIFIC, "Industry And Sector Specific"), + (MEDIA_LITERACY, "Media Literacy"), + (READING_AND_WRITING, "Reading And Writing"), + (LANGUAGE_LEARNING, "Language Learning"), + (BASIC_SKILLS, "Basic Skills"), + (PROFESSIONAL_SKILLS, "Professional Skills"), + (ARITHMETIC, "Arithmetic"), +) + +SUBJECTSLIST = [ + LOGIC_AND_CRITICAL_THINKING, + CALCULUS, + NUMERACY, + READING_COMPREHENSION, + TECHNICAL_AND_VOCATIONAL_TRAINING, + LEARNING_SKILLS, + PROGRAMMING, + WRITING, + ANTHROPOLOGY, + LESSON_PLANS, + SOCIAL_SCIENCES, + LITERATURE, + MATHEMATICS, + DAILY_LIFE, + CHEMISTRY, + PHYSICS, + FOR_TEACHERS, + ARTS, + MENTAL_HEALTH, + DANCE, + WORK, + SCIENCES, + CIVIC_EDUCATION, + TOOLS_AND_SOFTWARE_TRAINING, + ASTRONOMY, + EARTH_SCIENCE, + COMPUTER_SCIENCE, + SOCIOLOGY, + CURRENT_EVENTS, + BIOLOGY, + POLITICAL_SCIENCE, + DRAMA, + MUSIC, + MECHANICAL_ENGINEERING, + DIGITAL_LITERACY, + WEB_DESIGN, + LITERACY, + ENTREPRENEURSHIP, + GUIDES, + HISTORY, + VISUAL_ART, + ENVIRONMENT, + SCHOOL, + STATISTICS, + SKILLS_TRAINING, + ALGEBRA, + GEOMETRY, + DIVERSITY, + FINANCIAL_LITERACY, + PUBLIC_HEALTH, + INDUSTRY_AND_SECTOR_SPECIFIC, + MEDIA_LITERACY, + READING_AND_WRITING, + LANGUAGE_LEARNING, + BASIC_SKILLS, + PROFESSIONAL_SKILLS, + ARITHMETIC, +] diff --git a/le_utils/resources/labelslookup.json b/le_utils/resources/labelslookup.json deleted file mode 100644 index 4917481..0000000 --- a/le_utils/resources/labelslookup.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "AccessibilityCategories": { - "ALT_TEXT": "cuhrmh", - "AUDIO_DESCRIPTION": "cwDcsY", - "CAPTIONS_SUBTITLES": "da2iCe", - "HIGH_CONTRAST": "br&HYl", - "SIGN_LANGUAGE": "b1hGk&", - "TAGGED_PDF": "crDF4W" - }, - "ContentLevels": { - "BASIC_SKILLS": "tZV2y", - "LOWER_PRIMARY": "b9nfAn", - "LOWER_SECONDARY": "cTB&Zu", - "PRESCHOOL": "d53IF9", - "PROFESSIONAL": "4rj&2", - "TERTIARY": "bKBl54", - "UPPER_PRIMARY": "brWPPJ", - "UPPER_SECONDARY": "cxOxlD", - "WORK_SKILLS": "drnG58" - }, - "LearningActivities": { - "CREATE": "c7fP3a", - "EXPLORE": "d4NYxq", - "LISTEN": "WPRwV", - "PRACTICE": "c9ATW4", - "READ": "bzRtvr", - "REFLECT": "dCoWsm", - "WATCH": "c53M6c" - }, - "Needs": { - "INTERNET": "cfjB0R.cdGFA5", - "MATERIALS": "cfjB0R", - "OTHER_SUPPLIES": "cfjB0R.d4Uvx6", - "PAPER_PENCIL": "cfjB0R.cH#ig5", - "PEERS": "Ti5WR.cAsjNo", - "PEOPLE": "Ti5WR", - "SPECIAL_SOFTWARE": "cfjB0R.mhgPB", - "TEACHER": "Ti5WR.ch#A9l" - }, - "ResourceType": { - "ACTIVITY": "cpJLQx", - "BOOK": "dr5pZC", - "EXERCISE": "db5560", - "GAME": "d0o6Fw", - "GUIDE": "dBtI2b", - "LESSON": "bCz8L8", - "LESSON_PLAN": "cHbILa", - "MEDIA": "bgStlE", - "TEXTBOOK": "cwRiL", - "TUTORIAL": "dboes" - }, - "Subjects": { - "ALGEBRA": "p&dep.bblteS.drpKXi", - "ANTHROPOLOGY": "p&dep.ctZs6B.c8HSSg", - "ARITHMETIC": "p&dep.bblteS.2d3O2", - "ARTS": "p&dep.dMPOKy", - "ASTRONOMY": "p&dep.Jwimc.WMX&I", - "BASIC_SKILLS": "3hB92", - "BIOLOGY": "p&dep.Jwimc.br5gFI", - "CALCULUS": "p&dep.bblteS.dXgpNS", - "CHEMISTRY": "p&dep.Jwimc.d5hK4i", - "CIVIC_EDUCATION": "p&dep.ctZs6B.b&ZRDw", - "COMPUTER_SCIENCE": "p&dep.t6U3d", - "CURRENT_EVENTS": "cKga4t.cpTY7w", - "DAILY_LIFE": "cKga4t", - "DANCE": "p&dep.dMPOKy.bU6Aon", - "DIGITAL_LITERACY": "3hB92.bBpD5O", - "DIVERSITY": "cKga4t.b6eieL", - "DRAMA": "p&dep.dMPOKy.dflbK2", - "EARTH_SCIENCE": "p&dep.Jwimc.bKf1LD", - "ENTREPRENEURSHIP": "cKga4t.PHE2D", - "ENVIRONMENT": "cKga4t.boZVcq", - "FINANCIAL_LITERACY": "cKga4t.cgcil1", - "FOR_TEACHERS": "bKIpQL", - "GEOMETRY": "p&dep.bblteS.ShT6u", - "GUIDES": "bKIpQL.cUuuC&", - "HISTORY": "p&dep.bNbmkp", - "INDUSTRY_AND_SECTOR_SPECIFIC": "VT1kL.ckX7et.#TwHM", - "LANGUAGE_LEARNING": "p&dep.cn24wo", - "LEARNING_SKILLS": "3hB92.wNyNV", - "LESSON_PLANS": "bKIpQL.UHULh", - "LITERACY": "3hB92.cgu720", - "LITERATURE": "p&dep.Qgsp#.b2ovSe", - "LOGIC_AND_CRITICAL_THINKING": "3hB92.dkzVgX", - "MATHEMATICS": "p&dep.bblteS", - "MECHANICAL_ENGINEERING": "p&dep.t6U3d.dZm4cL", - "MEDIA_LITERACY": "cKga4t.c6I2x6", - "MENTAL_HEALTH": "cKga4t.pZ8zW", - "MUSIC": "p&dep.dMPOKy.btqcqM", - "NUMERACY": "3hB92.c1jGqN", - "PHYSICS": "p&dep.Jwimc.bh5yfp", - "POLITICAL_SCIENCE": "p&dep.ctZs6B.ctVB8#", - "PROFESSIONAL_SKILLS": "VT1kL.d6FA9G", - "PROGRAMMING": "p&dep.t6U3d.bWu0U1", - "PUBLIC_HEALTH": "cKga4t.OHvRm", - "READING_AND_WRITING": "p&dep.Qgsp#", - "READING_COMPREHENSION": "p&dep.Qgsp#.bhUTDV", - "SCHOOL": "p&dep", - "SCIENCES": "p&dep.Jwimc", - "SKILLS_TRAINING": "VT1kL.ckX7et.d&xa&j", - "SOCIAL_SCIENCES": "p&dep.ctZs6B", - "SOCIOLOGY": "p&dep.ctZs6B.dVNbTt", - "STATISTICS": "p&dep.bblteS.MCZxM", - "TECHNICAL_AND_VOCATIONAL_TRAINING": "VT1kL.ckX7et", - "TOOLS_AND_SOFTWARE_TRAINING": "VT1kL.ckX7et.dwmwig", - "VISUAL_ART": "p&dep.dMPOKy.dIviQH", - "WEB_DESIGN": "p&dep.t6U3d.cNTlX9", - "WORK": "VT1kL", - "WRITING": "p&dep.Qgsp#.cr#oHX" - } -} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..6de94ee --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "author": "Learning Equality", + "bugs": { + "url": "https://github.com/learningequality/le-utils/issues" + }, + "description": "A package that exposes constants commonly used across the Kolibri Ecosystem", + "directories": { + "src": "js" + }, + "files": [ + "js/*.js", + "js/**/*.js" + ], + "homepage": "https://github.com/learningequality/le-utils#readme", + "keywords": [ + "kolibri", + "constants", + "content" + ], + "license": "MIT", + "main": "js/index.js", + "name": "kolibri-constants", + "repository": { + "type": "git", + "url": "git+https://github.com/learningequality/le-utils.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "0.1.32" +} \ No newline at end of file diff --git a/scripts/generate_labels.py b/scripts/generate_labels.py new file mode 100644 index 0000000..02fbdc2 --- /dev/null +++ b/scripts/generate_labels.py @@ -0,0 +1,189 @@ +""" +generate_labels +Builds or rebuilds the labels py files assigning ids to the labels +""" +from __future__ import unicode_literals + +import json +import os +import re +import string +from hashlib import md5 +from uuid import UUID +from uuid import uuid3 + +from pkg_resources import get_distribution + +try: + FileNotFoundError +except NameError: + FileNotFoundError = IOError + + +root_label = md5() +root_label.update("Kolibri labels") + +root_namespace = UUID(hex=root_label.hexdigest()) + +pascal_case_pattern = re.compile(r"(? 0 or not res: + res += CHARACTERS[(data & 0x3F)] + data >>= 6 + res.reverse() + return "".join(res) + + +def generate_identifier(namespace, label): + return uuid3(namespace, label.encode("utf-8")) + + +def generate_key(identifier, previous=None): + key = _from_uuid(identifier) + if previous is None: + return key + return "{}.{}".format(previous, key) + + +def handle_array(labels, namespace, previous=None): + output = {} + for label in labels: + identifier = generate_identifier(namespace, label) + output[label] = generate_key(identifier, previous) + return output + + +def handle_object(element, namespace, previous=None): + output = {} + for key, value in element.items(): + handler = handle_object if isinstance(value, dict) else handle_array + identifier = generate_identifier(namespace, key) + new_key = generate_key(identifier, previous) + output[key] = new_key + output.update(handler(value, namespace, new_key)) + return output + + +def read_labels_spec(): + labels_spec_file = os.path.join( + os.path.dirname(__file__), + "..", + "spec", + "labels.json", + ) + with open(labels_spec_file) as json_labels_spec_file: + return json.load(json_labels_spec_file) + + +def write_labels_src(labels_spec): + py_output_dir = os.path.join( + os.path.dirname(__file__), "..", "le_utils", "constants", "labels" + ) + + for label_type, labels in labels_spec.items(): + handler = handle_object if isinstance(labels, dict) else handle_array + namespace = generate_identifier(root_namespace, label_type) + output = handler(labels, namespace) + py_output_file = os.path.join( + py_output_dir, "{}.py".format(pascal_to_snake(label_type)) + ) + with open(py_output_file, "w") as f: + f.write("# -*- coding: utf-8 -*-\n") + f.write("# Generated by scripts/generate_labels.py\n") + f.write("from __future__ import unicode_literals\n") + f.write("\n") + f.write("# {}\n".format(label_type)) + f.write("\n") + for key, value in output.items(): + f.write('{} = "{}"\n'.format(key, value)) + f.write("\n") + f.write("choices = (\n") + for key in output.keys(): + f.write(' ({}, "{}"),\n'.format(key, key.replace("_", " ").title())) + f.write(")\n") + f.write("\n") + f.write("{}LIST = [\n".format(label_type.upper())) + for key in output.keys(): + f.write(" {},\n".format(key)) + f.write("]\n") + + js_output_file = os.path.join(js_labels_output_dir, "{}.js".format(label_type)) + with open(js_output_file, "w") as f: + f.write("// -*- coding: utf-8 -*-\n") + f.write("// Generated by scripts/generate_labels.py\n") + f.write("\n") + f.write("export default {\n") + for key, value in output.items(): + f.write(' {key}: "{value}",\n'.format(key=key, value=value)) + f.write("};\n") + + js_labels_index_file = os.path.join(js_labels_output_dir, "index.js") + + with open(js_labels_index_file, "w") as f: + f.write("// -*- coding: utf-8 -*-\n") + f.write("// Generated by scripts/generate_labels.py\n") + f.write("\n") + for label_type in labels_spec.keys(): + f.write('import {0} from "./{0}";\n'.format(label_type)) + f.write("\n") + f.write("export default {\n") + for label_type in labels_spec.keys(): + f.write(" {0}: {0},\n".format(label_type)) + f.write("};\n") + + +def create_js_index(labels_spec): + js_index_file = os.path.join(os.path.dirname(__file__), "..", "js", "index.js") + + with open(js_index_file, "w") as f: + f.write("// -*- coding: utf-8 -*-\n") + f.write("// Generated by scripts/generate_labels.py\n") + f.write("\n") + for label_type in labels_spec.keys(): + f.write('import {0} from "./labels/{0}";\n'.format(label_type)) + f.write("\n") + f.write("export default {\n") + for label_type in labels_spec.keys(): + f.write(" {0}: {0},\n".format(label_type)) + f.write("};\n") + + +def set_package_json_version(): + python_version = get_distribution("le-utils").version + + package_json = os.path.join(os.path.dirname(__file__), "..", "package.json") + + with open(package_json, "r") as f: + package = json.load(f) + + package["version"] = python_version + + with open(package_json, "w") as f: + json.dump(package, f, indent=2, sort_keys=True) + + +if __name__ == "__main__": + labels_spec = read_labels_spec() + + write_labels_src(labels_spec) + + create_js_index(labels_spec) + + set_package_json_version() diff --git a/scripts/idforlabels.py b/scripts/idforlabels.py deleted file mode 100644 index 1eac930..0000000 --- a/scripts/idforlabels.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -idforlabels -Builds or rebuilds the labelslooup.json assigning ids to the labels that do not have it -""" -from __future__ import unicode_literals - -import json -import os -import string -from hashlib import md5 -from uuid import UUID -from uuid import uuid3 - -try: - FileNotFoundError -except NameError: - FileNotFoundError = IOError - - -root_label = md5() -root_label.update("Kolibri labels") - -root_namespace = UUID(hex=root_label.hexdigest()) - - -CHARACTERS = string.letters + string.digits + "#" + "&" - - -def _from_uuid(uuid): - """ - :params uuid: UUID - :returns: character string that represents the UUID - """ - data = int(uuid.hex[:8], 16) - res = [] - while data > 0 or not res: - res += CHARACTERS[(data & 0x3F)] - data >>= 6 - res.reverse() - return "".join(res) - - -def generate_identifier(namespace, label): - return uuid3(namespace, label.encode("utf-8")) - - -def generate_key(identifier, previous=None): - key = _from_uuid(identifier) - if previous is None: - return key - return "{}.{}".format(previous, key) - - -def handle_array(labels, namespace, previous=None): - output = {} - for label in labels: - identifier = generate_identifier(namespace, label) - output[label] = generate_key(identifier, previous) - return output - - -def handle_object(element, namespace, previous=None): - output = {} - for key, value in element.items(): - handler = handle_object if isinstance(value, dict) else handle_array - identifier = generate_identifier(namespace, key) - new_key = generate_key(identifier, previous) - output[key] = new_key - output.update(handler(value, namespace, new_key)) - return output - - -if __name__ == "__main__": - templates_file = os.path.join( - os.path.dirname(__file__), - "..", - "le_utils", - "resources", - "labelstemplatelookup.json", - ) - with open(templates_file) as json_templates_file: - templates = json.load(json_templates_file) - - output_file = os.path.join( - os.path.dirname(__file__), "..", "le_utils", "resources", "labelslookup.json" - ) - - output = {} - - for label_type, labels in templates.items(): - handler = handle_object if isinstance(labels, dict) else handle_array - namespace = generate_identifier(root_namespace, label_type) - output[label_type] = handler(labels, namespace) - - with open(output_file, "w") as json_labels_file: - json.dump(output, json_labels_file, sort_keys=True, indent=2) diff --git a/le_utils/resources/labelstemplatelookup.json b/spec/labels.json similarity index 99% rename from le_utils/resources/labelstemplatelookup.json rename to spec/labels.json index b8f3b4a..79b5769 100644 --- a/le_utils/resources/labelstemplatelookup.json +++ b/spec/labels.json @@ -1,5 +1,5 @@ { - "ContentLevels": [ + "Levels": [ "PRESCHOOL", "LOWER_PRIMARY", "UPPER_PRIMARY", From 13056c1837c9a68679ce0fc170958f050f800962 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 1 Oct 2021 16:33:42 -0700 Subject: [PATCH 6/8] Update js package details. Add prior knowledge label. Add npm auto publishing. --- .github/workflows/npm-publish.yml | 23 +++++++++++++++++++ Makefile | 4 ++++ js/labels/Needs.js | 12 +++++----- package.json => js/package.json | 8 +++---- le_utils/constants/labels/needs.py | 36 +++++++++++++++++------------- scripts/generate_labels.py | 8 ++++--- spec/labels.json | 5 ++++- 7 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/npm-publish.yml rename package.json => js/package.json (89%) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..4b07985 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,23 @@ +name: Publish npmjs Package + +on: + release: + types: [published] + +jobs: + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + - run: make release-npm + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_API_TOKEN}} diff --git a/Makefile b/Makefile index cbb9066..995f533 100644 --- a/Makefile +++ b/Makefile @@ -29,3 +29,7 @@ build-labels: release: clean build-labels python setup.py sdist twine upload dist/*.tar.gz + +release-npm: clean build-labels + cd js + npm publish diff --git a/js/labels/Needs.js b/js/labels/Needs.js index 3299e4d..60bf9c2 100644 --- a/js/labels/Needs.js +++ b/js/labels/Needs.js @@ -2,12 +2,14 @@ // Generated by scripts/generate_labels.py export default { - PEERS: "Ti5WR.cAsjNo", - SPECIAL_SOFTWARE: "cfjB0R.mhgPB", - OTHER_SUPPLIES: "cfjB0R.d4Uvx6", - PAPER_PENCIL: "cfjB0R.cH#ig5", - PEOPLE: "Ti5WR", + PRIOR_KNOWLEDGE: "biiiAR", MATERIALS: "cfjB0R", + FOR_BEGINNERS: "biiiAR.bjQPib", + PAPER_PENCIL: "cfjB0R.cH#ig5", + OTHER_SUPPLIES: "cfjB0R.d4Uvx6", INTERNET: "cfjB0R.cdGFA5", + SPECIAL_SOFTWARE: "cfjB0R.mhgPB", + PEOPLE: "Ti5WR", + PEERS: "Ti5WR.cAsjNo", TEACHER: "Ti5WR.ch#A9l", }; diff --git a/package.json b/js/package.json similarity index 89% rename from package.json rename to js/package.json index 6de94ee..6953d0f 100644 --- a/package.json +++ b/js/package.json @@ -8,8 +8,8 @@ "src": "js" }, "files": [ - "js/*.js", - "js/**/*.js" + "*.js", + "**/*.js" ], "homepage": "https://github.com/learningequality/le-utils#readme", "keywords": [ @@ -18,7 +18,7 @@ "content" ], "license": "MIT", - "main": "js/index.js", + "main": "index.js", "name": "kolibri-constants", "repository": { "type": "git", @@ -27,5 +27,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "0.1.32" + "version": "0.1.32-beta2" } \ No newline at end of file diff --git a/le_utils/constants/labels/needs.py b/le_utils/constants/labels/needs.py index 7087b9c..15a4fc4 100644 --- a/le_utils/constants/labels/needs.py +++ b/le_utils/constants/labels/needs.py @@ -4,33 +4,39 @@ # Needs -PEERS = "Ti5WR.cAsjNo" -SPECIAL_SOFTWARE = "cfjB0R.mhgPB" -OTHER_SUPPLIES = "cfjB0R.d4Uvx6" -PAPER_PENCIL = "cfjB0R.cH#ig5" -PEOPLE = "Ti5WR" +PRIOR_KNOWLEDGE = "biiiAR" MATERIALS = "cfjB0R" +FOR_BEGINNERS = "biiiAR.bjQPib" +PAPER_PENCIL = "cfjB0R.cH#ig5" +OTHER_SUPPLIES = "cfjB0R.d4Uvx6" INTERNET = "cfjB0R.cdGFA5" +SPECIAL_SOFTWARE = "cfjB0R.mhgPB" +PEOPLE = "Ti5WR" +PEERS = "Ti5WR.cAsjNo" TEACHER = "Ti5WR.ch#A9l" choices = ( - (PEERS, "Peers"), - (SPECIAL_SOFTWARE, "Special Software"), - (OTHER_SUPPLIES, "Other Supplies"), - (PAPER_PENCIL, "Paper Pencil"), - (PEOPLE, "People"), + (PRIOR_KNOWLEDGE, "Prior Knowledge"), (MATERIALS, "Materials"), + (FOR_BEGINNERS, "For Beginners"), + (PAPER_PENCIL, "Paper Pencil"), + (OTHER_SUPPLIES, "Other Supplies"), (INTERNET, "Internet"), + (SPECIAL_SOFTWARE, "Special Software"), + (PEOPLE, "People"), + (PEERS, "Peers"), (TEACHER, "Teacher"), ) NEEDSLIST = [ - PEERS, - SPECIAL_SOFTWARE, - OTHER_SUPPLIES, - PAPER_PENCIL, - PEOPLE, + PRIOR_KNOWLEDGE, MATERIALS, + FOR_BEGINNERS, + PAPER_PENCIL, + OTHER_SUPPLIES, INTERNET, + SPECIAL_SOFTWARE, + PEOPLE, + PEERS, TEACHER, ] diff --git a/scripts/generate_labels.py b/scripts/generate_labels.py index 02fbdc2..e1846bb 100644 --- a/scripts/generate_labels.py +++ b/scripts/generate_labels.py @@ -27,7 +27,9 @@ pascal_case_pattern = re.compile(r"(? Date: Fri, 1 Oct 2021 16:35:43 -0700 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3a832..7a10d1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Release History =============== -0.1.23 Sep 23, 2021 +0.1.32 Oct 4, 2021 ------------------- - Added new labelslookup.json constants - Added labelstemplatelookup.json and idforlabels.py From da508ad38ed74b1960d0749db3b49c99c429e06e Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 5 Oct 2021 10:41:43 -0700 Subject: [PATCH 8/8] Update label id length. --- js/labels/AccessibilityCategories.js | 12 +- js/labels/LearningActivities.js | 14 +-- js/labels/Levels.js | 18 +-- js/labels/Needs.js | 20 +-- js/labels/ResourceType.js | 20 +-- js/labels/Subjects.js | 114 +++++++++--------- js/package.json | 2 +- .../labels/accessibility_categories.py | 12 +- .../constants/labels/learning_activities.py | 14 +-- le_utils/constants/labels/levels.py | 18 +-- le_utils/constants/labels/needs.py | 20 +-- le_utils/constants/labels/resource_type.py | 20 +-- le_utils/constants/labels/subjects.py | 114 +++++++++--------- scripts/generate_labels.py | 10 +- 14 files changed, 208 insertions(+), 200 deletions(-) diff --git a/js/labels/AccessibilityCategories.js b/js/labels/AccessibilityCategories.js index 3cdea92..6026e4b 100644 --- a/js/labels/AccessibilityCategories.js +++ b/js/labels/AccessibilityCategories.js @@ -2,10 +2,10 @@ // Generated by scripts/generate_labels.py export default { - AUDIO_DESCRIPTION: "cwDcsY", - ALT_TEXT: "cuhrmh", - CAPTIONS_SUBTITLES: "da2iCe", - HIGH_CONTRAST: "br&HYl", - TAGGED_PDF: "crDF4W", - SIGN_LANGUAGE: "b1hGk&", + AUDIO_DESCRIPTION: "LNqKSN9j", + ALT_TEXT: "Lb0tb9VC", + CAPTIONS_SUBTITLES: "WnIhbgkY", + HIGH_CONTRAST: "uF4CI2wP", + TAGGED_PDF: "Kxx#meDW", + SIGN_LANGUAGE: "Dr4cVXkc", }; diff --git a/js/labels/LearningActivities.js b/js/labels/LearningActivities.js index 54c0041..73daec3 100644 --- a/js/labels/LearningActivities.js +++ b/js/labels/LearningActivities.js @@ -2,11 +2,11 @@ // Generated by scripts/generate_labels.py export default { - READ: "bzRtvr", - CREATE: "c7fP3a", - PRACTICE: "c9ATW4", - WATCH: "c53M6c", - REFLECT: "dCoWsm", - EXPLORE: "d4NYxq", - LISTEN: "WPRwV", + READ: "wA01urpi", + CREATE: "UXADWcXZ", + PRACTICE: "VwRCom7G", + WATCH: "UD5UGM0z", + REFLECT: "3dSeJhqs", + EXPLORE: "#j8L0eq3", + LISTEN: "mkA1R3NU", }; diff --git a/js/labels/Levels.js b/js/labels/Levels.js index 571c341..3e3c9bb 100644 --- a/js/labels/Levels.js +++ b/js/labels/Levels.js @@ -2,13 +2,13 @@ // Generated by scripts/generate_labels.py export default { - UPPER_SECONDARY: "dn4KHz", - WORK_SKILLS: "dp73Sn", - LOWER_PRIMARY: "by0beT", - LOWER_SECONDARY: "svpsy", - UPPER_PRIMARY: "bSQdiJ", - PRESCHOOL: "b#GEd", - BASIC_SKILLS: "chRJoI", - PROFESSIONAL: "dnezU7", - TERTIARY: "b&jDyf", + UPPER_SECONDARY: "ZEjiwvOb", + WORK_SKILLS: "Z#97dvst", + LOWER_PRIMARY: "wnarlxKo", + LOWER_SECONDARY: "eLt0Mbu4", + UPPER_PRIMARY: "BkGYi3lD", + PRESCHOOL: "FOhG0ib", + BASIC_SKILLS: "H64ZOHfi", + PROFESSIONAL: "ZrgBU73s", + TERTIARY: "FYxwbxts", }; diff --git a/js/labels/Needs.js b/js/labels/Needs.js index 60bf9c2..23c71cb 100644 --- a/js/labels/Needs.js +++ b/js/labels/Needs.js @@ -2,14 +2,14 @@ // Generated by scripts/generate_labels.py export default { - PRIOR_KNOWLEDGE: "biiiAR", - MATERIALS: "cfjB0R", - FOR_BEGINNERS: "biiiAR.bjQPib", - PAPER_PENCIL: "cfjB0R.cH#ig5", - OTHER_SUPPLIES: "cfjB0R.d4Uvx6", - INTERNET: "cfjB0R.cdGFA5", - SPECIAL_SOFTWARE: "cfjB0R.mhgPB", - PEOPLE: "Ti5WR", - PEERS: "Ti5WR.cAsjNo", - TEACHER: "Ti5WR.ch#A9l", + PRIOR_KNOWLEDGE: "sccgQZDd", + MATERIALS: "Hsw9k7Bz", + FOR_BEGINNERS: "sccgQZDd.sAQsauuo", + PAPER_PENCIL: "Hsw9k7Bz.OFIbUAK9", + OTHER_SUPPLIES: "Hsw9k7Bz.#lLv#LB7", + INTERNET: "Hsw9k7Bz.G4h2UBuK", + SPECIAL_SOFTWARE: "Hsw9k7Bz.dbXQw755", + PEOPLE: "lsoCk5Uy", + PEERS: "lsoCk5Uy.MKIzZKDO", + TEACHER: "lsoCk5Uy.H&MVs7S#", }; diff --git a/js/labels/ResourceType.js b/js/labels/ResourceType.js index 889a277..37ee3b3 100644 --- a/js/labels/ResourceType.js +++ b/js/labels/ResourceType.js @@ -2,14 +2,14 @@ // Generated by scripts/generate_labels.py export default { - MEDIA: "bgStlE", - TEXTBOOK: "cwRiL", - LESSON_PLAN: "cHbILa", - GAME: "d0o6Fw", - BOOK: "dr5pZC", - TUTORIAL: "dboes", - ACTIVITY: "cpJLQx", - LESSON: "bCz8L8", - GUIDE: "dBtI2b", - EXERCISE: "db5560", + MEDIA: "rReY3LOO", + TEXTBOOK: "LQYjqpA", + LESSON_PLAN: "OqyPqhxW", + GAME: "9dUN1LWT", + BOOK: "0Et83gje", + TUTORIAL: "WtHeUU1", + ACTIVITY: "J45AL9Nb", + LESSON: "xgFjFhrA", + GUIDE: "204TGB4U", + EXERCISE: "WEEETopZ", }; diff --git a/js/labels/Subjects.js b/js/labels/Subjects.js index 7b572be..7d600c0 100644 --- a/js/labels/Subjects.js +++ b/js/labels/Subjects.js @@ -2,61 +2,61 @@ // Generated by scripts/generate_labels.py export default { - LOGIC_AND_CRITICAL_THINKING: "3hB92.dkzVgX", - CALCULUS: "p&dep.bblteS.dXgpNS", - NUMERACY: "3hB92.c1jGqN", - READING_COMPREHENSION: "p&dep.Qgsp#.bhUTDV", - TECHNICAL_AND_VOCATIONAL_TRAINING: "VT1kL.ckX7et", - LEARNING_SKILLS: "3hB92.wNyNV", - PROGRAMMING: "p&dep.t6U3d.bWu0U1", - WRITING: "p&dep.Qgsp#.cr#oHX", - ANTHROPOLOGY: "p&dep.ctZs6B.c8HSSg", - LESSON_PLANS: "bKIpQL.UHULh", - SOCIAL_SCIENCES: "p&dep.ctZs6B", - LITERATURE: "p&dep.Qgsp#.b2ovSe", - MATHEMATICS: "p&dep.bblteS", - DAILY_LIFE: "cKga4t", - CHEMISTRY: "p&dep.Jwimc.d5hK4i", - PHYSICS: "p&dep.Jwimc.bh5yfp", - FOR_TEACHERS: "bKIpQL", - ARTS: "p&dep.dMPOKy", - MENTAL_HEALTH: "cKga4t.pZ8zW", - DANCE: "p&dep.dMPOKy.bU6Aon", - WORK: "VT1kL", - SCIENCES: "p&dep.Jwimc", - CIVIC_EDUCATION: "p&dep.ctZs6B.b&ZRDw", - TOOLS_AND_SOFTWARE_TRAINING: "VT1kL.ckX7et.dwmwig", - ASTRONOMY: "p&dep.Jwimc.WMX&I", - EARTH_SCIENCE: "p&dep.Jwimc.bKf1LD", - COMPUTER_SCIENCE: "p&dep.t6U3d", - SOCIOLOGY: "p&dep.ctZs6B.dVNbTt", - CURRENT_EVENTS: "cKga4t.cpTY7w", - BIOLOGY: "p&dep.Jwimc.br5gFI", - POLITICAL_SCIENCE: "p&dep.ctZs6B.ctVB8#", - DRAMA: "p&dep.dMPOKy.dflbK2", - MUSIC: "p&dep.dMPOKy.btqcqM", - MECHANICAL_ENGINEERING: "p&dep.t6U3d.dZm4cL", - DIGITAL_LITERACY: "3hB92.bBpD5O", - WEB_DESIGN: "p&dep.t6U3d.cNTlX9", - LITERACY: "3hB92.cgu720", - ENTREPRENEURSHIP: "cKga4t.PHE2D", - GUIDES: "bKIpQL.cUuuC&", - HISTORY: "p&dep.bNbmkp", - VISUAL_ART: "p&dep.dMPOKy.dIviQH", - ENVIRONMENT: "cKga4t.boZVcq", - SCHOOL: "p&dep", - STATISTICS: "p&dep.bblteS.MCZxM", - SKILLS_TRAINING: "VT1kL.ckX7et.d&xa&j", - ALGEBRA: "p&dep.bblteS.drpKXi", - GEOMETRY: "p&dep.bblteS.ShT6u", - DIVERSITY: "cKga4t.b6eieL", - FINANCIAL_LITERACY: "cKga4t.cgcil1", - PUBLIC_HEALTH: "cKga4t.OHvRm", - INDUSTRY_AND_SECTOR_SPECIFIC: "VT1kL.ckX7et.#TwHM", - MEDIA_LITERACY: "cKga4t.c6I2x6", - READING_AND_WRITING: "p&dep.Qgsp#", - LANGUAGE_LEARNING: "p&dep.cn24wo", - BASIC_SKILLS: "3hB92", - PROFESSIONAL_SKILLS: "VT1kL.d6FA9G", - ARITHMETIC: "p&dep.bblteS.2d3O2", + LOGIC_AND_CRITICAL_THINKING: "nX2&DRtz.YMBXStib", + CALCULUS: "d&WXdXWF.qs0Xlaxq.8rJ57ht6", + NUMERACY: "nX2&DRtz.Tsyej9ta", + READING_COMPREHENSION: "d&WXdXWF.kHKJ&PbV.r7RxB#9t", + TECHNICAL_AND_VOCATIONAL_TRAINING: "l7DsPDlm.ISEXeZt&", + LEARNING_SKILLS: "nX2&DRtz.fP2j70bj", + PROGRAMMING: "d&WXdXWF.e#RTW9E#.CfnlTDZ#", + WRITING: "d&WXdXWF.kHKJ&PbV.KFJOCr&6", + ANTHROPOLOGY: "d&WXdXWF.K80UMYnW.ViBlbQR&", + LESSON_PLANS: "ziJ6PCuU.lOBPr5ix", + SOCIAL_SCIENCES: "d&WXdXWF.K80UMYnW", + LITERATURE: "d&WXdXWF.kHKJ&PbV.DJLBbaEk", + MATHEMATICS: "d&WXdXWF.qs0Xlaxq", + DAILY_LIFE: "PbGoe2MV", + CHEMISTRY: "d&WXdXWF.i1IdaNwr.#r5ocgid", + PHYSICS: "d&WXdXWF.i1IdaNwr.r#wbt#jF", + FOR_TEACHERS: "ziJ6PCuU", + ARTS: "d&WXdXWF.5QAjgfv7", + MENTAL_HEALTH: "PbGoe2MV.d8&gCo2N", + DANCE: "d&WXdXWF.5QAjgfv7.BUMJJBnS", + WORK: "l7DsPDlm", + SCIENCES: "d&WXdXWF.i1IdaNwr", + CIVIC_EDUCATION: "d&WXdXWF.K80UMYnW.F863vKiF", + TOOLS_AND_SOFTWARE_TRAINING: "l7DsPDlm.ISEXeZt&.1JfIbP&N", + ASTRONOMY: "d&WXdXWF.i1IdaNwr.mjSF4QlF", + EARTH_SCIENCE: "d&WXdXWF.i1IdaNwr.zbDzxDE7", + COMPUTER_SCIENCE: "d&WXdXWF.e#RTW9E#", + SOCIOLOGY: "d&WXdXWF.K80UMYnW.75WBu1ZS", + CURRENT_EVENTS: "PbGoe2MV.J7CU1IxN", + BIOLOGY: "d&WXdXWF.i1IdaNwr.uErN4PdS", + POLITICAL_SCIENCE: "d&WXdXWF.K80UMYnW.K72&pITr", + DRAMA: "d&WXdXWF.5QAjgfv7.XsWznP4o", + MUSIC: "d&WXdXWF.5QAjgfv7.u0aKjT4i", + MECHANICAL_ENGINEERING: "d&WXdXWF.e#RTW9E#.8ZoaPsVW", + DIGITAL_LITERACY: "nX2&DRtz.wZ3EAedB", + WEB_DESIGN: "d&WXdXWF.e#RTW9E#.P7s8FxQ8", + LITERACY: "nX2&DRtz.HLo9TbNq", + ENTREPRENEURSHIP: "PbGoe2MV.kyxTNsRS", + GUIDES: "ziJ6PCuU.RLfhp37t", + HISTORY: "d&WXdXWF.zWtcJ&F2", + VISUAL_ART: "d&WXdXWF.5QAjgfv7.4LskOFXj", + ENVIRONMENT: "PbGoe2MV.tS7WKnZ7", + SCHOOL: "d&WXdXWF", + STATISTICS: "d&WXdXWF.qs0Xlaxq.jNm15RLB", + SKILLS_TRAINING: "l7DsPDlm.ISEXeZt&.&1WpYE&n", + ALGEBRA: "d&WXdXWF.qs0Xlaxq.0t5msbL5", + GEOMETRY: "d&WXdXWF.qs0Xlaxq.lb7ELcK5", + DIVERSITY: "PbGoe2MV.EHcbjuKq", + FINANCIAL_LITERACY: "PbGoe2MV.HGIc9sZq", + PUBLIC_HEALTH: "PbGoe2MV.kivAZaeX", + INDUSTRY_AND_SECTOR_SPECIFIC: "l7DsPDlm.ISEXeZt&.pRvOzJTE", + MEDIA_LITERACY: "PbGoe2MV.UOTL#KIV", + READING_AND_WRITING: "d&WXdXWF.kHKJ&PbV", + LANGUAGE_LEARNING: "d&WXdXWF.JDUfJNXc", + BASIC_SKILLS: "nX2&DRtz", + PROFESSIONAL_SKILLS: "l7DsPDlm.#N2VymZo", + ARITHMETIC: "d&WXdXWF.qs0Xlaxq.nG96nHDc", }; diff --git a/js/package.json b/js/package.json index 6953d0f..61cf082 100644 --- a/js/package.json +++ b/js/package.json @@ -27,5 +27,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "0.1.32-beta2" + "version": "0.1.32" } \ No newline at end of file diff --git a/le_utils/constants/labels/accessibility_categories.py b/le_utils/constants/labels/accessibility_categories.py index 7fb4986..851512f 100644 --- a/le_utils/constants/labels/accessibility_categories.py +++ b/le_utils/constants/labels/accessibility_categories.py @@ -4,12 +4,12 @@ # AccessibilityCategories -AUDIO_DESCRIPTION = "cwDcsY" -ALT_TEXT = "cuhrmh" -CAPTIONS_SUBTITLES = "da2iCe" -HIGH_CONTRAST = "br&HYl" -TAGGED_PDF = "crDF4W" -SIGN_LANGUAGE = "b1hGk&" +AUDIO_DESCRIPTION = "LNqKSN9j" +ALT_TEXT = "Lb0tb9VC" +CAPTIONS_SUBTITLES = "WnIhbgkY" +HIGH_CONTRAST = "uF4CI2wP" +TAGGED_PDF = "Kxx#meDW" +SIGN_LANGUAGE = "Dr4cVXkc" choices = ( (AUDIO_DESCRIPTION, "Audio Description"), diff --git a/le_utils/constants/labels/learning_activities.py b/le_utils/constants/labels/learning_activities.py index 61aafb7..5d41769 100644 --- a/le_utils/constants/labels/learning_activities.py +++ b/le_utils/constants/labels/learning_activities.py @@ -4,13 +4,13 @@ # LearningActivities -READ = "bzRtvr" -CREATE = "c7fP3a" -PRACTICE = "c9ATW4" -WATCH = "c53M6c" -REFLECT = "dCoWsm" -EXPLORE = "d4NYxq" -LISTEN = "WPRwV" +READ = "wA01urpi" +CREATE = "UXADWcXZ" +PRACTICE = "VwRCom7G" +WATCH = "UD5UGM0z" +REFLECT = "3dSeJhqs" +EXPLORE = "#j8L0eq3" +LISTEN = "mkA1R3NU" choices = ( (READ, "Read"), diff --git a/le_utils/constants/labels/levels.py b/le_utils/constants/labels/levels.py index fda2314..3307e05 100644 --- a/le_utils/constants/labels/levels.py +++ b/le_utils/constants/labels/levels.py @@ -4,15 +4,15 @@ # Levels -UPPER_SECONDARY = "dn4KHz" -WORK_SKILLS = "dp73Sn" -LOWER_PRIMARY = "by0beT" -LOWER_SECONDARY = "svpsy" -UPPER_PRIMARY = "bSQdiJ" -PRESCHOOL = "b#GEd" -BASIC_SKILLS = "chRJoI" -PROFESSIONAL = "dnezU7" -TERTIARY = "b&jDyf" +UPPER_SECONDARY = "ZEjiwvOb" +WORK_SKILLS = "Z#97dvst" +LOWER_PRIMARY = "wnarlxKo" +LOWER_SECONDARY = "eLt0Mbu4" +UPPER_PRIMARY = "BkGYi3lD" +PRESCHOOL = "FOhG0ib" +BASIC_SKILLS = "H64ZOHfi" +PROFESSIONAL = "ZrgBU73s" +TERTIARY = "FYxwbxts" choices = ( (UPPER_SECONDARY, "Upper Secondary"), diff --git a/le_utils/constants/labels/needs.py b/le_utils/constants/labels/needs.py index 15a4fc4..adb4c5c 100644 --- a/le_utils/constants/labels/needs.py +++ b/le_utils/constants/labels/needs.py @@ -4,16 +4,16 @@ # Needs -PRIOR_KNOWLEDGE = "biiiAR" -MATERIALS = "cfjB0R" -FOR_BEGINNERS = "biiiAR.bjQPib" -PAPER_PENCIL = "cfjB0R.cH#ig5" -OTHER_SUPPLIES = "cfjB0R.d4Uvx6" -INTERNET = "cfjB0R.cdGFA5" -SPECIAL_SOFTWARE = "cfjB0R.mhgPB" -PEOPLE = "Ti5WR" -PEERS = "Ti5WR.cAsjNo" -TEACHER = "Ti5WR.ch#A9l" +PRIOR_KNOWLEDGE = "sccgQZDd" +MATERIALS = "Hsw9k7Bz" +FOR_BEGINNERS = "sccgQZDd.sAQsauuo" +PAPER_PENCIL = "Hsw9k7Bz.OFIbUAK9" +OTHER_SUPPLIES = "Hsw9k7Bz.#lLv#LB7" +INTERNET = "Hsw9k7Bz.G4h2UBuK" +SPECIAL_SOFTWARE = "Hsw9k7Bz.dbXQw755" +PEOPLE = "lsoCk5Uy" +PEERS = "lsoCk5Uy.MKIzZKDO" +TEACHER = "lsoCk5Uy.H&MVs7S#" choices = ( (PRIOR_KNOWLEDGE, "Prior Knowledge"), diff --git a/le_utils/constants/labels/resource_type.py b/le_utils/constants/labels/resource_type.py index 7f4a817..b12539d 100644 --- a/le_utils/constants/labels/resource_type.py +++ b/le_utils/constants/labels/resource_type.py @@ -4,16 +4,16 @@ # ResourceType -MEDIA = "bgStlE" -TEXTBOOK = "cwRiL" -LESSON_PLAN = "cHbILa" -GAME = "d0o6Fw" -BOOK = "dr5pZC" -TUTORIAL = "dboes" -ACTIVITY = "cpJLQx" -LESSON = "bCz8L8" -GUIDE = "dBtI2b" -EXERCISE = "db5560" +MEDIA = "rReY3LOO" +TEXTBOOK = "LQYjqpA" +LESSON_PLAN = "OqyPqhxW" +GAME = "9dUN1LWT" +BOOK = "0Et83gje" +TUTORIAL = "WtHeUU1" +ACTIVITY = "J45AL9Nb" +LESSON = "xgFjFhrA" +GUIDE = "204TGB4U" +EXERCISE = "WEEETopZ" choices = ( (MEDIA, "Media"), diff --git a/le_utils/constants/labels/subjects.py b/le_utils/constants/labels/subjects.py index 5a37704..590793b 100644 --- a/le_utils/constants/labels/subjects.py +++ b/le_utils/constants/labels/subjects.py @@ -4,63 +4,63 @@ # Subjects -LOGIC_AND_CRITICAL_THINKING = "3hB92.dkzVgX" -CALCULUS = "p&dep.bblteS.dXgpNS" -NUMERACY = "3hB92.c1jGqN" -READING_COMPREHENSION = "p&dep.Qgsp#.bhUTDV" -TECHNICAL_AND_VOCATIONAL_TRAINING = "VT1kL.ckX7et" -LEARNING_SKILLS = "3hB92.wNyNV" -PROGRAMMING = "p&dep.t6U3d.bWu0U1" -WRITING = "p&dep.Qgsp#.cr#oHX" -ANTHROPOLOGY = "p&dep.ctZs6B.c8HSSg" -LESSON_PLANS = "bKIpQL.UHULh" -SOCIAL_SCIENCES = "p&dep.ctZs6B" -LITERATURE = "p&dep.Qgsp#.b2ovSe" -MATHEMATICS = "p&dep.bblteS" -DAILY_LIFE = "cKga4t" -CHEMISTRY = "p&dep.Jwimc.d5hK4i" -PHYSICS = "p&dep.Jwimc.bh5yfp" -FOR_TEACHERS = "bKIpQL" -ARTS = "p&dep.dMPOKy" -MENTAL_HEALTH = "cKga4t.pZ8zW" -DANCE = "p&dep.dMPOKy.bU6Aon" -WORK = "VT1kL" -SCIENCES = "p&dep.Jwimc" -CIVIC_EDUCATION = "p&dep.ctZs6B.b&ZRDw" -TOOLS_AND_SOFTWARE_TRAINING = "VT1kL.ckX7et.dwmwig" -ASTRONOMY = "p&dep.Jwimc.WMX&I" -EARTH_SCIENCE = "p&dep.Jwimc.bKf1LD" -COMPUTER_SCIENCE = "p&dep.t6U3d" -SOCIOLOGY = "p&dep.ctZs6B.dVNbTt" -CURRENT_EVENTS = "cKga4t.cpTY7w" -BIOLOGY = "p&dep.Jwimc.br5gFI" -POLITICAL_SCIENCE = "p&dep.ctZs6B.ctVB8#" -DRAMA = "p&dep.dMPOKy.dflbK2" -MUSIC = "p&dep.dMPOKy.btqcqM" -MECHANICAL_ENGINEERING = "p&dep.t6U3d.dZm4cL" -DIGITAL_LITERACY = "3hB92.bBpD5O" -WEB_DESIGN = "p&dep.t6U3d.cNTlX9" -LITERACY = "3hB92.cgu720" -ENTREPRENEURSHIP = "cKga4t.PHE2D" -GUIDES = "bKIpQL.cUuuC&" -HISTORY = "p&dep.bNbmkp" -VISUAL_ART = "p&dep.dMPOKy.dIviQH" -ENVIRONMENT = "cKga4t.boZVcq" -SCHOOL = "p&dep" -STATISTICS = "p&dep.bblteS.MCZxM" -SKILLS_TRAINING = "VT1kL.ckX7et.d&xa&j" -ALGEBRA = "p&dep.bblteS.drpKXi" -GEOMETRY = "p&dep.bblteS.ShT6u" -DIVERSITY = "cKga4t.b6eieL" -FINANCIAL_LITERACY = "cKga4t.cgcil1" -PUBLIC_HEALTH = "cKga4t.OHvRm" -INDUSTRY_AND_SECTOR_SPECIFIC = "VT1kL.ckX7et.#TwHM" -MEDIA_LITERACY = "cKga4t.c6I2x6" -READING_AND_WRITING = "p&dep.Qgsp#" -LANGUAGE_LEARNING = "p&dep.cn24wo" -BASIC_SKILLS = "3hB92" -PROFESSIONAL_SKILLS = "VT1kL.d6FA9G" -ARITHMETIC = "p&dep.bblteS.2d3O2" +LOGIC_AND_CRITICAL_THINKING = "nX2&DRtz.YMBXStib" +CALCULUS = "d&WXdXWF.qs0Xlaxq.8rJ57ht6" +NUMERACY = "nX2&DRtz.Tsyej9ta" +READING_COMPREHENSION = "d&WXdXWF.kHKJ&PbV.r7RxB#9t" +TECHNICAL_AND_VOCATIONAL_TRAINING = "l7DsPDlm.ISEXeZt&" +LEARNING_SKILLS = "nX2&DRtz.fP2j70bj" +PROGRAMMING = "d&WXdXWF.e#RTW9E#.CfnlTDZ#" +WRITING = "d&WXdXWF.kHKJ&PbV.KFJOCr&6" +ANTHROPOLOGY = "d&WXdXWF.K80UMYnW.ViBlbQR&" +LESSON_PLANS = "ziJ6PCuU.lOBPr5ix" +SOCIAL_SCIENCES = "d&WXdXWF.K80UMYnW" +LITERATURE = "d&WXdXWF.kHKJ&PbV.DJLBbaEk" +MATHEMATICS = "d&WXdXWF.qs0Xlaxq" +DAILY_LIFE = "PbGoe2MV" +CHEMISTRY = "d&WXdXWF.i1IdaNwr.#r5ocgid" +PHYSICS = "d&WXdXWF.i1IdaNwr.r#wbt#jF" +FOR_TEACHERS = "ziJ6PCuU" +ARTS = "d&WXdXWF.5QAjgfv7" +MENTAL_HEALTH = "PbGoe2MV.d8&gCo2N" +DANCE = "d&WXdXWF.5QAjgfv7.BUMJJBnS" +WORK = "l7DsPDlm" +SCIENCES = "d&WXdXWF.i1IdaNwr" +CIVIC_EDUCATION = "d&WXdXWF.K80UMYnW.F863vKiF" +TOOLS_AND_SOFTWARE_TRAINING = "l7DsPDlm.ISEXeZt&.1JfIbP&N" +ASTRONOMY = "d&WXdXWF.i1IdaNwr.mjSF4QlF" +EARTH_SCIENCE = "d&WXdXWF.i1IdaNwr.zbDzxDE7" +COMPUTER_SCIENCE = "d&WXdXWF.e#RTW9E#" +SOCIOLOGY = "d&WXdXWF.K80UMYnW.75WBu1ZS" +CURRENT_EVENTS = "PbGoe2MV.J7CU1IxN" +BIOLOGY = "d&WXdXWF.i1IdaNwr.uErN4PdS" +POLITICAL_SCIENCE = "d&WXdXWF.K80UMYnW.K72&pITr" +DRAMA = "d&WXdXWF.5QAjgfv7.XsWznP4o" +MUSIC = "d&WXdXWF.5QAjgfv7.u0aKjT4i" +MECHANICAL_ENGINEERING = "d&WXdXWF.e#RTW9E#.8ZoaPsVW" +DIGITAL_LITERACY = "nX2&DRtz.wZ3EAedB" +WEB_DESIGN = "d&WXdXWF.e#RTW9E#.P7s8FxQ8" +LITERACY = "nX2&DRtz.HLo9TbNq" +ENTREPRENEURSHIP = "PbGoe2MV.kyxTNsRS" +GUIDES = "ziJ6PCuU.RLfhp37t" +HISTORY = "d&WXdXWF.zWtcJ&F2" +VISUAL_ART = "d&WXdXWF.5QAjgfv7.4LskOFXj" +ENVIRONMENT = "PbGoe2MV.tS7WKnZ7" +SCHOOL = "d&WXdXWF" +STATISTICS = "d&WXdXWF.qs0Xlaxq.jNm15RLB" +SKILLS_TRAINING = "l7DsPDlm.ISEXeZt&.&1WpYE&n" +ALGEBRA = "d&WXdXWF.qs0Xlaxq.0t5msbL5" +GEOMETRY = "d&WXdXWF.qs0Xlaxq.lb7ELcK5" +DIVERSITY = "PbGoe2MV.EHcbjuKq" +FINANCIAL_LITERACY = "PbGoe2MV.HGIc9sZq" +PUBLIC_HEALTH = "PbGoe2MV.kivAZaeX" +INDUSTRY_AND_SECTOR_SPECIFIC = "l7DsPDlm.ISEXeZt&.pRvOzJTE" +MEDIA_LITERACY = "PbGoe2MV.UOTL#KIV" +READING_AND_WRITING = "d&WXdXWF.kHKJ&PbV" +LANGUAGE_LEARNING = "d&WXdXWF.JDUfJNXc" +BASIC_SKILLS = "nX2&DRtz" +PROFESSIONAL_SKILLS = "l7DsPDlm.#N2VymZo" +ARITHMETIC = "d&WXdXWF.qs0Xlaxq.nG96nHDc" choices = ( (LOGIC_AND_CRITICAL_THINKING, "Logic And Critical Thinking"), diff --git a/scripts/generate_labels.py b/scripts/generate_labels.py index e1846bb..6f38c52 100644 --- a/scripts/generate_labels.py +++ b/scripts/generate_labels.py @@ -44,7 +44,15 @@ def _from_uuid(uuid): :params uuid: UUID :returns: character string that represents the UUID """ - data = int(uuid.hex[:8], 16) + # With a length of 12 for the hex number, we would need approximately + # 24000 labels to have a 1 in a million chance of a collision. + # Numbers derived using the formula for the generalized birthday problem: + # https://en.wikipedia.org/wiki/Birthday_problem#The_generalized_birthday_problem + # n=sqrt(2*d*ln(1/(1-p)) + # where d is the number of combinations of d digits, p is the probability + # So for 12 digits, d = 16^12 + # p = 0.000001 for one in a million + data = int(uuid.hex[:12], 16) res = [] while data > 0 or not res: res += CHARACTERS[(data & 0x3F)]