Skip to content

Latest commit

 

History

History
 
 

README.rst

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.

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.

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

DICOM stores

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

To run this sample:

$ python dicom_stores.py

usage: dicom_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]
                       [--dicom_store_id DICOM_STORE_ID]
                       [--pubsub_topic PUBSUB_TOPIC] [--uri_prefix URI_PREFIX]
                       [--content_uri CONTENT_URI]
                       [--export_format {FORMAT_UNSPECIFIED,DICOM,JSON_BIGQUERY_IMPORT}]
                       {create-dicom-store,delete-dicom-store,get-dicom-store,list-dicom-stores,patch-dicom-store,export-dicom-store,import-dicom-store}
                       ...

positional arguments:
  {create-dicom-store,delete-dicom-store,get-dicom-store,list-dicom-stores,patch-dicom-store,export-dicom-store,import-dicom-store}
    create-dicom-store  Creates a new DICOM store within the parent dataset.
    delete-dicom-store  Deletes the specified DICOM store.
    get-dicom-store     Gets the specified DICOM store.
    list-dicom-stores   Lists the DICOM stores in the given dataset.
    patch-dicom-store   Updates the DICOM store.
    export-dicom-store  Export data to a Google Cloud Storage bucket by
                        copying it from the DICOM store.
    import-dicom-store  Import data into the DICOM store by copying it from
                        the specified source.

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
  --dicom_store_id DICOM_STORE_ID
                        Name of DICOM store
  --pubsub_topic PUBSUB_TOPIC
                        The Cloud Pub/Sub topic that notifications of changes
                        are published on
  --uri_prefix URI_PREFIX
                        URI for a Google Cloud Storage directory to which
                        result filesshould be written (e.g., "bucket-
                        id/path/to/destination/dir").
  --content_uri CONTENT_URI
                        URI for a Google Cloud Storage directory from which
                        filesshould be imported (e.g., "bucket-
                        id/path/to/destination/dir").
  --export_format {FORMAT_UNSPECIFIED,DICOM,JSON_BIGQUERY_IMPORT}
                        Specifies the output format. If the format is
                        unspecified, thedefault functionality is to export to
                        DICOM.

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.