Skip to content

Commit 9750c1c

Browse files
committed
2 parents 0fbecd2 + 60a13d1 commit 9750c1c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

caltechdata_api/decustomize_schema.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
2020

2121
#Extract identifier and label as DOI
2222
if "doi" in json_record:
23+
doi = json_record['doi']
2324
json_record['identifier'] = {'identifier':json_record['doi'],
2425
'identifierType':"DOI"}
2526
del json_record['doi']
@@ -77,7 +78,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
7778
idv.append(nid)
7879
new['nameIdentifiers']=idv
7980
else:
80-
print("Author identifiers not an array - please check")
81+
print("Author identifiers not an array - please check", doi)
8182
del a['authorIdentifiers']
8283
new['creatorName'] = a['authorName']
8384
newa.append(new)
@@ -105,7 +106,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
105106
newa.append(new)
106107
c['nameIdentifiers']=newa
107108
else:
108-
print("Contributor identifier not an array - please check")
109+
print("Contributor identifier not an array - please check",doi)
109110
del c['contributorIdentifiers']
110111
if pass_emails == False:
111112
if 'contributorEmail' in c:
@@ -140,9 +141,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
140141
#If "Submitted' date type was not manually set in metadata
141142
#Or 'Issued was not manually set
142143
#We want to save the entire publicationDate
143-
if 'Submitted' in datetypes or 'Issued' in datetypes:
144-
print("Custom Dates Present-Dropping TIND Publication Date")
145-
else:
144+
if 'Submitted' or 'Issued' not in datetypes:
146145
if 'dates' in json_record:
147146
json_record['dates'].append({"date":json_record['publicationDate'],\
148147
"dateType": "Submitted"})
@@ -152,7 +151,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
152151
del json_record['publicationDate']
153152

154153
else:
155-
print("No publication date set - something is odd with the record")
154+
print("No publication date set - something is odd with the record ",doi)
156155

157156
#license - no url available
158157
if 'rightsList' not in json_record:
@@ -166,7 +165,7 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
166165
if 'fundings' in json_record:
167166
#Metadata changes and all should all be DataCite standard
168167
#Clean out any residual issues
169-
print("Legacy funding information (fundings) not transferred")
168+
# Legacy funding information (fundings) not transferred
170169
del json_record['fundings']
171170

172171
#Geo

0 commit comments

Comments
 (0)