-
Notifications
You must be signed in to change notification settings - Fork 2
/
qti_oop_model.Rmd
152 lines (130 loc) · 4.6 KB
/
qti_oop_model.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
title: "QTI OOP Model"
output: rmarkdown::html_vignette
date: "`r Sys.Date()`"
vignette: >
%\VignetteIndexEntry{QTI OOP Model}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r, echo=FALSE}
library(rqti)
```
<style>
.zoomable-image {
position: relative;
}
.zoomable-image img {
width: 100%; /* Adjust the image size as needed */
height: auto;
}
.zoomable-image img:hover {
transform: scale(1.2); /* Adjust the zoom level as needed */
transition: transform 0.3s; /* Adjust the transition duration as needed */
}
</style>
This section is still under construction and only relevant if you want to create exercises without relying on Rmd files. Under the hood, rqti uses S4 OOP. This means that you can create all exercise types as objects, which gives you more flexibility and is much faster. If you are happy with Rmd, there is nothing wrong using it. If you want to go to the next level, consider creating exercise objects directly. In the future we want to add simple constructor functions instead of relying on the `new` function, so that the OOP system is more accessible. Currently, the focus is still on the RMD interface.
First, check out the overview of our classes:
<div class="zoomable-image">
<img src="images/s4model.svg" alt="Class diagram S4" />
</div>
The `rqti` class model consists of classes that represent types of tasks:
- `?SingleChoice`
- `?MultipleChoice`
- `?Essay`
- `?Entry`
- `?Order`
- `?DirectedPair`
- `?MultipleChoiceTable`
- `?OneInRowTable`
- `?OneInColTable`
In addition there are classes for the elements of interactive content of tasks:
- `?TextGap`
- `?NumericGap`
- `?InlineChoice`
- `?TextGapOpal`
- `?ModalFeedback`
- `?CorrectFeedback`
- `?WrongFeedback`
Finally, there are classes for tests and their sections:
- `?AssessmentSection`
- `?AssessmentTest`
- `?AssessmentTestOpal`
## How to create task objects
There are two ways to create task objects:
1. a call to `new`
2. using constructor functions (**will be delivered in the future**)
## Examples of creating task objects
```{r, echo=T, eval=F}
library(rqti)
# simple examples
sc0 <- new("SingleChoice",
identifier = "sc0",
choices = c("answer1", "answer2", "answer3"))
ord0 <- new("Order",
identifier = "ord0",
choices = c("item1", "item2", "item3"))
# more advance example
sc1 <- new("SingleChoice",
choices = c("option 1", "option 2", "option 3", "option 4"),
title = "Single Choice Task",
content = list("Select the correct choice."),
points = 2,
identifier = "sc_v0",
feedback = c(new("WrongFeedback", title = "Error",
content = list("You made a mistake")),
new("CorrectFeedback", title = "Success",
content = list("Well done")),
new("ModalFeedback", title = "Common information",
content = list("Model answer of some details"))))
```
To see the full list of slots call `?SingleChoice`
## Examples of creating section objects
```{r, echo=T, eval=F}
# simple example
section0 <- new("AssessmentSection",
identifier = "sect0",
assessment_item = list(ord0))
# note that assessment_item expects a list!
# more advance example
section1 <- new("AssessmentSection",
identifier = "sect1",
title = "First Section",
time_limits = 20,
visible = FALSE,
assessment_item = list(sc0, sc1),
max_attempts = 2,
allow_comment = TRUE)
```
## Examples of creating test objects
```{r, echo=T, eval=F}
# simple example with a call to `new`
test0 <- new("AssessmentTest",
identifier = "test",
section = list(section0, section1))
# simple example using constructor `test()`
test0 <- test(c(section0, section1), "test")
# more advance example with a call to `new`
test1 <- new("AssessmentTest",
identifier = "test",
title = "Test",
navigation_mode = "linear",
section = list(section0, section1),
time_limits = 60,
max_attempts = 1,
allow_comment = TRUE)
# more advance example using constructor `test()`
test1 <- test(content = c(section0, section1),
identifier = "test",
title = "Test",
navigation_mode = "linear",
time_limits = 60,
max_attempts = 1,
allow_comment = TRUE)
```