Configure DICOM Pub/Sub notifications

This page describes how to use Pub/Sub to get notifications about clinical events in a DICOM store. You can receive Pub/Sub notifications when a new DICOM instance is stored, imported from Cloud Storage, updated, or deleted in a DICOM store.

You can use Pub/Sub notifications for multiple purposes, such as triggering downstream processing or analyzing new data. For example, a machine learning model can receive notifications when new data is available for training and generate insights to improve patient care.

The following figure shows how Pub/Sub notifications are generated and published.

DICOM Pub/Sub notifications.

Figure 1. Receiving Pub/Sub notifications about clinical events in a DICOM store.

Figure 1 shows the following steps:

  1. A caller makes a request to store or import a DICOM instance.
  2. The DICOM store receives the request, creates a Pub/Sub message, and sends it to the Pub/Sub topic configured on the DICOM store.
  3. Pub/Sub forwards the message to the subscriptions attached to the topic.
  4. The subscribers receive the message from their subscription. Each subscription can have one or more subscribers for increased parallelism.

Before you begin

  1. Create a topic.
  2. Create a pull subscription.

Add Pub/Sub publisher permissions

To publish messages from the Cloud Healthcare API to Pub/Sub, you must add the pubsub.publisher role to your project's Cloud Healthcare Service Agent service account. For more information, see DICOM, FHIR, and HL7v2 store Pub/Sub permissions.

Notification configuration

You can configure Pub/Sub notifications and their behavior in a DicomNotificationConfig object on a DICOM store. Each DICOM store can have multiple DicomNotificationConfig objects configured.

The following table describes the fields in the DicomNotificationConfig object:

Field Description Example
pubsubTopic The Pub/Sub topic to attach to the DICOM store. Notifications are sent to the specified topic. projects/my-project/topics/my-topic

Notification format and content

A Pub/Sub notification contains a Message object that includes information about the clinical event. The Message object looks similar to the following:

{
  "message": {
    "attributes": {
      "action": "ACTION",
      "lastUpdatedTime": "RFC_1123_FORMAT_DATETIME",
      "storeName": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID",
      "studyInstanceUID": "STUDY_UID",
      "seriesInstanceUID": "SERIES_UID",
      "sopInstanceUID": "INSTANCE_UID",
      "versionId": "VERSION_ID",
      "modality": "MODALITY",
      "storageClass": "STORAGE_CLASS",
      "previousStorageClass": "PREVIOUS_STORAGE_CLASS"
    },
    "data": "BASE_64_ENCODED_DATA",
    "messageId": "MESSAGE_ID",
    "publishTime": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ"
  }
}

For more information about the fields included in each Pub/Sub message, see ReceivedMessage and PubsubMessage.

The following table describes each field in the attributes object:

Attribute Description Example
action The action that occurred on a DICOM resource. Possible values include:
  • StoreInstances
  • ImportDicomData
  • SetBlobSettings
  • DeleteInstances
StoreInstances
lastUpdatedTime A timestamp of the most recent time the DICOM resource was modified. The timestamp uses the RFC 1123 format. Mon, 01 Jan 2020 00:00:00 UTC
storeName The full resource name of the DICOM store where the action occurred. projects/my-project/locations/us/datasets/my-dataset/dicomStores/my-dicom-store
studyInstanceUID The DICOM study instance unique identifier (UID). 1.2.3.4.5.6
seriesInstanceUID The DICOM series instance unique identifier (UID). 1.2.3.4.5.6
sopInstanceUID The DICOM SOP instance unique identifier (UID). 1.2.3.4.5.6
versionId The ID of the most recent version of the DICOM resource that the action occurred on. MTY4MzA2MDQzOTI5NjIxMDAwMA
modality The modality tag of the DICOM resource. Possible values include but not limited to:
  • CT
  • MR
  • MG
CT
storageClass The storage class of the DICOM resource. Possible values include:
  • STANDARD
  • NEARLINE
  • COLDLINE
  • ARCHIVE
STANDARD
previousStorageClass The previous storage class of the DICOM resource. Possible values include:
  • STANDARD
  • NEARLINE
  • COLDLINE
  • ARCHIVE
NEARLINE

The following table describes the remaining fields in the message object:

Field Description
data A base 64-encoded string of the following identifier: projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID/dicomWeb/studies/STUDY_UID/series/