PackagesCanonicalsLogsProblems
    Packages
    hl7.fhir.r3.examples@3.0.2
    http://hl7.org/fhir/TestScript/testscript-example
{
  "description": "TestScript example resource with setup to delete if present and create a new instance of a Patient; and single test definition to read the created Patient with various asserts.",
  "_filename": "TestScript-testscript-example.json",
  "package_name": "hl7.fhir.r3.examples",
  "date": "2017-01-18",
  "variable": [ {
    "name": "createResourceId",
    "path": "Patient/id",
    "sourceId": "fixture-patient-create"
  } ],
  "publisher": "HL7",
  "jurisdiction": [ {
    "coding": [ {
      "code": "US",
      "system": "urn:iso:std:iso:3166",
      "display": "United States of America (the)"
    } ]
  } ],
  "purpose": "Patient Conditional Create (Update), Read and Delete Operations",
  "name": "TestScript Example",
  "useContext": [ {
    "code": {
      "code": "focus",
      "system": "http://hl7.org/fhir/usage-context-type"
    },
    "valueCodeableConcept": {
      "coding": [ {
        "code": "positive",
        "system": "http://hl7.org/fhir/variant-state"
      } ]
    }
  } ],
  "copyright": "© HL7.org 2011+",
  "type": null,
  "experimental": "true",
  "resourceType": "TestScript",
  "title": null,
  "setup": {
    "action": [ {
      "operation": {
        "type": {
          "code": "delete",
          "system": "http://hl7.org/fhir/testscript-operation-codes"
        },
        "label": "SetupDeletePatient",
        "accept": "json",
        "params": "/${createResourceId}",
        "resource": "Patient",
        "description": "Execute a delete operation to insure the patient does not exist on the server."
      }
    }, {
      "assert": {
        "operator": "in",
        "direction": "response",
        "description": "Confirm that the returned HTTP status is 200(OK) or 204(No Content).",
        "responseCode": "200,204"
      }
    }, {
      "operation": {
        "type": {
          "code": "update",
          "system": "http://hl7.org/fhir/testscript-operation-codes"
        },
        "label": "SetupCreatePatient",
        "accept": "json",
        "params": "/${createResourceId}",
        "resource": "Patient",
        "sourceId": "fixture-patient-create",
        "contentType": "json",
        "description": "Create patient resource on test server using the contents of fixture-patient-create"
      }
    }, {
      "assert": {
        "direction": "response",
        "description": "Confirm that the returned HTTP status is 201(Created).",
        "responseCode": "201"
      }
    }, {
      "operation": {
        "type": {
          "code": "read",
          "system": "http://hl7.org/fhir/testscript-operation-codes"
        },
        "resource": "Patient",
        "targetId": "fixture-patient-create",
        "description": "Read the created patient resource on the test server using the id from fixture-patient-create. Verify contents."
      }
    }, {
      "assert": {
        "response": "okay",
        "direction": "response",
        "description": "Confirm that the returned HTTP status is 200(OK)."
      }
    }, {
      "assert": {
        "operator": "equals",
        "description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient.",
        "compareToSourceId": "fixture-patient-create",
        "compareToSourceExpression": "Patient.name.first().family"
      }
    } ]
  },
  "package_version": "3.0.2",
  "status": "draft",
  "id": "b2668942-c28c-4823-8bbb-b6bf971e4301",
  "kind": null,
  "url": "http://hl7.org/fhir/TestScript/testscript-example",
  "identifier": {
    "value": "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9876",
    "system": "urn:ietf:rfc:3986"
  },
  "fixture": [ {
    "id": "fixture-patient-create",
    "resource": {
      "display": "Peter Chalmers",
      "reference": "Patient/example"
    },
    "autocreate": false,
    "autodelete": false
  }, {
    "id": "fixture-patient-minimum",
    "resource": {
      "display": "Peter Chalmers (minimum)",
      "reference": "Patient/example"
    },
    "autocreate": false,
    "autodelete": false
  } ],
  "version": "1.0",
  "teardown": {
    "action": [ {
      "operation": {
        "type": {
          "code": "delete",
          "system": "http://hl7.org/fhir/testscript-operation-codes"
        },
        "resource": "Patient",
        "targetId": "fixture-patient-create",
        "description": "Delete the patient resource on the test server using the id from fixture-patient-create."
      }
    } ]
  },
  "contact": [ {
    "name": "Support",
    "telecom": [ {
      "use": "work",
      "value": "support@HL7.org",
      "system": "email"
    } ]
  } ],
  "metadata": {
    "link": [ {
      "url": "http://hl7.org/fhir/patient.html",
      "description": "Demographics and other administrative information about an individual or animal receiving care or other health-related services."
    } ],
    "capability": [ {
      "link": [ "http://hl7.org/fhir/http.html#delete", "http://hl7.org/fhir/http.html#read", "http://hl7.org/fhir/http.html#update" ],
      "required": true,
      "description": "Patient Update, Read and Delete Operations",
      "capabilities": {
        "reference": "CapabilityStatement/example"
      }
    } ]
  },
  "test": [ {
    "id": "01-ReadPatient",
    "name": "Read Patient",
    "action": [ {
      "operation": {
        "type": {
          "code": "read",
          "system": "http://hl7.org/fhir/testscript-operation-codes"
        },
        "resource": "Patient",
        "targetId": "fixture-patient-create",
        "responseId": "fixture-patient-read",
        "description": "Read the patient resource on the test server using the id from fixture-patient-create. Prevent URL encoding of the request.",
        "encodeRequestUrl": false
      }
    }, {
      "assert": {
        "label": "01-ReadPatientOK",
        "response": "okay",
        "direction": "response",
        "description": "Confirm that the returned HTTP status is 200(OK)."
      }
    }, {
      "assert": {
        "operator": "notEmpty",
        "direction": "response",
        "description": "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server may not support versioning.",
        "headerField": "Last-Modified",
        "warningOnly": true
      }
    }, {
      "assert": {
        "resource": "Patient",
        "description": "Confirm that the returned resource type is Patient."
      }
    }, {
      "assert": {
        "description": "Confirm that the returned Patient conforms to the base FHIR specification.",
        "validateProfileId": "patient-profile"
      }
    }, {
      "assert": {
        "path": "fhir:Patient/fhir:name/fhir:family/@value",
        "value": "Chalmers",
        "operator": "equals",
        "sourceId": "fixture-patient-read",
        "description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit sourceId reference to read responseId fixture."
      }
    }, {
      "assert": {
        "path": "fhir:Patient/fhir:name/fhir:given/@value",
        "value": "Peter",
        "operator": "equals",
        "sourceId": "fixture-patient-read",
        "description": "Confirm that the returned Patient contains the expected given name 'Peter'. Uses explicit sourceId reference to read responseId fixture."
      }
    }, {
      "assert": {
        "path": "fhir:Patient/fhir:name/fhir:family/@value",
        "operator": "equals",
        "description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient and implicit reference to read response payload.",
        "compareToSourceId": "fixture-patient-create",
        "compareToSourcePath": "fhir:Patient/fhir:name/fhir:family/@value"
      }
    }, {
      "assert": {
        "path": "fhir:Patient/fhir:name/fhir:given/@value",
        "sourceId": "fixture-patient-read",
        "description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient and explicit reference to read response payload and default operator of 'equals'.",
        "compareToSourceId": "fixture-patient-create",
        "compareToSourcePath": "fhir:Patient/fhir:name/fhir:given/@value"
      }
    }, {
      "assert": {
        "minimumId": "fixture-patient-minimum",
        "description": "Confirm that the returned resource contains the expected retained elements and values. Warning only to provide users with reviewable results.",
        "warningOnly": true
      }
    } ],
    "description": "Read a Patient and validate response."
  } ],
  "profile": [ {
    "id": "patient-profile",
    "reference": "http://hl7.org/fhir/StructureDefinition/Patient"
  } ]
}