Skip to content

Commit 079d59c

Browse files
authored
healthcare API: update all FHIR v1beta1 samples to v1 (#3384)
* healthcare API: update all FHIR v1beta1 samples to v1 * update FHIR v1beta1 samples to v1 * minor fixes, remove requests package from requirements.txt * try adding oauth2client to requirements.txt for tests * fix lint * additional methods/cleanup for FHIR v1 * use backoff for tests, go back to using requests session for FHIR resource operations * fix lint * fix failing tests * address review comments * fix lint * fix failures * address review comments * remove some print lines * address review comments
1 parent 3582b12 commit 079d59c

File tree

10 files changed

+2141
-0
lines changed

10 files changed

+2141
-0
lines changed
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
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/fhir/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+
Install Dependencies
35+
++++++++++++++++++++
36+
37+
#. Clone python-docs-samples and change directory to the sample directory you want to use.
38+
39+
.. code-block:: bash
40+
41+
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
42+
43+
#. 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.
44+
45+
.. _Python Development Environment Setup Guide:
46+
https://cloud.google.com/python/setup
47+
48+
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
49+
50+
.. code-block:: bash
51+
52+
$ virtualenv env
53+
$ source env/bin/activate
54+
55+
#. Install the dependencies needed to run the samples.
56+
57+
.. code-block:: bash
58+
59+
$ pip install -r requirements.txt
60+
61+
.. _pip: https://pip.pypa.io/
62+
.. _virtualenv: https://virtualenv.pypa.io/
63+
64+
Samples
65+
-------------------------------------------------------------------------------
66+
67+
FHIR stores
68+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69+
70+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
71+
: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/fhir/fhir_stores.py,healthcare/api-client/fhir/README.rst
72+
73+
74+
75+
76+
To run this sample:
77+
78+
.. code-block:: bash
79+
80+
$ python fhir_stores.py
81+
82+
usage: fhir_stores.py [-h] [--project_id PROJECT_ID] [--cloud_region CLOUD_REGION]
83+
[--dataset_id DATASET_ID]
84+
[--fhir_store_id FHIR_STORE_ID]
85+
[--pubsub_topic PUBSUB_TOPIC] [--gcs_uri GCS_URI]
86+
[--member MEMBER] [--role ROLE]
87+
{create-fhir-store,delete-fhir-store,get-fhir-store,list-fhir-stores,patch-fhir-store,import-fhir-store,export-fhir-store-gcs,get_iam_policy,set_iam_policy}
88+
...
89+
90+
positional arguments:
91+
{create-fhir-store,delete-fhir-store,get-fhir-store,list-fhir-stores,patch-fhir-store,import-fhir-store,export-fhir-store-gcs,get_iam_policy,set_iam_policy}
92+
create-fhir-store Creates a new FHIR store within the parent dataset.
93+
delete-fhir-store Deletes the specified FHIR store.
94+
get-fhir-store Gets the specified FHIR store.
95+
list-fhir-stores Lists the FHIR stores in the given dataset.
96+
patch-fhir-store Updates the FHIR store.
97+
import-fhir-store Import resources into the FHIR store by copying them
98+
from the specified source.
99+
export-fhir-store-gcs
100+
Export resources to a Google Cloud Storage bucket by
101+
copying them from the FHIR store.
102+
get_iam_policy Gets the IAM policy for the specified FHIR store.
103+
set_iam_policy Sets the IAM policy for the specified FHIR store. A
104+
single member will be assigned a single role. A member
105+
can be any of: - allUsers, that is, anyone -
106+
allAuthenticatedUsers, anyone authenticated with a
107+
Google account - user:email, as in
108+
'user:[email protected]' - group:email, as in
109+
'group:[email protected]' - domain:domainname, as in
110+
'domain:example.com' - serviceAccount:email, as in
111+
'serviceAccount:my-other-
112+
[email protected]' A role can be any IAM
113+
role, such as 'roles/viewer', 'roles/owner', or
114+
'roles/editor'
115+
116+
optional arguments:
117+
-h, --help show this help message and exit
118+
--project_id PROJECT_ID
119+
GCP cloud project name
120+
--cloud_region CLOUD_REGION
121+
GCP cloud region
122+
--dataset_id DATASET_ID
123+
Name of dataset
124+
--fhir_store_id FHIR_STORE_ID
125+
Name of FHIR store
126+
--pubsub_topic PUBSUB_TOPIC
127+
The Cloud Pub/Sub topic where notifications of changes
128+
are published
129+
--gcs_uri GCS_URI URI for a Google Cloud Storage directory from which
130+
filesshould be import or to which result filesshould
131+
be written (e.g., "bucket-
132+
id/path/to/destination/dir").
133+
--member MEMBER Member to add to IAM policy (e.g.
134+
"domain:example.com")
135+
--role ROLE IAM Role to give to member (e.g. "roles/viewer")
136+
137+
138+
139+
FHIR resources
140+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141+
142+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
143+
: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/fhir/fhir_resources.py,healthcare/api-client/fhir/README.rst
144+
145+
146+
147+
148+
To run this sample:
149+
150+
.. code-block:: bash
151+
152+
$ python fhir_resources.py
153+
154+
usage: fhir_resources.py [-h] [--base_url BASE_URL] [--project_id PROJECT_ID]
155+
[--cloud_region CLOUD_REGION]
156+
[--dataset_id DATASET_ID]
157+
[--fhir_store_id FHIR_STORE_ID]
158+
[--resource_type RESOURCE_TYPE]
159+
[--resource_id RESOURCE_ID] [--bundle BUNDLE]
160+
[--uri_prefix URI_PREFIX] [--version_id VERSION_ID]
161+
{create-resource,delete-resource,get-resource,list-resource-history,export-resources,execute_bundle,get-resource-history,delete-resource-purge,update-resource,patch-resource,search-resources-get,search-resources-post,get-patient-everything,get-metadata}
162+
...
163+
164+
positional arguments:
165+
{create-resource,delete-resource,conditional-delete-resource,get-resource,list-resource-history,export-resources,execute_bundle,get-resource-history,delete-resource-purge,update-resource,conditional-update-resource,patch-resource,conditional-patch-resource,search-resources-get,search-resources-post,get-patient-everything,get-metadata}
166+
create-resource Creates a new resource in a FHIR store.
167+
delete-resource Creates a new resource in a FHIR store.
168+
get-resource Gets a FHIR resource.
169+
list-resource-history
170+
Gets the history of a resource.
171+
export-resources Exports resources in a FHIR store.
172+
export-resources Exports resources in a FHIR store.
173+
execute_bundle Executes the operations in the given bundle.
174+
get-resource-history
175+
Gets a version resource.
176+
delete-resource-purge
177+
Deletes versions of a resource (excluding current
178+
version).
179+
update-resource Updates an existing resource.
180+
patch-resource Updates part of an existing resource.
181+
search-resources-get
182+
Searches resources in the given FHIR store using the
183+
searchResources GET method.
184+
search-resources-post
185+
Searches resources in the given FHIR store using the
186+
searchResources GET method.
187+
get-patient-everything
188+
Gets all the resources in the patient compartment.
189+
get-metadata Gets the capabilities statement for a FHIR store.
190+
191+
optional arguments:
192+
-h, --help show this help message and exit
193+
--base_url BASE_URL Healthcare API URL.
194+
--project_id PROJECT_ID
195+
GCP project name
196+
--cloud_region CLOUD_REGION
197+
GCP region
198+
--dataset_id DATASET_ID
199+
Name of dataset
200+
--fhir_store_id FHIR_STORE_ID
201+
Name of FHIR store
202+
--resource_type RESOURCE_TYPE
203+
The type of resource. First letter must be capitalized
204+
--resource_id RESOURCE_ID
205+
Name of a FHIR resource
206+
--bundle BUNDLE Name of file containing bundle of operations to
207+
execute
208+
--uri_prefix URI_PREFIX
209+
Prefix of gs:// URIs for import and export
210+
--version_id VERSION_ID
211+
Version of a FHIR resource
212+
213+
214+
215+
216+
217+
The client library
218+
-------------------------------------------------------------------------------
219+
220+
This sample uses the `Google Cloud Client Library for Python`_.
221+
You can read the documentation for more details on API usage and use GitHub
222+
to `browse the source`_ and `report issues`_.
223+
224+
.. _Google Cloud Client Library for Python:
225+
https://googlecloudplatform.github.io/google-cloud-python/
226+
.. _browse the source:
227+
https://github.com/GoogleCloudPlatform/google-cloud-python
228+
.. _report issues:
229+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
230+
231+
232+
.. _Google Cloud SDK: https://cloud.google.com/sdk/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
- install_deps
20+
21+
samples:
22+
- name: FHIR stores
23+
file: fhir_stores.py
24+
show_help: True
25+
26+
- name: FHIR resources
27+
file: fhir_resources.py
28+
show_help: True
29+
30+
cloud_client_library: true
31+
32+
folder: healthcare/api-client/v1/fhir

0 commit comments

Comments
 (0)