Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github: store name and family name of author #1525

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions invenio_rdm_records/services/github/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}],
}
Expand Down
Loading