STU 3 Candidate

This page is part of the FHIR Specification (v1.4.0: STU 3 Ballot 3). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions

Testscript-history.ttl

Raw Turtle, JSON-LD

History TestScript Example

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<http://hl7.org/fhir//TestScript/history> a fhir:TestScript;
  fhir:nodeRole fhir:treeRoot;
  fhir:Resource.id [ fhir:value "history"];
  fhir:DomainResource.text [
     fhir:Narrative.status [ fhir:value "generated" ]
  ];
  fhir:TestScript.url [ fhir:value "http://hl7.org/fhir/TestScript/history"];
  fhir:TestScript.name [ fhir:value "History Test Script"];
  fhir:TestScript.status [ fhir:value "draft"];
  fhir:TestScript.description [ fhir:value "Test Script for history of the patient resource"];
  fhir:TestScript.metadata [
     fhir:TestScript.metadata.capability [
       fhir:index 0;
       fhir:TestScript.metadata.capability.required [ fhir:value "true"^^xs:boolean ];
       fhir:TestScript.metadata.capability.description [ fhir:value "Patient Create, Read, Update, and Delete Operations" ];
       fhir:TestScript.metadata.capability.link [
         fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#create";
         fhir:index 0       ];
       fhir:TestScript.metadata.capability.link [
         fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#read";
         fhir:index 1       ];
       fhir:TestScript.metadata.capability.link [
         fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#update";
         fhir:index 2       ];
       fhir:TestScript.metadata.capability.link [
         fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#delete";
         fhir:index 3       ];
       fhir:TestScript.metadata.capability.conformance [
         fhir:reference <http://hl7.org/fhir/Conformance/example>;
         fhir:Reference.reference [ fhir:value "Conformance/example" ]       ]     ]
  ];
  fhir:TestScript.fixture [
     fhir:index 0;
     fhir:Element.id [ fhir:value "example-patient" ];
     fhir:TestScript.fixture.resource [
       fhir:reference <http://hl7.org/fhir/Patient/example>;
       fhir:Reference.reference [ fhir:value "Patient/example" ]     ]
  ];
  fhir:TestScript.fixture [
     fhir:index 1;
     fhir:Element.id [ fhir:value "example-patient-updated" ];
     fhir:TestScript.fixture.resource [
       fhir:reference <http://hl7.org/fhir/Patient/pat1>;
       fhir:Reference.reference [ fhir:value "Patient/pat1" ]     ]
  ];
  fhir:TestScript.setup [
     fhir:TestScript.setup.action [
       fhir:index 0;
       fhir:TestScript.setup.action.operation [
         fhir:TestScript.setup.action.operation.type [
           fhir:Coding.code [ fhir:value "create" ]         ];
         fhir:TestScript.setup.action.operation.sourceId [ fhir:value "example-patient" ]       ]     ];
     fhir:TestScript.setup.action [
       fhir:index 1;
       fhir:TestScript.setup.action.operation [
         fhir:TestScript.setup.action.operation.type [
           fhir:Coding.code [ fhir:value "update" ]         ];
         fhir:TestScript.setup.action.operation.sourceId [ fhir:value "example-patient-updated" ];
         fhir:TestScript.setup.action.operation.targetId [ fhir:value "example-patient" ]       ]     ]
  ];
  fhir:TestScript.test [
     fhir:index 0;
     fhir:Element.id [ fhir:value "HISTORY01" ];
     fhir:TestScript.test.name [ fhir:value "History for specific resource" ];
     fhir:TestScript.test.description [ fhir:value "History for specific resource." ];
     fhir:TestScript.test.metadata [
       fhir:TestScript.metadata.capability [
         fhir:index 0;
         fhir:TestScript.metadata.capability.required [ fhir:value "true"^^xs:boolean ];
         fhir:TestScript.metadata.capability.description [ fhir:value "Patient History Operation" ];
         fhir:TestScript.metadata.capability.link [
           fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#history";
           fhir:index 0         ];
         fhir:TestScript.metadata.capability.conformance [
           fhir:reference <http://hl7.org/fhir/Conformance/example>;
           fhir:Reference.reference [ fhir:value "Conformance/example" ]         ]       ]     ];
     fhir:TestScript.test.action [
       fhir:index 0;
       fhir:TestScript.test.action.operation [
         fhir:TestScript.setup.action.operation.type [
           fhir:Coding.code [ fhir:value "history" ]         ];
         fhir:TestScript.setup.action.operation.targetId [ fhir:value "example-patient" ]       ]     ];
     fhir:TestScript.test.action [
       fhir:index 1;
       fhir:TestScript.test.action.assert [
         fhir:TestScript.setup.action.assert.response [ fhir:value "okay" ]       ]     ];
     fhir:TestScript.test.action [
       fhir:index 2;
       fhir:TestScript.test.action.assert [
         fhir:TestScript.setup.action.assert.resource [ fhir:value "Bundle" ]       ]     ];
     fhir:TestScript.test.action [
       fhir:index 3;
       fhir:TestScript.test.action.assert [
         fhir:TestScript.setup.action.assert.operator [ fhir:value "equals" ];
         fhir:TestScript.setup.action.assert.path [ fhir:value "fhir:Bundle/fhir:total/@value" ];
         fhir:TestScript.setup.action.assert.value [ fhir:value "2" ]       ]     ]
  ];
  fhir:TestScript.teardown [
     fhir:TestScript.teardown.action [
       fhir:index 0;
       fhir:TestScript.teardown.action.operation [
         fhir:TestScript.setup.action.operation.type [
           fhir:Coding.code [ fhir:value "delete" ]         ];
         fhir:TestScript.setup.action.operation.targetId [ fhir:value "example-patient" ]       ]     ]
  ].

# -------------------------------------------------------------------------------------


Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.