From 333ea02f540b01fdc754fade5c197aef16544fd5 Mon Sep 17 00:00:00 2001 From: Karolina Przerwa Date: Mon, 9 Oct 2023 16:30:02 +0200 Subject: [PATCH] github: store name and family name of author --- invenio_rdm_records/services/github/metadata.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/invenio_rdm_records/services/github/metadata.py b/invenio_rdm_records/services/github/metadata.py index 1c300786e..7a0f25702 100644 --- a/invenio_rdm_records/services/github/metadata.py +++ b/invenio_rdm_records/services/github/metadata.py @@ -90,15 +90,21 @@ def serialize_author(gh_data): name = gh_data.get("name", login) company = gh_data.get("company", "") - human_name = HumanName(name) - given_name = human_name.first - family_name = human_name.surnames + author = {} + if name.count(",") == 1: + family, given = name.split(",") + author["given_name"] = given.strip() + author["family_name"] = family.strip() + # autocompleted by RDM Metadata schema + author["name"] = name + else: + author["family_name"] = name + author["name"] = name rdm_contributor = { "person_or_org": { "type": "personal", - "given_name": given_name, - "family_name": family_name, + **author, }, "affiliations": [{"name": company}], }