Linking Each Interaction to its Own Variable and Setting the Values
  1. Knowledge Base
  2. Writing Your Own Scoring Rules for Your Assessments: An Example
  3. Linking Each Interaction to its Own Variable and Setting the Values

Linking the variables and the test-taker responses

To carry out the first step, Ian will link each interaction via its response variable (for which he set the id in step 1, for example, RESPONSE_1 for the test-taker’s response to the first interaction) to a chosen score variable (for example, SCORE_1 for the score of the first interaction). 

The code below shows a part of the rule Ian needs to write, which will create this link. This part links SCORE_1 to RESPONSE_1, and it will need to be repeated so that each interaction/variable pair is linked.

 

<responseCondition>

    <responseIf>

        <not>

            <isNull>

                <variable identifier="RESPONSE_1" />

            </isNull>

        </not>

        <setOutcomeValue identifier="SCORE_1">

            <mapResponse identifier="RESPONSE_1" />

        </setOutcomeValue>

    </responseIf>

</responseCondition>

 

Let’s break down the code.

  • the whole block is a 
  • <responseCondition>, which means that the instructions it contains will only be executed if certain conditions are met (see QTI documentation)
  • The first part of the <responseIf> block is the given condition (<not></not>) and the second part is the expression itself (<setOutcomeValue>)
  • the condition says that the expression will only be executed if the interaction is responded to, in other words if the interaction’s variable (RESPONSE_1) is not null
  • the expression says that the value of the variable SCORE_1 should be set to whatever the outcome of the mapResponse algorithm is for the interaction’s variable RESPONSE_1

Since our item contains three interactions, we need three similar 

 

<responseCondition>

 blocks in which we will just change the response identifiers (RESPONSE_1, RESPONSE_2 or RESPONSE_3) and their associated score variable (respectively, SCORE_1, SCORE_2 and SCORE_3).

 

All those blocks must be nested in a 

<responseProcessing/>

 element.

Using this code you can link the interaction responses with their corresponding variables. In the next lesson we’ll look at the other parts of the rule needed, and then the complete rule.