Skip to content

Commit d31d930

Browse files
noerogchenyumic
authored andcommitted
Cloud Healthcare API alpha HL7v2 samples and tests (#1805)
1 parent a3c9a24 commit d31d930

File tree

8 files changed

+1316
-0
lines changed

8 files changed

+1316
-0
lines changed
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
.. This file is automatically generated. Do not edit this file directly.
2+
3+
Cloud Healthcare API Python Samples
4+
===============================================================================
5+
6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=healthcare/api-client/hl7v2/README.rst
8+
9+
10+
This directory contains samples for Cloud Healthcare API. `Cloud Healthcare API`_ implements healthcare-native protocols and formats to accelerate ingestion, storage, analysis, and integration of healthcare data with cloud-based applications.
11+
- See the `migration guide`_ for information about migrating to Python client library v0.25.1.
12+
13+
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration
14+
15+
16+
17+
18+
.. _Cloud Healthcare API: https://cloud.google.com/healthcare/docs
19+
20+
Setup
21+
-------------------------------------------------------------------------------
22+
23+
24+
Authentication
25+
++++++++++++++
26+
27+
This sample requires you to have authentication setup. Refer to the
28+
`Authentication Getting Started Guide`_ for instructions on setting up
29+
credentials for applications.
30+
31+
.. _Authentication Getting Started Guide:
32+
https://cloud.google.com/docs/authentication/getting-started
33+
34+
Authentication
35+
++++++++++++++
36+
37+
Authentication for this service is done via an `API Key`_. To obtain an API
38+
Key:
39+
40+
1. Open the `Cloud Platform Console`_
41+
2. Make sure that billing is enabled for your project.
42+
3. From the **Credentials** page, create a new **API Key** or use an existing
43+
one for your project.
44+
45+
.. _API Key:
46+
https://developers.google.com/api-client-library/python/guide/aaa_apikeys
47+
.. _Cloud Console: https://console.cloud.google.com/project?_
48+
49+
Install Dependencies
50+
++++++++++++++++++++
51+
52+
#. Clone python-docs-samples and change directory to the sample directory you want to use.
53+
54+
.. code-block:: bash
55+
56+
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
57+
58+
#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.
59+
60+
.. _Python Development Environment Setup Guide:
61+
https://cloud.google.com/python/setup
62+
63+
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
64+
65+
.. code-block:: bash
66+
67+
$ virtualenv env
68+
$ source env/bin/activate
69+
70+
#. Install the dependencies needed to run the samples.
71+
72+
.. code-block:: bash
73+
74+
$ pip install -r requirements.txt
75+
76+
.. _pip: https://pip.pypa.io/
77+
.. _virtualenv: https://virtualenv.pypa.io/
78+
79+
Samples
80+
-------------------------------------------------------------------------------
81+
82+
HL7v2 stores
83+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
84+
85+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
86+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=healthcare/api-client/hl7v2/hl7v2_stores.py,healthcare/api-client/hl7v2/README.rst
87+
88+
89+
90+
91+
To run this sample:
92+
93+
.. code-block:: bash
94+
95+
$ python hl7v2_stores.py
96+
97+
usage: hl7v2_stores.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON]
98+
[--api_key API_KEY] [--project_id PROJECT_ID]
99+
[--cloud_region CLOUD_REGION] [--dataset_id DATASET_ID]
100+
[--hl7v2_store_id HL7V2_STORE_ID]
101+
[--pubsub_topic PUBSUB_TOPIC]
102+
{create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store}
103+
...
104+
105+
positional arguments:
106+
{create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store}
107+
create-hl7v2-store Creates a new HL7v2 store within the parent dataset.
108+
delete-hl7v2-store Deletes the specified HL7v2 store.
109+
get-hl7v2-store Gets the specified HL7v2 store.
110+
list-hl7v2-stores Lists the HL7v2 stores in the given dataset.
111+
patch-hl7v2-store Updates the HL7v2 store.
112+
113+
optional arguments:
114+
-h, --help show this help message and exit
115+
--service_account_json SERVICE_ACCOUNT_JSON
116+
Path to service account JSON file.
117+
--api_key API_KEY Your API key.
118+
--project_id PROJECT_ID
119+
GCP project name
120+
--cloud_region CLOUD_REGION
121+
GCP region
122+
--dataset_id DATASET_ID
123+
Name of dataset
124+
--hl7v2_store_id HL7V2_STORE_ID
125+
Name of HL7v2 store
126+
--pubsub_topic PUBSUB_TOPIC
127+
The Cloud Pub/Sub topic where notifications of changes
128+
are published
129+
130+
131+
132+
HL7v2 messages
133+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
134+
135+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
136+
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=healthcare/api-client/hl7v2/hl7v2_messages.py,healthcare/api-client/hl7v2/README.rst
137+
138+
139+
140+
141+
To run this sample:
142+
143+
.. code-block:: bash
144+
145+
$ python hl7v2_messages.py
146+
147+
usage: hl7v2_messages.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON]
148+
[--api_key API_KEY] [--project_id PROJECT_ID]
149+
[--cloud_region CLOUD_REGION]
150+
[--dataset_id DATASET_ID]
151+
[--hl7v2_store_id HL7V2_STORE_ID]
152+
[--hl7v2_message_file HL7V2_MESSAGE_FILE]
153+
[--hl7v2_message_id HL7V2_MESSAGE_ID]
154+
[--label_key LABEL_KEY] [--label_value LABEL_VALUE]
155+
{create-hl7v2-message,delete-hl7v2-message,get-hl7v2-message,ingest-hl7v2-message,list-hl7v2-messages,patch-hl7v2-message}
156+
...
157+
158+
positional arguments:
159+
{create-hl7v2-message,delete-hl7v2-message,get-hl7v2-message,ingest-hl7v2-message,list-hl7v2-messages,patch-hl7v2-message}
160+
create-hl7v2-message
161+
Creates an HL7v2 message and sends a notification to
162+
the Cloud Pub/Sub topic.
163+
delete-hl7v2-message
164+
Deletes an HL7v2 message.
165+
get-hl7v2-message Gets an HL7v2 message.
166+
ingest-hl7v2-message
167+
Ingests a new HL7v2 message from the hospital and
168+
sends a notification to the Cloud Pub/Sub topic.
169+
Return is an HL7v2 ACK message if the message was
170+
successfully stored.
171+
list-hl7v2-messages
172+
Lists all the messages in the given HL7v2 store with
173+
support for filtering.
174+
patch-hl7v2-message
175+
Updates the message.
176+
177+
optional arguments:
178+
-h, --help show this help message and exit
179+
--service_account_json SERVICE_ACCOUNT_JSON
180+
Path to service account JSON file.
181+
--api_key API_KEY Your API key.
182+
--project_id PROJECT_ID
183+
GCP project name
184+
--cloud_region CLOUD_REGION
185+
GCP region
186+
--dataset_id DATASET_ID
187+
Name of dataset
188+
--hl7v2_store_id HL7V2_STORE_ID
189+
Name of HL7v2 store
190+
--hl7v2_message_file HL7V2_MESSAGE_FILE
191+
A file containing a base64-encoded HL7v2 message
192+
--hl7v2_message_id HL7V2_MESSAGE_ID
193+
The identifier for the message returned by the server
194+
--label_key LABEL_KEY
195+
Arbitrary label key to apply to the message
196+
--label_value LABEL_VALUE
197+
Arbitrary label value to apply to the message
198+
199+
200+
201+
202+
203+
The client library
204+
-------------------------------------------------------------------------------
205+
206+
This sample uses the `Google Cloud Client Library for Python`_.
207+
You can read the documentation for more details on API usage and use GitHub
208+
to `browse the source`_ and `report issues`_.
209+
210+
.. _Google Cloud Client Library for Python:
211+
https://googlecloudplatform.github.io/google-cloud-python/
212+
.. _browse the source:
213+
https://github.com/GoogleCloudPlatform/google-cloud-python
214+
.. _report issues:
215+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
216+
217+
218+
.. _Google Cloud SDK: https://cloud.google.com/sdk/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file is used to generate README.rst
2+
3+
product:
4+
name: Cloud Healthcare API
5+
short_name: Healthcare API
6+
url: https://cloud.google.com/healthcare/docs
7+
description: >
8+
`Cloud Healthcare API`_ implements healthcare-native protocols and formats
9+
to accelerate ingestion, storage, analysis, and integration of healthcare
10+
data with cloud-based applications.
11+
12+
- See the `migration guide`_ for information about migrating to Python client library v0.25.1.
13+
14+
15+
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration
16+
17+
setup:
18+
- auth
19+
- auth_api_key
20+
- install_deps
21+
22+
samples:
23+
- name: HL7v2 stores
24+
file: hl7v2_stores.py
25+
show_help: True
26+
27+
- name: HL7v2 messages
28+
file: hl7v2_messages.py
29+
show_help: True
30+
31+
cloud_client_library: true
32+
33+
folder: healthcare/api-client/hl7v2

0 commit comments

Comments
 (0)