Skip to content

Commit 1ed90e7

Browse files
committed
Schema update fixes
1 parent 4196fb7 commit 1ed90e7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

caltechdata_write/customize_schema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def customize_schema(json_record):
6262
for a in authors:
6363
new = {}
6464
if 'affiliations' in a:
65-
astr = ''
66-
for afname in a['affiliations']:
67-
astr= astr + afname
68-
new['authorAffiliation'] = astr
65+
if isinstance(a['affiliations'], list):
66+
new['contributorAffiliation'] = a['affiliations']
67+
else:
68+
new['contributorAffiliation'] = [a['affiliations']]
6969
new['authorName'] = a['creatorName']
7070
if 'nameIdentifiers' in a:
7171
idn = []
@@ -88,10 +88,10 @@ def customize_schema(json_record):
8888
"contributorIdentifierScheme":n['nameIdentifierScheme']})
8989
new['contributorIdentifiers'] = idn
9090
if 'affiliations' in c:
91-
astr = ''
92-
for afname in c['affiliations']:
93-
astr= astr + afname
94-
new['contributorAffiliation'] = astr
91+
if isinstance(c['affiliations'], list):
92+
new['contributorAffiliation'] = c['affiliations']
93+
else:
94+
new['contributorAffiliation'] = [c['affiliations']]
9595
new['contributorName'] = c['contributorName']
9696
new['contributorType'] = c['contributorType']
9797
if 'contributorEmail' in c:
@@ -145,7 +145,7 @@ def customize_schema(json_record):
145145
if 'geoLocationPoint' in g:
146146
g['geoLocationPoint']['pointLatitude'] = str(g['geoLocationPoint']['pointLatitude'])
147147
g['geoLocationPoint']['pointLongitude'] = str(g['geoLocationPoint']['pointLongitude'])
148-
g['geoLocationPoint'] = [g['geoLocationPoint']]
148+
g['geoLocationPoint'] = g['geoLocationPoint']
149149
if 'geoLocationBox' in g:
150150
g['geoLocationBox']['northBoundLatitude']=str(g['geoLocationBox']['northBoundLatitude'])
151151
g['geoLocationBox']['southBoundLatitude']=str(g['geoLocationBox']['southBoundLatitude'])

0 commit comments

Comments
 (0)