[ 
https://issues.apache.org/jira/browse/BEAM-11073?focusedWorklogId=504838&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504838
 ]

ASF GitHub Bot logged work on BEAM-11073:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Oct/20 17:59
            Start Date: 26/Oct/20 17:59
    Worklog Time Spent: 10m 
      Work Description: poojavenkatram commented on a change in pull request 
#13137:
URL: https://github.com/apache/beam/pull/13137#discussion_r512143891



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/DicomIO.java
##########
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.healthcare;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubMessage;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionTuple;
+import org.apache.beam.sdk.values.PInput;
+import org.apache.beam.sdk.values.POutput;
+import org.apache.beam.sdk.values.PValue;
+import org.apache.beam.sdk.values.TupleTag;
+import org.apache.beam.sdk.values.TupleTagList;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
+
+/**
+ * The DicomIO connectors allows Beam pipelines to make calls to the Dicom API 
of the Google Cloud
+ * Healthcare API: https://cloud.google.com/healthcare/docs/how-tos#dicom-guide
+ */
+public class DicomIO {
+
+  /**
+   * This class makes a call to the retrieve metadata endpoint
+   * 
(https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_metadata).
 It defines a function that can
+   * be used to process a Pubsub message from a DICOM store, read the DICOM 
study path and get the metadata of the
+   * specified study.
+   * You can learn how to configure PubSub messages to be published when an 
instance is
+   * stored by following: 
https://cloud.google.com/healthcare/docs/how-tos/pubsub. The connector
+   * will output a {@link ReadDicomStudyMetadata.Result} which will contain 
metadata of the study
+   * encoded as a json array.
+   */
+  public static class ReadDicomStudyMetadata
+      extends PTransform<PCollection<PubsubMessage>, 
DicomIO.ReadDicomStudyMetadata.Result> {
+
+    public ReadDicomStudyMetadata() {}
+
+    /** TupleTag for the main output. */
+    public static final TupleTag<String> METADATA = new TupleTag<String>() {};
+    /** TupleTag for any error response. */
+    public static final TupleTag<String> ERROR_MESSAGE = new 
TupleTag<String>() {};
+
+    public static class Result implements POutput, PInput {
+      private PCollection<String> readResponse;
+
+      private PCollection<String> failedReads;
+
+      /** Contains both the response and error outputs from the 
transformation. */
+      PCollectionTuple pct;
+
+      /**
+       * Create DicomIO.ReadDicomStudyMetadata.Result form PCollectionTuple 
with OUT and DEAD_LETTER

Review comment:
       from instead of form and change the names here too..

##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/DicomIO.java
##########
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.healthcare;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubMessage;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionTuple;
+import org.apache.beam.sdk.values.PInput;
+import org.apache.beam.sdk.values.POutput;
+import org.apache.beam.sdk.values.PValue;
+import org.apache.beam.sdk.values.TupleTag;
+import org.apache.beam.sdk.values.TupleTagList;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
+
+/**
+ * The DicomIO connectors allows Beam pipelines to make calls to the Dicom API 
of the Google Cloud
+ * Healthcare API: https://cloud.google.com/healthcare/docs/how-tos#dicom-guide
+ */
+public class DicomIO {
+
+  /**
+   * This class makes a call to the retrieve metadata endpoint
+   * 
(https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_metadata).
 It defines a function that can
+   * be used to process a Pubsub message from a DICOM store, read the DICOM 
study path and get the metadata of the
+   * specified study.
+   * You can learn how to configure PubSub messages to be published when an 
instance is
+   * stored by following: 
https://cloud.google.com/healthcare/docs/how-tos/pubsub. The connector
+   * will output a {@link ReadDicomStudyMetadata.Result} which will contain 
metadata of the study
+   * encoded as a json array.
+   */
+  public static class ReadDicomStudyMetadata
+      extends PTransform<PCollection<PubsubMessage>, 
DicomIO.ReadDicomStudyMetadata.Result> {
+
+    public ReadDicomStudyMetadata() {}
+
+    /** TupleTag for the main output. */
+    public static final TupleTag<String> METADATA = new TupleTag<String>() {};
+    /** TupleTag for any error response. */
+    public static final TupleTag<String> ERROR_MESSAGE = new 
TupleTag<String>() {};
+
+    public static class Result implements POutput, PInput {
+      private PCollection<String> readResponse;
+
+      private PCollection<String> failedReads;
+
+      /** Contains both the response and error outputs from the 
transformation. */
+      PCollectionTuple pct;
+
+      /**
+       * Create DicomIO.ReadDicomStudyMetadata.Result form PCollectionTuple 
with OUT and DEAD_LETTER
+       * tags.
+       *
+       * @param pct the pct

Review comment:
       the PcollectionTuple which contains the response

##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HttpHealthcareApiClient.java
##########
@@ -196,6 +197,69 @@ public Empty deleteFhirStore(String name) throws 
IOException {
     return 
client.projects().locations().datasets().fhirStores().delete(name).execute();
   }
 
+  @Override
+  public String retrieveDicomStudyMetadata(String dicomWebPath) throws 
IOException {
+    String[] webPathSplit;
+    webPathSplit = dicomWebPath.split("/dicomWeb/");
+    if (webPathSplit.length != 2) {
+      throw new IOException("Invalid Web Path");
+    }
+
+    String dicomStorePath = webPathSplit[0];
+
+    String[] searchParameters;
+    searchParameters = webPathSplit[1].split("/");
+    if (searchParameters.length < 2) {
+      throw new IOException("Invalid Web Path");

Review comment:
       invalid DICOM web path




----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 504838)
    Time Spent: 1h 50m  (was: 1h 40m)

> GCP HCLS Api - Dicom IO Connector for Java
> ------------------------------------------
>
>                 Key: BEAM-11073
>                 URL: https://issues.apache.org/jira/browse/BEAM-11073
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-java-gcp
>            Reporter: Aliraza Nagamia
>            Assignee: Aliraza Nagamia
>            Priority: P2
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> We are looking to create a new Java Pipeline Connector to help facilitate 
> Reading data from the Imaging API in GCP. Initially, this connector will be 
> used to read study level metadata of Dicom instances.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to