Skip to content

healthcare API: update all FHIR v1beta1 samples to v1 #3384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions healthcare/api-client/v1/fhir/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
.. This file is automatically generated. Do not edit this file directly.

Cloud Healthcare API Python Samples
===============================================================================

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
: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


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.

.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration




.. _Cloud Healthcare API: https://cloud.google.com/healthcare/docs

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 Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started

Install Dependencies
++++++++++++++++++++

#. Clone python-docs-samples and change directory to the sample directory you want to use.

.. code-block:: bash

$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git

#. 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.

.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

.. code-block:: bash

$ virtualenv env
$ source env/bin/activate

#. Install the dependencies needed to run the samples.

.. code-block:: bash

$ pip install -r requirements.txt

.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/

Samples
-------------------------------------------------------------------------------

FHIR stores
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
: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




To run this sample:

.. code-block:: bash

$ python fhir_stores.py

usage: fhir_stores.py [-h] [--project_id PROJECT_ID] [--cloud_region CLOUD_REGION]
[--dataset_id DATASET_ID]
[--fhir_store_id FHIR_STORE_ID]
[--pubsub_topic PUBSUB_TOPIC] [--gcs_uri GCS_URI]
[--member MEMBER] [--role ROLE]
{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}
...

positional arguments:
{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}
create-fhir-store Creates a new FHIR store within the parent dataset.
delete-fhir-store Deletes the specified FHIR store.
get-fhir-store Gets the specified FHIR store.
list-fhir-stores Lists the FHIR stores in the given dataset.
patch-fhir-store Updates the FHIR store.
import-fhir-store Import resources into the FHIR store by copying them
from the specified source.
export-fhir-store-gcs
Export resources to a Google Cloud Storage bucket by
copying them from the FHIR store.
get_iam_policy Gets the IAM policy for the specified FHIR store.
set_iam_policy Sets the IAM policy for the specified FHIR store. A
single member will be assigned a single role. A member
can be any of: - allUsers, that is, anyone -
allAuthenticatedUsers, anyone authenticated with a
Google account - user:email, as in
'user:[email protected]' - group:email, as in
'group:[email protected]' - domain:domainname, as in
'domain:example.com' - serviceAccount:email, as in
'serviceAccount:my-other-
[email protected]' A role can be any IAM
role, such as 'roles/viewer', 'roles/owner', or
'roles/editor'

optional arguments:
-h, --help show this help message and exit
--project_id PROJECT_ID
GCP cloud project name
--cloud_region CLOUD_REGION
GCP cloud region
--dataset_id DATASET_ID
Name of dataset
--fhir_store_id FHIR_STORE_ID
Name of FHIR store
--pubsub_topic PUBSUB_TOPIC
The Cloud Pub/Sub topic where notifications of changes
are published
--gcs_uri GCS_URI URI for a Google Cloud Storage directory from which
filesshould be import or to which result filesshould
be written (e.g., "bucket-
id/path/to/destination/dir").
--member MEMBER Member to add to IAM policy (e.g.
"domain:example.com")
--role ROLE IAM Role to give to member (e.g. "roles/viewer")



FHIR resources
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
: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




To run this sample:

.. code-block:: bash

$ python fhir_resources.py

usage: fhir_resources.py [-h] [--base_url BASE_URL] [--project_id PROJECT_ID]
[--cloud_region CLOUD_REGION]
[--dataset_id DATASET_ID]
[--fhir_store_id FHIR_STORE_ID]
[--resource_type RESOURCE_TYPE]
[--resource_id RESOURCE_ID] [--bundle BUNDLE]
[--uri_prefix URI_PREFIX] [--version_id VERSION_ID]
{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}
...

positional arguments:
{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}
create-resource Creates a new resource in a FHIR store.
delete-resource Creates a new resource in a FHIR store.
get-resource Gets a FHIR resource.
list-resource-history
Gets the history of a resource.
export-resources Exports resources in a FHIR store.
export-resources Exports resources in a FHIR store.
execute_bundle Executes the operations in the given bundle.
get-resource-history
Gets a version resource.
delete-resource-purge
Deletes versions of a resource (excluding current
version).
update-resource Updates an existing resource.
patch-resource Updates part of an existing resource.
search-resources-get
Searches resources in the given FHIR store using the
searchResources GET method.
search-resources-post
Searches resources in the given FHIR store using the
searchResources GET method.
get-patient-everything
Gets all the resources in the patient compartment.
get-metadata Gets the capabilities statement for a FHIR store.

optional arguments:
-h, --help show this help message and exit
--base_url BASE_URL Healthcare API URL.
--project_id PROJECT_ID
GCP project name
--cloud_region CLOUD_REGION
GCP region
--dataset_id DATASET_ID
Name of dataset
--fhir_store_id FHIR_STORE_ID
Name of FHIR store
--resource_type RESOURCE_TYPE
The type of resource. First letter must be capitalized
--resource_id RESOURCE_ID
Name of a FHIR resource
--bundle BUNDLE Name of file containing bundle of operations to
execute
--uri_prefix URI_PREFIX
Prefix of gs:// URIs for import and export
--version_id VERSION_ID
Version of a FHIR resource





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`_.

.. _Google Cloud Client Library for Python:
https://googlecloudplatform.github.io/google-cloud-python/
.. _browse the source:
https://github.com/GoogleCloudPlatform/google-cloud-python
.. _report issues:
https://github.com/GoogleCloudPlatform/google-cloud-python/issues


.. _Google Cloud SDK: https://cloud.google.com/sdk/
32 changes: 32 additions & 0 deletions healthcare/api-client/v1/fhir/README.rst.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is used to generate README.rst

product:
name: Cloud Healthcare API
short_name: Healthcare API
url: https://cloud.google.com/healthcare/docs
description: >
`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.


.. _migration guide: https://cloud.google.com/vision/docs/python-client-migration

setup:
- auth
- install_deps

samples:
- name: FHIR stores
file: fhir_stores.py
show_help: True

- name: FHIR resources
file: fhir_resources.py
show_help: True

cloud_client_library: true

folder: healthcare/api-client/v1/fhir
Loading