Skip to content

Commit 0472e0a

Browse files
committed
Obsolete message version
1 parent 611f969 commit 0472e0a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

edit_all_tccon.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
rid = str(h['id'])
1919
print(rid)
2020
record = decustomize_schema(h['metadata'],True)
21+
replace = False
22+
if 'relatedIdentifiers' in record:
23+
for r in record['relatedIdentifiers']:
24+
if r['relationType']=='IsPreviousVersionOf':
25+
description = \
26+
"<br> These data are now obsolete and should be replaced by the most recent data: https://doi.org/"\
27+
+r['relatedIdentifier']+' <br><br>'
28+
description = description +\
29+
record['descriptions'][0]['description']
30+
replace = True
2131

22-
group = {'contributorName':'TCCON','contributorType':'ResearchGroup'}
23-
new = ''
24-
if 'contributors' in record:
25-
existing = False
26-
for c in record['contributors']:
27-
if c['contributorName'] == 'TCCON':
28-
existing = True
29-
if existing == False:
30-
v = record['contributors']
31-
v.append(group)
32-
new = {'contributors':v}
33-
else:
34-
new = {'contributors':[group]}
35-
if new != '':
36-
response = caltechdata_edit(token, rid, new, {}, {}, production)
32+
33+
if replace == True:
34+
metadata =\
35+
{'descriptions':[{'description':description,'descriptionType':'Abstract'}]}
36+
response = caltechdata_edit(token, rid, metadata, {}, {}, production)
3737
print(response)

0 commit comments

Comments
 (0)