Test Script

Name/FHIRSandbox/DaVinci/FHIR4-0-1-PAS/PAS-1-0-0/02-Subscription/01-Rest-Hooks/01-RestHookSubscriptionListener
DescriptionRest Hook listener for testing Rest Hook Subscriptions as defined in DaVinci PAS IG. redirectURL = the url that the empty POST is expected to be sent to as defined by the Subscription resource authorizationresponseid = claimResponse.identifier PatientIdentifier = claimResponse.patient.identifier origin 1: client which will request the created/updated claimResponse once prompted by the empty POST origin 2: client endpoint that the empty POST will originate from destination 1: server to accept the empty POST (endpoint in Touchstone should not matter, it is being overridden by the endpointURL variable destination 2: server with created/updated claimResponse on it (should also be the server with the Subscription resource)
Version1Latest1
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="RestHookSubscriptionListener"/>  
    <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="rule-validate-pas-claimresponse-bundle-claimresponse"/> 
        </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 == 'ClaimResponse')].resource"/> 
            </extension> 
        </extension>  
        <extension url="param"> 
            <extension url="name"> 
                <valueString value="profileId"/> 
            </extension>  
            <extension url="value"> 
                <valueString value="PASClaimResponseProfile"/> 
            </extension> 
        </extension> 
    </extension>  
    <url value="http://wildfhir.aegis.net/FHIRSandbox/DaVinci/FHIR4-0-1-PAS/02-Subscription/01-Rest-Hooks/00-RestHookSubscriptionListener.xml"/>  
    <name value="RestHookSubscriptionListener"/>  
    <status value="active"/>  
    <date value="2020-01-27"/>  
    <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="Rest Hook listener for testing Rest Hook Subscriptions as defined in DaVinci PAS IG.    redirectURL = the url that the empty POST is expected to be sent to as defined by the Subscription resource   authorizationresponseid = claimResponse.identifier   PatientIdentifier = claimResponse.patient.identifier    origin 1: client which will request the created/updated claimResponse once prompted by the empty POST   origin 2: client endpoint that the empty POST will originate from   destination 1: server to accept the empty POST (endpoint in Touchstone should not matter, it is being overridden by the endpointURL variable   destination 2: server with created/updated claimResponse on it (should also be the server with the Subscription resource)"/>  
    <copyright value="This FHIR Test Script is licensed under Creative Commons (CC0) 'No Rights Reserved'. Learn more at https://creativecommons.org/licenses"/>  
    <origin> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>  
            <code value="FHIR-Client"/> 
        </profile> 
    </origin>  
    <origin> 
        <index value="2"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>  
            <code value="FHIR-Client"/> 
        </profile> 
    </origin>  
    <destination> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <destination> 
        <index value="2"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <profile id="PASBundleProfile"> 
        <reference value="http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-pas-response-bundle"/> 
    </profile>  
    <profile id="PASClaimResponseProfile"> 
        <reference value="http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claimresponse"/> 
    </profile>  
    <variable> 
        <name value="redirectURL"/>  
        <description value="the url that the empty POST is expected to be sent to as defined by the Subscription resource"/>  
        <hint value="the url that the empty POST is expected to be sent to as defined by the Subscription resource"/> 
    </variable>  
    <variable> 
        <name value="authorizationresponseid"/>  
        <description value="claimResponse.identifier"/>  
        <hint value="claimResponse.identifier"/> 
    </variable>  
    <variable> 
        <name value="PatientIdentifier"/>  
        <description value="claimResponse.patient.identifier"/>  
        <hint value="claimResponse.patient.identifier"/> 
    </variable>  
    <test id="RestHookListener"> 
        <name value="RestHookListener"/>  
        <description value="Rest Hook Listener test to catch the notification sent by the server that the Subscription was created on."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://hl7.org/fhir/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <description value="Listen for the empty notification post"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="false"/>  
                <method value="post"/>  
                <origin value="2"/>  
                <url value="${redirectURL}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://hl7.org/fhir/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="ClaimResponse"/>  
                <description value="Search on the polling url to see the new ClaimResponse"/>  
                <accept value="json"/>  
                <destination value="2"/>  
                <encodeRequestUrl value="false"/>  
                <origin value="1"/>  
                <params value="?identifier=${authorizationresponseid}&amp;patient.identifier=${PatientIdentifier}&amp;status=active"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <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 HTTP Header Content-Type is present."/>  
                <direction value="response"/>  
                <headerField value="Content-Type"/>  
                <operator value="notEmpty"/>  
                <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 HTTP Header Content-Type contains the FHIR mime-type 'application/fhir+json'."/>  
                <direction value="response"/>  
                <headerField value="Content-Type"/>  
                <operator value="contains"/>  
                <value value="application/fhir+json"/>  
                <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 response payload contains the Bundle resource type."/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <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 Bundle conforms to the Da Vinci PAS IG. ???Note: the fixtures used will show validation errors for slice matching on Bundle.entry this is a known IG issue in the process of being resolved."/>  
                <direction value="response"/>  
                <validateProfileId value="PASBundleProfile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the Bundle.entry contains at least one ClaimResponse resource."/>  
                <direction value="response"/>  
                <expression value="Bundle.entry.select(resource as ClaimResponse).count()"/>  
                <operator value="greaterThan"/>  
                <value value="0"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="rule-validate-pas-claimresponse-bundle-claimresponse"/> 
                    </extension> 
                </extension>  
                <description value="Validate PAS ClaimResponse within the response PAS Bundle."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>