This page describes how to create, edit, view, list, and delete datasets. After creating a dataset, you can create data stores that hold electronic health records and medical imaging data, de-identify the dataset, and more.
Before you begin
See the Cloud Healthcare API Data model.
Create a dataset
The following samples show how to create a dataset.
Console
In the Google Cloud console, go to the Browser page.
Click add_box Create dataset. The Dataset properties page is displayed.
In the Name field, enter an identifier for the dataset subject to the dataset permitted characters and size requirements.
Select one of the following location types:
Region. The dataset permanently resides within one Google Cloud region. After selecting this option, type or select a location in the Region field.
Multi-region. The dataset permanently resides within a location that spans multiple Google Cloud regions. After selecting this option, type or select a multi-region location in the Multi-region field.
Click Create. The Browser page is displayed. The new dataset is displayed in the list of datasets.
gcloud
Run the gcloud healthcare datasets create
command.
Before using any of the command data below, make the following replacements:
LOCATION
: a supported location for the datasetDATASET_ID
: an identifier subject to the dataset permitted characters and size requirements
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets create DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets create DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets create DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
Create request issued for: [DATASET_ID] Created dataset [DATASET_ID].
REST
Create the dataset using the
projects.locations.datasets.create
method.Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: a supported location for the datasetDATASET_ID
: an identifier subject to the dataset permitted characters and size requirements
To send your request, choose one of these options:
curl
Execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets?datasetId=DATASET_ID"PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets?datasetId=DATASET_ID" | Select-Object -Expand ContentAPIs Explorer
Open the method reference page. The APIs 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.
OPERATION_ID
. You need this value in the next step.Get the status of the long-running operation using the
projects.locations.datasets.operations.get
method.Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: the dataset locationDATASET_ID
: the dataset IDOPERATION_ID
: the ID returned from the long-running operation
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/operations/OPERATION_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/operations/OPERATION_ID" | Select-Object -Expand ContentAPIs Explorer
Open the method reference page. The APIs 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.
"done": true
, the long-running operation has finished.
Go
Java
Node.js
Python
Edit a dataset
The following samples show how to edit a dataset.
Console
The Google Cloud console doesn't support editing a dataset. Instead, use the Google Cloud CLI or the REST API.
gcloud
Run the gcloud healthcare datasets update
command.
Before using any of the command data below, make the following replacements:
LOCATION
: the dataset locationDATASET_ID
: the dataset IDTIME_ZONE
: a supported time zone, such asUTC
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets update DATASET_ID \ --location=LOCATION \ --time-zone=TIME_ZONE
Windows (PowerShell)
gcloud healthcare datasets update DATASET_ID ` --location=LOCATION ` --time-zone=TIME_ZONE
Windows (cmd.exe)
gcloud healthcare datasets update DATASET_ID ^ --location=LOCATION ^ --time-zone=TIME_ZONE
You should receive a response similar to the following:
Updated dataset [DATASET_ID]. name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID timeZone: TIME_ZONE
REST
Use the projects.locations.datasets.patch
method.
Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: the dataset locationDATASET_ID
: the dataset IDTIME_ZONE
: a supported time zone, such asUTC
Request JSON body:
{ "timeZone": "TIME_ZONE" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
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?updateMask=timeZone"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$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?updateMask=timeZone" | Select-Object -Expand Content
APIs Explorer
Copy the request body and open the method reference page. The APIs 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
Get dataset details
The following samples show how to get details about a dataset.
Console
In the Google Cloud console, go to the Browser page.
Select the dataset. The Dataset page and the data stores in the dataset are displayed.
gcloud
Run the
gcloud healthcare datasets describe
command.
Before using any of the command data below, make the following replacements:
LOCATION
: the dataset locationDATASET_ID
: the dataset ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets describe DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets describe DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets describe DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID timeZone: TIME_ZONE
REST
Use the projects.locations.datasets.get
method.
Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: the dataset locationDATASET_ID
: the dataset 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"
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" | Select-Object -Expand Content
APIs Explorer
Open the method reference page. The APIs 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
List datasets
The following samples show how to list the datasets in your project.
Console
In the Google Cloud console, go to the Browser page.
gcloud
Run the
gcloud healthcare datasets list
command.
Before using any of the command data below, make the following replacements:
LOCATION
: the dataset location
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets list --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets list --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets list --location=LOCATION
You should receive a response similar to the following:
ID LOCATION TIMEZONE DATASET_ID LOCATION TIME_ZONE
REST
Use the projects.locations.datasets.list
method.
Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: 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"
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" | Select-Object -Expand Content
APIs Explorer
Open the method reference page. The APIs 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
Delete a dataset
The following samples show how to delete a dataset.
Console
In the Google Cloud console, go to the Browser page.
In the same row as the dataset, click the
Actions option, and then select Delete.In the confirmation dialog, enter the dataset ID, and then click Delete.
gcloud
Run the
gcloud healthcare datasets delete
command.
Before using any of the command data below, make the following replacements:
LOCATION
: the dataset locationDATASET_ID
: the dataset ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets delete DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets delete DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets delete DATASET_ID ^ --location=LOCATION
To confirm, type Y.
The output is the following:
Deleted dataset [DATASET_ID]
REST
Use the projects.locations.datasets.delete
method.
Before using any of the request data, make the following replacements:
PROJECT_ID
: the ID of your Google Cloud projectLOCATION
: the dataset locationDATASET_ID
: the dataset 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"
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" | Select-Object -Expand Content
APIs Explorer
Open the method reference page. The APIs 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 successful status code (2xx) and an empty response.
Go
Java
Node.js
Python
What's next
- De-identify sensitive data
- Create and manage DICOM stores
- Create and manage FHIR stores
- Create and manage HL7v2 stores