Background

We have received the MTF Question contribution in the C4GT 2023 program for the editor and the code is merged one of the feature branch.

Player side implementation is not done yet, before starting the player implementation we need to re-look into the MTF data model if it’s as per the QuML spec and if any improvement can be done in it to make it easy to understand.

Data Model of MTF Question

body

1<div class='question-body' tabindex='-1'> 2 <div class='mtf-title' tabindex='0'> 3 <p>Match the colour with the fruits.</p> 4 </div> 5 <div data-match-interaction='response1' class='mtf-horizontal'></div> 6</div>

Question body is per the QuML spec

responseDeclaration - C4GT 2023 contributed Format

C4GT contribution exits in feature branch - C4GT_Issue_42

1{ 2 "response1": { 3 "cardinality": "multiple", 4 "type": "map", 5 "correctResponse": { 6 "value": [ 7 { 8 "0": 0 9 }, 10 { 11 "1": 1 12 }, 13 { 14 "2": 2 15 }, 16 { 17 "3": 3 18 } 19 ] 20 }, 21 "mapping": [ 22 { 23 "value": { 24 "0": 0 25 }, 26 "score": 0.25 27 }, 28 { 29 "value": { 30 "1": 1 31 }, 32 "score": 0.25 33 }, 34 { 35 "value": { 36 "2": 2 37 }, 38 "score": 0.25 39 }, 40 { 41 "value": { 42 "3": 3 43 }, 44 "score": 0.25 45 } 46 ] 47 } 48 }

responseDeclaration is as per the QuML spec

But above format of responseDeclaration it not self explanatory

Here are few new proposed Format for responseDeclaration

Cardinality for MTF Question should be "cardinality": "ordered"

Format1 (Recommended)

1{ 2 "response1": { 3 "cardinality": "ordered", 4 "type": "map", 5 "correctResponse": { 6 "value": [ 7 { 8 "lhs": 0, 9 "rhs": 0 10 }, 11 { 12 "lhs": 1, 13 "rhs": 1 14 }, 15 { 16 "lhs": 2, 17 "rhs": 2 18 }, 19 { 20 "lhs": 3, 21 "rhs": 3 22 } 23 ] 24 }, 25 "mapping": [ 26 { 27 "value": { 28 "lhs": 0, 29 "rhs": 0 30 }, 31 "score": 0.25 32 }, 33 { 34 "value": { 35 "lhs": 1, 36 "rhs": 1 37 }, 38 "score": 0.25 39 }, 40 { 41 "value": { 42 "lhs": 2, 43 "rhs": 2 44 }, 45 "score": 0.25 46 }, 47 { 48 "value": { 49 "lhs": 3, 50 "rhs": 3 51 }, 52 "score": 0.25 53 } 54 ] 55 } 56}

Format2

1{ 2 "response1": { 3 "cardinality": "ordered", 4 "type": "map", 5 "correctResponse": { 6 "value": [ 7 { 8 "leftIndex": 0, 9 "rightIndex": 0 10 }, 11 { 12 "leftIndex": 1, 13 "rightIndex": 1 14 }, 15 { 16 "leftIndex": 2, 17 "rightIndex": 2 18 }, 19 { 20 "leftIndex": 3, 21 "rightIndex": 3 22 } 23 ] 24 }, 25 "mapping": [ 26 { 27 "value": { 28 "leftIndex": 0, 29 "rightIndex": 0 30 }, 31 "score": 0.25 32 }, 33 { 34 "value": { 35 "leftIndex": 1, 36 "rightIndex": 1 37 }, 38 "score": 0.25 39 }, 40 { 41 "value": { 42 "leftIndex": 2, 43 "rightIndex": 2 44 }, 45 "score": 0.25 46 }, 47 { 48 "value": { 49 "leftIndex": 3, 50 "rightIndex": 3 51 }, 52 "score": 0.25 53 } 54 ] 55 } 56}

Format3

