CareCommunication Test scripts
4.0.0 - release

This page is part of the CareCommunication Testscripts (v4.0.0: Release) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions

: Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded - TTL Representation

Active as of 2024-07-15

Raw ttl | Download

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

 a fhir:TestScript ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "carecommunication-send-forward-partialthread"] ; # 
  fhir:meta [
    ( fhir:profile [
fhir:v "http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"^^xsd:anyURI ;
fhir:link <http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript>     ] )
  ] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: TestScript carecommunication-send-forward-partialthread</b></p><a name=\"carecommunication-send-forward-partialthread\"> </a><a name=\"hccarecommunication-send-forward-partialthread\"> </a><a name=\"carecommunication-send-forward-partialthread-en-US\"> </a><p><b>url</b>: <a href=\"TestScript-carecommunication-send-forward-partialthread.html\">TestScript Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded</a></p><p><b>version</b>: 4.0.0</p><p><b>name</b>: CareCommunicationTestScript</p><p><b>title</b>: Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded</p><p><b>status</b>: Active</p><p><b>date</b>: 2024-07-15</p><p><b>contact</b>: MedCom: <a href=\"mailto:mailto:fhir@medcom.dk\">mailto:fhir@medcom.dk</a></p><p><b>description</b>: </p><div><p>Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded</p>\n</div><p><b>copyright</b>: </p><div><p>MedCom 2023</p>\n</div><h3>Origins</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style=\"display: none\">*</td><td>1</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-profile-origin-types.html#testscript-profile-origin-types-FHIR-Client\">Test script profile origin type</a> FHIR-Client: FHIR Client</td></tr></table><h3>Destinations</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style=\"display: none\">*</td><td>1</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-profile-destination-types.html#testscript-profile-destination-types-FHIR-Server\">Test script profile destination type</a> FHIR-Server: FHIR Server</td></tr></table><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-new-message-01</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href=\"/Fixtures/CareCommunication-fixture-attachment.xml\">/Fixtures/CareCommunication-fixture-attachment.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-forward-message-02</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href=\"/Fixtures/CareCommunication-fixture-empty.xml\">/Fixtures/CareCommunication-fixture-empty.xml</a></p></blockquote><p><b>profile</b>: <a href=\"http://medcomfhir.dk/ig/carecommunication/4.0.1/StructureDefinition-medcom-careCommunication-message.html\">??</a></p><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-new-message-01</p><p><b>expression</b>: Bundle.entry[0].resource.id</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: destinationUri-new-message-01</p><p><b>expression</b>: Bundle.entry.resource.ofType(MessageHeader).destination.endpoint</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: bundleid-new-message-01</p><p><b>expression</b>: Bundle.id</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: hospitalSOR-new-message-01</p><p><b>expression</b>: Bundle.entry[0].resource.sender.reference.resolve().identifier.where(system = 'urn:oid:1.2.208.176.1.1').value</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-forward-message-02</p><p><b>expression</b>: Bundle.entry[0].resource.id</p><p><b>sourceId</b>: create-message-forward-message-02</p></blockquote><blockquote><p><b>setup</b></p><blockquote><p><b>action</b></p><h3>Operations</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-delete\">Test script operation code</a> delete: Delete</td><td>Bundle</td><td>System-generated search, delete operations from conditional delete on Bundle MessageHeader.destination.endpoint</td><td>xml</td><td>true</td><td>?message.destination-uri=${destinationUri-new-message}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-create\">Test script operation code</a> create: Create</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-new-message-01</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-updateCreate\">Test script operation code</a> updateCreate: Create using Update</td><td>Bundle</td><td>Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-new-message-01.</td><td>xml</td><td>xml</td><td>true</td><td>/${bundleid-new-message-01}</td><td>create-new-message-01</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</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-new-message-01</blockquote><p><b>name</b>: Get a new-message 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 style=\"display: none\">-</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 style=\"display: none\">*</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-read\">Test script operation code</a> read: Read</td><td>Bundle</td><td>Receive message</td><td>xml</td><td>1</td><td>true</td><td>1</td><td>/${bundleid-new-message-01}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</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>carecommunication-create-forward-message-02</blockquote><p><b>name</b>: Create a CareCommunication forward-message Message 02</p><p><b>description</b>: Post CareCommunication to the server.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-create\">Test script operation code</a> create: Create</td><td>Bundle</td><td>Post a carecommunication</td><td>1</td><td>true</td><td>1</td><td>create-message-forward-message-02</td><td>create-forward-message-02</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</td><td>Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication</td><td>request</td><td>carecommunication</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</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 style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</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 style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</td><td>Confirm that the previous MessageHeader.id is identical to Provenance.entity.what</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-reply-message-01}')).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</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 = 'care-communication-message').allTrue()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</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.where(role = 'revision').exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</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.contains(%resource.entry[0].resource.id)).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</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 style=\"display: none\">*</td><td>Confirm that the 2 Provenance instances exists.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).count()</td><td>equals</td><td>2</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</td><td>Confirm that number of payloads is '2'</td><td>request</td><td>Bundle.entry.resource.ofType(Communication).payload.count() = '2'</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style=\"display: none\">*</td><td>Confirm that the sender SOR number is different from the previous message.</td><td>request</td><td>Bundle.entry[0].resource.sender.reference.resolve().identifier.where(system = 'urn:oid:1.2.208.176.1.1').value != ${hospitalSOR-new-message})</td><td>false</td></tr></table></blockquote></blockquote></div>"
  ] ; # 
  fhir:url [ fhir:v "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-forward-partialthread"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "4.0.0"] ; # 
  fhir:name [ fhir:v "CareCommunicationTestScript"] ; # 
  fhir:title [ fhir:v "Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded"] ; # 
  fhir:status [ fhir:v "active"] ; # 
  fhir:date [ fhir:v "2024-07-15"^^xsd:date] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "MedCom" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "email" ] ;
