3.3.6. Response Processing¶
3.3.6.1. Generalized Response Processing¶
-
class
pyslet.qtiv2.processing.ResponseProcessing(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementResponse processing is the process by which the Delivery Engine assigns outcomes based on the candidate’s responses:
<xsd:attributeGroup name="responseProcessing.AttrGroup"> <xsd:attribute name="template" type="uri.Type" use="optional"/> <xsd:attribute name="templateLocation" type="uri.Type" use="optional"/> </xsd:attributeGroup> <xsd:group name="responseProcessing.ContentGroup"> <xsd:sequence> <xsd:group ref="responseRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
run(state)¶ Runs response processing using the values in state.
- state is an
ItemSessionStateinstance.
- state is an
-
-
class
pyslet.qtiv2.processing.ResponseRule(parent, name=None)¶ Bases:
pyslet.qtiv2.core.QTIElementAbstract class to represent all response rules.
-
run(state)¶ Abstract method to run this rule using the values in state.
-
-
class
pyslet.qtiv2.processing.ResponseCondition(parent)¶ Bases:
pyslet.qtiv2.processing.ResponseRuleIf the expression given in a responseIf or responseElseIf evaluates to true then the sub-rules contained within it are followed and any following responseElseIf or responseElse parts are ignored for this response condition:
<xsd:group name="responseCondition.ContentGroup"> <xsd:sequence> <xsd:element ref="responseIf" minOccurs="1" maxOccurs="1"/> <xsd:element ref="responseElseIf" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="responseElse" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.ResponseIf(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementA responseIf part consists of an expression which must have an effective baseType of boolean and single cardinality. If the expression is true then the sub-rules are processed, otherwise they are skipped (including if the expression is NULL):
<xsd:group name="responseIf.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> <xsd:group ref="responseRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
run(state)¶ Run this test and, if True, any resulting rules.
Returns True if the condition evaluated to True.
-
-
class
pyslet.qtiv2.processing.ResponseElseIf(parent)¶ Bases:
pyslet.qtiv2.processing.ResponseIfRepresents the responseElse element, see
ResponseIf<xsd:group name="responseElseIf.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> <xsd:group ref="responseRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.ResponseElse(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementRepresents the responseElse element, see
ResponseCondition<xsd:group name="responseElse.ContentGroup"> <xsd:sequence> <xsd:group ref="responseRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
run(state)¶ Runs the sub-rules.
-
-
class
pyslet.qtiv2.processing.SetOutcomeValue(parent)¶ Bases:
pyslet.qtiv2.processing.ResponseRuleThe setOutcomeValue rule sets the value of an outcome variable to the value obtained from the associated expression:
<xsd:attributeGroup name="setOutcomeValue.AttrGroup"> <xsd:attribute name="identifier" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="setOutcomeValue.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.StopProcessing¶ Bases:
pyslet.qtiv2.core.QTIErrorRaised when a rule which stops processing is encountered.
-
class
pyslet.qtiv2.processing.ExitResponse(parent, name=None)¶ Bases:
pyslet.qtiv2.processing.ResponseRuleThe exit response rule terminates response processing immediately (for this invocation). It does this by raising
StopProcessing:<xsd:complexType name="exitResponse.Type"/>
3.3.7. Template Processing¶
-
class
pyslet.qtiv2.processing.TemplateProcessing(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementTemplate processing consists of one or more templateRules that are followed by the cloning engine or delivery system in order to assign values to the template variables:
<xsd:group name="templateProcessing.ContentGroup"> <xsd:sequence> <xsd:group ref="templateRule.ElementGroup" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group> <xsd:complexType name="templateProcessing.Type" mixed="false"> <xsd:group ref="templateProcessing.ContentGroup"/> </xsd:complexType>
-
run(state)¶ Runs template processing rules using the values in state.
- state is an
ItemSessionStateinstance.
- state is an
-
-
class
pyslet.qtiv2.processing.TemplateRule(parent, name=None)¶ Bases:
pyslet.qtiv2.core.QTIElementAbstract class to represent all template rules.
-
run(state)¶ Abstract method to run this rule using the values in state.
-
-
class
pyslet.qtiv2.processing.TemplateCondition(parent)¶ Bases:
pyslet.qtiv2.processing.TemplateRuleIf the expression given in the templateIf or templateElseIf evaluates to true then the sub-rules contained within it are followed and any following templateElseIf or templateElse parts are ignored for this template condition:
<xsd:group name="templateCondition.ContentGroup"> <xsd:sequence> <xsd:element ref="templateIf" minOccurs="1" maxOccurs="1"/> <xsd:element ref="templateElseIf" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="templateElse" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.TemplateIf(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementA templateIf part consists of an expression which must have an effective baseType of boolean and single cardinality. If the expression is true then the sub-rules are processed, otherwise they are skipped (including if the expression is NULL):
<xsd:group name="templateIf.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> <xsd:group ref="templateRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
run(state)¶ Run this test and, if True, any resulting rules.
Returns True if the condition evaluated to True.
-
-
class
pyslet.qtiv2.processing.TemplateElseIf(parent)¶ Bases:
pyslet.qtiv2.processing.TemplateIfRepresents the templateElse element, see
templateIf<xsd:group name="templateElseIf.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> <xsd:group ref="templateRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.TemplateElse(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementRepresents the templateElse element, see
TemplateCondition<xsd:group name="templateElse.ContentGroup"> <xsd:sequence> <xsd:group ref="templateRule.ElementGroup" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group>
-
run(state)¶ Runs the sub-rules.
-
-
class
pyslet.qtiv2.processing.SetTemplateValue(parent)¶ Bases:
pyslet.qtiv2.processing.TemplateRuleThe setTemplateValue rule sets the value of a template variable to the value obtained from the associated expression:
<xsd:attributeGroup name="setTemplateValue.AttrGroup"> <xsd:attribute name="identifier" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="setTemplateValue.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.SetCorrectResponse(parent)¶ Bases:
pyslet.qtiv2.processing.TemplateRuleThe setCorrectResponse rule sets the correct value of a response variable to the value obtained from the associated expression:
<xsd:attributeGroup name="setCorrectResponse.AttrGroup"> <xsd:attribute name="identifier" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="setCorrectResponse.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.SetDefaultValue(parent)¶ Bases:
pyslet.qtiv2.processing.TemplateRuleThe setDefaultValue rule sets the default value of a response or outcome variable to the value obtained from the associated expression:
<xsd:attributeGroup name="setDefaultValue.AttrGroup"> <xsd:attribute name="identifier" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="setDefaultValue.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.ExitTemplate(parent, name=None)¶ Bases:
pyslet.qtiv2.processing.TemplateRuleThe exit template rule terminates template processing immediately. It does this by raising
StopProcessing:<xsd:complexType name="exitTemplate.Type"/>
3.3.8. Pre-conditions and Branching¶
-
class
pyslet.qtiv2.processing.TestPartCondition(parent)¶ Bases:
pyslet.qtiv2.core.QTIElement-
evaluate(state)¶ Evaluates the condition using the values in state.
- state is a
TestSessionStateinstance.
- state is a
-
Evaluate(*args, **kwargs)¶ Deprecated equivalent to
evaluate()
-
-
class
pyslet.qtiv2.processing.PreCondition(parent)¶ Bases:
pyslet.qtiv2.processing.TestPartConditionA preCondition is a simple expression attached to an assessmentSection or assessmentItemRef that must evaluate to true if the item is to be presented:
<xsd:group name="preCondition.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.BranchRule(parent)¶ Bases:
pyslet.qtiv2.processing.TestPartConditionA branch-rule is a simple expression attached to an assessmentItemRef, assessmentSection or testPart that is evaluated after the item, section, or part has been presented to the candidate:
<xsd:attributeGroup name="branchRule.AttrGroup"> <xsd:attribute name="target" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="branchRule.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
class
pyslet.qtiv2.processing.TemplateDefault(parent)¶ Bases:
pyslet.qtiv2.core.QTIElementOverrides the default value of a template variable based on the test context in which the template is instantiated:
<xsd:attributeGroup name="templateDefault.AttrGroup"> <xsd:attribute name="templateIdentifier" type="identifier.Type" use="required"/> </xsd:attributeGroup> <xsd:group name="templateDefault.ContentGroup"> <xsd:sequence> <xsd:group ref="expression.ElementGroup" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:group>
-
run(item_state, test_state)¶ Updates the value of a template variable in item_state based on the values in test_state.
-