1{ 2 "response1": { 3 "cardinality": "ordered", 4 "type": "map", 5 "correctResponse": { 6 "value": [ 7 { 8 "left": 0, 9 "right": 0 10 }, 11 { 12 "left": 1, 13 "right": 1 14 }, 15 { 16 "left": 2, 17 "right": 2 18 }, 19 { 20 "left": 3, 21 "right": 3 22 } 23 ] 24 }, 25 "mapping": [ 26 { 27 "value": { 28 "left": 0, 29 "right": 0 30 }, 31 "score": 0.25 32 }, 33 { 34 "value": { 35 "left": 1, 36 "right": 1 37 }, 38 "score": 0.25 39 }, 40 { 41 "value": { 42 "left": 2, 43 "right": 2 44 }, 45 "score": 0.25 46 }, 47 { 48 "value": { 49 "left": 3, 50 "right": 3 51 }, 52 "score": 0.25 53 } 54 ] 55 } 56}

Final Format of responseDeclaration: ?

Note - cardinality enum should be changed in inQuiry schema to fit in "cardinality": "ordered"

Since MTF and Arrange Sequence question is type of question where score is calculated based on order of response, the cardinality should be ordered. Refer QuML spec - cardinality

outcomeDeclaration

1{ 2 "maxScore": { 3 "cardinality": "ordered", 4 "type": "integer", 5 "defaultValue": 1 6 } 7 }


For more info on outcomeDeclarartion - refer , reference2

interactions

1{ 2 "response1": { 3 "type": "match", 4 "options": { 5 "left": [ 6 { 7 "label": "<p>Red</p>", 8 "value": 0 9 }, 10 { 11 "label": "<p>Yellow</p>", 12 "value": 1 13 }, 14 { 15 "label": "<p>Green</p>", 16 "value": 2 17 }, 18 { 19 "label": "<p>Orange</p>", 20 "value": 3 21 } 22 ], 23 "right": [ 24 { 25 "label": "<p>Apple</p>", 26 "value": 0 27 }, 28 { 29 "label": "<p>Banana</p>", 30 "value": 1 31 }, 32 { 33 "label": "<p>Grapes</p>", 34 "value": 2 35 }, 36 { 37 "label": "<p>Orange</p>", 38 "value": 3 39 } 40 ] 41 }, 42 "validation": { 43 "required": "Yes" 44 } 45 } 46}

Question interactions is of type object so it is as per the QuML spec

editorState

1{ 2 "options": { 3 "left": [ 4 { 5 "value": { 6 "body": "<p>Red</p>", 7 "value": 0 8 } 9 }, 10 { 11 "value": { 12 "body": "<p>Yellow</p>", 13 "value": 1 14 } 15 }, 16 { 17 "value": { 18 "body": "<p>Green</p>", 19 "value": 2 20 } 21 }, 22 { 23 "value": { 24 "body": "<p>Orange</p>", 25 "value": 3 26 } 27 } 28 ], 29 "right": [ 30 { 31 "value": { 32 "body": "<p>Apple</p>", 33 "value": 0 34 } 35 }, 36 { 37 "value": { 38 "body": "<p>Banana</p>", 39 "value": 1 40 } 41 }, 42 { 43 "value": { 44 "body": "<p>Grapes</p>", 45 "value": 2 46 } 47 }, 48 { 49 "value": { 50 "body": "<p>Orange</p>", 51 "value": 3 52 } 53 } 54 ] 55 }, 56 "question": "<p>Match the colour with the fruits.</p>", 57 "solutions": [ 58 { 59 "id": "3fe0e600-9746-4673-81a9-3429af3fef41", 60 "type": "html", 61 "value": "<figure class=\"table\"><table><tbody><tr><td>Red</td><td>Apple</td></tr><tr><td>Yellow</td><td>Banana</td></tr><tr><td>Green</td><td>Grapes</td></tr><tr><td>Orange</td><td>Orange</td></tr></tbody></table></figure><p>In the solution we can use the feature of ckeditor so we can also add table as above. using table menu.<br>We can add solution as text + image / Video / Audi (Yet to come)</p>" 62 } 63 ] 64}

editorState Stores editor specific data.

templateId

1"templateId": "mtf-horizontal" / "mtf-vertical"

primaryCategory

1"primaryCategory": "Match The Following Question"

qType

1"qType": "MTF"

interactionTypes

1"interactionTypes": ["match"]



Let’s Compare MTF with MCQ data

Compare MCQ body with MTF body

MCQ Body

MTF Body

