Skip to content

Commit bfd5d07

Browse files
noerogchenyumic
authored and
chenyumic
committed
Add CHC API alpha datasets and FHIR samples and tests. (#1783)
* Add CHC API datasets samples and tests. * Add CHC API alpha FHIR samples and tests * Fix lint error. ./fhir_resources.py:330:80: E501 line too long (91 > 79 characters) resource_path = '{}/datasets/{}/fhirStores/{}/resources/Patient/{}/$everything'.format( * Fix lint errors. ./fhir_resources_test.py:22:1: E402 module level import not at top of file import datasets ^ ./fhir_resources_test.py:23:1: E402 module level import not at top of file import fhir_stores ^ ./fhir_resources_test.py:24:1: E402 module level import not at top of file import fhir_resources ^ * Fix lint errors. ./fhir_stores.py:85:80: E501 line too long (82 > 79 characters) fhir_store_name = 'projects/{}/locations/{}/datasets/{}/fhirStores/{}'.format( ^ ./fhir_stores.py:111:80: E501 line too long (82 > 79 characters) fhir_store_name = 'projects/{}/locations/{}/datasets/{}/fhirStores/{}'.format( ^ ./fhir_stores.py:340:5: E303 too many blank lines (2) command = parser.add_subparsers(dest='command') ^ ./fhir_stores.py:347:80: E501 line too long (81 > 79 characters) command.add_parser('export-fhir-resource', help=import_fhir_resource.__doc__) ^ ./fhir_stores.py:348:80: E501 line too long (81 > 79 characters) command.add_parser('import-fhir-resource', help=export_fhir_resource.__doc__) ^ ./fhir_stores.py:349:1: W293 blank line contains whitespace * Fix lint errors. ./fhir_stores_test.py:22:1: E402 module level import not at top of file import datasets ^ ./fhir_stores_test.py:23:1: E402 module level import not at top of file import fhir_stores * Remove blank line. * Remove blank line. * Remove blank line. * Remove blank line.
1 parent cce955f commit bfd5d07

12 files changed

+2228
-0
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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/datasets/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+
Datasets
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/datasets/datasets.py,healthcare/api-client/datasets/README.rst
87+
88+
89+
90+
91+
To run this sample:
92+
93+
.. code-block:: bash
94+
95+
$ python datasets.py
96+
97+
usage: datasets.py [-h] --service_account_json SERVICE_ACCOUNT_JSON --api_key
98+
API_KEY --project_id PROJECT_ID --cloud_region CLOUD_REGION
99+
--dataset_id DATASET_ID [--time_zone TIME_ZONE]
100+
[--destination_dataset_id DESTINATION_DATASET_ID]
101+
[--whitelist_tags WHITELIST_TAGS]
102+
{create-dataset,delete-dataset,get-dataset,list-datasets,patch-dataset,deidentify-dataset}
103+
...
104+
105+
positional arguments:
106+
{create-dataset,delete-dataset,get-dataset,list-datasets,patch-dataset,deidentify-dataset}
107+
create-dataset Creates a dataset.
108+
delete-dataset Deletes a dataset.
109+
get-dataset Gets any metadata associated with a dataset.
110+
list-datasets Lists the datasets in the project.
111+
patch-dataset Updates dataset metadata.
112+
deidentify-dataset Creates a new dataset containing de-identified data
113+
from the source dataset.
114+
115+
optional arguments:
116+
-h, --help show this help message and exit
117+
--service_account_json SERVICE_ACCOUNT_JSON
118+
Path to service account JSON file.
119+
--api_key API_KEY Your API key.
120+
--project_id PROJECT_ID
121+
GCP project name
122+
--cloud_region CLOUD_REGION
123+
GCP cloud region
124+
--dataset_id DATASET_ID
125+
Name of dataset
126+
--time_zone TIME_ZONE
127+
The default timezone used by a dataset
128+
--destination_dataset_id DESTINATION_DATASET_ID
129+
The name of the new dataset where the de-identified
130+
data will be written
131+
--whitelist_tags WHITELIST_TAGS
132+
The data to whitelist, for example "PatientID" or
133+
"StudyInstanceUID"
134+
135+
136+
137+
138+
139+
The client library
140+
-------------------------------------------------------------------------------
141+
142+
This sample uses the `Google Cloud Client Library for Python`_.
143+
You can read the documentation for more details on API usage and use GitHub
144+
to `browse the source`_ and `report issues`_.
145+
146+
.. _Google Cloud Client Library for Python:
147+
https://googlecloudplatform.github.io/google-cloud-python/
148+
.. _browse the source:
149+
https://github.com/GoogleCloudPlatform/google-cloud-python
150+
.. _report issues:
151+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
152+
153+
154+
.. _Google Cloud SDK: https://cloud.google.com/sdk/
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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: Datasets
24+
file: datasets.py
25+
show_help: True
26+
27+
cloud_client_library: true
28+
29+
folder: healthcare/api-client/datasets

0 commit comments

Comments
 (0)