Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Matrix Question Type Specification: Difference between revisions

From MoodleDocs
No edit summary
m (Text replacement - "class="nicetable"" to "class="wikitable"")
 
(15 intermediate revisions by 4 users not shown)
Line 6: Line 6:
The follow serves as my very high level (mostly technical) specification.
The follow serves as my very high level (mostly technical) specification.


===Database Tables===
===Some examples===


====Question Definition Tables====
Here are three simple examples of the way this question type could be used. ( ) is mean to be a radio button. [ ] is a checkbox.


=====question_matrix=====
-----
 
Evaluate the following statements:
 
{|
!  !! True !! False
|-
| Moodle is a learning management system || (*) || ( )
|-
| Mahara is an ePortfolio system || (*) || ( )
|-
| Moodle has no bugs || ( ) || (*)
|-
| This proposal is a good idea || (*) || ( )
|}
 
-----
 
Which colours are mixed on your computer's monitor to make each of the listed colours:
 
{|
!  !! Red !! Green !! Blue
|-
| Red || [*] || [ ] || [ ]
|-
| Magenta || [*] || [ ] || [*]
|-
| Cyan || [ ] || [*] || [*]
|-
| Black || [ ] || [ ] || [ ]
|-
| White || [*] || [*] || [*]
|}
 
-----
 
Match the adult to their young:
 
{|
!  !! Tadpole !! Joey !! Foal !! Puppy
|-
| Poney || ( ) || ( ) || (*) || ( )
|-
| Frog || (*) || ( ) || ( ) || ( )
|-
| Kangaroo || ( ) || (*) || ( ) || ( )
|}
 
 
But the most useful example is probably the Likert Scale:
 
How often do you do the following?
 
{|
!  !! Never !! Very rarely !! Rarely !! Occasionally !! Frequently !! Very Frequently
|-
| Brush your teeth || [] || [ ] || [ ] || [*] || [ ] || []
|-
| Cook your own dinner || [*] || [ ] || [] || [] || [ ] || []
|-
| Make your bed || [ ] || [] || [] || [] || [ ] || [*]
|-
| Dye your hair || [ ] || [ ] || [ ] || [*] || [ ] || []
|-
| Pick your nose || [] || [] || [*] || [] || [ ] || []
|}
 
==Database Tables==
 
===Question Definition Tables===
 
