Skip to content

Commit 299c0df

Browse files
committed
Add review comment option
1 parent 568f920 commit 299c0df

File tree

6 files changed

+43
-22
lines changed

6 files changed

+43
-22
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ keywords:
1515
- metadata
1616
- software
1717
- Invenio
18-
date-released: 2023-05-17
18+
date-released: 2023-05-25

caltechdata_api/caltechdata_write.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def add_file_links(
101101
return metadata
102102

103103

104-
def send_to_community(review_link, data, headers, publish, community):
104+
def send_to_community(review_link, data, headers, publish, community, message=None):
105+
106+
if not message:
107+
message = "This record is submitted automatically with the CaltechDATA API"
105108

106109
data = {
107110
"receiver": {"community": community},
@@ -113,7 +116,7 @@ def send_to_community(review_link, data, headers, publish, community):
113116
submit_link = result.json()["links"]["actions"]["submit"]
114117
data = comment = {
115118
"payload": {
116-
"content": "This record is submitted automatically with the CaltechDATA API",
119+
"content": message,
117120
"format": "html",
118121
}
119122
}
@@ -148,6 +151,7 @@ def caltechdata_write(
148151
file_descriptions=[],
149152
s3_link=None,
150153
default_preview=None,
154+
review_message=None,
151155
):
152156
"""
153157
File links are links to files existing in external systems that will
@@ -218,7 +222,8 @@ def caltechdata_write(
218222
"provider": "external",
219223
}
220224

221-
metadata["pids"] = pids
225+
if "pids" not in metadata:
226+
metadata["pids"] = pids
222227

223228
if authors == False:
224229
data = customize_schema.customize_schema(metadata, schema=schema)
@@ -247,8 +252,6 @@ def caltechdata_write(
247252
elif default_preview:
248253
data["files"] = {"enabled": True, "default_preview": default_preview}
249254

250-
print(data)
251-
252255
# Make draft and publish
253256
result = requests.post(url + "/api/records", headers=headers, json=data)
254257
if result.status_code != 201:
@@ -262,7 +265,9 @@ def caltechdata_write(
262265

263266
if community:
264267
review_link = result.json()["links"]["review"]
265-
send_to_community(review_link, data, headers, publish, community)
268+
send_to_community(
269+
review_link, data, headers, publish, community, review_message
270+
)
266271

267272
else:
268273
if publish:

codemeta.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"codeRepository": "https://github.com/caltechlibrary/caltechdata_api",
77
"issueTracker": "https://github.com/caltechlibrary/caltechdata_api/issues",
88
"license": "https://data.caltech.edu/license",
9-
"version": "1.4.0",
9+
"version": "1.4.1",
1010
"author": [
1111
{
1212
"@type": "Person",
@@ -21,13 +21,24 @@
2121
}],
2222
"developmentStatus": "active",
2323
"downloadUrl":
24-
"https://github.com/caltechlibrary/caltechdata_api/archive/1.4.0.zip",
24+
"https://github.com/caltechlibrary/caltechdata_api/archive/1.4.1.zip",
2525
"keywords": [
2626
"GitHub",
2727
"metadata",
2828
"software",
2929
"Invenio"
3030
],
31-
"maintainer": "https://orcid.org/0000-0001-9266-5146",
31+
"maintainer": [
32+
{
33+
"@type": "Person",
34+
"givenName": "Thomas E",
35+
"familyName": "Morrell",
36+
"affiliation": {
37+
"@type": "Organization",
38+
"name": "Caltech Library"
39+
},
40+
"email": "[email protected]",
41+
"@id": "https://orcid.org/0000-0001-9266-5146"
42+
}],
3243
"programmingLanguage": "Python"
3344
}

process_tomograms.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ def create_detailed_description(information, annotation):
6666
species = information["species/Specimen"][0]
6767
if "name" in species:
6868
sp = species["name"]
69-
description += f"{s}Species / Specimen:{e} {sp}{sep}"
70-
keywords.append(sp)
69+
if sp != 'Unspecified':
70+
description += f"{s}Species / Specimen:{e} {sp}{sep}"
71+
keywords.append(sp)
7172
if "strain" in species:
7273
st = species["strain"]
73-
description += f"{s}Strain:{e} {st}{sep}"
74-
if st not in keywords:
75-
keywords.append(st)
74+
if st != "None":
75+
description += f"{s}Strain:{e} {st}{sep}"
76+
if st not in keywords:
77+
keywords.append(st)
7678
if "tiltSeriesCollection" in information:
7779
settings = ""
7880
info = information["tiltSeriesCollection"][0]
@@ -99,8 +101,9 @@ def create_detailed_description(information, annotation):
99101
description += f"{s}Tilt Series Settings:{e} {settings}{sep}"
100102
if "Microscope" in info:
101103
if info["Microscope"] != "":
102-
description += f'{s}Microscope:{e} {info["Microscope"]}{sep}'
103-
keywords.append(info["Microscope"])
104+
if info["Microscope"] != "None":
105+
description += f'{s}Microscope:{e} {info["Microscope"]}{sep}'
106+
keywords.append(info["Microscope"])
104107
if "acquisitionSoftware" in info:
105108
description += (
106109
f'{s}Acquisition Software:{e} {info["acquisitionSoftware"]}{sep}'
@@ -238,9 +241,11 @@ def process_record(source, edit=None):
238241
embargoed = True
239242
metadata["identifiers"] = [{"identifier": idv, "identifierType": "tiltid"}]
240243
if "collaboratorsAndRoles" in annotation:
241-
metadata["contributors"] = parse_collaborators(
242-
annotation["collaboratorsAndRoles"]
243-
)
244+
with open("collab_not_completed.txt", "a") as myfile:
245+
myfile.write(f"{idv}\n")
246+
#metadata["contributors"] = parse_collaborators(
247+
# annotation["collaboratorsAndRoles"]
248+
#)
244249
creators = []
245250
for name in information["dataTakenBy"]:
246251
creator = {

tomogram_ids.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

write_authors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
production = False
2323
publish = True
2424
authors = True
25-
community = "5ab46cf6-8210-4ade-89ca-1e06d82a0de6"
25+
community = "70768bd5-918b-441b-bd45-12a3f296447c"
2626

2727
response = caltechdata_write(
2828
metadata,

0 commit comments

Comments
 (0)