Skip to content

Latest commit

 

History

History
 
 

Cloud Healthcare API Python Samples

https://gstatic.com/cloudssh/images/open-btn.png

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.

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.

Install Dependencies

  1. Clone python-docs-samples and change directory to the sample directory you want to use.

    $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
  2. 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.

  3. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

    $ virtualenv env
    $ source env/bin/activate
  4. Install the dependencies needed to run the samples.

    $ pip install -r requirements.txt

Samples

HL7v2 stores

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python hl7v2_stores.py

usage: hl7v2_stores.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON]
                       [--project_id PROJECT_ID] [--cloud_region CLOUD_REGION]
                       [--dataset_id DATASET_ID]
                       [--hl7v2_store_id HL7V2_STORE_ID]
                       [--pubsub_topic PUBSUB_TOPIC] [--member MEMBER]
                       [--role ROLE]
                       {create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store,get_iam_policy,set_iam_policy}
                       ...

positional arguments:
  {create-hl7v2-store,delete-hl7v2-store,get-hl7v2-store,list-hl7v2-stores,patch-hl7v2-store,get_iam_policy,set_iam_policy}
    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.
    get_iam_policy      Gets the IAM policy for the specified hl7v2 store.
    set_iam_policy      Sets the IAM policy for the specified hl7v2 store. A
                        single member will be assigned a single role. A member
                        can be any of: - allUsers, that is, anyone -
                        allAuthenticatedUsers, anyone authenticated with a
                        Google account - user:email, as in
                        'user:[email protected]' - group:email, as in
                        'group:[email protected]' - domain:domainname, as in
                        'domain:example.com' - serviceAccount:email, as in
                        'serviceAccount:my-other-
                        [email protected]' A role can be any IAM
                        role, such as 'roles/viewer', 'roles/owner', or
                        'roles/editor'

optional arguments:
  -h, --help            show this help message and exit
  --service_account_json SERVICE_ACCOUNT_JSON
                        Path to service account JSON file.
  --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
  --member MEMBER       Member to add to IAM policy (e.g.
                        "domain:example.com")
  --role ROLE           IAM Role to give to member (e.g. "roles/viewer")

HL7v2 messages

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python hl7v2_messages.py

usage: hl7v2_messages.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON]
                         [--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.
  --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.