Skip to content

Commit 872dd3f

Browse files
committed
Better handle dates
1 parent 10086fa commit 872dd3f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

caltechdata_api/customize_schema.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,16 @@ def customize_schema(json_record):
103103

104104
if "dates" in json_record:
105105
dates = json_record['dates']
106+
priority = False
106107
for d in dates:
107108
#If metadata has Submitted date, we can get a full date in TIND
108109
if d['dateType']=='Submitted':
109110
json_record["publicationDate"]=d['date']
111+
priority = True
112+
#If we have an Issued but not a Submitted date, save full date
113+
if d['dateType']=='Issued':
114+
if priority == False:
115+
json_record["publicationDate"]=d['date']
110116
d['relevantDateValue']=str(d.pop('date'))
111117
d['relevantDateType']=d.pop('dateType')
112118
json_record['relevantDates']=json_record.pop('dates')

0 commit comments

Comments
 (0)