This page explains how to create, edit, view, and delete Health Level Seven Version 2.x (HL7v2) stores. HL7v2 stores hold HL7v2 messages, which are used to transmit clinical data between systems.
Creating an HL7v2 store
Before you can create an HL7v2 store, you need to create a dataset.
The following samples show how to create an HL7v2 store.
Console
To create an HL7v2 store:
- In the Google Cloud console, go to the Datasets page.
- Select the dataset where you want to create an HL7v2 store.
- Click Create Data Store.
- Select HL7v2 as the data store type.
- Enter a name of your choice that's unique in your dataset. If the name is not unique, the data store creation fails.
- Click Next.
- To allow messages with no header, click Allow null message headers (MSH).
- To set a custom segment terminator, click Set a custom segment terminator and enter the terminator in the text box.
- To reject all messages with the same raw bytes as a message that has already been ingested/created, click Reject duplicate messages.
- Click Next.
-
If you want to configure a Pub/Sub topic for the data 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 data store appears in the list.
gcloud
To create an HL7v2 store, run the gcloud healthcare hl7v2-stores create
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the HL7v2 store's parent dataset
- HL7V2_STORE_ID:
an identifier for the HL7v2 store. The HL7v2 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
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare hl7v2-stores create HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare hl7v2-stores create HL7V2_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare hl7v2-stores create HL7V2_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following:
Response
Created hl7v2Store [HL7V2_STORE_ID].
REST
To create an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.create
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 HL7v2 store's parent dataset
- HL7V2_STORE_ID:
an identifier for the HL7v2 store. The HL7v2 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
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/DATASET_ID/hl7V2Stores?hl7V2StoreId=HL7V2_STORE_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/DATASET_ID/hl7V2Stores?hl7V2StoreId=HL7V2_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
Editing an HL7v2 store
The following samples show how to make these changes to an HL7v2 store:
Edit the list of Pub/Sub topics and filters that the Cloud Healthcare API uses to send notifications of HL7v2 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
To edit an HL7v2 store, complete the following steps:
- In the Google Cloud console, go to the Datasets page.
- Select the dataset containing the HL7v2 store you want to edit.
- In the Data stores list, click the data store you want to edit.
- To edit the HL7v2 store's configuration, click HL7v2 Store Configuration.
For more information on the HL7v2 store's configuration options, see Creating an HL7v2 store. - If you want to configure a Pub/Sub topic for the data store, click Add Pub/Sub topic 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
- If you have added a Pub/Sub topic, click Done.
- 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, see
- Click Save.
gcloud
The gcloud CLI doesn't support this action. Instead, use the Google Cloud console, curl
, PowerShell, or your preferred language.
REST
To edit an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.patch
method.
Before running the following samples, you must create at least one Pub/Sub topic in your project.
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 HL7v2 store's parent dataset
- HL7V2_STORE_ID: the HL7v2 store ID
- PUBSUB_TOPIC1: a Pub/Sub topic to which messages are published when an event occurs in a data store
- FILTER1: a string used to match messages published to PUBSUB_TOPIC1
See
filter
for examples of valid filter values. - PUBSUB_TOPIC2: a Pub/Sub topic to which messages are published
- FILTER2: a string used to match messages published to PUBSUB_TOPIC2
- KEY1: the first label key
- VALUE1: the first label value
- KEY2: the second label key
- VALUE2: the second label value
Request JSON body:
{ 'notificationConfigs': [ { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC1', 'filter' : 'FILTER1' }, { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC2', 'filter': 'FILTER2' }, ], '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' { 'notificationConfigs': [ { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC1', 'filter' : 'FILTER1' }, { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC2', 'filter': 'FILTER2' }, ], '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/hl7V2Stores/HL7V2_STORE_ID?updateMask=notificationConfigs,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:
@' { 'notificationConfigs': [ { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC1', 'filter' : 'FILTER1' }, { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC2', 'filter': 'FILTER2' }, ], '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/hl7V2Stores/HL7V2_STORE_ID?updateMask=notificationConfigs,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 HL7v2 store details
The following samples show how to get details about an HL7v2 store.
Console
To view an HL7v2 store's details:
- In the Google Cloud console, go to the Datasets page.
- Select the dataset containing the HL7v2 store you want to view.
- Click the name of the HL7v2 store.
gcloud
To get details about an HL7v2 store, run the gcloud healthcare hl7v2-stores describe
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the HL7v2 store's parent dataset
- HL7V2_STORE_ID: the HL7v2 store ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare hl7v2-stores describe HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare hl7v2-stores describe HL7V2_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare hl7v2-stores describe HL7V2_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following.
If you configured any fields in the Hl7V2Store
resource, they also appear in the response.
Response
... name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID ...
REST
To get details about an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.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 HL7v2 store's parent dataset
- HL7V2_STORE_ID: the HL7v2 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/hl7V2Stores/HL7V2_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/hl7V2Stores/HL7V2_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 Hl7V2Store
resource, they also appear in the response.
Go
Java
Node.js
Python
Listing the HL7v2 stores in a dataset
The following samples show how to list the HL7v2 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 list the HL7v2 stores in a dataset, run the gcloud healthcare hl7v2-stores list
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the HL7v2 store's parent dataset
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare hl7v2-stores list --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare hl7v2-stores list --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare hl7v2-stores list --dataset=DATASET_ID ^ --location=LOCATION
You should receive a response similar to the following.
If you configured any fields in the Hl7V2Store
resource, they also appear in the response.
ID LOCATION TOPIC HL7V2_STORE_ID LOCATION projects/PROJECT_ID/topics/PUBSUB_TOPIC PUBSUB_TOPIC ...
REST
To list the HL7v2 stores in a dataset, use the projects.locations.datasets.hl7V2Stores.list
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 HL7v2 store's parent dataset
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/hl7V2Stores"
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/hl7V2Stores" | 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 Hl7V2Store
resource, they also appear in the response.
Go
Java
Node.js
Python
Deleting an HL7v2 store
The following samples show how to delete an HL7v2 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 an HL7v2 store, run the gcloud healthcare hl7v2-stores delete
command.
Before using any of the command data below, make the following replacements:
- LOCATION: the dataset location
- DATASET_ID: the HL7v2 store's parent dataset
- HL7V2_STORE_ID: the HL7v2 store ID
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud healthcare hl7v2-stores delete HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
Windows (PowerShell)
gcloud healthcare hl7v2-stores delete HL7V2_STORE_ID ` --dataset=DATASET_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud healthcare hl7v2-stores delete HL7V2_STORE_ID ^ --dataset=DATASET_ID ^ --location=LOCATION
Deleted hl7v2Store [HL7V2_STORE_ID].
REST
To delete an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.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 HL7v2 store's parent dataset
- HL7V2_STORE_ID: the HL7v2 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/hl7V2Stores/HL7V2_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/hl7V2Stores/HL7V2_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.
Go
Java
Node.js
Python
What's next
- Read the conceptual documentation on how HL7v2 is implemented in the Cloud Healthcare API.
- Learn how to create and manage HL7v2 messages.