Experiment
experiment.models#
Block
#
Bases: Model
Root entity for configuring experiment blocks
Attributes:
Name | Type | Description |
---|---|---|
phase |
Phase
|
The phase this block belongs to |
index |
int
|
Index of this block in the phase |
slug |
str
|
Slug for this block |
name |
str
|
Block name |
description |
str
|
Description |
playlists |
list(section.models.Playlist
|
The playlist(s) used in this block |
image |
Image
|
Image that will be showed on the dashboard |
active |
bool
|
Is this block active? |
rounds |
int
|
Number of rounds |
bonus_points |
int
|
Bonus points |
rules |
str
|
The rules used for this block |
theme_config |
ThemeConfig
|
Theme settings |
Source code in experiment/models.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
|
add_default_question_series()
#
Add default question_series to block
Source code in experiment/models.py
current_participants()
#
Get distinct list of participants
Returns:
Type | Description |
---|---|
List[Participant]
|
Associated participants |
Source code in experiment/models.py
get_rules()
#
Get instance of rules class to be used for this session
Returns:
Type | Description |
---|---|
Base
|
Rules |
Source code in experiment/models.py
max_score()
#
Get max score from all sessions with a positive score
Returns:
Type | Description |
---|---|
int
|
max score from all sessions with a positive score |
Source code in experiment/models.py
playlist_count()
#
Experiment
#
Bases: Model
A model to allow nesting multiple phases with blocks into a ‘parent’ experiment
Attributes:
Name | Type | Description |
---|---|---|
slug |
str
|
Slug |
name |
str
|
Name of the experiment |
description |
str
|
Description |
consent |
FileField
|
Consent text markdown or html |
about_content |
str
|
About text |
social_media_message |
str
|
Message to post with on social media. Can contain {points} and {experiment_name} placeholders |
disclaimer |
str
|
Disclaimer text |
privacy |
str
|
Privacy statement text |
theme_config |
ThemeConfig
|
ThemeConfig instance |
active |
bool
|
Set experiment active |
social_media_config |
SocialMediaConfig
|
SocialMediaConfig instance |
phases |
Queryset[Phase]
|
Queryset of Phase instances |
Source code in experiment/models.py
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 |
|
associated_blocks()
#
Return a list of all associated blocks for this experiment
Returns:
Type | Description |
---|---|
list[Block]
|
Associated blocks |
Source code in experiment/models.py
current_participants()
#
Get distinct list of participants
Returns:
Type | Description |
---|---|
Participant
|
Associated participants |
Source code in experiment/models.py
export_feedback()
#
export feedback for the blocks in this experiment
Returns:
Type | Description |
---|---|
QuerySet[Session]
|
Associated block feedback |
Source code in experiment/models.py
Feedback
#
Bases: Model
A model for adding feedback to an experiment block
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
Text |
block |
Block
|
Associated block |
Source code in experiment/models.py
Phase
#
Bases: Model
Root entity for configuring experiment phases
Attributes:
Name | Type | Description |
---|---|---|
experiment |
Experiment
|
Instance of an Experiment |
index |
int
|
Index of the phase |
dashboard |
bool
|
Should the dashbopard be displayed for this phase? |
randomize |
bool
|
Should the blocks of this phase be randomized? |
Source code in experiment/models.py
SocialMediaConfig
#
Bases: Model
Social media config for an experiment
Attributes:
Name | Type | Description |
---|---|---|
experiment |
Experiment
|
Experiment instance |
tags |
list[str]
|
Tags |
url |
str
|
Url to be shared |
channels |
list[str]
|
Social media channel |
Source code in experiment/models.py
get_content(score)
#
Get social media share content
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score |
float
|
Score |
required |
experiment_name |
Experiment name |
required |
Returns:
Type | Description |
---|---|
str
|
Social media shared text |
Raises:
Type | Description |
---|---|
ValueError
|
If required parameters are missing when needed |
Source code in experiment/models.py
consent_upload_path(instance, filename)
#
Generate path to save consent file based on experiment.slug and language Returns: upload_to (str): Path for uploading the consent file