diff --git a/eossr/metadata/codemeta2zenodo.py b/eossr/metadata/codemeta2zenodo.py index 4233e338b14e7ae57ad648301455531090b9ca9e..61fd2d8b346644b79e7dbb90be7e2b3d7e508a2a 100644 --- a/eossr/metadata/codemeta2zenodo.py +++ b/eossr/metadata/codemeta2zenodo.py @@ -38,6 +38,9 @@ def parse_person_schema_property(person_property, contributor_field): dictionary with the correct zenodo syntax for all {author, contributor, maintainer}. """ + if person_property["@type"] != "Person": + return None + zenodo_person = {} name = person_property['familyName'] @@ -93,10 +96,12 @@ def add_author_metadata(zenodo_file, codemt_person_entry, person_field): zenodo_person = parse_person_schema_property(person_property, person_field) # 'name' is the only key that MUST be contained in a # person_property at least - full_contacts[zenodo_person['name']] = zenodo_person + if zenodo_person is not None: + full_contacts[zenodo_person['name']] = zenodo_person else: zenodo_person = parse_person_schema_property(codemt_person_entry, person_field) - full_contacts[zenodo_person['name']] = zenodo_person + if zenodo_person is not None: + full_contacts[zenodo_person['name']] = zenodo_person # then save each person by field and avoid duplicates for person, value in full_contacts.items(): diff --git a/eossr/metadata/tests/samples/codemeta_contributors_sample.json b/eossr/metadata/tests/samples/codemeta_contributors_sample.json index 6a27134359b673f93e613a31515a1b69aec20393..f4b73a15e90a1eea43f89d635f36ea97c8e33c7a 100644 --- a/eossr/metadata/tests/samples/codemeta_contributors_sample.json +++ b/eossr/metadata/tests/samples/codemeta_contributors_sample.json @@ -38,6 +38,11 @@ "@id": "https://orcid.org/0000-0000-0000-0000" }, "contributor": [ + { + "@type": "ResearchOrganization", + "@id": "https://ror.org/", + "name:": "Some Research Org" + }, { "@type": "Person", "givenName": "Contributor-name",