Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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

Datasets

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

To run this sample:

$ python datasets.py

usage: datasets.py [-h] --service_account_json SERVICE_ACCOUNT_JSON --api_key
                   API_KEY --project_id PROJECT_ID --cloud_region CLOUD_REGION
                   --dataset_id DATASET_ID [--time_zone TIME_ZONE]
                   [--destination_dataset_id DESTINATION_DATASET_ID]
                   [--whitelist_tags WHITELIST_TAGS]
                   {create-dataset,delete-dataset,get-dataset,list-datasets,patch-dataset,deidentify-dataset}
                   ...

positional arguments:
  {create-dataset,delete-dataset,get-dataset,list-datasets,patch-dataset,deidentify-dataset}
    create-dataset      Creates a dataset.
    delete-dataset      Deletes a dataset.
    get-dataset         Gets any metadata associated with a dataset.
    list-datasets       Lists the datasets in the project.
    patch-dataset       Updates dataset metadata.
    deidentify-dataset  Creates a new dataset containing de-identified data
                        from the source dataset.

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 cloud region
  --dataset_id DATASET_ID
                        Name of dataset
  --time_zone TIME_ZONE
                        The default timezone used by a dataset
  --destination_dataset_id DESTINATION_DATASET_ID
                        The name of the new dataset where the de-identified
                        data will be written
  --whitelist_tags WHITELIST_TAGS
                        The data to whitelist, for example "PatientID" or
                        "StudyInstanceUID"

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.