Name | /FHIRSandbox/MedCom/CareCommunication/v400-send/Send/TechnicalCases/CareCommunication_TestScripts_send-tec-02 |
Description | Send CareCommunication with sender and recipient |
Version | 2 | Latest | 2 |
{
"resourceType" : "TestScript",
"id" : "carecommunication-send-tec-02",
"meta" : {
"profile" : [ "http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript" ]
},
"status" : "active",
"date" : "2024-07-15",
"publisher" : "MedCom",
"contact" : [ {
"name" : "MedCom",
"telecom" : [ {
"system" : "email",
"value" : "mailto:fhir@medcom.dk"
}, {
"system" : "url",
"value" : "https://medcom.dk/"
} ]
} ],
"copyright" : "MedCom 2023",
"description" : "Send CareCommunication with sender and recipient",
"title" : "Send CareCommunication with sender and recipient",
"url" : "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-tec-02",
"name" : "CareCommunicationTestScript",
"origin" : [ {
"index" : 1,
"profile" : {
"system" : "http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types",
"code" : "FHIR-Client"
}
} ],
"destination" : [ {
"index" : 1,
"profile" : {
"system" : "http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types",
"code" : "FHIR-Server"
}
} ],
"profile" : [ {
"id" : "carecommunication",
"reference" : "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message"
} ],
"fixture" : [ {
"id" : "create-new-message-01",
"autocreate" : false,
"autodelete" : false,
"resource" : {
"reference" : "../Fixtures/CareCommunication-fixture.xml"
}
} ],
"variable" : [ {
"name" : "messageHeaderid-new-message-01",
"expression" : "Bundle.entry[0].resource.id",
"sourceId" : "create-message-new-message-01"
}, {
"name" : "searchParamIdentifier-new-message",
"expression" : "Bundle.entry.resource.ofType(MessageHeader).id",
"sourceId" : "create-message-new-message"
} ],
"test" : [ {
"id" : "carecommunication-create-new-message-01",
"name" : "Create a CareCommunication new-message Message 01",
"description" : "Post CareCommunication to the server.",
"action" : [ {
"operation" : {
"type" : {
"system" : "http://terminology.hl7.org/CodeSystem/testscript-operation-codes",
"code" : "create"
},
"resource" : "Bundle",
"description" : "Post a carecommunication",
"destination" : 1,
"encodeRequestUrl" : true,
"origin" : 1,
"requestId" : "create-message-new-message-01",
"sourceId" : "create-new-message-01"
}
}, {
"assert" : {
"description" : "Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication",
"direction" : "request",
"validateProfileId" : "carecommunication",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the returned HTTP status is okay or created.",
"direction" : "response",
"responseCode" : "200,201",
"operator" : "in",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the client request payload contains a Bundle resource type.",
"direction" : "request",
"resource" : "Bundle",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the request resource contains the expected eventCoding.code.",
"direction" : "request",
"expression" : "Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the request resource contains the expected activity code.",
"direction" : "request",
"expression" : "Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'new-message').exists()",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the target reference in Provenance equals MessageHeader.id",
"direction" : "request",
"expression" : "Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that the Communication.identifier is a UUID v4.",
"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}')",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that a specific sender is included",
"direction" : "request",
"expression" : "Bundle.entry.resource.ofType(Communication).extension.where(url = 'http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-carecommunication-sender-extension').exists()",
"warningOnly" : false
}
}, {
"assert" : {
"description" : "Confirm that a specific recipient is included",
"direction" : "request",
"expression" : "Bundle.entry.resource.ofType(Communication).recipient.exists()",
"warningOnly" : false
}
} ]
} ]
}