What data to publish
To protect data quality of information passing through the NEMS:
-
Event messages published to the NEMS MUST only contain event information originating from the publishing system. Publishers should not re-publish event information they receive from other providers.
-
The NEMS event message forwarding functionality is designed to send event messages based on subscription criteria and does not perform any message routing or filtering based on who the publishing and subscribing systems are. Therefore it is possible that a system/provider publishing an event message may receive back their own event message, if the subscription criteria is met for one or more of their subscriptions.
Due to the wide variety of system architectures used by provider it is impractical and possibly unsafe to filter out these message loops centrally within the NEMS, therefore it is the responsibility of the system/provider to filter out these loop back messages where necessary to avoid duplicate data being created within their system.
Pre-requisites
In addition to the guidance on this page the guidance and requirement on the Generic Publication API Guidance page SHALL be followed when using the NEMS publication API.
Publishing an event message
To send an event message to the National Events Management Service (NEMS) the publisher MUST:
- construct an event message which conforms to the NEMS message architecture requirements within this specification and one of the event message implementation guides listed on the Introduction to National Events Management Service page.
- POST the event message to the National Events Management Service via the “$process-message” FHIR operation endpoint on the Spine
POST /$process-message
Request Headers
The publishing system MUST include the following HTTP request headers when making the call to the Publish API endpoint:
Header | Description |
---|---|
fromASID | ASID of the system posting to the Subscription API |
toASID | ASID of the NEMS service |
InteractionID | Fixed value: urn:nhs:names:services:clinicals-sync:PublicationApiPost |
Additional information about standard headers and endpoint looking is available in the Spine Core specification.
Response
The National Events Management Service will perform validation on the event message it receives from the publisher and will return:
- a
HTTP 202 Accepted
response when the event message successfully passes validation - an
OperationOutcome
FHIR resource containing error information when the event message fails validation. The OperationOutcome resource will contain one of the Spine ErrorOrWarning Codes and conform to the structure set out in the Spine Core FHIR specification.
Onward Delivery of the event message to subscribers
Following successful validation and providing a HTTP 202 Accepted
response the National Events Management Service will match the event message to Subscription criteria, and forward the event message to the originating Organisation for the subscription.
Publish Event Example
Request
The event message is included in the body of the POST request:
POST https://clinicals.spineservices.nhs.uk/STU3/$process-message HTTP/1.1
<Bundle xmlns="http://hl7.org/fhir">
<meta>
<profile value="https://fhir.nhs.uk/STU3/StructureDefinition/EMS-Bundle-1"/>
</meta>
<type value="message"/>
<entry>
<fullUrl value="urn:uuid:b9c63b5e-a88e-47d3-9d45-081ebe9e48b5"/>
<resource>
<MessageHeader>
<id value="b9c63b5e-a88e-47d3-9d45-081ebe9e48b5"/>
<meta>
<profile value="https://fhir.nhs.uk/STU3/StructureDefinition/EMS-MessageHeader-1"/>
</meta>
<extension url="https://fhir.nhs.uk/STU3/StructureDefinition/Extension-EMS-MessageEventType-1">
<valueCodeableConcept>
<coding>
<system value="https://fhir.nhs.uk/STU3/CodeSystem/EMS-MessageEventType-1"/>
<code value="new"/>
<display value="New event message"/>
</coding>
</valueCodeableConcept>
</extension>
<event>
<system value="https://fhir.nhs.uk/STU3/CodeSystem/EMS-EventType-1"/>
<code value="PDS002"/>
<display value="PDS Change of Address"/>
</event>
<timestamp value="2017-11-01T15:00:00+00:00"/>
<source>
<endpoint value="urn:nhs-uk:addressing:ods:RX3EP"/>
</source>
<responsible>
<reference value="urn:uuid:e04e172e-db43-4ff3-a30a-9d574f693d96"/>
</responsible>
<focus>
<reference value="urn:uuid:58df44c5-2b01-4425-bd9a-985ac73152d0"/>
</focus>
</MessageHeader>
</resource>
</entry>
<!-- ... Multiple entries for event content ... -->
</Bundle>
Response
If successfully received and validated, the response is:
HTTP 202 Accepted
Date: Fri, 25 May 2018 16:09:50 GMT