devanshmodi commented on code in PR #28873:
URL: https://github.com/apache/beam/pull/28873#discussion_r1367387084
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,504 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "include_colab_link": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "view-in-github",
+ "colab_type": "text"
+ },
+ "source": [
+ "<a
href=\"https://colab.research.google.com/github/devanshmodi/beam/blob/devanshmodi-patch-healthcare-hl7-to-hcapi/examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb\"
target=\"_parent\"><img
src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In
Colab\"/></a>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "zQ_JXPR3RoFV"
+ },
+ "outputs": [],
+ "source": [
+ "# @title ###### Licensed to the Apache Software Foundation (ASF),
Version 2.0 (the \"License\")\n",
+ "\n",
+ "# Licensed to the Apache Software Foundation (ASF) under one\n",
+ "# or more contributor license agreements. See the NOTICE file\n",
+ "# distributed with this work for additional information\n",
+ "# regarding copyright ownership. The ASF licenses this file\n",
+ "# to you under the Apache License, Version 2.0 (the\n",
+ "# \"License\"); you may not use this file except in compliance\n",
+ "# with the License. You may obtain a copy of the License at\n",
+ "#\n",
+ "# http://www.apache.org/licenses/LICENSE-2.0\n",
+ "#\n",
+ "# Unless required by applicable law or agreed to in writing,\n",
+ "# software distributed under the License is distributed on an\n",
+ "# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n",
+ "# KIND, either express or implied. See the License for the\n",
+ "# specific language governing permissions and limitations\n",
+ "# under the License\n",
+ "\n",
+ "##################################\n",
+ "# Author: Devansh Modi #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**Highlevel Architecture**\n",
+ "\n",
+ ""
+ ],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to Google Cloud Healthcare API HL7v2 store
pipeline**\n",
+ "\n",
+ "This example demonstrates how to set up an Apache Beam pipeline that
reads a HL7 file from [Google Cloud
Storage](https://https://cloud.google.com/storage), and calls the [Google Cloud
Healthcare API Hl7v2 store to store Hl7
messages](https://cloud.google.com/healthcare-api/docs/how-tos/hl7v2-messages)
to extract information from unstructured data. This application can be used in
contexts such as reading raw Hl7 messages, if needed parse them or modify them
as per your defined Hl7v2 store configurations and store data into Hl7v2
store.\n",
+ "\n",
+ "An Apache Beam pipeline is a pipeline that reads input data,
transforms that data, and writes output data. It consists of PTransforms and
PCollections. A PCollection represents a distributed data set that your Beam
pipeline operates on. A PTransform represents a data processing operation, or a
step, in your pipeline. It takes one or more PCollections as input, performs a
processing function that you provide on the elements of that PCollection, and
produces zero or more output PCollection objects.\n",
+ "\n",
+ "For details about Apache Beam pipelines, including PTransforms and
PCollections, visit the [Beam Programming
Guide](https://beam.apache.org/documentation/programming-guide/).\n",
+ "\n",
+ "You'll be able to use this notebook to explore the data in each
PCollection."
+ ],
+ "metadata": {
+ "id": "wC9KRrlORwKu"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "***Sample HL7v2 Message***\n",
+ "\n",
+ "The below reference message shows a sample Hl7v2 messages seperated
by \\r.\n",
+ "\n",
+
"**MSH|^~\\&|FROM_APP|FROM_FACILITY|TO_APP|TO_FACILITY|20150503223000||ADT^A01|20150503223000|P|2.5|\\r\n",
+ "EVN|A01|20110613083617|\\r\n",
+ "PID|1||21004053^^^^MRN||SULLY^BRIAN||19611209|M|||123 MAIN
ST^^MOUNTAIN SPRINGS^CO^80439|\\r\n",
+ "PV1||I|H73 RM1^1^^HIGHWAY 73 CLINIC||||5148^MARY
QUINN|||||||||Y||||||||||||||||||||||||||||20150503223000|**\n",
+ "\n",
+ "The file contains many such messages and the objective of this code
will be to split and construct messages and POST it to Google Cloud HealthCare
API HL7v2 store."
+ ],
+ "metadata": {
+ "id": "AOVYgtyaqSxa"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Lets install necessary packages"
+ ],
+ "metadata": {
+ "id": "81wCK9XnS6Sc"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "!pip install apache-beam[gcp]"
+ ],
+ "metadata": {
+ "id": "Yv1phmRZS23c"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**GCP Setup**\n",
Review Comment:
Added the GCP account creation info.
--
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]