svetakvsundhar commented on code in PR #28873:
URL: https://github.com/apache/beam/pull/28873#discussion_r1349232568
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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>"
Review Comment:
```suggestion
"<a
href=\"https://colab.research.google.com/github/apache/beam/blob/master/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>"
```
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
Review Comment:
```suggestion
"# Author: Devansh Modi #\n",
```
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI 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": [
+ "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",
+ "1. Authenticate your notebook by `gcloud auth application-default
login` in the Colab terminal.\n",
+ "\n",
+ "2. Run `gcloud config set project <YOUR-PROJECT>`\n",
+ "\n",
+ "Set the variables in the next cell based upon your project and
preferences. The files referred to in this notebook nlpsample*.csv are in the
format with one\n",
+ "blurb of clinical note.\n",
+ "\n",
+ "Note that below, **us-central1** is hardcoded as the location. This
is because of the limited number of
[locations](https://cloud.google.com/healthcare-api/docs/how-tos/hl7v2-messages)
the API currently supports."
+ ],
+ "metadata": {
+ "id": "tpePe_yOsdSJ"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Before running please set the following variables as arguments as
mentioned below\n"
+ ],
+ "metadata": {
+ "id": "_1Q3mw1usnoE"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "args = {'gcp_project':'xxx', #GCP project ID\n",
+ " 'gcp_region':'xxx', # GCP project region\n",
+ " 'temp_location':'gs://<YOUR Bucket>/tmp', #input location
where your HL7 messages are stored in GCS bucket\n",
+ " 'input_file':'gs://<YOUR Bucket>/my_message.hl7', #input
location where your HL7 messages are stored in GCS bucket\n",
+ " 'hcapi_project_id':'xxxxxx', #healthcare API project ID\n",
+ " 'hcapi_dataset':'xxxx', #healthcare dataset\n",
+ " 'hcapi_version':'v1', #healthcare API version by defualt
v1\n",
+ " 'hcapi_location':'xxxx', #healthcare API configured
location\n",
+ " 'hcapi_hl7_store':'xxx', #healthcare api hl7 store\n",
+ " 'hcapi_fhir_store':''}"
+ ],
+ "metadata": {
+ "id": "a722GbqdvgOX"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**HCAPI Utils class**\n",
+ "\n",
+ "Below is the code snippet which describes class having healthcare API
conncetions and configurations. Basic functionality, includes constructing the
hcapi_url as per the input parameters, clean the HL7 message in terms of proper
formatting and post hl7v2 message to hl7v2 store. You can add more
transformations as per your requirements."
Review Comment:
```suggestion
"Below is the code snippet which describes the class having
healthcare API connections and configurations. Basic functionality, includes
constructing the hcapi_url as per the input parameters, clean the HL7 message
in terms of proper formatting and post hl7v2 message to hl7v2 store. You can
add more transformations as per your requirements."
```
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI 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": [
+ "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",
+ "1. Authenticate your notebook by `gcloud auth application-default
login` in the Colab terminal.\n",
+ "\n",
+ "2. Run `gcloud config set project <YOUR-PROJECT>`\n",
+ "\n",
+ "Set the variables in the next cell based upon your project and
preferences. The files referred to in this notebook nlpsample*.csv are in the
format with one\n",
+ "blurb of clinical note.\n",
+ "\n",
+ "Note that below, **us-central1** is hardcoded as the location. This
is because of the limited number of
[locations](https://cloud.google.com/healthcare-api/docs/how-tos/hl7v2-messages)
the API currently supports."
+ ],
+ "metadata": {
+ "id": "tpePe_yOsdSJ"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Before running please set the following variables as arguments as
mentioned below\n"
+ ],
+ "metadata": {
+ "id": "_1Q3mw1usnoE"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "args = {'gcp_project':'xxx', #GCP project ID\n",
+ " 'gcp_region':'xxx', # GCP project region\n",
+ " 'temp_location':'gs://<YOUR Bucket>/tmp', #input location
where your HL7 messages are stored in GCS bucket\n",
+ " 'input_file':'gs://<YOUR Bucket>/my_message.hl7', #input
location where your HL7 messages are stored in GCS bucket\n",
+ " 'hcapi_project_id':'xxxxxx', #healthcare API project ID\n",
+ " 'hcapi_dataset':'xxxx', #healthcare dataset\n",
+ " 'hcapi_version':'v1', #healthcare API version by defualt
v1\n",
+ " 'hcapi_location':'xxxx', #healthcare API configured
location\n",
+ " 'hcapi_hl7_store':'xxx', #healthcare api hl7 store\n",
+ " 'hcapi_fhir_store':''}"
+ ],
+ "metadata": {
+ "id": "a722GbqdvgOX"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**HCAPI Utils class**\n",
+ "\n",
+ "Below is the code snippet which describes class having healthcare API
conncetions and configurations. Basic functionality, includes constructing the
hcapi_url as per the input parameters, clean the HL7 message in terms of proper
formatting and post hl7v2 message to hl7v2 store. You can add more
transformations as per your requirements."
+ ],
+ "metadata": {
+ "id": "NHzk8JIqxQoa"
+ }
+ },
+ {
+ "cell_type": "code",
Review Comment:
Some sort of system diagram may be useful here to convey the point
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI 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": [
+ "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",
+ "1. Authenticate your notebook by `gcloud auth application-default
login` in the Colab terminal.\n",
+ "\n",
+ "2. Run `gcloud config set project <YOUR-PROJECT>`\n",
+ "\n",
+ "Set the variables in the next cell based upon your project and
preferences. The files referred to in this notebook nlpsample*.csv are in the
format with one\n",
+ "blurb of clinical note.\n",
+ "\n",
+ "Note that below, **us-central1** is hardcoded as the location. This
is because of the limited number of
[locations](https://cloud.google.com/healthcare-api/docs/how-tos/hl7v2-messages)
the API currently supports."
+ ],
+ "metadata": {
+ "id": "tpePe_yOsdSJ"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Before running please set the following variables as arguments as
mentioned below\n"
+ ],
+ "metadata": {
+ "id": "_1Q3mw1usnoE"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "args = {'gcp_project':'xxx', #GCP project ID\n",
+ " 'gcp_region':'xxx', # GCP project region\n",
+ " 'temp_location':'gs://<YOUR Bucket>/tmp', #input location
where your HL7 messages are stored in GCS bucket\n",
+ " 'input_file':'gs://<YOUR Bucket>/my_message.hl7', #input
location where your HL7 messages are stored in GCS bucket\n",
+ " 'hcapi_project_id':'xxxxxx', #healthcare API project ID\n",
+ " 'hcapi_dataset':'xxxx', #healthcare dataset\n",
+ " 'hcapi_version':'v1', #healthcare API version by defualt
v1\n",
+ " 'hcapi_location':'xxxx', #healthcare API configured
location\n",
+ " 'hcapi_hl7_store':'xxx', #healthcare api hl7 store\n",
+ " 'hcapi_fhir_store':''}"
+ ],
+ "metadata": {
+ "id": "a722GbqdvgOX"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**HCAPI Utils class**\n",
+ "\n",
+ "Below is the code snippet which describes class having healthcare API
conncetions and configurations. Basic functionality, includes constructing the
hcapi_url as per the input parameters, clean the HL7 message in terms of proper
formatting and post hl7v2 message to hl7v2 store. You can add more
transformations as per your requirements."
+ ],
+ "metadata": {
+ "id": "NHzk8JIqxQoa"
+ }
+ },
+ {
+ "cell_type": "code",
Review Comment:
The following code blocks have a lot of code but very little output. This
may not be a great user experience. Is it possible to break these into multiple
cells, and provide some output so the user could see what is being run, and why
it's significant?
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI 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",
Review Comment:
I think it'd serve as a good user experience to have a brief bit on what an
HL7 file/message is, so that somebody without a healthcare background could
follow.
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI 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": [
+ "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",
+ "1. Authenticate your notebook by `gcloud auth application-default
login` in the Colab terminal.\n",
+ "\n",
+ "2. Run `gcloud config set project <YOUR-PROJECT>`\n",
+ "\n",
+ "Set the variables in the next cell based upon your project and
preferences. The files referred to in this notebook nlpsample*.csv are in the
format with one\n",
Review Comment:
L115-118 are irrelevant to this notebook, right?
##########
examples/notebooks/healthcare/beam_post_hl7_messages_to_hcapi.ipynb:
##########
@@ -0,0 +1,484 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "provenance": [],
+ "private_outputs": true,
+ "toc_visible": true,
+ "authorship_tag": "ABX9TyO1CyOP+QixaUtoDgsgifYl",
+ "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: [email protected] #\n",
+ "##################################\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [],
+ "metadata": {
+ "id": "RL1LDp645ogr"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# **Post Hl7v2 messages to HCAPI HL7v2 store pipeline**\n",
Review Comment:
Can we replace HCAPI with `Google Cloud Healthcare API` in all places in
this notebook?
--
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]