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

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

                Author: ASF GitHub Bot
            Created on: 13/Mar/20 19:21
            Start Date: 13/Mar/20 19:21
    Worklog Time Spent: 10m 
      Work Description: jaketf commented on pull request #11107: [BEAM-9468] 
[WIP] add HL7v2IO and FhirIO
URL: https://github.com/apache/beam/pull/11107#discussion_r392424941
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FetchHL7v2Message.java
 ##########
 @@ -0,0 +1,95 @@
+/*
+ * 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 com.google.api.services.healthcare.v1alpha2.model.Message;
+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.TupleTag;
+import org.apache.beam.sdk.values.TupleTagList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * DoFn to fetch a message from an Google Cloud Healthcare HL7v2 store based 
on msgID
+ *
+ * <p>This DoFn consumes a {@link PCollection<String>} of notifications from 
the HL7v2 store, and
+ * fetches the actual {@link Message} object based on the id in the 
notification and will output a
+ * {@link PCollectionTuple} which contains the output and dead-letter {@link 
PCollection}.
+ *
+ * <p>The {@link PCollectionTuple} output will contain the following {@link 
PCollection}:
+ *
+ * <ul>
+ *   <li>{@link FetchHL7v2Message#OUT} - Contains all {@link FailsafeElement} 
records successfully
+ *       read from the HL7v2 store.
+ *   <li>{@link FetchHL7v2Message#DEAD_LETTER} - Contains all {@link 
FailsafeElement} records which
+ *       failed to be fetched from the HL7v2 store, with error message and 
stacktrace.
+ * </ul>
+ *
+ * <p>Example:
+ *
+ * <pre>{@code
+ * PipelineOptions options = ...;
+ * Pipeline pipeline = Pipeline.create(options)
+ *
+ * PCollection<String> msgIDs = pipeline.apply(
+ *    "ReadHL7v2Notifications",
+ *    PubsubIO.readStrings().fromSubscription(options.getInputSubscription()));
+ *
+ * PCollectionTuple fetchResults = msgIDs.apply(
+ *    "FetchHL7v2Messages",
+ *    new FetchHL7v2Message;
+ *
+ * // Write errors to your favorite dead letter  queue (e.g. Pub/Sub, GCS, 
BigQuery)
+ * fetchResults.get(PubsubNotificationToHL7v2Message.DEAD_LETTER)
+ *    .apply("WriteToDeadLetterQueue", ...);
+ *
+ * PCollection<Message> fetchedMessages = 
fetchResults.get(PubsubNotificationToHL7v2Message.OUT)
+ *    .apply("ExtractFetchedMessage",
+ *    MapElements
+ *        .into(TypeDescriptor.of(Message.class))
+ *        .via(FailsafeElement::getPayload));
+ *
+ * // Go about your happy path transformations.
+ * fetchedMessages.apply("ProcessFetchedMessages", ...)
+ *
+ * }***
+ * </pre>
+ */
+public class FetchHL7v2Message extends PTransform<PCollection<String>, 
PCollectionTuple> {
 
 Review comment:
   Totally Agreed. This is why I elected to use adaptive throttling in the 
HL7MessageGetFn.
 
----------------------------------------------------------------
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: 403103)
    Time Spent: 50m  (was: 40m)

> Add Google Cloud Healthcare API IO Connectors
> ---------------------------------------------
>
>                 Key: BEAM-9468
>                 URL: https://issues.apache.org/jira/browse/BEAM-9468
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-java-gcp
>            Reporter: Jacob Ferriero
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Add IO Transforms for the HL7v2, FHIR and DICOM stores in the [Google Cloud 
> Healthcare API|https://cloud.google.com/healthcare/docs/]
> HL7v2IO
> FHIRIO
> DICOMĀ 



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

Reply via email to