1<div class='question-body' tabindex='-1'> 2 <div class='mcq-title' tabindex='0'> 3 <p>Which of the fruits is red in colour?</p> 4 </div> 5 <div data-choice-interaction='response1' class='mcq-vertical'></div> 6</div>
1<div class='question-body' tabindex='-1'> 2 <div class='mtf-title' tabindex='0'> 3 <p>Match the colour with the fruits.</p> 4 </div> 5 <div data-match-interaction='response1' class='mtf-horizontal'></div> 6</div>

Compare MCQ interactions with MTF interactions

MCQ interaction

MTF interaction

1{ 2 "response1": { 3 "type": "choice", 4 "options": [ 5 { 6 "label": "<p>Apple</p>", 7 "value": 0, 8 "hint": "" 9 }, 10 { 11 "label": "<p>Banana</p>", 12 "value": 1, 13 "hint": "" 14 }, 15 { 16 "label": "<p>Grapes</p>", 17 "value": 2, 18 "hint": "" 19 }, 20 { 21 "label": "<p>Orange</p>", 22 "value": 3, 23 "hint": "" 24 } 25 ], 26 "validation": { 27 "required": "Yes" 28 } 29 } 30}
1{ 2 "response1": { 3 "type": "match", 4 "options": { 5 "left": [ 6 { 7 "label": "<p>Red</p>", 8 "value": 0 9 }, 10 { 11 "label": "<p>Yellow</p>", 12 "value": 1 13 }, 14 { 15 "label": "<p>Green</p>", 16 "value": 2 17 }, 18 { 19 "label": "<p>Orange</p>", 20 "value": 3 21 } 22 ], 23 "right": [ 24 { 25 "label": "<p>Apple</p>", 26 "value": 0 27 }, 28 { 29 "label": "<p>Banana</p>", 30 "value": 1 31 }, 32 { 33 "label": "<p>Grapes</p>", 34 "value": 2 35 }, 36 { 37 "label": "<p>Orange</p>", 38 "value": 3 39 } 40 ] 41 }, 42 "validation": { 43 "required": "Yes" 44 } 45 } 46}

Compare MCQ responseDeclaration with MTF responseDeclaration

MCQ responseDeclaration

MTF responseDeclaration

1{ 2 "response1": { 3 "cardinality": "single", 4 "type": "integer", 5 "correctResponse": { 6 "value": 0 7 }, 8 "mapping": [ 9 { 10 "value": 0, 11 "score": 1 12 } 13 ] 14 } 15}
1//MMCQ 2{ 3 "response1": { 4 "cardinality": "multiple", 5 "type": "integer", 6 "correctResponse": { 7 "value": [ 8 0, 9 3 10 ] 11 }, 12 "mapping": [ 13 { 14 "value": 0, 15 "score": 0.5 16 }, 17 { 18 "value": 3, 19 "score": 0.5 20 } 21 ] 22 } 23 }
1{ 2 "response1": { 3 "cardinality": "multiple", 4 "type": "map", 5 "correctResponse": { 6 "value": [ 7 { 8 "0": 0 9 }, 10 { 11 "1": 1 12 }, 13 { 14 "2": 2 15 }, 16 { 17 "3": 3 18 } 19 ] 20 }, 21 "mapping": [ 22 { 23 "value": { 24 "0": 0 25 }, 26 "score": 0.25 27 }, 28 { 29 "value": { 30 "1": 1 31 }, 32 "score": 0.25 33 }, 34 { 35 "value": { 36 "2": 2 37 }, 38 "score": 0.25 39 }, 40 { 41 "value": { 42 "3": 3 43 }, 44 "score": 0.25 45 } 46 ] 47 } 48 }

Compare MCQ outcomeDeclaration with MTF outcomeDeclaration

MCQ outcomeDeclaration

MTF outcomeDeclaration

1{ 2 "maxScore": { 3 "cardinality": "multiple", 4 "type": "integer", 5 "defaultValue": 1 6 } 7 }
1{ 2 "maxScore": { 3 "cardinality": "multiple", 4 "type": "integer", 5 "defaultValue": 1 6 } 7 }

Compare MCQ editorState with MTF editorState

MCQ editorState

MTF editorState

