You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/07/23 16:53:07 UTC
[GitHub] [beam] George-Wu commented on a change in pull request #12331: DICOM api beam adapter draft pr
George-Wu commented on a change in pull request #12331:
URL: https://github.com/apache/beam/pull/12331#discussion_r459590786
##########
File path: sdks/python/apache_beam/io/gcp/dicomio.py
##########
@@ -248,31 +268,31 @@ def __init__(self, destination_dict, credential=None):
self.destination_dict = destination_dict
def expand(self, pcoll):
- return pcoll | beam.ParDo(StoreInstanceBytes(self.destination_dict, self.credential))
+ return pcoll | beam.ParDo(
+ StoreInstanceBytes(self.destination_dict, self.credential))
class StoreInstanceBytes(beam.DoFn):
"""A DoFn execute every file input."""
Review comment:
Examples and more comments added
##########
File path: sdks/python/apache_beam/io/gcp/dicomio.py
##########
@@ -157,27 +172,33 @@ class ConvertPubsubToQido(beam.DoFn):
def process(self, element):
# Check if all required keys present.
required_keys = [
- 'projects', 'locations', 'datasets', 'dicomStores', 'dicomWeb',
- 'studies', 'series', 'instances'
- ]
-
+ 'projects',
+ 'locations',
+ 'datasets',
+ 'dicomStores',
+ 'dicomWeb',
+ 'studies',
+ 'series',
+ 'instances'
+ ]
+
entries = element.split('/')
valid = True
-
+
if len(entries) != 15:
valid = False
-
+
if valid:
# check if the position of keys are correct
for i in range(5):
- if required_keys[i] != entries[i*2]:
- valid = False
- break
- for i in range(5,8):
- if required_keys[i] != entries[i*2 - 1]:
- valid = False
- break
-
+ if required_keys[i] != entries[i * 2]:
+ valid = False
+ break
+ for i in range(5, 8):
+ if required_keys[i] != entries[i * 2 - 1]:
+ valid = False
+ break
+
Review comment:
magic numbers removed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org