Experiment utils
backend.experiment.utils#
block_export_json_results(block_identifier)
#
Export block JSON data as zip archive
Source code in backend/experiment/utils.py
block_generate_results_data_frame(block_identifier)
#
export results and profiles in two csvs This export does not provide all data, but a selection of the variables expected to be of most interest for basic analyses
Source code in backend/experiment/utils.py
consent_upload_path(instance, filename)
#
Generate path to save consent file based on experiment.identifier and language
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
Experiment
|
Experiment instance to determine folder name |
required |
filename
|
str
|
Name of the consent file to be uploaded |
required |
Returns:
| Name | Type | Description |
|---|---|---|
upload_to |
str
|
Path for uploading the consent file |
Note
Used by the Block model for uploading consent file
Source code in backend/experiment/utils.py
external_url(text, url)
#
Create a HTML element for an external url
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text |
required |
url
|
str
|
Url |
required |
Returns:
| Type | Description |
|---|---|
str
|
HTML element |
Source code in backend/experiment/utils.py
format_label(number, label_style)
#
Generate a label based on an index and a label style
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
index |
required |
label_style
|
str
|
‘alphabetic’, ‘roman’ |
required |
Returns:
| Type | Description |
|---|---|
str
|
Player label |
Source code in backend/experiment/utils.py
get_block_csv_export_as_response(block_identifier)
#
Create a download response for the admin experimenter dashboard
Source code in backend/experiment/utils.py
get_block_json_export_as_response(block_identifier)
#
Create a download response for the admin experimenter dashboard
Source code in backend/experiment/utils.py
get_experiment_csv_export_as_response(experiment_identifier)
#
Create a download response for the admin experimenter dashboard
Source code in backend/experiment/utils.py
non_breaking_spaces(input_string)
#
Convert regular spaces to non breaking spacing on the given string Args: input_string: Input string
Returns:
| Type | Description |
|---|---|
str
|
String with non breaking spaces |