fbeevikm commented on code in PR #17741:
URL: https://github.com/apache/beam/pull/17741#discussion_r883955069
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java:
##########
@@ -1524,6 +1548,101 @@ private int parseBundleStatus(String status) {
}
}
+ /**
+ * ExecuteBundlesResult contains both successfully executed bundles and
information help debugging
+ * failed executions (eg metadata & error msgs).
+ */
+ public static class ExecuteBundlesResult extends Write.AbstractResult {
+ private final Pipeline pipeline;
+ private final PCollection<FhirBundleResponse> successfulBundles;
+ private final PCollection<HealthcareIOError<FhirBundleResponse>>
failedBundles;
+
+ private ExecuteBundlesResult(
+ Pipeline pipeline,
+ PCollection<FhirBundleResponse> successfulBundles,
+ PCollection<HealthcareIOError<FhirBundleResponse>> failedBundles) {
+ this.pipeline = pipeline;
+ this.successfulBundles = successfulBundles;
+ this.failedBundles = failedBundles;
+ }
+
+ /**
+ * Entry point for the ExecuteBundlesResult, storing the successful and
failed bundles and their
+ * metadata.
+ */
+ public static ExecuteBundlesResult in(
+ Pipeline pipeline,
+ PCollection<FhirBundleResponse> successfulBundles,
+ PCollection<HealthcareIOError<FhirBundleResponse>> failedBundles) {
+ return new ExecuteBundlesResult(pipeline, successfulBundles,
failedBundles);
+ }
+
+ @Override
+ public PCollection<String> getSuccessfulBodies() {
+ return this.successfulBundles.apply(
+ MapElements.into(TypeDescriptors.strings())
+ .via(bundleResponse ->
bundleResponse.getFhirBundleParameter().getBundle()));
Review Comment:
done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]