Skip to content

Commit 2dd981b

Browse files
committed
Add in default name value
1 parent 4924dc1 commit 2dd981b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

caltechdata_api/customize_schema.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def rdm_creators_contributors(person_list, peopleroles):
8181
cre["type"] = "personal"
8282
change_label(cre, "givenName", "given_name")
8383
change_label(cre, "familyName", "family_name")
84+
if 'name' not in cre:
85+
cre['name'] = cre['family_name']+','+cre['given_name']
8486
change_label(cre, "nameIdentifiers", "identifiers")
8587
if "identifiers" in cre:
8688
new_id = []
@@ -199,29 +201,29 @@ def customize_schema_rdm(json_record):
199201
dates = json_record["dates"]
200202
new = []
201203
for d in dates:
202-
date = d["date"]
204+
datev = d["date"]
203205
# Strip out any time imformation
204-
if " " in date:
205-
date = date.split(" ")[0]
206+
if " " in datev:
207+
datev = datev.split(" ")[0]
206208
# If metadata has Submitted date, this gets priority
207209
if d["dateType"] == "Submitted":
208-
json_record["publication_date"] = date
210+
json_record["publication_date"] = datev
209211
# If we have an Issued but not a Submitted date, this is
210212
# publication date
211213
elif d["dateType"] == "Issued":
212-
json_record["publication_date"] = date
214+
json_record["publication_date"] = datev
213215
elif d["dateType"] == "Updated":
214216
# We now let InvenioRDM handle updated dates
215217
print("Skipping updated date")
216218
else:
217219
dtype = d.pop("dateType")
218220
d["type"] = {"id": datetypes[dtype]}
219-
d["date"] = date
221+
d["date"] = datev
220222
change_label(d, "dateInformation", "description")
221223
new.append(d)
222224
json_record["dates"] = new
223225
if "publication_date" not in json_record:
224-
# A publication date isalways required
226+
# A publication date is always required
225227
if "publicationYear" in json_record:
226228
json_record["publication_date"] = json_record.pop("publicationYear")
227229
else:

0 commit comments

Comments
 (0)