-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cloud Healthcare API alpha HL7v2 samples and tests (#1805)
- Loading branch information
Showing
8 changed files
with
1,316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
.. This file is automatically generated. Do not edit this file directly. | ||
Cloud Healthcare API Python Samples | ||
=============================================================================== | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
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. | ||
- See the `migration guide`_ for information about migrating to Python client library v0.25.1. | ||
|
||
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration | ||
|
||
|
||
|
||
|
||
.. _Cloud Healthcare API: https://cloud.google.com/healthcare/docs | ||
|
||
Setup | ||
------------------------------------------------------------------------------- | ||
|
||
|
||
Authentication | ||
++++++++++++++ | ||
|
||
This sample requires you to have authentication setup. Refer to the | ||
`Authentication Getting Started Guide`_ for instructions on setting up | ||
credentials for applications. | ||
|
||
.. _Authentication Getting Started Guide: | ||
https://cloud.google.com/docs/authentication/getting-started | ||
|
||
Authentication | ||
++++++++++++++ | ||
|
||
Authentication for this service is done via an `API Key`_. To obtain an API | ||
Key: | ||
|
||
1. Open the `Cloud Platform Console`_ | ||
2. Make sure that billing is enabled for your project. | ||
3. From the **Credentials** page, create a new **API Key** or use an existing | ||
one for your project. | ||
|
||
.. _API Key: | ||
https://developers.google.com/api-client-library/python/guide/aaa_apikeys | ||
.. _Cloud Console: https://console.cloud.google.com/project?_ | ||
|
||
Install Dependencies | ||
++++++++++++++++++++ | ||
|
||
#. Clone python-docs-samples and change directory to the sample directory you want to use. | ||
|
||
.. code-block:: bash | ||
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git | ||
#. 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. | ||
|
||
.. _Python Development Environment Setup Guide: | ||
https://cloud.google.com/python/setup | ||
|
||
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. | ||
|
||
.. code-block:: bash | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
#. Install the dependencies needed to run the samples. | ||
|
||
.. code-block:: bash | ||
$ pip install -r requirements.txt | ||
.. _pip: https://pip.pypa.io/ | ||
.. _virtualenv: https://virtualenv.pypa.io/ | ||
|
||
Samples | ||
------------------------------------------------------------------------------- | ||
|
||
HL7v2 stores | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python hl7v2_stores.py | ||
usage: hl7v2_stores.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON] | ||
[--api_key API_KEY] [--project_id PROJECT_ID] | ||
[--cloud_region CLOUD_REGION] [--dataset_id DATASET_ID] | ||
[--hl7v2_store_id HL7V2_STORE_ID] | ||
[--pubsub_topic PUBSUB_TOPIC] | ||
{create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store} | ||
... | ||
positional arguments: | ||
{create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store} | ||
create-hl7v2-store Creates a new HL7v2 store within the parent dataset. | ||
delete-hl7v2-store Deletes the specified HL7v2 store. | ||
get-hl7v2-store Gets the specified HL7v2 store. | ||
list-hl7v2-stores Lists the HL7v2 stores in the given dataset. | ||
patch-hl7v2-store Updates the HL7v2 store. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
--service_account_json SERVICE_ACCOUNT_JSON | ||
Path to service account JSON file. | ||
--api_key API_KEY Your API key. | ||
--project_id PROJECT_ID | ||
GCP project name | ||
--cloud_region CLOUD_REGION | ||
GCP region | ||
--dataset_id DATASET_ID | ||
Name of dataset | ||
--hl7v2_store_id HL7V2_STORE_ID | ||
Name of HL7v2 store | ||
--pubsub_topic PUBSUB_TOPIC | ||
The Cloud Pub/Sub topic where notifications of changes | ||
are published | ||
HL7v2 messages | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
: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 | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python hl7v2_messages.py | ||
usage: hl7v2_messages.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON] | ||
[--api_key API_KEY] [--project_id PROJECT_ID] | ||
[--cloud_region CLOUD_REGION] | ||
[--dataset_id DATASET_ID] | ||
[--hl7v2_store_id HL7V2_STORE_ID] | ||
[--hl7v2_message_file HL7V2_MESSAGE_FILE] | ||
[--hl7v2_message_id HL7V2_MESSAGE_ID] | ||
[--label_key LABEL_KEY] [--label_value LABEL_VALUE] | ||
{create-hl7v2-message,delete-hl7v2-message,get-hl7v2-message,ingest-hl7v2-message,list-hl7v2-messages,patch-hl7v2-message} | ||
... | ||
positional arguments: | ||
{create-hl7v2-message,delete-hl7v2-message,get-hl7v2-message,ingest-hl7v2-message,list-hl7v2-messages,patch-hl7v2-message} | ||
create-hl7v2-message | ||
Creates an HL7v2 message and sends a notification to | ||
the Cloud Pub/Sub topic. | ||
delete-hl7v2-message | ||
Deletes an HL7v2 message. | ||
get-hl7v2-message Gets an HL7v2 message. | ||
ingest-hl7v2-message | ||
Ingests a new HL7v2 message from the hospital and | ||
sends a notification to the Cloud Pub/Sub topic. | ||
Return is an HL7v2 ACK message if the message was | ||
successfully stored. | ||
list-hl7v2-messages | ||
Lists all the messages in the given HL7v2 store with | ||
support for filtering. | ||
patch-hl7v2-message | ||
Updates the message. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
--service_account_json SERVICE_ACCOUNT_JSON | ||
Path to service account JSON file. | ||
--api_key API_KEY Your API key. | ||
--project_id PROJECT_ID | ||
GCP project name | ||
--cloud_region CLOUD_REGION | ||
GCP region | ||
--dataset_id DATASET_ID | ||
Name of dataset | ||
--hl7v2_store_id HL7V2_STORE_ID | ||
Name of HL7v2 store | ||
--hl7v2_message_file HL7V2_MESSAGE_FILE | ||
A file containing a base64-encoded HL7v2 message | ||
--hl7v2_message_id HL7V2_MESSAGE_ID | ||
The identifier for the message returned by the server | ||
--label_key LABEL_KEY | ||
Arbitrary label key to apply to the message | ||
--label_value LABEL_VALUE | ||
Arbitrary label value to apply to the message | ||
The client library | ||
------------------------------------------------------------------------------- | ||
This sample uses the `Google Cloud Client Library for Python`_. | ||
You can read the documentation for more details on API usage and use GitHub | ||
to `browse the source`_ and `report issues`_. | ||
.. _Google Cloud Client Library for Python: | ||
https://googlecloudplatform.github.io/google-cloud-python/ | ||
.. _browse the source: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python | ||
.. _report issues: | ||
https://github.com/GoogleCloudPlatform/google-cloud-python/issues | ||
.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file is used to generate README.rst | ||
|
||
product: | ||
name: Cloud Healthcare API | ||
short_name: Healthcare API | ||
url: https://cloud.google.com/healthcare/docs | ||
description: > | ||
`Cloud Healthcare API`_ implements healthcare-native protocols and formats | ||
to accelerate ingestion, storage, analysis, and integration of healthcare | ||
data with cloud-based applications. | ||
|
||
- See the `migration guide`_ for information about migrating to Python client library v0.25.1. | ||
|
||
|
||
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration | ||
|
||
setup: | ||
- auth | ||
- auth_api_key | ||
- install_deps | ||
|
||
samples: | ||
- name: HL7v2 stores | ||
file: hl7v2_stores.py | ||
show_help: True | ||
|
||
- name: HL7v2 messages | ||
file: hl7v2_messages.py | ||
show_help: True | ||
|
||
cloud_client_library: true | ||
|
||
folder: healthcare/api-client/hl7v2 |
Oops, something went wrong.