Skip to content

Commit

Permalink
feat: populate additional fields from zotero
Browse files Browse the repository at this point in the history
parse more fields: volume, edition, issue
  • Loading branch information
babslgam committed Apr 4, 2024
1 parent 1a2d17a commit 432fa6e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions apis_ontology/scripts/import_zotero_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 432fa6e

Please sign in to comment.