====question_matrix====
Contains basic information about the matrix - what the grading method and
Contains basic information about the matrix - what the grading method and
whether multiple checks per row are supported(eg checkboxes vs radio buttons)
whether multiple checks per row are supported(eg checkboxes vs radio buttons)
Line 17: Line 88:
* ALL - the student must select ALL correct answers and get 100%, else 0%.
* ALL - the student must select ALL correct answers and get 100%, else 0%.
* ANY - the student must select at least one of the correct answers, and get 100% else 0%.
* ANY - the student must select at least one of the correct answers, and get 100% else 0%.
* WEIGHTED - each cell has a weighting from -100% to 100%.  The "correct"
* WEIGHTED - each cell has a weighting from -100% to 100%.  The "correct" answers must add up to 100%, but the 0 and negative ones don't have any constraint on them.
answers must add up to 100%, but the 0 and negative ones don't have any
* NONE - this could be used for example for Likert scales.
constraint on them.
* SUM of CORRECT ANSWERS - each row is graded. The user is able to choose the percentage on basis of the number of correct answers in all rows. For the first example (4 true/false-questions about moodle) the student selects 4 correct answers in 4 rows --> 100%. The student selects 3 correct answers out of 4 rows (it does not matter if the student has checked the wrong button or hasn't checked any button in the fourth row) --> 50%. The student selects 2, 1 or 0 correct answers out of 4 rows --> 0% (because one can obtain 2 correct answers out of 4 rows by guessing. The probability of a correct answer is 50% in each row).  


{| class="nicetable"
{| class="wikitable"
|-
|-
!field
!field
Line 29: Line 100:
|sequence
|sequence
|-
|-
|question
|questionid
|fk to mdl_question (or mdl_question_instances)
|fk to mdl_question  
|-
|-
|multiple
|multiple
Line 36: Line 107:
|-
|-
|grading
|grading
|(ALL or ANY of WEIGHTED) enum or fk to another table containing these values.
|(ALL or ANY of WEIGHTED or NONE) enum or fk to another table containing these values.
|-
|-
|roundzero
|roundzero
Line 45: Line 116:
|}
|}


=====question_matrix_option=====
====question_matrix_cols====
Contains the definition of the matrix.
Contains the definition of the matrix columns


{| class="nicetable"
{| class="wikitable"
|-
|-
!field
!field
Line 56: Line 127:
|sequence
|sequence
|-
|-
|matrix
|matrixid
|fk to question_matrix
|fk to question_matrix
|-
|-
Line 64: Line 135:
|longtext
|longtext
|title or hover or something
|title or hover or something
|}
====question_matrix_rows====
Contains the definition of the matrix rows
{| class="wikitable"
|-
!field
!notes
|-
|id
|sequence
|-
|-
|xory
|matrixid
|enum (x, y)
|fk to question_matrix
|-
|shorttext
|short word to fit in
|-
|longtext
|title or hover or something
|}
|}




=====question_matrix_weight=====
====question_matrix_weights====
Contains more information about how each cell should be graded.
Contains more information about how each cell should be graded.
EVERY cell should have an entry in this table.  When the grading method is
EVERY cell should have an entry in this table.  When the grading method is
Line 76: Line 165:
percentage automatically and the non-correct answers will be zero.
percentage automatically and the non-correct answers will be zero.


{| class="nicetable"
{| class="wikitable"
|-
|-
!field
!field
Line 84: Line 173:
|sequence
|sequence
|-
|-
|x
|rowid
|fk to question_matrix_option
|fk to question_matrix_rows
|-
|-
|y
|colid
|fk to question_matrix_option
|fk to question_matrix_cols
|-
|-
|weight
|weight
Line 96: Line 185:




====Student Answer Tables====
===Student Answer Tables===


=====question_matrix_answer=====
====question_matrix_answers====
This table contains a list of all the cells that the student has selected.
This table contains a list of all the cells that the student has selected.


{| class="nicetable"
{| class="wikitable"
|-
|-
!field
!field
Line 109: Line 198:
|sequence
|sequence
|-
|-
|x
|rowid
|fk to question_matrix_option
|fk to question_matrix_rows
|-
|-
|y
|colid
|fk to question_matrix_option
|fk to question_matrix_cols
|}
|}


===Implementation notes===
==Implementation notes==


====Grading====
===Grading===
There should be classes to match the grading types (all or any or weighted) so
There should be classes to match the grading types (all or any or weighted) so
that new options could be written.
that new options could be written.


====Renderers====
===Renderers===
It may make sense for some point for some different method to be used to render
It may make sense for some point for some different method to be used to render
this to the user, so we can start with a matrix class and maybe add more later
this to the user, so we can start with a matrix class and maybe add more later
if necessary.
if necessary.
==Penny's TODO==
* Find out about roundzero
* Find out about constant namespacing in qtypes.

Latest revision as of 13:22, 14 July 2021

Introduction

I need to develop a n:n matching type of question that is suited to a matrix. The teacher should be able to define the matrix and the various grading options.

The follow serves as my very high level (mostly technical) specification.

Some examples

Here are three simple examples of the way this question type could be used. ( ) is mean to be a radio button. [ ] is a checkbox.


Evaluate the following statements:

True False
Moodle is a learning management system (*) ( )
Mahara is an ePortfolio system (*) ( )
Moodle has no bugs ( ) (*)
This proposal is a good idea (*) ( )

Which colours are mixed on your computer's monitor to make each of the listed colours:

Red Green Blue
Red [*] [ ] [ ]
Magenta [*] [ ] [*]
Cyan [ ] [*] [*]
Black [ ] [ ] [ ]
White [*] [*] [*]

Match the adult to their young:

Tadpole Joey Foal Puppy
Poney ( ) ( ) (*) ( )
Frog (*) ( ) ( ) ( )
Kangaroo ( ) (*) ( ) ( )


But the most useful example is probably the Likert Scale:

How often do you do the following?

Never Very rarely Rarely Occasionally Frequently Very Frequently
Brush your teeth [] [ ] [ ] [*] [ ] []
Cook your own dinner [*] [ ] [] [] [ ] []
Make your bed [ ] [] [] [] [ ] [*]
Dye your hair [ ] [ ] [ ] [*] [ ] []
Pick your nose [] [] [*] [] [ ] []

Database Tables

Question Definition Tables

question_matrix

Contains basic information about the matrix - what the grading method and whether multiple checks per row are supported(eg checkboxes vs radio buttons) The grading methods translate to:

  • ALL - the student must select ALL correct answers and get 100%, else 0%.
  • ANY - the student must select at least one of the correct answers, and get 100% else 0%.
  • WEIGHTED - each cell has a weighting from -100% to 100%. The "correct" answers must add up to 100%, but the 0 and negative ones don't have any constraint on them.
  • NONE - this could be used for example for Likert scales.
  • SUM of CORRECT ANSWERS - each row is graded. The user is able to choose the percentage on basis of the number of correct answers in all rows. For the first example (4 true/false-questions about moodle) the student selects 4 correct answers in 4 rows --> 100%. The student selects 3 correct answers out of 4 rows (it does not matter if the student has checked the wrong button or hasn't checked any button in the fourth row) --> 50%. The student selects 2, 1 or 0 correct answers out of 4 rows --> 0% (because one can obtain 2 correct answers out of 4 rows by guessing. The probability of a correct answer is 50% in each row).
field notes
id sequence
questionid fk to mdl_question
multiple boolean
grading (ALL or ANY of WEIGHTED or NONE) enum or fk to another table containing these values.
roundzero If the total for the question is less than 0, set it to 0. (This can be triggered by highly negative weights)
renderer 'matrix' hardcoded at the moment (see implementation notes)

question_matrix_cols

Contains the definition of the matrix columns

field notes
id sequence
matrixid fk to question_matrix
shorttext short word to fit in
longtext title or hover or something

question_matrix_rows

Contains the definition of the matrix rows

field notes
id sequence
matrixid fk to question_matrix
shorttext short word to fit in
longtext title or hover or something


question_matrix_weights

Contains more information about how each cell should be graded. EVERY cell should have an entry in this table. When the grading method is 'all' or 'any', the 'correct' answers will be stored here as a non-zero percentage automatically and the non-correct answers will be zero.

field notes
id sequence
rowid fk to question_matrix_rows
colid fk to question_matrix_cols
weight percentage value


Student Answer Tables

question_matrix_answers

This table contains a list of all the cells that the student has selected.

field notes
id sequence
rowid fk to question_matrix_rows
colid fk to question_matrix_cols

Implementation notes

Grading

There should be classes to match the grading types (all or any or weighted) so that new options could be written.

Renderers

It may make sense for some point for some different method to be used to render this to the user, so we can start with a matrix class and maybe add more later if necessary.

Penny's TODO

  • Find out about roundzero
  • Find out about constant namespacing in qtypes.