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.
Permissions required for this task
To perform this task, you must have been granted the following permissions or the following Identity and Access Management (IAM) roles:
Permissions
healthcare.datasets.create
Roles
You can ask your administrator to grant you these Identity and Access Management roles. For instructions on granting roles, see Manage access or Control access to Cloud Healthcare API resources. You might also be able to get the required permissions through custom roles or other predefined roles.
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.
Run the gcloud healthcare datasets create
command.
Before using any of the command data below, make the following replacements:
: a supported location for the datasetLOCATION
: an identifier subject to the dataset permitted characters and size requirementsDATASET_ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets createDATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets createDATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets createDATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
Create request issued for: [DATASET_ID ] Created dataset [DATASET_ID ].
Create the dataset using the
projects.locations.datasets.create
method.Before using any of the request data, make the following replacements:
: the ID of your Google Cloud projectPROJECT_ID
: a supported location for the datasetLOCATION
: an identifier subject to the dataset permitted characters and size requirementsDATASET_ID
To send your request, choose one of these options:
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 "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 ContentOpen 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.Response
{ "name": "projects/
PROJECT_ID /locations/LOCATION /datasets/DATASET_ID /operations/OPERATION_ID " }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:
: the ID of your Google Cloud projectPROJECT_ID
: the dataset locationLOCATION
: the dataset IDDATASET_ID
: the ID returned from the long-running operationOPERATION_ID
To send your request, choose one of these options:
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 "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 ContentOpen 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.Response
{ "name": "projects/
PROJECT_ID /locations/LOCATION /datasets/DATASET_ID /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.CreateDataset", "createTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ ", "endTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ ", "logsUrl": "https://console.cloud.google.com/CLOUD_LOGGING_URL " "counter": { "success": "SUCCESS_COUNT ", // If there were any failures, they display in the `failure` field. "failure": "FAILURE_COUNT " } }, "done": true, // The `response` field only displays if there were no errors. "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.dataset.Dataset", "name": "PROJECT_ID /locations/LOCATION /datasets/DATASET_ID ", }, // If there were any errors, an `error` field displays instead of a `response` field. // See Troubleshooting long-running operations for a list of response codes. "error": { "code":ERROR_CODE , "message": "DESCRIPTION ", "details": [ { "@type": "...",FIELD1 : ..., ... } ] } }
Edit a dataset
The following samples show how to edit a dataset.
Permissions required for this task
To perform this task, you must have been granted the following permissions or the following Identity and Access Management (IAM) roles:
Permissions
healthcare.datasets.update
Roles
You can ask your administrator to grant you these Identity and Access Management roles. For instructions on granting roles, see Manage access or Control access to Cloud Healthcare API resources. You might also be able to get the required permissions through custom roles or other predefined roles.
The Google Cloud console doesn't support editing a dataset. Instead, use the Google Cloud CLI or the REST API.
Run the gcloud healthcare datasets update
command.
Before using any of the command data below, make the following replacements:
: the dataset locationLOCATION
: the dataset IDDATASET_ID
: a supported time zone, such asTIME_ZONE UTC
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets updateDATASET_ID \ --location=LOCATION \ --time-zone=TIME_ZONE
Windows (PowerShell)
gcloud healthcare datasets updateDATASET_ID ` --location=LOCATION ` --time-zone=TIME_ZONE
Windows (cmd.exe)
gcloud healthcare datasets updateDATASET_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
Use the projects.locations.datasets.patch
method.
Before using any of the request data, make the following replacements:
: the ID of your Google Cloud projectPROJECT_ID
: the dataset locationLOCATION
: the dataset IDDATASET_ID
: a supported time zone, such asTIME_ZONE UTC
Request JSON body:
{ "timeZone": "TIME_ZONE " }
To send your request, choose one of these options:
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"
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
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:
Response
{ "name": "projects/PROJECT_ID /locations/LOCATION /datasets/DATASET_ID " "timeZone": "TIME_ZONE " }
Get dataset details
The following samples show how to get details about a dataset.
Permissions required for this task
To perform this task, you must have been granted the following permissions or the following Identity and Access Management (IAM) roles:
Permissions
healthcare.datasets.get
Roles
-
Healthcare Dataset Viewer
(
roles/healthcare.datasetViewer
) -
Healthcare Dataset Administrator
(
roles/healthcare.datasetAdmin
)
You can ask your administrator to grant you these Identity and Access Management roles. For instructions on granting roles, see Manage access or Control access to Cloud Healthcare API resources. You might also be able to get the required permissions through custom roles or other predefined roles.
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.
Run the
gcloud healthcare datasets describe
command.
Before using any of the command data below, make the following replacements:
: the dataset locationLOCATION
: the dataset IDDATASET_ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets describeDATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets describeDATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets describeDATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
name: projects/PROJECT_ID /locations/LOCATION /datasets/DATASET_ID timeZone:TIME_ZONE
Use the projects.locations.datasets.get
method.
Before using any of the request data, make the following replacements:
: the ID of your Google Cloud projectPROJECT_ID
: the dataset locationLOCATION
: the dataset IDDATASET_ID
To send your request, choose one of these options:
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 "
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
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:
Response
{ "name": "projects/PROJECT_ID /locations/LOCATION /datasets/DATASET_ID " "timeZone": "TIME_ZONE " }
List datasets
The following samples show how to list the datasets in your project.
Permissions required for this task
To perform this task, you must have been granted the following permissions or the following Identity and Access Management (IAM) roles:
Permissions
healthcare.datasets.list
Roles
-
Healthcare Dataset Viewer
(
roles/healthcare.datasetViewer
) -
Healthcare Dataset Administrator
(
roles/healthcare.datasetAdmin
)
You can ask your administrator to grant you these Identity and Access Management roles. For instructions on granting roles, see Manage access or Control access to Cloud Healthcare API resources. You might also be able to get the required permissions through custom roles or other predefined roles.
In the Google Cloud console, go to the Browser page.
Run the
gcloud healthcare datasets list
command.
Before using any of the command data below, make the following replacements:
: the dataset locationLOCATION
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 TIMEZONEDATASET_ID LOCATION TIME_ZONE
Use the projects.locations.datasets.list
method.
Before using any of the request data, make the following replacements:
: the ID of your Google Cloud projectPROJECT_ID
: the dataset locationLOCATION
To send your request, choose one of these options:
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"
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
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:
Response
{ "datasets": [ { "name": "projects/PROJECT_ID /locations/LOCATION /datasets/DATASET_ID ", "timeZone": "TIME_ZONE " }, { ... } ] }
Delete a dataset
The following samples show how to delete a dataset.
Permissions required for this task
To perform this task, you must have been granted the following permissions or the following Identity and Access Management (IAM) roles:
Permissions
healthcare.datasets.delete
Roles
You can ask your administrator to grant you these Identity and Access Management roles. For instructions on granting roles, see Manage access or Control access to Cloud Healthcare API resources. You might also be able to get the required permissions through custom roles or other predefined roles.
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.
Run the
gcloud healthcare datasets delete
command.
Before using any of the command data below, make the following replacements:
: the dataset locationLOCATION
: the dataset IDDATASET_ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare datasets deleteDATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare datasets deleteDATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare datasets deleteDATASET_ID ^ --location=LOCATION
To confirm, type Y.
The output is the following:
Deleted dataset [DATASET_ID ]
Use the projects.locations.datasets.delete
method.
Before using any of the request data, make the following replacements:
: the ID of your Google Cloud projectPROJECT_ID
: the dataset locationLOCATION
: the dataset IDDATASET_ID
To send your request, choose one of these options:
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 "
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
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.
What's next
- De-identify sensitive data
- Create and manage DICOM stores
- Create and manage FHIR stores
- Create and manage HL7v2 stores