From 432fa6ec466b714757d9a91937693f223ab4f8a8 Mon Sep 17 00:00:00 2001 From: Barbara Krautgartner Date: Thu, 4 Apr 2024 17:56:33 +0000 Subject: [PATCH] feat: populate additional fields from zotero parse more fields: volume, edition, issue --- .../scripts/import_zotero_collections.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apis_ontology/scripts/import_zotero_collections.py b/apis_ontology/scripts/import_zotero_collections.py index cb947c4..a39247e 100644 --- a/apis_ontology/scripts/import_zotero_collections.py +++ b/apis_ontology/scripts/import_zotero_collections.py @@ -636,7 +636,9 @@ def create_entities(item, source): item_tags = item_data.get("tags", []) series = item_data.get("series", "") publication_title = item_data.get("publicationTitle", "") - issue = item_data.get("seriesNumber", "") + issue = item_data.get("seriesNumber", item_data.get("issue", "")) + volume = item_data.get("volume", "") + edition = item_data.get("edition", "") creators_with_props = [] edition_types = [] work_types = [] @@ -890,14 +892,22 @@ def create_entities(item, source): title=series, defaults={"data_source": source} ) parent_expression, created = Expression.objects.get_or_create( - title=series, issue=issue, defaults={"data_source": source} + title=series, + issue=issue, + volume=volume, + edition=edition, + defaults={"data_source": source}, ) if publication_title: parent_publication, created = Work.objects.get_or_create( title=publication_title, defaults={"data_source": source} ) parent_expression, created = Expression.objects.get_or_create( - title=publication_title, issue=issue, defaults={"data_source": source} + title=publication_title, + issue=issue, + volume=volume, + edition=edition, + defaults={"data_source": source}, ) if parent_publication and parent_expression: parent_parent_triple, created = create_triple(