PackagesCanonicalsLogsProblems
    Packages
    medcom.fhir.dk.carecommunicationtestscripts@4.0.0
    http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-new-message
{
  "description": "Send CareCommunication. Receiver is expected to be 'Klinik for Ældresygdomme, AUH, Skejby' with SOR-id: 441211000016000.",
  "_filename": "example/TestScript-carecommunication-send-new-message.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-new-message-01",
    "sourceId": "create-message-new-message-01",
    "expression": "Bundle.entry[0].resource.id"
  }, {
    "name": "searchParamIdentifier-new-message",
    "sourceId": "create-message-new-message",
    "expression": "Bundle.entry.resource.ofType(MessageHeader).id"
  } ],
  "publisher": null,
  "name": "CareCommunicationTestScript",
  "copyright": "MedCom 2023",
  "type": null,
  "experimental": null,
  "resourceType": "TestScript",
  "title": "Send CareCommunication. Receiver is expected to be 'Klinik for Ældresygdomme, AUH, Skejby' with SOR-id: 441211000016000.",
  "package_version": "4.0.0",
  "status": "active",
  "id": "066222c8-d2c9-4489-9116-150fe031bec1",
  "kind": null,
  "url": "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-new-message",
  "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": "4.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",
        "requestId": "create-message-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",
        "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 = '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(MessageHeader).destination.receiver.reference.resolve().identifier.where(system = 'https://www.gs1.org/gln').value = '5790001987244'",
        "description": "Confirm that the receiver EAN-number is 5790001987244",
        "warningOnly": false
      }
    }, {
      "assert": {
        "direction": "request",
        "expression": "Bundle.entry.resource.ofType(MessageHeader).destination.receiver.reference.resolve().identifier.where(system = 'urn:oid:1.2.208.176.1.1').value = '441211000016000'",
        "description": "Confirm that the receiver SOR-id is 441211000016000",
        "warningOnly": false
      }
    } ],
    "description": "Post CareCommunication to the server."
  } ],
  "profile": [ {
    "id": "carecommunication",
    "reference": "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message"
  } ]
}