{
"description": "Send CareCommunication where the patient has a replacement-CPR-number as identifier",
"_filename": "example/TestScript-carecommunication-send-tec-04.json",
"package_name": "medcom.fhir.dk.carecommunicationtestscripts",
"date": "2025-10-15",
"meta": {
"profile": [ "http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript" ]
},
"variable": [ {
"name": "messageHeaderid-new-message-01",
"sourceId": "create-new-message-01",
"expression": "Bundle.entry[0].resource.id"
}, {
"name": "searchParamIdentifier-new-message",
"sourceId": "create-new-message",
"expression": "Bundle.entry.resource.ofType(MessageHeader).id"
} ],
"publisher": null,
"jurisdiction": [ {
"coding": [ {
"code": "DK",
"system": "urn:iso:std:iso:3166",
"display": "Denmark"
} ]
} ],
"name": "CareCommunicationTestScript",
"copyright": "MedCom 2023",
"type": null,
"experimental": null,
"resourceType": "TestScript",
"title": "Send CareCommunication where the patient has a replacement-CPR-number as identifier",
"package_version": "5.0.0",
"status": "active",
"id": "36cce301-4a2f-4ad2-8207-30e1e44551f7",
"kind": null,
"url": "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-tec-04",
"origin": [ {
"index": 1,
"profile": {
"code": "FHIR-Client",
"system": "http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"
}
} ],
"fixture": [ {
"id": "create-new-message-01",
"resource": {
"reference": "../Fixtures/CareCommunication-fixture.xml"
},
"autocreate": false,
"autodelete": false
} ],
"version": "5.0.0",
"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-new-message-01",
"name": "Create a CareCommunication new-message Message 01",
"action": [ {
"operation": {
"type": {
"code": "create",
"system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"
},
"origin": 1,
"resource": "Bundle",
"sourceId": "create-new-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|5.0.1",
"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).code = 'care-communication-message'",
"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 = 'new-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
}
}, {
"assert": {
"direction": "request",
"expression": "Bundle.entry.resource.ofType(Patient).identifier.system != 'urn:oid:1.2.208.176.1.2'",
"description": "Confirm that the system of the patient.identifier is not urn:oid:1.2.208.176.1.2",
"warningOnly": false
}
} ],
"description": "Post CareCommunication to the server."
} ],
"profile": [ {
"id": "carecommunication",
"reference": "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message|5.0.1"
} ]
}