From e6febfe69fc13b82556446557269062e1112cf64 Mon Sep 17 00:00:00 2001 From: KK Date: Mon, 2 Sep 2024 19:25:14 +0200 Subject: [PATCH 1/3] refactor(imports): remove unused function --- apis_ontology/scripts/import_zotero_collections.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/apis_ontology/scripts/import_zotero_collections.py b/apis_ontology/scripts/import_zotero_collections.py index b88fc9f..8ded2b4 100644 --- a/apis_ontology/scripts/import_zotero_collections.py +++ b/apis_ontology/scripts/import_zotero_collections.py @@ -400,14 +400,6 @@ def get_valid_collection_items(collection_items): return importable, not_importable -def get_manifestation_type(collection_name): - available_manifestation_types = Expression.ManifestationTypes - manifestation_type = [ - x for x in available_manifestation_types if x.label in collection_name - ] - return manifestation_type - - def get_edition_types_from_tags(tags): """ Check if a Zotero collection item's tags contain valid From 02e0beef8367d9c7a79e0c0adf4f8f02e70491dd Mon Sep 17 00:00:00 2001 From: KK Date: Mon, 2 Sep 2024 19:26:29 +0200 Subject: [PATCH 2/3] fix(imports): fix reference to Choices --- apis_ontology/scripts/import_zotero_collections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis_ontology/scripts/import_zotero_collections.py b/apis_ontology/scripts/import_zotero_collections.py index 8ded2b4..df9b3c6 100644 --- a/apis_ontology/scripts/import_zotero_collections.py +++ b/apis_ontology/scripts/import_zotero_collections.py @@ -408,7 +408,7 @@ def get_edition_types_from_tags(tags): :param tags: a list of strings :return: a list of strings """ - valid_tags = [t.value for t in Expression.EditionTypes if t.label in tags] + valid_tags = [t.value for t in Expression.EditionTypes.choices if t.label in tags] return valid_tags From 56e1caee79af7bd0dc894816d78ea12cd0111c37 Mon Sep 17 00:00:00 2001 From: KK Date: Tue, 3 Sep 2024 13:24:56 +0200 Subject: [PATCH 3/3] refactor(imports): adapt references to choices Change references to TextChoices for matching Character relevancy, fictionality when importing from Excel sheets to German labels following recent updates to choices values in models.py and the DB. --- .../import_nonbibl_entities_from_excel.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apis_ontology/scripts/import_nonbibl_entities_from_excel.py b/apis_ontology/scripts/import_nonbibl_entities_from_excel.py index cf9bad8..bb4b4f2 100644 --- a/apis_ontology/scripts/import_nonbibl_entities_from_excel.py +++ b/apis_ontology/scripts/import_nonbibl_entities_from_excel.py @@ -29,16 +29,19 @@ } RELEVANCIES = { - "H": "protagonist", - "N": "supporting_character", - "E": "referenced_character", + "H": "Hauptfigur", + "N": "Nebenfigur", + "E": "erwähnte Figur", } FICTIONALITY_DEGREES = { - "F": "fictional_character", - "M": "mythical_character", - "R": "historical_character", - "M/R": ["mythical_character", "historical_character"], + "F": "fiktive Figur", + "M": "mythologische Figur", + "R": "historische Figur", + "M/R": [ + "historische Figur", + "mythologische Figur", + ], }