Skip to content

Commit d62dff0

Browse files
author
Renzo Frigato
committed
move filter comment on download docstring
1 parent ed1b052 commit d62dff0

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

api/core.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,6 @@ def _filter_check(property_filter, property_values):
3232
def _append_targets(targets, container, prefix, total_size, total_cnt, optional, data_path, filters):
3333
for f in container.get('files', []):
3434
if filters:
35-
# Here we use filters in the payload to exclude/include files.
36-
# To pass a single filter, each of its conditions should be satisfied.
37-
# If a file pass at least one filter, it is included in the targets.
38-
# For example:
39-
#
40-
# download_payload = {
41-
# 'optional': True,
42-
# 'nodes': [{'level':'project', '_id':project_id}],
43-
# 'filters':[{
44-
# 'tags':{'+':['incomplete']}
45-
# },
46-
# {
47-
# 'types':{'-':['dicom']}
48-
# }]
49-
# }
50-
# will download files with tag 'incomplete' OR type different from 'dicom'
51-
#
52-
# download_payload = {
53-
# 'optional': True,
54-
# 'nodes': [{'level':'project', '_id':project_id}],
55-
# 'filters':[{
56-
# 'tags':{'+':['incomplete']},
57-
# 'types':{'+':['dicom']}
58-
# }]
59-
# }
60-
# will download only files with tag 'incomplete' AND type different from 'dicom'
6135
filtered = True
6236
for filter_ in filters:
6337
type_as_list = [f['type']] if f.get('type') else []
@@ -332,6 +306,34 @@ def _symlinkarchivestream(self, ticket, data_path):
332306

333307

334308
def download(self):
309+
"""
310+
In downloads we use filters in the payload to exclude/include files.
311+
To pass a single filter, each of its conditions should be satisfied.
312+
If a file pass at least one filter, it is included in the targets.
313+
For example:
314+
315+
download_payload = {
316+
'optional': True,
317+
'nodes': [{'level':'project', '_id':project_id}],
318+
'filters':[{
319+
'tags':{'+':['incomplete']}
320+
},
321+
{
322+
'types':{'-':['dicom']}
323+
}]
324+
}
325+
will download files with tag 'incomplete' OR type different from 'dicom'
326+
327+
download_payload = {
328+
'optional': True,
329+
'nodes': [{'level':'project', '_id':project_id}],
330+
'filters':[{
331+
'tags':{'+':['incomplete']},
332+
'types':{'+':['dicom']}
333+
}]
334+
}
335+
will download only files with tag 'incomplete' AND type different from 'dicom'
336+
"""
335337
ticket_id = self.get_param('ticket')
336338
if ticket_id:
337339
ticket = config.db.downloads.find_one({'_id': ticket_id})

0 commit comments

Comments
 (0)