This page explains how to create, edit, view, and delete Fast Healthcare Interoperability Resources (FHIR) stores. The FHIR version of a FHIR store can be DSTU2, STU3, or R4.
Creating a FHIR store
Before you can create a FHIR store, you need to create a dataset.
The following samples show how to create a FHIR store using the
projects.locations.datasets.fhirStores.create
method.
Console
To create a FHIR store:
- In the Cloud Console, go to the Datasets page.
- Open the dataset where you want to create a FHIR store.
- Click Create Data Store.
- Enter a name of your choice that's unique in your dataset. If the name is not unique, the FHIR store creation fails.
- Select FHIR as the data store type.
- Choose the FHIR version for the FHIR store, one of DSTU2, STU3, or R4.
-
If you want to configure a Pub/Sub topic for the FHIR store, type the topic name.
When specifying a Pub/Sub topic, enter the qualified URI to the topic, as shown in the
following sample:
projects/PROJECT_ID/topics/PUBSUB_TOPIC
- Click Create.
The new FHIR store appears in the list.
gcloud
To create a FHIR store in the dataset, run the
gcloud healthcare fhir-stores create
command.
- The FHIR store ID must be unique in the dataset. It can be any Unicode string of 1 to 256 characters consisting of numbers, letters, underscores, dashes, and periods.
- To set the FHIR version, specify the optional
--version
argument. This defines the FHIR version asDSTU2
,STU3
, orR4
. If you don't specify this argument, the version is set toSTU3
by default.
To notify a Pub/Sub topic of FHIR store changes, specify an existing Pub/Sub topic name using the
When specifying a Pub/Sub topic, enter the qualified URI to the topic, as shown in the following sample:--pubsub-topic
argument.projects/PROJECT_ID/topics/PUBSUB_TOPIC
The following sample shows how to create a FHIR store.
gcloud healthcare fhir-stores create FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ --version=FHIR_STORE_VERSION \ [--pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC]
If the request is successful, the command prompt displays the following message:
Created fhirStore [FHIR_STORE_ID].
API
To create a FHIR store, use the
projects.locations.datasets.fhirStores.create
method.
curl
To create a FHIR store, make a POST
request and specify the following
information:
- The name of the parent dataset
- A name for the FHIR store. The FHIR store name must be unique in its parent dataset. It can be any Unicode string of 1 to 256 characters consisting of numbers, letters, underscores, dashes, and periods.
- The FHIR version of the FHIR store:
DSTU2
,STU3
, orR4
- An access token
The following sample shows a POST
request using curl
.
You can optionally configure an existing Pub/Sub topic to which the Cloud Healthcare API sends notifications of FHIR store changes. See Editing a FHIR store for information on how to configure the Pub/Sub topic.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'version': 'FHIR_STORE_VERSION' }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID"
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": "FHIR_STORE_VERSION" }
PowerShell
To create a FHIR store, make a POST
request and specify the following
information:
- The name of the parent dataset
- A name for the FHIR store. The FHIR store name must be unique in its parent dataset. It can be any Unicode string of 1 to 256 characters consisting of numbers, letters, underscores, dashes, and periods.
- The FHIR version of the FHIR store:
DSTU2
,STU3
, orR4
- An access token
The following sample shows a POST
request using Windows PowerShell.
You can optionally configure an existing Pub/Sub topic to which the Cloud Healthcare API sends notifications of FHIR store changes. See Editing a FHIR store for information on how to configure the Pub/Sub topic.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'version': 'FHIR_STORE_VERSION' }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": "FHIR_STORE_VERSION" }
Go
Java
Node.js
Python
Editing a FHIR store
The following samples show how to make the following changes to a FHIR store:
- Edit the Pub/Sub topic to which the Cloud Healthcare API sends notifications of FHIR store changes.
- Edit the labels. Labels are key-value pairs that help you organize your Google Cloud resources.
projects/PROJECT_ID/topics/PUBSUB_TOPICFor notifications to work, you must grant additional permissions to the Cloud Healthcare Service Agent service account. For more information, see DICOM, FHIR, and HL7v2 store Pub/Sub permissions.
Console
Cloud Console doesn't support editing the Pub/Sub
topic or labels. Instead, use curl
, Windows PowerShell, or your preferred
language.
gcloud
To update the FHIR store, run the
gcloud healthcare fhir-stores update
command.
The following sample shows how to update the Pub/Sub topic for
the FHIR store. gcloud
tool doesn't support editing labels.
gcloud healthcare fhir-stores update FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC
If the request is successful, the command prompt displays the FHIR store details including the new topic name:
Updated fhirStore [FHIR_STORE_ID]. name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhir-stores/FHIR_STORE_ID notificationConfig: pubsubTopic: projects/PROJECT_ID/topics/PUBSUB_TOPIC version: FHIR_STORE_VERSION
API
To edit a FHIR store, use the
projects.locations.datasets.fhirStores.patch
method.
curl
To edit a FHIR store, make a PATCH
request and specify the following information:
- The name of the parent dataset
- The name of the FHIR store
- The metadata to update
- An update mask
- An access token
The following sample shows a PATCH
request using curl
.
curl -X PATCH \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'notificationConfig': { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC' }, 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=notificationConfig,labels"
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "notificationConfig": { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC" }, 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } 'version': FHIR_STORE_VERSION }
PowerShell
To edit a FHIR store, make a PATCH
request and specify the following information:
- The name of the parent dataset
- The name of the FHIR store
- The metadata to update
- An update mask
- An access token
The following sample shows a PATCH
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Patch ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'notificationConfig': { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC' }, 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=notificationConfig,labels" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "notificationConfig": { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC" }, 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } 'version': FHIR_STORE_VERSION }
Go
Java
Node.js
Python
Getting FHIR store details
The following samples show how to get details about a FHIR store.
Console
To view a FHIR store's details:
- In the Cloud Console, go to the Datasets page.
- Click the ID of the dataset that contains the FHIR store.
- Click the name of the FHIR store.
gcloud
To view details about a FHIR store, run the
gcloud healthcare fhir-stores describe
command.
The following sample shows how to get details about a FHIR store.
gcloud healthcare fhir-stores describe FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
If the request is successful, the command prompt displays the FHIR store details:
name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhir-stores/FHIR_STORE_ID version: FHIR_STORE_VERSION
API
To get details about a FHIR store, use the
projects.locations.datasets.fhirStores.get
method.
curl
To get details about a FHIR store, make a GET
request and specify the
following information:
- The name of the parent dataset
- The name of the FHIR store
- An access token
The following sample shows a GET
request using curl
.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": FHIR_STORE_VERSION }
If you configured any fields in the FhirStore
resource, they also appear in the response.
PowerShell
To get details about a FHIR store, make a GET
request and specify the following
information:
* The name of the parent dataset
* The name of the FHIR store
* An access token
The following sample shows a GET
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": FHIR_STORE_VERSION }
If you configured any fields in the FhirStore
resource, they also appear in the response.
Go
Java
Node.js
Python
Listing the FHIR stores in a dataset
The following samples show how to list the FHIR stores in a dataset.
Console
To view the data stores in a dataset:
- In the Cloud Console, go to the Datasets page.
- Click the ID of the dataset whose data stores you want to view.
gcloud
To list the FHIR stores in a dataset, run the
gcloud healthcare fhir-stores list
command.
gcloud healthcare fhir-stores list --dataset=DATASET_ID
If the request is successful, the command prompt lists the FHIR stores:
ID LOCATION TOPIC FHIR_STORE_ID LOCATION projects/PROJECT_ID/topics/PUBSUB_TOPIC
API
To list the FHIR stores in a dataset, use the projects.locations.datasets.fhirStores.list
method.
curl
To list the FHIR stores in a dataset, make a GET
request and specify the
following information:
- The name of the dataset
- An access token
The following sample shows a GET
request using curl
.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores"
If the request is successful, the server returns the response in JSON format:
{ "fhirStores": [ { "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" }, { ... } ] }
If you configured any fields in the FhirStore
resource, they also appear in the response.
PowerShell
To list the FHIR stores in a dataset, make a GET
request and specify the
following information:
- The name of the dataset
- An access token
The following sample shows a GET
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{ "fhirStores": [ { "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" }, { ... } ] }
If you configured any fields in the FhirStore
resource, they also appear in the response.
Go
Java
Node.js
Python
Getting the capabilities or conformance statement for a FHIR store
The following samples show how to get the capabilities (STU3 or R4) or conformance (DSTU2) statement for a FHIR store.
The information in the capabilities or conformance statement reflects the
settings in the FHIR store. For example, if
FhirStore.enableUpdateCreate
is set to true
, then this is reflected in the capabilities statement's
CapabilityStatement.rest.resource.updateCreate
field.
The following table shows the Cloud Healthcare API method for getting the capabilities or conformance statement for a FHIR store and its equivalent FHIR specification interaction:
Cloud Healthcare API method | FHIR specification interaction |
---|---|
projects.locations.datasets.fhirStores.fhir.capabilities |
capabilities (STU3 or R4) or conformance (DSTU2) |
Console
Cloud Console doesn't support getting the capabilities or
conformance statement. Instead, use curl
, Windows PowerShell, or your
preferred language.
gcloud
The gcloud
tool doesn't support getting the capabilities or
conformance statement. Instead, use curl
, Windows PowerShell, or your
preferred language.
API
To get the capabilities or conformance statement for a FHIR store, use the
projects.locations.datasets.fhirStores.fhir.capabilities
method.
curl
To get the capabilities or conformance statement for a FHIR store, make a GET
request and specify the following information:
- The name of the dataset
- The name of the FHIR store
- An access token
The following sample shows a GET
request using curl
.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/metadata"
If the request is successful, the server returns the response in JSON format:
{ "acceptUnknown": "both", "date": "2018-01-01", "description": "FHIR capability statement for the FHIR store specified by the request.", "experimental": true, "fhirVersion": "FHIR_VERSION", "format": [ "json" ], "id": "FHIR_STORE_ID", "kind": "instance", "patchFormat": [ "application/json-patch+json" ], "publisher": "Google", "resourceType": "CapabilityStatement", ... "status": "draft", "url": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": "20180101" }
PowerShell
To get the capabilities or conformance statement for a FHIR store, make a GET
request and specify the following information:
- The name of the dataset
- The name of the FHIR store
- An access token
The following sample shows a GET
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/metadata" | ConvertTo-Json
If the request is successful, the server returns the response in JSON format:
{ "acceptUnknown": "both", "date": "2018-01-01", "description": "FHIR capability statement for the FHIR store specified by the request.", "experimental": true, "fhirVersion": "FHIR_VERSION", "format": [ "json" ], "id": "FHIR_STORE_ID", "kind": "instance", "patchFormat": [ "application/json-patch+json" ], "publisher": "Google", "resourceType": "CapabilityStatement", ... "status": "draft", "url": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID", "version": "20180101" }
Go
Java
Node.js
Python
Deleting a FHIR store
The following samples show how to delete a FHIR store.
Console
To delete a data store:
- In the Cloud Console, go to the Datasets page.
- Open the dataset by clicking the dataset ID.
- Select the data store that you want to delete and then click Delete.
- To confirm, type the data store name and then click Delete.
gcloud
To delete a FHIR store, run the
gcloud healthcare fhir-stores delete
command:
Run the
delete
command.gcloud healthcare fhir-stores delete FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
To confirm, type Y.
If the request is successful, the command prompt displays the following message:
Deleted fhirStore [FHIR_STORE_ID].
API
To delete a FHIR store, use the projects.locations.datasets.fhirStores.delete
method.
curl
To delete a FHIR store, make a DELETE
request and specify the following information:
- The name of the parent dataset
- The name of the FHIR store
- An access token
The following sample shows a DELETE
request using curl
.
curl -X DELETE \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"
If the request is successful, the server returns the empty response body in JSON format:
{}
PowerShell
To delete a FHIR store, make a DELETE
request and specify the following information:
- The name of the parent dataset
- The name of the FHIR store
- An access token
The following sample shows a DELETE
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Delete ` -Headers $headers ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID" | Select-Object -Expand Content
If the request is successful, the server returns the empty response body in JSON format:
{}
Go
Java
Node.js
Python
What's next
Learn how to create and work with FHIR resources.