Test Script

Name/FHIRSandbox/DaVinci/FHIR4-0-1-Formulary/Formulary-BulkData/02-Export-All-InsPlans/02c-Form-Graph-Export/02b-Formuarly-BulkData-GraphDefForm-StatusComplete
Description02b-Formulary BulkData Export Status Complete. This test exercises the BulkData server to ensure that the response for a query to status when the response is 200 OK (complete). The required response elements will be verified and the format of the response verified. The test requires manual entry of a Content-Location URL to allow for testing against systems that do not complete the $export request immediately, allowing for the time needed for that server to complete the response before the test is attempted.
Version1Latest1
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="02b-Formulary-BulkData-Export-Status-Expected-Complete"/>  
    <meta> 
        <profile value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/> 
    </meta>  
    <text> 
        <status value="generated"/>  
        <div xmlns="http://www.w3.org/1999/xhtml">  
            <p>Bulk Data Export</p> 
        </div> 
    </text>  
    <url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/bulkdata-group-export-status-complete"/>  
    <name value="FormularyBulkDataExportExpectStatusComplete"/>  
    <title value="FormularyBulkDataExportExpectStatusComplete"/>  
    <status value="active"/>  
    <date value="2023-01-30"/>  
    <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="02b-Formulary BulkData Export Status Complete.  This test exercises the BulkData server to ensure that the response for a query to status when the response is 200 OK (complete).  The required response elements will be verified and the format of the response verified.  The test requires manual entry of a Content-Location URL to allow for testing against systems that do not complete the $export request immediately, allowing for the time needed for that server to complete the response before the test is attempted."/>  
    <copyright value="This FHIR Test Script is licensed under Creative Commons (CC0) 'No Rights Reserved'. Learn more at https://creativecommons.org/licenses"/>  
    <destination id="Server"> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <profile id="resource-profile-InsPlan"> 
        <reference value="{$.type.coding[?(@.code != 'DRUGPOL')]}http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-PayerInsurancePlan"/> 
    </profile>  
    <profile id="resource-profile-Formulary"> 
        <reference value="{$.type.coding[?(@.code == 'DRUGPOL')]}http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-Formulary"/> 
    </profile>  
    <profile id="resource-profile-MedKnowledge"> 
        <reference value="http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyDrug"/> 
    </profile>  
    <profile id="resource-profile-FormItem"> 
        <reference value="http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyItem"/> 
    </profile>  
    <profile id="resource-profile-Location"> 
        <reference value="http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-InsurancePlanLocation"/> 
    </profile>  
    <variable> 
        <name value="InsPlanFileLocation"/>  
        <path value=".output[?(@.type=='InsurancePlan')].url"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <variable> 
        <name value="MedKnowFileLocation"/>  
        <path value=".output[?(@.type=='MedicationKnowledge')].url"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <variable> 
        <name value="BasicFileLocation"/>  
        <path value=".output[?(@.type=='Basic')].url"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <variable> 
        <name value="LocationFileLocation"/>  
        <path value=".output[?(@.type=='Location')].url"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <variable> 
        <name value="BulkDataStatusEndpoint"/>  
        <description value="Content-Location URL"/>  
        <hint value="Content-Location in response from the previous $export operation test"/> 
    </variable>  
    <test id="01-Query-Status-From-Status-Endpoint"> 
        <name value="01-Query-Status-From-Status-Endpoint"/>  
        <description value="01: Query for BulkData file status with expected response '200' and completed file Locations in the response."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <description value="Query Content-Location"/>  
                <accept value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <responseId value="searchResponse"/>  
                <url value="${BulkDataStatusEndpoint}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the client requested an Accept of the FHIR JSON mime type 'application/fhir+json'."/>  
                <direction value="request"/>  
                <headerField value="Accept"/>  
                <operator value="contains"/>  
                <value value="application/fhir+json"/>  
                <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="Confirm that the returned HTTP status is 200.  This test assumes the file build process is complete."/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response contains a value in transactionTime."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.transactionTime"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response contains a value in request."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.request"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response element requiresAccessToken value is 'true'."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="$.requiresAccessToken"/>  
                <value value="true"/>  
                <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="Confirm that the returned response contains the output element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="02-Verify-Output-InsurancePlan"> 
        <name value="02-Verify-Output-InsurancePlan"/>  
        <description value="02: Inspect the Output array and verify required elements.  This test will also check for the presence of Basic, MedicationKnowledge, and Location resources."/>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that a Basic output file url is present."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output[?(@.type=='Basic')].url"/>  
                <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="Confirm that a MedicationKnowledge output file url is present."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output[?(@.type=='MedicationKnowledge')].url"/>  
                <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="Confirm that a Location output file url is present."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output[?(@.type=='Location')].url"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test>  
    <test id="03-ResourceValidation-FormularyDrug"> 
        <name value="04-Resource-FormularyDrug"/>  
        <description value="04: FormularyDrug/MedicationKnowledge-Pull the file and validate the contents against the DaVinci FormularyDrug profile for conformance."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/touchstone/fhir/testing/CodeSystem/codesystem-testscript-operation-codes"/>  
                    <code value="get"/> 
                </type>  
                <description value="Request BulkData ndjson MedicationKnowledge. If no file url was provided in the output file, this test will fail."/>  
                <accept value="ndjson"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <url value="${MedKnowFileLocation}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned HTTP status is 200."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <direction value="response"/>  
                <resource value="MedicationKnowledge"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify that there are AT LEAST 2 records in the file"/>  
                <direction value="response"/>  
                <operator value="greaterThan"/>  
                <path value="resource-count"/>  
                <value value="1"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate that the returned resource conforms to the FormularyDrug FHIR resource profile."/>  
                <direction value="response"/>  
                <validateProfileId value="resource-profile-MedKnowledge"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="04-ResourceValidation-FormularyItem"> 
        <name value="05-Resource-FormularyItem"/>  
        <description value="05: FormularyItem/Basic-Pull the file and validate the contents against the DaVinci FormularyItem profile for conformance."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/touchstone/fhir/testing/CodeSystem/codesystem-testscript-operation-codes"/>  
                    <code value="get"/> 
                </type>  
                <description value="Request BulkData ndjson Basic. If no file url was provided in the output file, this test will fail."/>  
                <accept value="ndjson"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <url value="${BasicFileLocation}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned HTTP status is 200."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <direction value="response"/>  
                <resource value="Basic"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify that there are AT LEAST 2 records in the file"/>  
                <direction value="response"/>  
                <operator value="greaterThan"/>  
                <path value="resource-count"/>  
                <value value="1"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate that the returned resource conforms to the FormularyItem FHIR resource profile."/>  
                <direction value="response"/>  
                <validateProfileId value="resource-profile-FormItem"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="05-ResourceValidation-Location"> 
        <name value="06-Resource-Location"/>  
        <description value="06: Location-Pull the file and validate the contents against the DaVinci Formulary Location profile for conformance."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/touchstone/fhir/testing/CodeSystem/codesystem-testscript-operation-codes"/>  
                    <code value="get"/> 
                </type>  
                <description value="Request BulkData ndjson Location. If no file url was provided in the output file, this test will fail."/>  
                <accept value="ndjson"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <url value="${LocationFileLocation}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned HTTP status is 200."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <direction value="response"/>  
                <resource value="Location"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Verify that there are AT LEAST 2 records in the file"/>  
                <direction value="response"/>  
                <operator value="greaterThan"/>  
                <path value="resource-count"/>  
                <value value="1"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Validate that the returned resource conforms to the Location FHIR resource profile."/>  
                <direction value="response"/>  
                <validateProfileId value="resource-profile-Location"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>