{ "description": "Reply CareCommunication to a CareCommunication that has been forwarded", "_filename": "example/TestScript-carecommunication-send-reply-forward.json", "package_name": "medcom.fhir.dk.carecommunicationtestscripts", "date": "2024-07-15", "meta": { "profile": [ "http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript" ] }, "variable": [ { "name": "messageHeaderid-forward-message-01", "sourceId": "create-message-forward-message-01", "expression": "Bundle.entry[0].resource.id" }, { "name": "searchParamIdentifier-forward-message", "sourceId": "create-message-forward-message", "expression": "Bundle.entry.resource.ofType(MessageHeader).id" }, { "name": "messageHeaderid-reply-message-02", "sourceId": "create-message-reply-message-02", "expression": "Bundle.entry[0].resource.id" }, { "name": "identifier-forward-message-01", "sourceId": "create-message-forward-message-01", "expression": "Bundle.entry.resource.ofType(Communication).identifier.value" }, { "name": "identifier-reply-message-02", "sourceId": "create-message-reply-message-02", "expression": "Bundle.entry.resource.ofType(Communication).identifier.value" } ], "publisher": null, "name": "CareCommunicationTestScript", "copyright": "MedCom 2023", "type": null, "experimental": null, "resourceType": "TestScript", "title": "Reply CareCommunication to a CareCommunication that has been forwarded", "package_version": "4.0.1", "status": "active", "id": "fd2ecae1-3188-4802-9630-6fd193b913cd", "kind": null, "url": "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-reply-new", "origin": [ { "index": 1, "profile": { "code": "FHIR-Client", "system": "http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types" } } ], "fixture": [ { "id": "create-forward-message-01", "resource": { "reference": "/Fixtures/CareCommunication-fixture-forward.xml" }, "autocreate": false, "autodelete": false }, { "id": "create-reply-message-02", "resource": { "reference": "/Fixtures/CareCommunication-fixture-empty.xml" }, "autocreate": false, "autodelete": false } ], "version": "4.0.1", "contact": [ { "name": "MedCom", "telecom": [ { "value": "mailto:fhir@medcom.dk", "system": "email" } ] } ], "destination": [ { "index": 1, "profile": { "code": "FHIR-Server", "system": "http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types" } } ], "test": [ { "id": "carecommunication-create-forward-message-01", "name": "Create a CareCommunication forward-message Message 01", "action": [ { "operation": { "type": { "code": "create", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "origin": 1, "resource": "Bundle", "sourceId": "create-forward-message-01", "requestId": "create-message-forward-message-01", "description": "Post a carecommunication", "destination": 1, "encodeRequestUrl": true } }, { "assert": { "direction": "request", "description": "Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication", "warningOnly": false, "validateProfileId": "carecommunication" } }, { "assert": { "operator": "in", "direction": "response", "description": "Confirm that the returned HTTP status is okay or created.", "warningOnly": false, "responseCode": "200,201" } }, { "assert": { "resource": "Bundle", "direction": "request", "description": "Confirm that the client request payload contains a Bundle resource type.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()", "description": "Confirm that the request resource contains the expected eventCoding.code.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'forward-message').exists()", "description": "Confirm that the request resource contains the expected activity code.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()", "description": "Confirm that the target reference in Provenance equals MessageHeader.id", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Communication).identifier.value.matches('urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')", "description": "Confirm that the Communication.identifier is a UUID v4.", "warningOnly": false } } ], "description": "Post CareCommunication to the server." }, { "id": "carecommunication-create-reply-message-02", "name": "Create a CareCommunication reply-message Message 02", "action": [ { "operation": { "type": { "code": "create", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "origin": 1, "resource": "Bundle", "sourceId": "create-reply-message-02", "requestId": "create-message-reply-message-02", "description": "Post a carecommunication", "destination": 1, "encodeRequestUrl": true } }, { "assert": { "direction": "request", "description": "Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication", "warningOnly": false, "validateProfileId": "carecommunication" } }, { "assert": { "operator": "in", "direction": "response", "description": "Confirm that the returned HTTP status is okay or created.", "warningOnly": false, "responseCode": "200,201" } }, { "assert": { "resource": "Bundle", "direction": "request", "description": "Confirm that the client request payload contains a Bundle resource type.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-new-message-01}')).exists()", "description": "Confirm that the previous MessageHeader.id is identical to Provenance.entity.what", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()", "description": "Confirm that the request resource contains the expected eventCoding.code.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).entity.where(role = 'revision').exists()", "description": "Confirm that the role is set to revision. Not used when testing the first message in a stream", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()", "description": "Confirm that the target reference in Provenance equals MessageHeader.id", "warningOnly": false } }, { "assert": { "value": "2", "operator": "equals", "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).count()", "description": "Confirm that the 2 Provenance instances exists.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Communication).payload.count() = '2'", "description": "Confirm that number of payloads is '2'", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "'${identifier-forward-message-01}' = '${identifier-reply-message-02}'", "description": "Confirm that the content is the same in the two messages", "warningOnly": false } } ], "description": "Post CareCommunication to the server." } ], "profile": [ { "id": "carecommunication", "reference": "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message" } ] }