Skip to content

Commit 8e6d407

Browse files
noerogleahecole
andauthored
Cloud Healthcare API beta FHIR updates (GoogleCloudPlatform#2639)
* Cloud Healthcare API beta FHIR updates * Format fixes. * Run black * Fix lint * Remove modified Patient.json from PR * Address review comments. * Fix conditional tests so that they don't detect multiple resources * Fix lint issues * Skip delete blob in test if it was already deleted * fix lint and disable two conditional tests * lint fix Co-authored-by: Leah E. Cole <[email protected]>
1 parent 8ab4153 commit 8e6d407

File tree

5 files changed

+852
-248
lines changed

5 files changed

+852
-248
lines changed
+243-23
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,252 @@
1-
# This file is used to generate README.rst
1+
.. This file is automatically generated. Do not edit this file directly.
22

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.
3+
Cloud Healthcare API Python Samples
4+
===============================================================================
115

12-
- See the `migration guide`_ for information about migrating to Python client library v0.25.1.
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
138

149

15-
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration
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.
1612

17-
setup:
18-
- auth
19-
- install_deps
13+
.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration
2014

21-
samples:
22-
- name: FHIR stores
23-
file: fhir_stores.py
24-
show_help: True
2515

26-
- name: FHIR resources
27-
file: fhir_resources.py
28-
show_help: True
2916

30-
cloud_client_library: true
3117

32-
folder: healthcare/api-client/fhir
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] [--service_account_json SERVICE_ACCOUNT_JSON]
83+
[--project_id PROJECT_ID] [--cloud_region CLOUD_REGION]
84+
[--dataset_id DATASET_ID]
85+
[--fhir_store_id FHIR_STORE_ID]
86+
[--pubsub_topic PUBSUB_TOPIC] [--gcs_uri GCS_URI]
87+
[--member MEMBER] [--role ROLE]
88+
{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}
89+
...
90+
91+
positional arguments:
92+
{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}
93+
create-fhir-store Creates a new FHIR store within the parent dataset.
94+
delete-fhir-store Deletes the specified FHIR store.
95+
get-fhir-store Gets the specified FHIR store.
96+
list-fhir-stores Lists the FHIR stores in the given dataset.
97+
patch-fhir-store Updates the FHIR store.
98+
import-fhir-store Import resources into the FHIR store by copying them
99+
from the specified source.
100+
export-fhir-store-gcs
101+
Export resources to a Google Cloud Storage bucket by
102+
copying them from the FHIR store.
103+
get_iam_policy Gets the IAM policy for the specified FHIR store.
104+
set_iam_policy Sets the IAM policy for the specified FHIR store. A
105+
single member will be assigned a single role. A member
106+
can be any of: - allUsers, that is, anyone -
107+
allAuthenticatedUsers, anyone authenticated with a
108+
Google account - user:email, as in
109+
'user:[email protected]' - group:email, as in
110+
'group:[email protected]' - domain:domainname, as in
111+
'domain:example.com' - serviceAccount:email, as in
112+
'serviceAccount:my-other-
113+
[email protected]' A role can be any IAM
114+
role, such as 'roles/viewer', 'roles/owner', or
115+
'roles/editor'
116+
117+
optional arguments:
118+
-h, --help show this help message and exit
119+
--service_account_json SERVICE_ACCOUNT_JSON
120+
Path to service account JSON file.
121+
--project_id PROJECT_ID
122+
GCP cloud project name
123+
--cloud_region CLOUD_REGION
124+
GCP cloud region
125+
--dataset_id DATASET_ID
126+
Name of dataset
127+
--fhir_store_id FHIR_STORE_ID
128+
Name of FHIR store
129+
--pubsub_topic PUBSUB_TOPIC
130+
The Cloud Pub/Sub topic where notifications of changes
131+
are published
132+
--gcs_uri GCS_URI URI for a Google Cloud Storage directory from which
133+
filesshould be import or to which result filesshould
134+
be written (e.g., "bucket-
135+
id/path/to/destination/dir").
136+
--member MEMBER Member to add to IAM policy (e.g.
137+
"domain:example.com")
138+
--role ROLE IAM Role to give to member (e.g. "roles/viewer")
139+
140+
141+
142+
FHIR resources
143+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144+
145+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
146+
: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
147+
148+
149+
150+
151+
To run this sample:
152+
153+
.. code-block:: bash
154+
155+
$ python fhir_resources.py
156+
157+
usage: fhir_resources.py [-h] [--service_account_json SERVICE_ACCOUNT_JSON]
158+
[--base_url BASE_URL] [--project_id PROJECT_ID]
159+
[--cloud_region CLOUD_REGION]
160+
[--dataset_id DATASET_ID]
161+
[--fhir_store_id FHIR_STORE_ID]
162+
[--resource_type RESOURCE_TYPE]
163+
[--resource_id RESOURCE_ID] [--bundle BUNDLE]
164+
[--uri_prefix URI_PREFIX] [--version_id VERSION_ID]
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+
...
167+
168+
positional arguments:
169+
{create-patient,create-encounter,create-observation,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}
170+
create-patient Creates a new Patient resource in a FHIR store.
171+
create-encounter Creates a new Encounter resource in a FHIR store.
172+
create-observation Creates a new Observation resource in a FHIR store.
173+
delete-resource Creates a new resource in a FHIR store.
174+
conditional-delete-resource
175+
Deletes an existing resource specified by search
176+
criteria.
177+
get-resource Gets a FHIR resource.
178+
list-resource-history
179+
Gets the history of a resource.
180+
export-resources Exports resources in a FHIR store.
181+
export-resources Exports resources in a FHIR store.
182+
execute_bundle Executes the operations in the given bundle.
183+
get-resource-history
184+
Gets a version resource.
185+
delete-resource-purge
186+
Deletes versions of a resource (excluding current
187+
version).
188+
update-resource Updates an existing resource.
189+
conditional-update-resource
190+
Updates an existing resource specified by search
191+
criteria.
192+
patch-resource Updates part of an existing resource.
193+
conditional-patch-resource
194+
Updates part of an existing resource.
195+
search-resources-get
196+
Searches resources in the given FHIR store using the
197+
searchResources GET method.
198+
search-resources-post
199+
Searches resources in the given FHIR store using the
200+
searchResources GET method.
201+
get-patient-everything
202+
Gets all the resources in the patient compartment.
203+
get-metadata Gets the capabilities statement for a FHIR store.
204+
205+
optional arguments:
206+
-h, --help show this help message and exit
207+
--service_account_json SERVICE_ACCOUNT_JSON
208+
Path to service account JSON file.
209+
--base_url BASE_URL Healthcare API URL.
210+
--project_id PROJECT_ID
211+
GCP project name
212+
--cloud_region CLOUD_REGION
213+
GCP region
214+
--dataset_id DATASET_ID
215+
Name of dataset
216+
--fhir_store_id FHIR_STORE_ID
217+
Name of FHIR store
218+
--resource_type RESOURCE_TYPE
219+
The type of resource. First letter must be capitalized
220+
--resource_id RESOURCE_ID
221+
Name of a FHIR resource
222+
--patient_id PATIENT_ID
223+
Identifier for a Patient resource. Can be used as a reference for an Encounter/Observation
224+
--encounter_id ENCOUNTER_ID
225+
Identifier for an Encounter resource. Can be used as a reference for an Observation
226+
--bundle BUNDLE Name of file containing bundle of operations to
227+
execute
228+
--uri_prefix URI_PREFIX
229+
Prefix of gs:// URIs for import and export
230+
--version_id VERSION_ID
231+
Version of a FHIR resource
232+
233+
234+
235+
236+
237+
The client library
238+
-------------------------------------------------------------------------------
239+
240+
This sample uses the `Google Cloud Client Library for Python`_.
241+
You can read the documentation for more details on API usage and use GitHub
242+
to `browse the source`_ and `report issues`_.
243+
244+
.. _Google Cloud Client Library for Python:
245+
https://googlecloudplatform.github.io/google-cloud-python/
246+
.. _browse the source:
247+
https://github.com/GoogleCloudPlatform/google-cloud-python
248+
.. _report issues:
249+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
250+
251+
252+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

0 commit comments

Comments
 (0)