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 in the dataset, run the
gcloud healthcare hl7v2-stores create
command.
- The HL7v2 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 notify a Pub/Sub topic of HL7v2 store changes, specify an
existing Pub/Sub topic name using the
--pubsub-topic
argument.
projects/PROJECT_ID/topics/PUBSUB_TOPIC
The following sample shows how to create an HL7v2 store.
gcloud healthcare hl7v2-stores create HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
If the request is successful, the command prompt displays the following message:
Created hl7v2Store [HL7V2_STORE_ID].
API
To create an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.create
method.
curl
To create an HL7v2 store, make a POST
request and specify the following
information:
- The name of the parent dataset
- A name for the HL7v2 store. The HL7v2 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.
- An access token
- Optionally, an existing Pub/Sub topic to which the Cloud Healthcare API sends notifications of HL7v2 store changes. See Editing an HL7v2 store for information on how to configure the Pub/Sub topic.
- Optionally, a list of existing Pub/Sub topics and filters. The Cloud Healthcare API can send notifications to multiple topics, and you can use filters to restrict which notifications are sent. For more information on how to configure the Pub/Sub topics and filters, see Editing an HL7v2 store.
The following sample shows a POST
request using curl
.
curl -X POST \ --data "" \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores?hl7V2StoreId=HL7V2_STORE_ID"
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID" }
PowerShell
To create an HL7v2 store, make a POST
request and specify the following
information:
- The name of the parent dataset
- A name for the HL7v2 store. The HL7v2 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.
- An access token
- Optionally, an existing Pub/Sub topic to which the Cloud Healthcare API sends notifications of HL7v2 store changes. See Editing an HL7v2 store for information on how to configure the Pub/Sub topic.
- Optionally, a list of existing Pub/Sub topics and filters. The Cloud Healthcare API can send notifications to multiple topics, and you can use filters to restrict which notifications are sent. For more information on how to configure the Pub/Sub topics and filters, see Editing an HL7v2 store.
The following sample shows a POST
request using Windows PowerShell.
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores?hl7V2StoreId=HL7V2_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/hl7V2Stores/HL7V2_STORE_ID" }
Go
Java
Node.js
Python
Editing an HL7v2 store
The following samples show how to make the following 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 the edit icon next to Labels, click Add label, and enter the key/value label. For more information on resource labels, see Using resource labels.
- If you have added a label, click Save.
gcloud
gcloud CLI does not support editing the Pub/Sub
topic or labels. Instead, use curl
, Windows PowerShell, or your preferred
language.
API
To edit an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.patch
method.
curl
To edit an HL7v2 store, make a PATCH
request and specify the following
information:
- The name of the parent dataset
- The name of the HL7v2 store
The metadata to update. This sample includes the qualified URI to the Pub/Sub topics, the filters for the topics, and a set of labels defined as a comma-delimited list of key-value pairs.
See
filter
for examples of valid filter values.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 "{ 'notificationConfigs': [ { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC1', 'filter' : 'FILTER1' }, { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC2', 'filter': 'FILTER2' }, ], 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID?updateMask=notificationConfigs,labels"
For more information on defining filters and filter syntax, see Hl7V2NotificationConfig
.
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID", "parserConfig": {}, "labels": { "KEY1": "VALUE1", "KEY2": "VALUE2" }, "notificationConfigs": [ { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC1", "filter": "FILTER1" }, { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC2", "filter": "FILTER2" } ] }
PowerShell
To edit an HL7v2 store, make a PATCH
request and specify the following
information:
- The name of the parent dataset
- The name of the HL7v2 store
The metadata to update. This sample includes the qualified URI to the Pub/Sub topics, the filters for the topics, and a set of labels defined as a comma-delimited list of key-value pairs.
See
filter
for examples of valid filter values.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 "{ 'notificationConfigs': [ { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC1', 'filter': 'FILTER1' }, { 'pubsubTopic': 'projects/PROJECT_ID/topics/PUBSUB_TOPIC2', 'filter': 'FILTER2' }, ], 'labels': { 'KEY1':'VALUE1','KEY2':'VALUE2' } }" ` -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
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID", "parserConfig": {}, "labels": { "KEY1": "VALUE1", "KEY2": "VALUE2" }, "notificationConfigs": [ { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC1", "filter": "FILTER1" }, { "pubsubTopic": "projects/PROJECT_ID/topics/PUBSUB_TOPIC2", "filter": "FILTER2" } ] }
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 view details about an HL7v2 store, run the
gcloud healthcare hl7v2-stores describe
command.
The following sample shows how to get details about an HL7v2 store.
gcloud healthcare hl7v2-stores describe HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
If the request is successful, the command prompt displays the HL7v2 store details:
name: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7v2-stores/HL7V2_STORE_ID
API
To get details about an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.get
method.
curl
To get details about an HL7v2 store, make a GET
request and specify the
following information:
- The name of the parent dataset
- The name of the HL7v2 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/hl7V2Stores/HL7V2_STORE_ID"
If the request is successful, the server returns the response in JSON format:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID" }
If you configured any fields in the Hl7V2Store
resource, they also appear in the response.
PowerShell
To get details about an HL7v2 store, make a GET
request and specify the
following information:
- The name of the parent dataset
- The name of the HL7v2 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/hl7V2Stores/HL7V2_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/hl7V2Stores/HL7V2_STORE_ID" }
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.
- Click the ID of the dataset whose data stores you want to view.
gcloud
To list the HL7v2 stores in a dataset, run the
gcloud healthcare hl7v2-stores list
command.
gcloud healthcare hl7v2-stores list --dataset=DATASET_ID
If the request is successful, the command prompt lists the HL7v2 stores:
ID LOCATION TOPIC HL7V2_STORE_ID LOCATION projects/PROJECT_ID/topics/PUBSUB_TOPIC
API
To list the HL7v2 stores in a dataset, use the projects.locations.datasets.hl7V2Stores.list
method.
curl
To list the HL7v2 stores in a dataset, make a GET
request and specify the
following information:
- The name of the parent 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/hl7V2Stores"
If the request is successful, the server returns the response in JSON format:
{ "hl7V2Stores": [ { "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID" }, { ... } ] }
If you configured any fields in the Hl7V2Store
resource, they also appear in the response.
PowerShell
To list the HL7v2 stores in a dataset, make a GET
request and specify the
following information:
- The name of the parent 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/hl7V2Stores" | Select-Object -Expand Content
If the request is successful, the server returns the response in JSON format:
{ "hl7V2Stores": [ { "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID" }, { ... } ] }
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:
Run the
delete
command.gcloud healthcare hl7v2-stores delete HL7V2_STORE_ID \ --dataset=DATASET_ID \ --location=LOCATION
To confirm, type Y.
If the request is successful, the command prompt displays the following:
Deleted hl7v2Store [HL7V2_STORE_ID]
API
To delete an HL7v2 store, use the projects.locations.datasets.hl7V2Stores.delete
method.
curl
To delete an HL7v2 store, make a DELETE
request and specify the
following information:
- The name of the parent dataset
- The name of the HL7v2 store to delete
- 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/hl7V2Stores/HL7V2_STORE_ID"
If the request is successful, the server returns the empty body response in JSON format:
{}
PowerShell
To delete an HL7v2 store, make a DELETE
request and specify the following
information:
- The name of the parent dataset
- The name of the HL7v2 store to delete
- 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/hl7V2Stores/HL7V2_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
- Read the conceptual documentation on how HL7v2 is implemented in the Cloud Healthcare API.
- Learn how to create and manage HL7v2 messages.