fhir:value [ fhir:v "mailto:fhir@medcom.dk" ]     ] )
  ] ) ; # 
  fhir:description [ fhir:v "Forward a part of the CareCommunication thread. Only the message text is expected to be forwarded"] ; # 
  fhir:copyright [ fhir:v "MedCom 2023"] ; # 
  fhir:origin ( [
fhir:index [ fhir:v "1"^^xsd:integer ] ;
fhir:profile [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"^^xsd:anyURI ] ;
fhir:code [ fhir:v "FHIR-Client" ]     ]
  ] ) ; # 
  fhir:destination ( [
fhir:index [ fhir:v "1"^^xsd:integer ] ;
fhir:profile [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"^^xsd:anyURI ] ;
fhir:code [ fhir:v "FHIR-Server" ]     ]
  ] ) ; # 
  fhir:fixture ( [
fhir:id [ fhir:v "create-new-message-01" ] ;
fhir:autocreate [ fhir:v "false"^^xsd:boolean ] ;
fhir:autodelete [ fhir:v "false"^^xsd:boolean ] ;
fhir:resource [
fhir:reference [ fhir:v "/Fixtures/CareCommunication-fixture-attachment.xml" ]     ]
  ] [
fhir:id [ fhir:v "create-forward-message-02" ] ;
fhir:autocreate [ fhir:v "false"^^xsd:boolean ] ;
fhir:autodelete [ fhir:v "false"^^xsd:boolean ] ;
fhir:resource [
fhir:reference [ fhir:v "/Fixtures/CareCommunication-fixture-empty.xml" ]     ]
  ] ) ; # 
  fhir:profile ( [
fhir:link <http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message> ;
fhir:id [ fhir:v "carecommunication" ] ;
fhir:reference [ fhir:v "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message" ]
  ] ) ; # 
  fhir:variable ( [
fhir:name [ fhir:v "messageHeaderid-new-message-01" ] ;
fhir:expression [ fhir:v "Bundle.entry[0].resource.id" ] ;
fhir:sourceId [ fhir:v "create-message-new-message-01" ]
  ] [
fhir:name [ fhir:v "destinationUri-new-message-01" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(MessageHeader).destination.endpoint" ] ;
fhir:sourceId [ fhir:v "create-message-new-message-01" ]
  ] [
fhir:name [ fhir:v "bundleid-new-message-01" ] ;
fhir:expression [ fhir:v "Bundle.id" ] ;
fhir:sourceId [ fhir:v "create-message-new-message-01" ]
  ] [
fhir:name [ fhir:v "hospitalSOR-new-message-01" ] ;
fhir:expression [ fhir:v "Bundle.entry[0].resource.sender.reference.resolve().identifier.where(system = 'urn:oid:1.2.208.176.1.1').value" ] ;
fhir:sourceId [ fhir:v "create-message-new-message-01" ]
  ] [
fhir:name [ fhir:v "messageHeaderid-forward-message-02" ] ;
fhir:expression [ fhir:v "Bundle.entry[0].resource.id" ] ;
fhir:sourceId [ fhir:v "create-message-forward-message-02" ]
  ] ) ; # 
  fhir:setup [
    ( fhir:action [
fhir:operation [
fhir:type [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"^^xsd:anyURI ] ;
fhir:code [ fhir:v "delete" ]         ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:description [ fhir:v "System-generated search, delete operations from conditional delete on Bundle MessageHeader.destination.endpoint" ] ;
fhir:accept [ fhir:v "xml" ] ;
fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
fhir:params [ fhir:v "?message.destination-uri=${destinationUri-new-message}" ]       ]     ] [
fhir:operation [
fhir:type [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"^^xsd:anyURI ] ;
fhir:code [ fhir:v "create" ]         ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:description [ fhir:v "Create the Bundle resource in XML format on the destination server." ] ;
fhir:accept [ fhir:v "xml" ] ;
fhir:contentType [ fhir:v "xml" ] ;
fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
fhir:sourceId [ fhir:v "create-new-message-01" ]       ]     ] [
fhir:operation [
fhir:type [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"^^xsd:anyURI ] ;
fhir:code [ fhir:v "updateCreate" ]         ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:description [ fhir:v "Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-new-message-01." ] ;
fhir:accept [ fhir:v "xml" ] ;
fhir:contentType [ fhir:v "xml" ] ;
fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
fhir:params [ fhir:v "/${bundleid-new-message-01}" ] ;
fhir:sourceId [ fhir:v "create-new-message-01" ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the returned HTTP status is okay or created." ] ;
fhir:direction [ fhir:v "response" ] ;
fhir:operator [ fhir:v "in" ] ;
fhir:responseCode [ fhir:v "200,201" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] )
  ] ; # 
  fhir:test ( [
fhir:id [ fhir:v "message-read-new-message-01" ] ;
fhir:name [ fhir:v "Get a new-message message 01" ] ;
fhir:description [ fhir:v "GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format." ] ;
    ( fhir:action [
fhir:operation [
fhir:type [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"^^xsd:anyURI ] ;
fhir:code [ fhir:v "read" ]         ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:description [ fhir:v "Receive message" ] ;
fhir:accept [ fhir:v "xml" ] ;
fhir:destination [ fhir:v "1"^^xsd:integer ] ;
fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
fhir:origin [ fhir:v "1"^^xsd:integer ] ;
fhir:params [ fhir:v "/${bundleid-new-message-01}" ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the returned HTTP status is okay or created." ] ;
fhir:direction [ fhir:v "response" ] ;
fhir:operator [ fhir:v "in" ] ;
fhir:responseCode [ fhir:v "200,201" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] )
  ] [
fhir:id [ fhir:v "carecommunication-create-forward-message-02" ] ;
fhir:name [ fhir:v "Create a CareCommunication forward-message Message 02" ] ;
fhir:description [ fhir:v "Post CareCommunication to the server." ] ;
    ( fhir:action [
fhir:operation [
fhir:type [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"^^xsd:anyURI ] ;
fhir:code [ fhir:v "create" ]         ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:description [ fhir:v "Post a carecommunication" ] ;
fhir:destination [ fhir:v "1"^^xsd:integer ] ;
fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
fhir:origin [ fhir:v "1"^^xsd:integer ] ;
fhir:requestId [ fhir:v "create-message-forward-message-02" ] ;
fhir:sourceId [ fhir:v "create-forward-message-02" ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication" ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:validateProfileId [ fhir:v "carecommunication" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the returned HTTP status is okay or created." ] ;
fhir:direction [ fhir:v "response" ] ;
fhir:operator [ fhir:v "in" ] ;
fhir:responseCode [ fhir:v "200,201" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the client request payload contains a Bundle resource type." ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:resource [ fhir:v "Bundle" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the previous MessageHeader.id is identical to Provenance.entity.what" ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-reply-message-01}')).exists()" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the request resource contains the expected eventCoding.code." ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the role is set to revision. Not used when testing the first message in a stream" ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(Provenance).entity.where(role = 'revision').exists()" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the target reference in Provenance equals MessageHeader.id" ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the 2 Provenance instances exists." ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(Provenance).count()" ] ;
fhir:operator [ fhir:v "equals" ] ;
fhir:value [ fhir:v "2" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that number of payloads is '2'" ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry.resource.ofType(Communication).payload.count() = '2'" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] [
fhir:assert [
fhir:description [ fhir:v "Confirm that the sender SOR number is different from the previous message." ] ;
fhir:direction [ fhir:v "request" ] ;
fhir:expression [ fhir:v "Bundle.entry[0].resource.sender.reference.resolve().identifier.where(system = 'urn:oid:1.2.208.176.1.1').value != ${hospitalSOR-new-message})" ] ;
fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]       ]     ] )
  ] ) . #