1{ 2 "options": [ 3 { 4 "answer": true, 5 "value": { 6 "body": "<p>Apple</p>", 7 "value": 0 8 } 9 }, 10 { 11 "answer": false, 12 "value": { 13 "body": "<p>Banana</p>", 14 "value": 1 15 } 16 }, 17 { 18 "answer": false, 19 "value": { 20 "body": "<p>Grapes</p>", 21 "value": 2 22 } 23 }, 24 { 25 "answer": true, 26 "value": { 27 "body": "<p>Strawberry</p>", 28 "value": 3 29 } 30 } 31 ], 32 "question": "<p>Which of the fruits is red in colour?</p>", 33 "solutions": [ 34 { 35 "id": "71efa845-2856-4a82-b493-101facfddd26", 36 "type": "html", 37 "value": "<p>Apple is red in colour</p>" 38 } 39 ] 40 }
1
1{ 2 "options": { 3 "left": [ 4 { 5 "value": { 6 "body": "<p>Red</p>", 7 "value": 0 8 } 9 }, 10 { 11 "value": { 12 "body": "<p>Yellow</p>", 13 "value": 1 14 } 15 }, 16 { 17 "value": { 18 "body": "<p>Green</p>", 19 "value": 2 20 } 21 }, 22 { 23 "value": { 24 "body": "<p>Orange</p>", 25 "value": 3 26 } 27 } 28 ], 29 "right": [ 30 { 31 "value": { 32 "body": "<p>Apple</p>", 33 "value": 0 34 } 35 }, 36 { 37 "value": { 38 "body": "<p>Banana</p>", 39 "value": 1 40 } 41 }, 42 { 43 "value": { 44 "body": "<p>Grapes</p>", 45 "value": 2 46 } 47 }, 48 { 49 "value": { 50 "body": "<p>Orange</p>", 51 "value": 3 52 } 53 } 54 ] 55 }, 56 "question": "<p>Match the colour with the fruits.</p>", 57 "solutions": [ 58 { 59 "id": "3fe0e600-9746-4673-81a9-3429af3fef41", 60 "type": "html", 61 "value": "<figure class=\"table\"><table><tbody><tr><td>Red</td><td>Apple</td></tr><tr><td>Yellow</td><td>Banana</td></tr><tr><td>Green</td><td>Grapes</td></tr><tr><td>Orange</td><td>Orange</td></tr></tbody></table></figure><p>In the solution we can use the feature of ckeditor so we can also add table as above. using table menu.<br>We can add solution as text + image / Video / Audi (Yet to come)</p>" 62 } 63 ] 64}


