This page explains how to create, edit, view, list, and delete Fast Healthcare Interoperability Resources (FHIR) stores. FHIR stores hold FHIR resources, such as Claim resources, Patient resources, Medication resources, and more.
The Cloud Healthcare API supports the following FHIR versions:
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 Google Cloud console, go to the Datasets page.
- Select 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.
- Click Next.
- Choose the FHIR version for the FHIR store, one of DSTU2, STU3, or R4.
- To enable the client to use an update operation to create a new resource with a client-specified ID, click Allow update create.
- To enable referential integrity in this store, click Referential integrity
checks.
Note: This can't be changed after the store is created. - To automatically record historical versions of resources in the store, click Resource
versioning.
Note: This can't be changed after the store is created. - Click Next.
- To export resource changes to BigQuery each time the FHIR resources in your store are created, updated, patched, or deleted, click Stream resource changes to BigQuery and click Add new streaming config. For more information on BigQuery streaming, see Streaming FHIR resource changes to BigQuery.
- To set the depth for all recursive structures in the output schema, click the relevant depth level in the Recursive Structure Depth slider. By default, the recursive value is 2.
- Click Done to save the streaming configuration.
- Click Next.
-
If you want to configure a Pub/Sub topic for the FHIR store, click Receive
Cloud Pub/Sub notifications and select 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 Next.
- To add one or more labels to the store, click Add Labels to organize your data stores and enter the key/value label. For more information on resource labels, see Using resource labels.
- 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.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID:
an identifier for the FHIR store. The FHIR store ID must have the following:
- A unique ID in its dataset
- A Unicode string of 1-256 characters consisting of the following:
- Numbers
- Letters
- Underscores
- Dashes
- Periods
- FHIR_STORE_VERSION: the FHIR version of the FHIR store. The available options are DSTU2, STU3, or R4.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare fhir-stores create FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ --version=FHIR_STORE_VERSION
Windows (PowerShell)
gcloud healthcare fhir-stores create FHIR_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION ` --version=FHIR_STORE_VERSION
Windows (cmd.exe)
gcloud healthcare fhir-stores create FHIR_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION ^ --version=FHIR_STORE_VERSION
You should receive a response similar to the following:
Response
Created fhirStore [FHIR_STORE_ID].
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID:
an identifier for the FHIR store. The FHIR store ID must have the following:
- A unique ID in its dataset
- A Unicode string of 1-256 characters consisting of the following:
- Numbers
- Letters
- Underscores
- Dashes
- Periods
- FHIR_STORE_VERSION: the FHIR version of the FHIR store. The available options are DSTU2, STU3, or R4.
Request JSON body:
{ "version": "FHIR_STORE_VERSION" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "version": "FHIR_STORE_VERSION" } EOF
Then execute the following command to send your REST request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID"
PowerShell
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "version": "FHIR_STORE_VERSION" } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores?fhirStoreId=FHIR_STORE_ID" | Select-Object -Expand Content
API Explorer
Copy the request body and open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Paste the request body in this tool, complete any other required fields, and click Execute.
You should receive a JSON response similar to the following:
Go
Java
Node.js
Python
Editing a FHIR store
The following samples show how to edit a FHIR store. You can edit a FHIR store to modify properties such as the following:
- The Pub/Sub topic to which the Cloud Healthcare API sends notifications of FHIR store changes.
- The FHIR store's 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
To edit a FHIR store, complete the following steps:
In the Google Cloud console, go to the Datasets page.
Go to DatasetsSelect the dataset containing the FHIR store you want to edit.
In the Data Stores list, select the FHIR store you want to edit.
To edit the store's configuration, click the FHIR Store Configuration edit button.
For more information on the FHIR store's configuration options, see Creating a FHIR store.
To export resource changes to BigQuery each time the FHIR resources in your store are created, updated, patched, or deleted, click Add new streaming config in the Dataset field.
Select a BigQuery dataset where resource changes will be streamed. For more information on BigQuery streaming, see Streaming FHIR resource changes to BigQuery.
To set the depth for all recursive structures in the output schema, click the relevant depth in the Recursive Structure Depth slider. By default, the recursive depth is 2.
To export resource changes only for specific resource types, select the resource types from the Select FHIR resource types list.
To configure a Pub/Sub topic for the data store, select a topic name in the Cloud Pub/Sub Notifications section. 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
To add one or more labels to the store, click Using resource labels.
Labels, click Add label and enter the key/value label. For more information on resource labels, seeClick Save.
gcloud
To edit a FHIR store, run the gcloud healthcare fhir-stores update
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
- PUBSUB_TOPIC_ID: a Pub/Sub topic to which messages are published when an event occurs in a data store
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare fhir-stores update FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION \ --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID
Windows (PowerShell)
gcloud healthcare fhir-stores update FHIR_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION ` --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID
Windows (cmd.exe)
gcloud healthcare fhir-stores update FHIR_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION ^ --pubsub-topic=projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID
You should receive a response similar to the following:
Response
Updated fhirStore [FHIR_STORE_ID]. name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID notificationConfig: pubsubTopic: projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID version: FHIR_STORE_VERSION
REST
To edit a FHIR store, use the projects.locations.datasets.fhirStores.patch
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
- PUBSUB_TOPIC_ID: the Pub/Sub topic ID. To determine what data to include in Pub/Sub notifications, see FHIR Pub/Sub notifications.
- KEY1: the first label key
- VALUE1: the first label value
- KEY2: the second label key
- VALUE2: the second label value
Request JSON body:
{ "notificationConfig": { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID" }, "labels": { "KEY1": "VALUE1", "KEY2": "VALUE2" } }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "notificationConfig": { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID" }, "labels": { "KEY1": "VALUE1", "KEY2": "VALUE2" } } EOF
Then execute the following command to send your REST request:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=notificationConfig,labels"
PowerShell
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "notificationConfig": { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC_ID" }, "labels": { "KEY1": "VALUE1", "KEY2": "VALUE2" } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-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
API Explorer
Copy the request body and open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Paste the request body in this tool, complete any other required fields, and click Execute.
You should receive a JSON response similar to the following:
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 Google Cloud console, go to the Datasets page.
- Select the dataset containing the FHIR store.
- Click the name of the FHIR store.
gcloud
To get details about a FHIR store, run the gcloud healthcare fhir-stores describe
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare fhir-stores describe FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare fhir-stores describe FHIR_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare fhir-stores describe FHIR_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following.
If you configured any fields in the FhirStore
resource, they also appear in the response.
Response
... name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID ... version: FHIR_STORE_VERSION
REST
To get details about a FHIR store, use the projects.locations.datasets.fhirStores.get
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"
PowerShell
Execute the following command:
$cred = gcloud auth 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
API Explorer
Open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.
You should receive a response similar to the following.
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 Google Cloud console, go to the Datasets page.
- Select the dataset containing the data store you want to view.
gcloud
To view details about a FHIR store, run the gcloud healthcare fhir-stores list
command.
Before using any of the command data below, make the following replacements:
- DATASET_ID: the FHIR store's parent dataset
- LOCATION: the dataset location
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION
Windows (PowerShell)
gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION
Windows (cmd.exe)
gcloud healthcare fhir-stores list --dataset=DATASET_ID --location=LOCATION
You should receive a response similar to the following.
If you configured any fields in the FhirStore
resource, they also appear in the response.
ID LOCATION REF_INT RES_VER UPDATE_CREATE TOPIC FHIR_STORE_ID LOCATION PUBSUB_TOPIC ...
REST
To list the FHIR stores in a dataset, use the projects.locations.datasets.fhirStores.list
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- DATASET_ID: the FHIR store's parent dataset
- LOCATION: the dataset location
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores"
PowerShell
Execute the following command:
$cred = gcloud auth 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
API Explorer
Open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.
You should receive a response similar to the following.
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
The Google Cloud console and the gcloud CLI don't support this action. Instead, use curl
, PowerShell, or your preferred language.
gcloud
The Google Cloud console and the gcloud CLI don't support this action. Instead, use curl
, PowerShell, or your preferred language.
REST
To get the capabilities or conformance statement for a FHIR store, use the projects.locations.datasets.fhirStores.fhir.capabilities
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/metadata"
PowerShell
Execute the following command:
$cred = gcloud auth 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" | Select-Object -Expand Content
API Explorer
Open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.
You should receive a JSON response similar to the following:
Go
Java
Node.js
Python
Setting the base resource validation level
By default, all resources in your FHIR store have base resource validation applied to them. This validation ensures that the following are true when the resource is created:
- All required fields are defined.
- All referred resource types are valid.
- The resource meets all FHIRPath constraints.
You can make your base resource validation less strict by disabling one or more of these types of base resource validation for your FHIR store.
Console
The Google Cloud console and the gcloud CLI don't support this action. Instead, use curl
, PowerShell, or your preferred language.
gcloud
The Google Cloud console and the gcloud CLI don't support this action. Instead, use curl
, PowerShell, or your preferred language.
REST
To disable base resource validation in an existing FHIR store, use the projects.locations.datasets.fhirStores.patch
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- DATASET_ID: the FHIR store's parent dataset
- LOCATION: the dataset location
- BASE_RESOURCE_VALIDATION_TYPE: the base resource validation type you want to disable. To disable validation, set any of the following fields to
true
:disableRequiredFieldValidation
disableReferenceTypeValidation
disableFhirpathValidation
Request JSON body:
{ "validationConfig": { "BASE_RESOURCE_VALIDATION_TYPE": true } }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "validationConfig": { "BASE_RESOURCE_VALIDATION_TYPE": true } } EOF
Then execute the following command to send your REST request:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=validationConfig"
PowerShell
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "validationConfig": { "BASE_RESOURCE_VALIDATION_TYPE": true } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=validationConfig" | Select-Object -Expand Content
API Explorer
Copy the request body and open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Paste the request body in this tool, complete any other required fields, and click Execute.
You should receive a response similar to the following.
If you configured any fields in the FhirStore
resource, they also appear in the response.
Deleting a FHIR store
The following samples show how to delete a FHIR store.
Console
To delete a data store:
- In the Google Cloud console, go to the Datasets page.
- Select the dataset containing the data store you want to delete.
- Choose Delete from the Actions drop-down list for the data store that you want to 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.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare fhir-stores delete FHIR_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare fhir-stores delete FHIR_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare fhir-stores delete FHIR_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
Deleted fhirStore [FHIR_STORE_ID].
REST
To delete a FHIR store, use the projects.locations.datasets.fhirStores.delete
method.
Before using any of the request data, make the following replacements:
- PROJECT_ID: the ID of your Google Cloud project
- LOCATION: the dataset location
- DATASET_ID: the FHIR store's parent dataset
- FHIR_STORE_ID: the FHIR store ID
To send your request, choose one of these options:
curl
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID"
PowerShell
Execute the following command:
$cred = gcloud auth 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
API Explorer
Open the method reference page. The API Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.
You should receive a JSON response similar to the following:
Go
Java
Node.js
Python
What's next
Learn how to create and work with FHIR resources.