Test Script

Name/FHIR4-0-1-Advanced/USCore-ClinData/01-USCore-Tests/us-core-diagnosticreport-lab-sequence
DescriptionTests for USCDI DiagnosticReport Lab using the US Core resource. Reference http://www.hl7.org/fhir/us/core/general-guidance.html#must-support and http://hl7.org/fhir/us/core/structuredefinition-us-core-diagnosticreport-lab.html
Version10Latest10
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="DiagnosticReport-Lab-Tests"/>  
    <meta> 
        <profile value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/> 
    </meta>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule"> 
        <extension url="ruleId"> 
            <valueId value="historyOrder"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/rule/historyOrder.groovy"/> 
        </extension> 
    </extension>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule"> 
        <extension url="ruleId"> 
            <valueId value="assert-by-path"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/rule/AssertValidateJSONExtractProfileId.groovy"/> 
        </extension>  
        <extension url="param"> 
            <extension url="name"> 
                <valueString value="jsonPath"/> 
            </extension>  
            <extension url="value"> 
                <valueString value="$.entry[?(@.resource.resourceType == 'DiagnosticReport' &amp;&amp; @.resource.category[0].coding[0].code == 'LAB')].resource"/> 
            </extension> 
        </extension>  
        <extension url="param"> 
            <extension url="name"> 
                <valueString value="profileId"/> 
            </extension>  
            <extension url="value"> 
                <valueString value="DiagnosticReportProfile"/> 
            </extension> 
        </extension> 
    </extension>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule"> 
        <extension url="ruleId"> 
            <valueId value="resolveReferences"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/rule/resolveReferences.groovy"/> 
        </extension> 
    </extension>  
    <url value="http://wildfhir.aegis.net/fhir4-0-0/TestScript/DiagnosticReport_Lab_Tests"/>  
    <name value="DiagnosticReport_Lab_Tests"/>  
    <title value="DiagnosticReport Lab Tests"/>  
    <status value="active"/>  
    <date value="2020-05-15"/>  
    <publisher value="AEGIS.net, Inc."/>  
    <contact> 
        <name value="Touchstone Support"/>  
        <telecom> 
            <system value="email"/>  
            <value value="Touchstone_Support@aegis.net"/>  
            <use value="work"/> 
        </telecom> 
    </contact>  
    <description value="Tests for USCDI DiagnosticReport Lab using the US Core resource. Reference http://www.hl7.org/fhir/us/core/general-guidance.html#must-support and http://hl7.org/fhir/us/core/structuredefinition-us-core-diagnosticreport-lab.html"/>  
    <copyright value="This FHIR Test Script is licensed under Creative Commons (CC0) 'No Rights Reserved'. Learn more at https://creativecommons.org/licenses"/>  
    <destination> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <profile id="DiagnosticReportProfile"> 
        <reference value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab"/> 
    </profile>  
    <profile id="BundleProfile"> 
        <reference value="http://hl7.org/fhir/StructureDefinition/Bundle"/> 
    </profile>  
    <variable> 
        <name value="patientId"/>  
        <description value="Patient id"/> 
    </variable>  
    <variable> 
        <name value="testOneId"/>  
        <description value="Test 01 resource id"/>  
        <expression value="Bundle.entry.resource.id"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testOneCount"/>  
        <description value="Test 01 count"/>  
        <expression value="Bundle.entry.resource.count()"/>  
        <sourceId value="testTwoSearch"/> 
    </variable>  
    <variable> 
        <name value="testTwoStatus"/>  
        <description value="Test 02 Status"/>  
        <expression value="Bundle.entry.resource.status"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testTwoCodeSystem"/>  
        <description value="Test 02 Code System"/>  
        <expression value="Bundle.entry.resource.code.coding.where(code.exists() and system.exists()).system"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testTwoCode"/>  
        <description value="Test 02 Code"/>  
        <expression value="Bundle.entry.resource.code.coding.where(code.exists() and system.exists()).code"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testTwoCategoryEqDate"/>  
        <expression value="Bundle.entry.resource.effective.as(DateTime).first()"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testTwoCategoryGtDate"/>  
        <expression value="Bundle.entry.resource.effective.as(DateTime).first() - 1 day"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testTwoCategoryLtDate"/>  
        <expression value="Bundle.entry.resource.effective.as(DateTime).first() + 1 day"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testThreeCodeSystem"/>  
        <description value="Test 02 Code System"/>  
        <expression value="Bundle.entry.resource.where(code.coding.where(code.exists() and system.exists()).exists() and effective.as(DateTime).exists()).code.coding.where(code.exists() and system.exists()).system"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testThreeCode"/>  
        <description value="Test 02 Code"/>  
        <expression value="Bundle.entry.resource.where(code.coding.where(code.exists() and system.exists()).exists() and effective.as(DateTime).exists()).code.coding.where(code.exists() and system.exists()).code"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testThreeCodeEqDate"/>  
        <expression value="Bundle.entry.resource.where(code.coding.where(code.exists() and system.exists()).exists() and effective.as(DateTime).exists()).effective.as(DateTime).first()"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testThreeCodeGtDate"/>  
        <expression value="Bundle.entry.resource.where(code.coding.where(code.exists() and system.exists()).exists() and effective.as(DateTime).exists()).effective.as(DateTime).first() - 1 day"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <variable> 
        <name value="testThreeCodeLtDate"/>  
        <expression value="Bundle.entry.resource.where(code.coding.where(code.exists() and system.exists()).exists() and effective.as(DateTime).exists()).effective.as(DateTime).first() + 1 day"/>  
        <sourceId value="testOneSearch-1"/> 
    </variable>  
    <test id="01-search_by_patient_category"> 
        <name value="search_by_patient_category"/>  
        <description value="A server SHALL support searching by patient and category on the DiagnosticReport resource."/>  
        <action> 
            <operation> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-operation-pagesNext"> 
                    <valuePositiveInt value="10"/> 
                </extension>  
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB"/>  
                <responseId value="testOneSearch-1"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=http://terminology.hl7.org/CodeSystem/v2-0074|LAB"/>  
                <responseId value="testTwoSearch"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=Patient/${patientId}&amp;category=http://terminology.hl7.org/CodeSystem/v2-0074|LAB"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify at least one DiagnosticReport is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.count()"/>  
                <operator value="equals"/>  
                <value value="${testOneCount}"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="02-search_by_patient"> 
        <name value="search_by_patient"/>  
        <description value="Search by Patient Id"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by Patient Id"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by Patient Id"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="03-search_by_patient_code"> 
        <name value="search_by_patient_code"/>  
        <description value="A server SHALL support searching by patient and code on the DiagnosticReport resource."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testTwoCode}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testTwoCodeSystem}|${testTwoCode}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="04-search_by_patient_category_date"> 
        <name value="search_by_patient_category_date"/>  
        <description value="A server SHALL support searching by patient, category, and date on the DiagnosticReport resource."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB&amp;date=${testTwoCategoryEqDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB&amp;date=gt${testTwoCategoryGtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB&amp;date=ge${testTwoCategoryGtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB&amp;date=lt${testTwoCategoryLtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=LAB&amp;date=le${testTwoCategoryLtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and category and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;category=http://terminology.hl7.org/CodeSystem/v2-0074|LAB&amp;date=${testTwoCategoryEqDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="05-search_by_patient_status"> 
        <name value="search_by_patient_status"/>  
        <description value="Search by patient id and status"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and status"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;status=${testTwoStatus}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="06-search_by_patient_code_date"> 
        <name value="search_by_patient_code_date"/>  
        <description value="Search by patient, code, and date"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCode}&amp;date=${testThreeCodeEqDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCode}&amp;date=gt${testThreeCodeGtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCode}&amp;date=ge${testThreeCodeGtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCode}&amp;date=lt${testThreeCodeLtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCode}&amp;date=le${testThreeCodeLtDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search by patient id and code and date"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;code=${testThreeCodeSystem}|${testThreeCode}&amp;date=${testThreeCodeEqDate}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify an DiagnosticReport exists in the Bundle"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(DiagnosticReport).exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="07-read_interaction"> 
        <name value="read_interaction"/>  
        <description value="Read DiagnosticReport"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Read DiagnosticReport"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <targetId value="testOneSearch-1"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is an Diagnostic Report resource"/>  
                <direction value="response"/>  
                <resource value="DiagnosticReport"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the resource id exists"/>  
                <direction value="response"/>  
                <expression value="DiagnosticReport.id.exists()"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Validate response against the Diagnostic Report profile"/>  
                <direction value="response"/>  
                <validateProfileId value="DiagnosticReportProfile"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="08-vread_interaction"> 
        <name value="vread_interaction"/>  
        <description value="Version read DiagnosticReport"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="vread"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="vRead Diagnostic Report"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <targetId value="testOneSearch-1"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is an Diagnostic Report resource"/>  
                <direction value="response"/>  
                <resource value="DiagnosticReport"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Validate response against the Diagnostic Report profile"/>  
                <direction value="response"/>  
                <validateProfileId value="DiagnosticReportProfile"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="09-history_interaction"> 
        <name value="history_interaction"/>  
        <description value="History Interactions"/>  
        <action> 
            <operation> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-operation-pagesNext"> 
                    <valuePositiveInt value="10"/> 
                </extension>  
                <resource value="DiagnosticReport"/>  
                <description value="History Interactions"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${testOneId}/_history"/>  
                <responseId value="testHistorySearch-1"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response includes History"/>  
                <direction value="response"/>  
                <path value="$.type"/>  
                <value value="history"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the Diagnostic Report resource is found in the Bundle"/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.entry[?(@.resource.resourceType == 'DiagnosticReport')].resource"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="true"/> 
                </extension>  
                <description value="Validate response bundle"/>  
                <direction value="response"/>  
                <validateProfileId value="BundleProfile"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="assert-by-path"/> 
                    </extension> 
                </extension>  
                <description value="Validate against US Core profile"/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="historyOrder"/> 
                    </extension>  
                    <extension url="param"> 
                        <extension url="name"> 
                            <valueString value="sourcePrefix"/> 
                        </extension>  
                        <extension url="value"> 
                            <valueString value="testHistorySearch"/> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Validate History order"/>  
                <sourceId value="none"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="10-Server returns Provenance resources from DiagnosticReport search by patient + code + _revIncludes: Provenance:target"> 
        <name value="Server returns Provenance resources from DiagnosticReport search by patient + code + _revIncludes: Provenance:target"/>  
        <description value="Search for an Diagnostic Report by patient and code and include Provenance"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="DiagnosticReport"/>  
                <description value="Search for an Diagnostic Report by patient and code and include Provenance"/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?patient=${patientId}&amp;_revinclude=Provenance:target"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify a response is returned"/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify the response is a Bundle"/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify Provenance is returned"/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.resource.as(Provenance).exists()"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>