Skip to content

Commit 91f626d

Browse files
committed
Support existing mapping - correct array will be activated once TIND fixes
stuff
1 parent f3be9c7 commit 91f626d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

caltechdata_write/customize_schema.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ def customize_schema(json_record):
99
if "subjects" in json_record:
1010
subjects = json_record['subjects']
1111
substr = ''
12+
#subs = []
1213
for s in subjects:
14+
#subs.append(s['subject'])
1315
if substr != '':
1416
substr = substr + ', '
1517
substr = substr+s['subject']
16-
json_record['subjects']=substr
18+
json_record['keywords']=substr
19+
del json_record['subjects']
1720

1821
#Extract identifier and label as DOI
1922
if "identifier" in json_record:
@@ -64,10 +67,11 @@ def customize_schema(json_record):
6467
new['authorAffiliation'] = astr
6568
new['authorName'] = a['creatorName']
6669
if 'nameIdentifiers' in a:
70+
idn = []
6771
for n in a['nameIdentifiers']:
68-
if n['nameIdentifierScheme']=="ORCID":
69-
new['authorIdentifiers']=[{"authorIdentifier":n["nameIdentifier"],
70-
"authorIdentifierScheme": "ORCID"}]
72+
idn.append({"authorIdentifier":n["nameIdentifier"],
73+
"authorIdentifierScheme": n["nameIdentifierScheme"]})
74+
new['authorIdentifiers'] = idn
7175
newa.append(new)
7276
json_record['authors']=newa
7377

@@ -77,10 +81,11 @@ def customize_schema(json_record):
7781
for c in json_record['contributors']:
7882
new = {}
7983
if 'nameIdentifiers' in c:
84+
idn = []
8085
for n in c['nameIdentifiers']:
81-
if n['nameIdentifierScheme']=="ORCID":
82-
new['contributorIdentifiers']=[{"contributorIdentifier":n["nameIdentifier"],
83-
"contributorIdentifierScheme":"ORCID"}]
86+
idn.append({"contributorIdentifier":n["nameIdentifier"],
87+
"contributorIdentifierScheme":n['nameIdentifierScheme']})
88+
new['contributorIdentifiers'] = idn
8489
if 'affiliations' in c:
8590
astr = ''
8691
for afname in c['affiliations']:

0 commit comments

Comments
 (0)