Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina fornisce una panoramica sull'utilizzo di Pub/Sub per ricevere notifiche quando si verificano eventi clinici in un datastore dell'API Cloud Healthcare.
Per informazioni su come configurare e utilizzare i messaggi Pub/Sub, consulta Configurazione delle notifiche Pub/Sub.
Panoramica
Puoi ricevere notifiche utilizzando
Pub/Sub quando si verifica uno dei seguenti eventi clinici:
Importa un'istanza DICOM in un archivio DICOM utilizzando il metodo dicomStores.import.
Una risorsa FHIR viene creata, sottoposta a patch, aggiornata o eliminata in un archivio FHIR. Tuttavia,
le notifiche non vengono inviate quando una risorsa FHIR viene importata da Cloud Storage.
Un messaggio HL7v2 viene importato o creato in un archivio HL7v2.
Le informazioni su ciascun evento vengono aggiunte all'argomento Pub/Sub del datastore corrispondente sotto forma di messaggio.
Puoi pubblicare messaggi in qualsiasi argomento Pub/Sub di tutti i progetti per i quali disponi di autorizzazioni sufficienti. Quando l'argomento Pub/Sub riceve il messaggio, questo verrà inoltrato a tutti i sottoscrittori dell'argomento.
Notifiche DICOM
Per informazioni sull'utilizzo delle notifiche Pub/Sub con i dati DICOM, consulta Notifiche Pub/Sub DICOM.
Notifiche FHIR
Per informazioni sull'utilizzo delle notifiche Pub/Sub con i dati FHIR, consulta Notifiche Pub/Sub FHIR.
Notifiche HL7v2
Il seguente diagramma mostra il flusso di notifiche che si verificano quando un messaggio HL7v2 viene importato o creato:
L'API Cloud Healthcare importa un messaggio HL7v2 da un sistema sanitario.
Il messaggio viene archiviato in un archivio HL7v2.
L'archivio HL7v2 crea e invia un messaggio Pub/Sub agli argomenti Pub/Sub dell'archivio che hanno un filtro corrispondente al messaggio HL7v2.
Pub/Sub inoltra il messaggio Pub/Sub alle sottoscrizioni degli argomenti.
Gli abbonati ricevono una notifica, sotto forma di messaggio Pub/Sub, dal loro abbonamento. Ogni abbonamento può avere uno o più abbonati per un maggiore parallelismo.
Formato delle notifiche
Le notifiche inviate a un argomento Pub/Sub sono composte da due parti:
Attributi: un set di coppie chiave:valore che descrivono l'evento. Questi valori possono essere utilizzati per filtrare gli eventi ricevuti da un client filtrando i messaggi di un abbonamento.
Dati: una stringa che contiene un identificatore per la risorsa FHIR, l'istanza DICOM o il messaggio HL7v2 in questione.
Dati delle istanze DICOM
Ogni volta che un'istanza DICOM viene memorizzata in un archivio DICOM, il seguente identificatore viene sempre incluso nel campo data del messaggio Pub/Sub:
Le notifiche per un'istanza DICOM archiviata non contengono valori attribute.
Dati e attributi dei messaggi HL7v2
Quando un messaggio HL7v2 viene creato o importato in un archivio HL7v2, il seguente
identificatore viene sempre incluso nel campo data del messaggio Pub/Sub:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003ePub/Sub notifications are sent when clinical events occur, such as storing a DICOM instance, creating or updating a FHIR resource, or ingesting an HL7v2 message.\u003c/p\u003e\n"],["\u003cp\u003eEach event notification includes information about the event added to the data store's Pub/Sub topic in the form of a message, forwarded to subscribers.\u003c/p\u003e\n"],["\u003cp\u003eNotifications consist of attributes, key-value pairs describing the event, and data, an identifier for the relevant FHIR resource, DICOM instance, or HL7v2 message.\u003c/p\u003e\n"],["\u003cp\u003eFor DICOM instance notifications, only the data field is populated with the instance identifier; no attribute values are sent.\u003c/p\u003e\n"],["\u003cp\u003eHL7v2 message notifications include the message's identifier in the data field and attributes like \u003ccode\u003emsgType\u003c/code\u003e that describe the type of message.\u003c/p\u003e\n"]]],[],null,["# Pub/Sub notifications\n\nThis page provides an overview of using Pub/Sub to receive\nnotifications when clinical events occur in a Cloud Healthcare API data\nstore.\nTo learn how to set up and use Pub/Sub messages, see\n[Configuring Pub/Sub notifications](/healthcare-api/docs/how-tos/pubsub).\n\nOverview\n--------\n\nYou can receive notifications using\n[Pub/Sub](/pubsub) when any of the following clinical events occur:\n\n- You store a DICOM instance in a DICOM store using the [`dicomStores.dicomWeb.studies.storeInstances`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores.studies/storeInstances) method.\n- You import a DICOM instance into a DICOM store using the [`dicomStores.import`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.dicomStores/import) method.\n- A FHIR resource is created, patched, updated, or deleted in a FHIR store. However, notifications are not sent when a FHIR resource is [imported from Cloud Storage](/healthcare-api/docs/how-tos/fhir-import-export#importing_fhir_resources).\n- An HL7v2 message is ingested or created in an HL7v2 store.\n\nInformation about each event is added to the corresponding data store's\nPub/Sub topic in the form of a message.\n\nYou can publish messages to any Pub/Sub topic in any project\nfor which you have sufficient permissions. After the Pub/Sub\ntopic receives the message, the message will be forwarded to any number of\nsubscribers to the topic.\n\nDICOM notifications\n-------------------\n\nFor information on using Pub/Sub notifications with DICOM data, see\n[DICOM Pub/Sub notifications](/healthcare-api/docs/dicom-pubsub).\n\nFHIR notifications\n------------------\n\nFor information on using Pub/Sub notifications with FHIR data,\nsee [FHIR Pub/Sub notifications](/healthcare-api/docs/fhir-pubsub).\n\nHL7v2 notifications\n-------------------\n\nThe following diagram shows the flow of notifications that occur when an HL7v2\nmessage is ingested or created:\n\n1. The Cloud Healthcare API ingests an HL7v2 message from a care system.\n2. The message is stored in an HL7v2 store.\n3. The HL7v2 store creates and sends a Pub/Sub message to the store's Pub/Sub topics that have a filter that matches the HL7v2 message.\n4. Pub/Sub forwards the Pub/Sub message to the topics' subscriptions.\n5. The subscribers receive a notification, in the form of a Pub/Sub message, from their subscription. Each subscription can have one or more subscribers for increased parallelism.\n\nNotification format\n-------------------\n\nNotifications sent to a Pub/Sub topic consist of two parts:\n\n- **Attributes** : A set of key:value pairs describing the event. These values can be used to filter which events a client receives by [filtering messages\n from a subscription](/pubsub/docs/subscription-message-filter).\n- **Data**: A string that contains an identifier for the relevant FHIR resource, DICOM instance, or HL7v2 message.\n\n### DICOM instance data\n\nWhen a DICOM instance is stored in a DICOM store, the following identifier\nis always included in the `data` field of the Pub/Sub\nmessage: \n\n```bash\nprojects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID/dicomWeb/studies/STUDY_UID/series/SERIES_UID/instances/INSTANCE_UID\n```\n\nNotifications for a stored DICOM instance do not contain\nany `attribute` values.\n\n### HL7v2 message data and attributes\n\nWhen an HL7v2 message is created or ingested into an HL7v2 store, the following\nidentifier is always included in the `data` field of the Pub/Sub\nmessage: \n\n```bash\nprojects/PROJECT_ID/locations/us-central1/datasets/DATASET_ID/hl7V2Stores/HL7V2_STORE_ID/messages/HL7V2_MESSAGE_ID\n```\n\nThe following set of key:value pairs is always included in the Pub/Sub\nmessage's `attributes` field:\n\nWhat's next\n-----------\n\n- Read the [Pub/Sub documentation](/pubsub/docs).\n- For an in-depth explanation of Pub/Sub, see [What is Cloud Pub/Sub?](/pubsub/docs/overview)"]]