@@ -8,16 +8,10 @@ def customize_schema(json_record):
88 #Extract subjects to single string
99 if "subjects" in json_record :
1010 subjects = json_record ['subjects' ]
11- #substr = ''
1211 subs = []
1312 for s in subjects :
1413 subs .append (s ['subject' ])
15- #if substr != '':
16- # substr = substr + ', '
17- #substr = substr+s['subject']
18- json_record ['subjects' ]= subs #tr
19- #print(substr)
20- #del json_record['subjects']
14+ json_record ['subjects' ]= subs
2115
2216 #Extract identifier and label as DOI
2317 if "identifier" in json_record :
@@ -63,9 +57,9 @@ def customize_schema(json_record):
6357 new = {}
6458 if 'affiliations' in a :
6559 if isinstance (a ['affiliations' ], list ):
66- new ['contributorAffiliation ' ] = a ['affiliations' ]
60+ new ['authorAffiliation ' ] = a ['affiliations' ]
6761 else :
68- new ['contributorAffiliation ' ] = [a ['affiliations' ]]
62+ new ['authorAffiliation ' ] = [a ['affiliations' ]]
6963 new ['authorName' ] = a ['creatorName' ]
7064 if 'nameIdentifiers' in a :
7165 idn = []
@@ -107,12 +101,12 @@ def customize_schema(json_record):
107101 if "dates" in json_record :
108102 dates = json_record ['dates' ]
109103 for d in dates :
110- d ['relevantDateValue' ]= d .pop ('date' )
104+ d ['relevantDateValue' ]= str ( d .pop ('date' ) )
111105 d ['relevantDateType' ]= d .pop ('dateType' )
112106 json_record ['relevantDates' ]= json_record .pop ('dates' )
113107
114108 if "publicationYear" in json_record :
115- json_record ["publicationDate" ]= json_record ["publicationYear" ]
109+ json_record ["publicationDate" ]= str ( json_record ["publicationYear" ])
116110
117111 #license
118112 if 'rightsList' in json_record :
@@ -145,13 +139,11 @@ def customize_schema(json_record):
145139 if 'geoLocationPoint' in g :
146140 g ['geoLocationPoint' ]['pointLatitude' ] = str (g ['geoLocationPoint' ]['pointLatitude' ])
147141 g ['geoLocationPoint' ]['pointLongitude' ] = str (g ['geoLocationPoint' ]['pointLongitude' ])
148- g ['geoLocationPoint' ] = g ['geoLocationPoint' ]
149142 if 'geoLocationBox' in g :
150143 g ['geoLocationBox' ]['northBoundLatitude' ]= str (g ['geoLocationBox' ]['northBoundLatitude' ])
151144 g ['geoLocationBox' ]['southBoundLatitude' ]= str (g ['geoLocationBox' ]['southBoundLatitude' ])
152145 g ['geoLocationBox' ]['eastBoundLongitude' ]= str (g ['geoLocationBox' ]['eastBoundLongitude' ])
153146 g ['geoLocationBox' ]['westBoundLongitude' ]= str (g ['geoLocationBox' ]['westBoundLongitude' ])
154- g ['geoLocationBox' ] = [g ['geoLocationBox' ]]
155147 json_record ['geographicCoverage' ] = json_record .pop ('geoLocations' )
156148
157149 #Publisher
0 commit comments