Skip to content

Commit 51417dc

Browse files
committed
Don't allow final action for editing
1 parent c47fd8b commit 51417dc

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

caltechdata_write/caltechdata_write.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ def Caltechdata_write(metadata,token,files=[],production=False):
8181

8282
newdata = customize_schema.customize_schema(metadata)
8383
newdata['files'] = fileinfo
84+
if 'doi' not in newdata:
85+
#We want tind to generate the identifier
86+
newdata['final_actions'] = [{"type":"create_doi",\
87+
"parameters":{"type":"records","field":"doi"}}]
8488

8589
dat = json.dumps({'record': newdata})
8690

caltechdata_write/customize_schema.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ def customize_schema(json_record):
2020
json_record['doi'] = identifier
2121
del json_record['identifier']
2222
#will delete other ideintifiers in file
23-
else: #We want tind to generate the identifier
24-
json_record['final_actions'] = [{"type":"create_doi",\
25-
"parameters":{"type":"records","field":"doi"}}]
2623

2724
#Extract description
2825
if "descriptions" in json_record:
@@ -120,21 +117,6 @@ def customize_schema(json_record):
120117
json_record['license']=licenses[0]['rights']
121118
#Only transfers first license
122119

123-
#Funding
124-
#if 'fundingReferences' in json_record:
125-
# funding = json_record['fundingReferences']
126-
# newf = []
127-
# for f in funding:
128-
# frec = {}
129-
# if 'funderName' in f:
130-
# frec['fundingName'] = f['funderName']
131-
# #f['fundingName']=f.pop('funderName')
132-
# if 'awardNumber' in f:
133-
# frec['fundingAwardNumber']=f['awardNumber']['awardNumber']
134-
# newf.append(frec)
135-
# json_record['fundings']=newf
136-
# #Some fields not preserved
137-
138120
#Geo
139121
if 'geoLocations' in json_record:
140122
for g in json_record['geoLocations']:

0 commit comments

Comments
 (0)