Complete MTF Question Metadata Example:
1{ 2 "mimeType": "application/vnd.sunbird.question", 3 "media": [], 4 "editorState": { 5 "options": { 6 "left": [ 7 { 8 "value": { 9 "body": "<p>Red</p>", 10 "value": 0 11 } 12 }, 13 { 14 "value": { 15 "body": "<p>Yellow</p>", 16 "value": 1 17 } 18 }, 19 { 20 "value": { 21 "body": "<p>Green</p>", 22 "value": 2 23 } 24 }, 25 { 26 "value": { 27 "body": "<p>Orange</p>", 28 "value": 3 29 } 30 } 31 ], 32 "right": [ 33 { 34 "value": { 35 "body": "<p>Apple</p>", 36 "value": 0 37 } 38 }, 39 { 40 "value": { 41 "body": "<p>Banana</p>", 42 "value": 1 43 } 44 }, 45 { 46 "value": { 47 "body": "<p>Grapes</p>", 48 "value": 2 49 } 50 }, 51 { 52 "value": { 53 "body": "<p>Orange</p>", 54 "value": 3 55 } 56 } 57 ] 58 }, 59 "question": "<p>Match the colour with the fruits.</p>", 60 "solutions": [ 61 { 62 "id": "3fe0e600-9746-4673-81a9-3429af3fef41", 63 "type": "html", 64 "value": "<figure class=\"table\"><table><tbody><tr><td>Red</td><td>Apple</td></tr><tr><td>Yellow</td><td>Banana</td></tr><tr><td>Green</td><td>Grapes</td></tr><tr><td>Orange</td><td>Orange</td></tr></tbody></table></figure><p>In the solution we can use the feature of ckeditor so we can also add table as above. using table menu.<br>We can add solution as text + image / Video / Audi (Yet to come)</p>" 65 } 66 ] 67 }, 68 "templateId": "mtf-horizontal", 69 "complexityLevel": [], 70 "maxScore": 1, 71 "name": "MTF", 72 "responseDeclaration": { 73 "response1": { 74 "cardinality": "multiple", 75 "type": "map", 76 "correctResponse": { 77 "value": [ 78 { 79 "0": 0 80 }, 81 { 82 "1": 1 83 }, 84 { 85 "2": 2 86 }, 87 { 88 "3": 3 89 } 90 ] 91 }, 92 "mapping": [ 93 { 94 "value": { 95 "0": 0 96 }, 97 "score": 0.25 98 }, 99 { 100 "value": { 101 "1": 1 102 }, 103 "score": 0.25 104 }, 105 { 106 "value": { 107 "2": 2 108 }, 109 "score": 0.25 110 }, 111 { 112 "value": { 113 "3": 3 114 }, 115 "score": 0.25 116 } 117 ] 118 } 119 }, 120 "outcomeDeclaration": { 121 "maxScore": { 122 "cardinality": "multiple", 123 "type": "integer", 124 "defaultValue": 1 125 }, 126 "hint": { 127 "cardinality": "single", 128 "type": "string", 129 "defaultValue": "098eacc6-07fd-45ba-9e3c-372042154cd3" 130 } 131 }, 132 "interactionTypes": [ 133 "match" 134 ], 135 "interactions": { 136 "response1": { 137 "type": "match", 138 "options": { 139 "left": [ 140 { 141 "label": "<p>Red</p>", 142 "value": 0 143 }, 144 { 145 "label": "<p>Yellow</p>", 146 "value": 1 147 }, 148 { 149 "label": "<p>Green</p>", 150 "value": 2 151 }, 152 { 153 "label": "<p>Orange</p>", 154 "value": 3 155 } 156 ], 157 "right": [ 158 { 159 "label": "<p>Apple</p>", 160 "value": 0 161 }, 162 { 163 "label": "<p>Banana</p>", 164 "value": 1 165 }, 166 { 167 "label": "<p>Grapes</p>", 168 "value": 2 169 }, 170 { 171 "label": "<p>Orange</p>", 172 "value": 3 173 } 174 ] 175 }, 176 "validation": { 177 "required": "Yes" 178 } 179 } 180 }, 181 "qType": "MTF", 182 "primaryCategory": "Match The Following Question", 183 "solutions": { 184 "3fe0e600-9746-4673-81a9-3429af3fef41": "<figure class=\"table\"><table><tbody><tr><td>Red</td><td>Apple</td></tr><tr><td>Yellow</td><td>Banana</td></tr><tr><td>Green</td><td>Grapes</td></tr><tr><td>Orange</td><td>Orange</td></tr></tbody></table></figure><p>In the solution we can use the feature of ckeditor so we can also add table as above. using table menu.<br>We can add solution as text + image / Video / Audi (Yet to come)</p>" 185 }, 186 "body": "<div class='question-body' tabindex='-1'><div class='mtf-title' tabindex='0'><p>Match the colour with the fruits.</p></div><div data-match-interaction='response1' class='mtf-horizontal'></div></div>", 187 "answer": "<div class='match-container'><div class='left-options'><div class='left-option'><p>Red</p></div><div class='left-option'><p>Yellow</p></div><div class='left-option'><p>Green</p></div><div class='left-option'><p>Orange</p></div></div><div class='right-options'><div class='right-option'><p>Apple</p></div><div class='right-option'><p>Banana</p></div><div class='right-option'><p>Grapes</p></div><div class='right-option'><p>Orange</p></div></div></div>", 188 "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64", 189 "board": "CBSE", 190 "medium": [ 191 "English" 192 ], 193 "gradeLevel": [ 194 "Class 4" 195 ], 196 "subject": [ 197 "Hindi" 198 ], 199 "author": "Test User", 200 "channel": "01309282781705830427", 201 "framework": "inquiry_k-12", 202 "copyright": "NIT123", 203 "audience": [ 204 "Student" 205 ], 206 "license": "CC BY 4.0" 207}