Acknowledgement Test scripts
2.0.0 - release

This page is part of the DK MedCom Acknowledgement TestScripts (v2.0.0: Release) based on FHIR R4. . For a full list of available versions, see the Directory of published versions

: Acknowledgement_TestScript_OK-duplicate-hospitalnotification - XML Representation

Active as of 2023-05-25

Raw xml | Download



<TestScript xmlns="http://hl7.org/fhir">
  <id value="acknowledgement-send-ok-duplicate-hospitalnotification"/>
  <meta>
    <profile
             value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/>
  </meta>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative: TestScript</b><a name="acknowledgement-send-ok-duplicate-hospitalnotification"> </a></p><div style="display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%"><p style="margin-bottom: 0px">Resource TestScript &quot;acknowledgement-send-ok-duplicate-hospitalnotification&quot; </p><p style="margin-bottom: 0px">Profile: <a href="file://D:\GitHub\Touchstone\testing-ig\output/StructureDefinition-testscript.html">AEGIS Touchstone Testing TestScript Profile</a></p></div><p><b>url</b>: <code>http://medcomfhir.dk/ig/acknowledgementtestscript/acknowledgement-send-ok-duplicate-hospitalnotification</code></p><p><b>version</b>: 2.0.0</p><p><b>name</b>: AcknowledgementTestScript</p><p><b>title</b>: Send duplicate acknowledgement - OK</p><p><b>status</b>: active</p><p><b>date</b>: 2023-05-25</p><p><b>publisher</b>: MedCom</p><p><b>contact</b>: MedCom: <a href="mailto:mailto:fhir@medcom.dk">mailto:fhir@medcom.dk</a></p><p><b>description</b>: Send duplicate acknowledgement - OK</p><p><b>copyright</b>: MedCom 2023</p><h3>Origins</h3><table class="grid"><tr><td>-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td>*</td><td>1</td><td>FHIR Client (Details: http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types code FHIR-Client = 'FHIR Client', stated as 'null')</td></tr></table><h3>Destinations</h3><table class="grid"><tr><td>-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td>*</td><td>1</td><td>FHIR Server (Details: http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types code FHIR-Server = 'FHIR Server', stated as 'null')</td></tr></table><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-STIN-01</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml">/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-STIN2-03</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml">/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-ok-02</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml">/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-ok-04</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml">/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml</a></p></blockquote><p><b>profile</b>: <a href="http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement">http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement</a> &quot;MedComAcknowledgementMessage&quot;</p><blockquote><p><b>variable</b></p><p><b>name</b>: destinationUri-STIN</p><p><b>expression</b>: Bundle.entry.resource.ofType(MessageHeader).destination.endpoint</p><p><b>sourceId</b>: create-STIN-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundleid-STIN-01</p><p><b>expression</b>: Bundle.id</p><p><b>sourceId</b>: create-STIN-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-STIN</p><p><b>expression</b>: Bundle.entry[0].fullUrl</p><p><b>sourceId</b>: create-STIN-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: destinationUri-STIN2</p><p><b>expression</b>: Bundle.entry.resource.ofType(MessageHeader).destination.endpoint</p><p><b>sourceId</b>: create-STIN2-03</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundleid-STIN2-03</p><p><b>expression</b>: Bundle.id</p><p><b>sourceId</b>: create-STIN2-03</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-STIN2</p><p><b>expression</b>: Bundle.entry[0].fullUrl</p><p><b>sourceId</b>: create-STIN2-03</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundleid-ok-02</p><p><b>expression</b>: Bundle.id</p><p><b>sourceId</b>: create-message-ok-02</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundletimestamp-ok-02</p><p><b>expression</b>: Bundle.timestamp</p><p><b>sourceId</b>: create-message-ok-02</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundleid-ok-04</p><p><b>expression</b>: Bundle.id</p><p><b>sourceId</b>: create-message-ok-04</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundletimestamp-ok-04</p><p><b>expression</b>: Bundle.timestamp</p><p><b>sourceId</b>: create-message-ok-04</p></blockquote><blockquote><p><b>setup</b></p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td></tr><tr><td>*</td><td>Delete (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code delete = 'Delete', stated as 'null')</td><td>Bundle</td><td>System-generated search and delete operations from conditional delete on Bundle MessageHeader.destination.endpoint</td><td>xml</td><td>true</td><td>?message.destination-uri=${destinationUri-STIN}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>ContentType</b></td><td><b>EncodeRequestUrl</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code create = 'Create', stated as 'null')</td><td>Bundle</td><td>Create the Bundle resource in XML format on the destination server.</td><td>xml</td><td>xml</td><td>true</td><td>create-STIN-01</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>ContentType</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create using Update (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code updateCreate = 'Create using Update', stated as 'null')</td><td>Bundle</td><td>Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-STIN-01.</td><td>xml</td><td>xml</td><td>true</td><td>/${bundleid-STIN-01}</td><td>create-STIN-01</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>ContentType</b></td><td><b>EncodeRequestUrl</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code create = 'Create', stated as 'null')</td><td>Bundle</td><td>Create the Bundle resource in XML format on the destination server.</td><td>xml</td><td>xml</td><td>true</td><td>create-STIN2-03</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>ContentType</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create using Update (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code updateCreate = 'Create using Update', stated as 'null')</td><td>Bundle</td><td>Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-STIN2-03.</td><td>xml</td><td>xml</td><td>true</td><td>/${bundleid-STIN2-03}</td><td>create-STIN2-03</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>message-read-STIN-01</blockquote><p><b>name</b>: Get a STIN message 01</p><p><b>description</b>: GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>Params</b></td></tr><tr><td>*</td><td>Read (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code read = 'Read', stated as 'null')</td><td>Bundle</td><td>Receive message</td><td>xml</td><td>1</td><td>true</td><td>1</td><td>/${bundleid-STIN-01}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>message-create-ok-02</blockquote><p><b>name</b>: Create an Acknowledegment ok Message 02</p><p><b>description</b>: Post Acknowledegment to the server.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>RequestId</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code create = 'Create', stated as 'null')</td><td>Bundle</td><td>Post an Acknowledegment</td><td>1</td><td>true</td><td>1</td><td>create-message-ok-02</td><td>create-ok-02</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the client request payload contains a Bundle resource type.</td><td>request</td><td>Bundle</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Validates the bundle against http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement</td><td>request</td><td>acknowledgement</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the previous MessageHeader fullURL is identical to Provenance.entity.what</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(entity.what.reference = '${messageHeaderid-STIN}').count() = 1</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the request resource contains the expected eventCoding.code.</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'acknowledgement-message').allTrue()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that MessageHeader.responseCode equals to ok</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok'</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that a OperationOutcome instance is included, when the responseCode is 'transient-error' or 'fatal-error'</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok' or ((Bundle.entry.resource.ofType(MessageHeader).response.code = 'transient-error' or Bundle.entry.resource.ofType(MessageHeader).response.code = 'fatal-error') and Bundle.entry.resource.ofType(OperationOutcome).exists())</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the role is set to revision. Not used when testing the first message in a stream</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).entity.role</td><td>equals</td><td>revision</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the target reference in Provenance equals MessageHeader.id</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(target.reference = %resource.entry[0].fullUrl).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that 2 Provenance instances exists.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).count() = 2</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the one Provenance instance contains the expected activity code.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'acknowledgement').count() = 1</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>message-read-STIN2-03</blockquote><p><b>name</b>: Get a STIN2 message 03</p><p><b>description</b>: GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Accept</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>Params</b></td></tr><tr><td>*</td><td>Read (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code read = 'Read', stated as 'null')</td><td>Bundle</td><td>Receive message</td><td>xml</td><td>1</td><td>true</td><td>1</td><td>/${bundleid-STIN2-03}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>message-create-ok-04</blockquote><p><b>name</b>: Create an Acknowledegment ok Message 04</p><p><b>description</b>: Post Acknowledegment to the server.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>RequestId</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>Create (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code create = 'Create', stated as 'null')</td><td>Bundle</td><td>Post an Acknowledegment</td><td>1</td><td>true</td><td>1</td><td>create-message-ok-04</td><td>create-ok-04</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the client request payload contains a Bundle resource type.</td><td>request</td><td>Bundle</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Validates the bundle against http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement</td><td>request</td><td>acknowledgement</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the previous MessageHeader fullURL is identical to Provenance.entity.what</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(entity.what.reference = '${messageHeaderid-STIN2}').count() = 1</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the request resource contains the expected eventCoding.code.</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'acknowledgement-message').allTrue()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that MessageHeader.responseCode equals to ok</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok'</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that a OperationOutcome instance is included, when the responseCode is 'transient-error' or 'fatal-error'</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok' or ((Bundle.entry.resource.ofType(MessageHeader).response.code = 'transient-error' or Bundle.entry.resource.ofType(MessageHeader).response.code = 'fatal-error') and Bundle.entry.resource.ofType(OperationOutcome).exists())</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the role is set to revision. Not used when testing the first message in a stream</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).entity.role</td><td>equals</td><td>revision</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the target reference in Provenance equals MessageHeader.id</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(target.reference = %resource.entry[0].fullUrl).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that 2 Provenance instances exists.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).count() = 2</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the one Provenance instance contains the expected activity code.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'acknowledgement').count() = 1</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the Bundle.timestamp of the two Acknowledgements are different.</td><td>request</td><td>'${bundletimestamp-ok-02}' != '${bundletimestamp-ok-04}'</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td>-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td>*</td><td>Confirm that the Bundle.id of the two Acknowledgements are different.</td><td>request</td><td>'${bundleid-ok-02}' != '${bundleid-ok-04}'</td><td>false</td></tr></table></blockquote></blockquote></div>
  </text>
  <url
       value="http://medcomfhir.dk/ig/acknowledgementtestscript/acknowledgement-send-ok-duplicate-hospitalnotification"/>
  <version value="2.0.0"/>
  <name value="AcknowledgementTestScript"/>
  <title value="Send duplicate acknowledgement - OK"/>
  <status value="active"/>
  <date value="2023-05-25"/>
  <publisher value="MedCom"/>
  <contact>
    <name value="MedCom"/>
    <telecom>
      <system value="email"/>
      <value value="mailto:fhir@medcom.dk"/>
    </telecom>
  </contact>
  <description value="Send duplicate acknowledgement - OK"/>
  <copyright value="MedCom 2023"/>
  <origin>
    <index value="1"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>
      <code value="FHIR-Client"/>
    </profile>
  </origin>
  <destination>
    <index value="1"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>
      <code value="FHIR-Server"/>
    </profile>
  </destination>
  <fixture id="create-STIN-01">
    <autocreate value="false"/>
    <autodelete value="false"/>
    <resource>
      <reference
                 value="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml"/>
    </resource>
  </fixture>
  <fixture id="create-STIN2-03">
    <autocreate value="false"/>
    <autodelete value="false"/>
    <resource>
      <reference
                 value="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/HospitalNotification-fixture-STIN-ok.xml"/>
    </resource>
  </fixture>
  <fixture id="create-ok-02">
    <autocreate value="false"/>
    <autodelete value="false"/>
    <resource>
      <reference
                 value="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml"/>
    </resource>
  </fixture>
  <fixture id="create-ok-04">
    <autocreate value="false"/>
    <autodelete value="false"/>
    <resource>
      <reference
                 value="/FHIRSandbox/MedCom/Acknowledgement/draft/Send/Fixtures/Acknowledgement-fixture.xml"/>
    </resource>
  </fixture>
  <profile id="acknowledgement">
    <reference
               value="http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement"/>
  </profile>
  <variable>
    <name value="destinationUri-STIN"/>
    <expression
                value="Bundle.entry.resource.ofType(MessageHeader).destination.endpoint"/>
    <sourceId value="create-STIN-01"/>
  </variable>
  <variable>
    <name value="bundleid-STIN-01"/>
    <expression value="Bundle.id"/>
    <sourceId value="create-STIN-01"/>
  </variable>
  <variable>
    <name value="messageHeaderid-STIN"/>
    <expression value="Bundle.entry[0].fullUrl"/>
    <sourceId value="create-STIN-01"/>
  </variable>
  <variable>
    <name value="destinationUri-STIN2"/>
    <expression
                value="Bundle.entry.resource.ofType(MessageHeader).destination.endpoint"/>
    <sourceId value="create-STIN2-03"/>
  </variable>
  <variable>
    <name value="bundleid-STIN2-03"/>
    <expression value="Bundle.id"/>
    <sourceId value="create-STIN2-03"/>
  </variable>
  <variable>
    <name value="messageHeaderid-STIN2"/>
    <expression value="Bundle.entry[0].fullUrl"/>
    <sourceId value="create-STIN2-03"/>
  </variable>
  <variable>
    <name value="bundleid-ok-02"/>
    <expression value="Bundle.id"/>
    <sourceId value="create-message-ok-02"/>
  </variable>
  <variable>
    <name value="bundletimestamp-ok-02"/>
    <expression value="Bundle.timestamp"/>
    <sourceId value="create-message-ok-02"/>
  </variable>
  <variable>
    <name value="bundleid-ok-04"/>
    <expression value="Bundle.id"/>
    <sourceId value="create-message-ok-04"/>
  </variable>
  <variable>
    <name value="bundletimestamp-ok-04"/>
    <expression value="Bundle.timestamp"/>
    <sourceId value="create-message-ok-04"/>
  </variable>
  <setup>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="delete"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="System-generated search and delete operations from conditional delete on Bundle MessageHeader.destination.endpoint"/>
        <accept value="xml"/>
        <encodeRequestUrl value="true"/>
        <params value="?message.destination-uri=${destinationUri-STIN}"/>
      </operation>
    </action>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="create"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="Create the Bundle resource in XML format on the destination server."/>
        <accept value="xml"/>
        <contentType value="xml"/>
        <encodeRequestUrl value="true"/>
        <sourceId value="create-STIN-01"/>
      </operation>
    </action>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="updateCreate"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-STIN-01."/>
        <accept value="xml"/>
        <contentType value="xml"/>
        <encodeRequestUrl value="true"/>
        <params value="/${bundleid-STIN-01}"/>
        <sourceId value="create-STIN-01"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="create"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="Create the Bundle resource in XML format on the destination server."/>
        <accept value="xml"/>
        <contentType value="xml"/>
        <encodeRequestUrl value="true"/>
        <sourceId value="create-STIN2-03"/>
      </operation>
    </action>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="updateCreate"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-STIN2-03."/>
        <accept value="xml"/>
        <contentType value="xml"/>
        <encodeRequestUrl value="true"/>
        <params value="/${bundleid-STIN2-03}"/>
        <sourceId value="create-STIN2-03"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </setup>
  <test id="message-read-STIN-01">
    <name value="Get a STIN message 01"/>
    <description
                 value="GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Bundle"/>
        <description value="Receive message"/>
        <accept value="xml"/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <origin value="1"/>
        <params value="/${bundleid-STIN-01}"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
  <test id="message-create-ok-02">
    <name value="Create an Acknowledegment ok Message 02"/>
    <description value="Post Acknowledegment to the server."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="create"/>
        </type>
        <resource value="Bundle"/>
        <description value="Post an Acknowledegment"/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <origin value="1"/>
        <requestId value="create-message-ok-02"/>
        <sourceId value="create-ok-02"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the client request payload contains a Bundle resource type."/>
        <direction value="request"/>
        <resource value="Bundle"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Validates the bundle against http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement"/>
        <direction value="request"/>
        <validateProfileId value="acknowledgement"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the previous MessageHeader fullURL is identical to Provenance.entity.what"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(entity.what.reference = '${messageHeaderid-STIN}').count() = 1"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the request resource contains the expected eventCoding.code."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'acknowledgement-message').allTrue()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that MessageHeader.responseCode equals to ok"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok'"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that a OperationOutcome instance is included, when the responseCode is 'transient-error' or 'fatal-error'"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok' or ((Bundle.entry.resource.ofType(MessageHeader).response.code = 'transient-error' or Bundle.entry.resource.ofType(MessageHeader).response.code = 'fatal-error') and Bundle.entry.resource.ofType(OperationOutcome).exists())"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the role is set to revision. Not used when testing the first message in a stream"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).entity.role"/>
        <operator value="equals"/>
        <value value="revision"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the target reference in Provenance equals MessageHeader.id"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(target.reference = %resource.entry[0].fullUrl).exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description value="Confirm that 2 Provenance instances exists."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).count() = 2"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the one Provenance instance contains the expected activity code."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'acknowledgement').count() = 1"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
  <test id="message-read-STIN2-03">
    <name value="Get a STIN2 message 03"/>
    <description
                 value="GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Bundle"/>
        <description value="Receive message"/>
        <accept value="xml"/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <origin value="1"/>
        <params value="/${bundleid-STIN2-03}"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
  <test id="message-create-ok-04">
    <name value="Create an Acknowledegment ok Message 04"/>
    <description value="Post Acknowledegment to the server."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="create"/>
        </type>
        <resource value="Bundle"/>
        <description value="Post an Acknowledegment"/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <origin value="1"/>
        <requestId value="create-message-ok-04"/>
        <sourceId value="create-ok-04"/>
      </operation>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the returned HTTP status is okay or created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200,201"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the client request payload contains a Bundle resource type."/>
        <direction value="request"/>
        <resource value="Bundle"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Validates the bundle against http://medcomfhir.dk/ig/acknowledgement/StructureDefinition/medcom-messaging-acknowledgement"/>
        <direction value="request"/>
        <validateProfileId value="acknowledgement"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the previous MessageHeader fullURL is identical to Provenance.entity.what"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(entity.what.reference = '${messageHeaderid-STIN2}').count() = 1"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the request resource contains the expected eventCoding.code."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'acknowledgement-message').allTrue()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that MessageHeader.responseCode equals to ok"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok'"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that a OperationOutcome instance is included, when the responseCode is 'transient-error' or 'fatal-error'"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(MessageHeader).response.code = 'ok' or ((Bundle.entry.resource.ofType(MessageHeader).response.code = 'transient-error' or Bundle.entry.resource.ofType(MessageHeader).response.code = 'fatal-error') and Bundle.entry.resource.ofType(OperationOutcome).exists())"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the role is set to revision. Not used when testing the first message in a stream"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).entity.role"/>
        <operator value="equals"/>
        <value value="revision"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the target reference in Provenance equals MessageHeader.id"/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(target.reference = %resource.entry[0].fullUrl).exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description value="Confirm that 2 Provenance instances exists."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).count() = 2"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the one Provenance instance contains the expected activity code."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'acknowledgement').count() = 1"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the Bundle.timestamp of the two Acknowledgements are different."/>
        <direction value="request"/>
        <expression
                    value="'${bundletimestamp-ok-02}' != '${bundletimestamp-ok-04}'"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <description
                     value="Confirm that the Bundle.id of the two Acknowledgements are different."/>
        <direction value="request"/>
        <expression value="'${bundleid-ok-02}' != '${bundleid-ok-04}'"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
</TestScript>