<TestScript xmlns="http://hl7.org/fhir">
  <id value="core-examples-search" />
  <meta>
    <versionId value="3" />
    <lastUpdated value="2016-09-08T12:21:39.925+00:00" />
  </meta>
  <text>
    <status value="generated" />
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p>
        <b>Generated Narrative with Details</b>
      </p>
      <p>
        <b>id</b>: search</p>
      <p>
        <b>name</b>: Read, Search and Conditional Create and Delete</p>
      <p>
        <b>description</b>: Test Script for testing search, read, and conditional create and delete</p>
      <h3>Fixtures</h3>
      <table>
        <tr>
          <td>-</td>
          <td>
            <b>Resource</b>
          </td>
        </tr>
        <tr>
          <td>*</td>
          <td>
            <a>Patient/patient-example.xml</a>
          </td>
        </tr>
      </table>
      <blockquote>
        <p>
          <b>variable</b>
        </p>
        <p>
          <b>name</b>: V1</p>
        <p>
          <b>sourceId</b>: R1</p>
        <p>
          <b>headerField</b>: Location</p>
      </blockquote>
      <blockquote>
        <p>
          <b>variable</b>
        </p>
        <p>
          <b>name</b>: V2</p>
        <p>
          <b>sourceId</b>: R3</p>
        <p>
          <b>path</b>: fhir:Patient/fhir:name/fhir:given/@value</p>
      </blockquote>
      <blockquote>
        <p>
          <b>setup</b>
        </p>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
              <td>
                <b>Type</b>
              </td>
              <td>
                <b>Resource</b>
              </td>
              <td>
                <b>Params</b>
              </td>
            </tr>
            <tr>
              <td>*</td>
              <td>delete</td>
              <td>Patient</td>
              <td>given=John&amp;family=Doe</td>
            </tr>
          </table>
        </blockquote>
      </blockquote>
      <blockquote>
        <p>
          <b>test</b>
        </p>
        <p>
          <b>name</b>: Create</p>
        <p>
          <b>description</b>: Create, read, search, conditional create, conditional delete.</p>
        <blockquote>
          <p>
            <b>metadata</b>
          </p>
          <h3>Links</h3>
          <table>
            <tr>
              <td>-</td>
              <td>
                <b>Url</b>
              </td>
              <td>
                <b>Description</b>
              </td>
            </tr>
            <tr>
              <td>*</td>
              <td>
                <a>http://hl7.org/implement/standards/FHIR-Develop/patient.html</a>
              </td>
              <td>FHIR Patient</td>
            </tr>
          </table>
          <blockquote>
            <p>
              <b>operation</b>
            </p>
            <p>
              <b>type</b>: create</p>
            <p>
              <b>resource</b>: Patient</p>
            <p>
              <b>description</b>: Conditional Create Operation</p>
            <p>
              <b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.13.1</a></p>
            <p>
              <b>required</b>: true</p>
            <p>
              <b>validated</b>: true</p>
          </blockquote>
          <blockquote>
            <p>
              <b>operation</b>
            </p>
            <p>
              <b>type</b>: delete</p>
            <p>
              <b>resource</b>: Patient</p>
            <p>
              <b>description</b>: Conditional Delete Operation</p>
            <p>
              <b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.12.1</a></p>
            <p>
              <b>required</b>: true</p>
            <p>
              <b>validated</b>: true</p>
          </blockquote>
          <blockquote>
            <p>
              <b>operation</b>
            </p>
            <p>
              <b>type</b>: read</p>
            <p>
              <b>resource</b>: Patient</p>
            <p>
              <b>description</b>: Patient Read Operation</p>
            <p>
              <b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></p>
            <p>
              <b>validated</b>: true</p>
          </blockquote>
          <blockquote>
            <p>
              <b>operation</b>
            </p>
            <p>
              <b>type</b>: search</p>
            <p>
              <b>resource</b>: Patient</p>
            <p>
              <b>description</b>: Patient Search Operation</p>
            <p>
              <b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.14</a></p>
            <p>
              <b>validated</b>: true</p>
          </blockquote>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Operations</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
        <blockquote>
          <p>
            <b>action</b>
          </p>
          <h3>Asserts</h3>
          <table>
            <tr>
              <td>-</td>
            </tr>
            <tr>
              <td>*</td>
            </tr>
          </table>
        </blockquote>
      </blockquote>
    </div>
  </text>
  <url value="http://hl7.org/fhir/TestScript/search" />
  <name value="Read, Search and Conditional Create and Delete" />
  <status value="draft" />
  <description value="Test Script for testing search, read, and conditional create and delete" />
  <metadata>
    <capability>
      <required value="true" />
      <description value="Patient Create and Read Operations" />
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#create" />
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#read" />
      <conformance>
        <reference value="Conformance/example" />
      </conformance>
    </capability>
    <capability>
      <required value="true" />
      <description value="Patient Conditional Delete Operation" />
      <link value="http://hl7-fhir.github.io/http.html#2.1.0.12.1" />
      <conformance>
        <reference value="Conformance/example" />
      </conformance>
    </capability>
    <capability>
      <required value="true" />
      <description value="Patient Conditional Create Operation" />
      <link value="http://hl7-fhir.github.io/http.html#2.1.0.13.1" />
      <conformance>
        <reference value="Conformance/example" />
      </conformance>
    </capability>
  </metadata>
  <fixture id="example-patient">
    <resource>
      <reference value="Patient/example" />
    </resource>
  </fixture>
  <variable>
    <name value="V1" />
    <headerField value="Location" />
    <sourceId value="R1" />
  </variable>
  <variable>
    <name value="V2" />
    <path value="fhir:Patient/fhir:name/fhir:given/@value" />
    <sourceId value="R3" />
  </variable>
  <setup>
    <action>
      <operation>
        <type>
          <code value="delete" />
        </type>
        <resource value="Patient" />
        <params value="given=John&amp;family=Doe" />
      </operation>
    </action>
  </setup>
  <test id="Test1">
    <name value="Create" />
    <description value="Create, read, search, conditional create, conditional delete." />
    <metadata>
      <link>
        <url value="http://hl7.org/implement/standards/FHIR-Develop/patient.html" />
        <description value="FHIR Patient" />
      </link>
      <capability>
        <validated value="true" />
        <description value="Patient Search Operation" />
        <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#search" />
        <conformance>
          <reference value="Conformance/example" />
        </conformance>
      </capability>
    </metadata>
    <action>
      <operation>
        <type>
          <code value="create" />
        </type>
        <sourceId value="example-patient" />
      </operation>
    </action>
    <action>
      <assert>
        <responseCode value="201" />
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="search" />
        </type>
        <resource value="Patient" />
        <contentType value="json" />
        <params value="?given=John&amp;family=Doe" />
        <responseId value="R1" />
      </operation>
    </action>
    <action>
      <assert>
        <headerField value="Location" />
        <operator value="notEmpty" />
        <warningOnly value="true" />
      </assert>
    </action>
    <action>
      <assert>
        <operator value="equals" />
        <path value="fhir:Patient/fhir:birthDate/@value" />
        <sourceId value="R1" />
        <value value="1974-12-31" />
      </assert>
    </action>
    <action>
      <assert>
        <navigationLinks value="true" />
        <warningOnly value="true" />
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="search" />
        </type>
        <accept value="json" />
        <responseId value="R2" />
        <url value="${V1}" />
      </operation>
    </action>
    <action>
      <assert>
        <contentType value="json" />
      </assert>
    </action>
    <action>
      <assert>
        <response value="okay" />
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="search" />
        </type>
        <resource value="Patient" />
        <accept value="json" />
        <params value="?given=John&amp;family=Doe&amp;birthdate=1974-12-31" />
        <responseId value="R3" />
      </operation>
    </action>
    <action>
      <assert>
        <contentType value="json" />
      </assert>
    </action>
    <action>
      <assert>
        <response value="okay" />
      </assert>
    </action>
    <action>
      <assert>
        <compareToSourceId value="R2" />
        <compareToSourcePath value="fhir:Patient/fhir:birthDate/@value" />
        <path value="fhir:Patient/fhir:birthDate/@value" />
        <sourceId value="R3" />
      </assert>
    </action>
    <action>
      <assert>
        <path value="fhir:Patient/fhir:name/fhir:given/@value" />
        <sourceId value="R3" />
        <value value="John" />
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="create" />
        </type>
        <requestHeader>
          <field value="If-None-Exist" />
          <value value="Patient?given=John&amp;Doe&amp;birthdate=1974-12-31" />
        </requestHeader>
        <sourceId value="F1" />
      </operation>
    </action>
    <action>
      <assert>
        <responseCode value="200" />
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="delete" />
        </type>
        <resource value="Patient" />
        <params value="?given=John&amp;family=Doe&amp;birthdate=1974-12-31" />
      </operation>
    </action>
    <action>
      <operation>
        <type>
          <code value="read" />
        </type>
        <resource value="Patient" />
        <params value="/${V2}" />
      </operation>
    </action>
    <action>
      <assert>
        <responseCode value="410" />
      </assert>
    </action>
  </test>
</TestScript>