This app is a flexible survey module for oTree that loads its questions from a CSV file csv_questionnaire.csv stored in the _static folder of your main oTree project. The goal is to make questionnaires easy to configure and modify without editing the Python code. The app reads the csv file when the session starts and automatically generates the questionnaire.
How it works
Each row of the CSV file defines one question. The behavior of the question is controlled by several columns.
Supported question types (column type):
mc – multiple choice question
opentext – free text response
opennumber – integer response
visualscale – horizontal Likert-style scale
Columns in the CSV file
question
The text of the question shown to participants.
type
The type of response expected (mc, opentext, opennumber, visualscale).
possible_answers
Used only for multiple-choice questions. It must contain a Python-style list of options. Example: ['Yes', 'No']; ['Make, 'Female','Other']
bounds (optional except for visualscale for which it is mandatory)
Defines limits for some question types:
opennumber → numeric range
Example: [0,100]
opentext → minimum and maximum number of characters
Example: [2,200]
visualscale → endpoints of the Likert scale
Example: [1,7]
anchor (optional)
Used for visualscale questions to define the labels displayed at the ends of the scale. Example: ['Strongly Disagree', 'Strongly Agree']
The order of questions can be randomized for each participant by setting the RANDOMIZE_QUESTION_ORDER constant to True.
An optional attention check can be activated (ATTENTION_CHECK=True) by specifying the round in which it appears (ATTENTION_CHECK_ROUND) and the number participants must enter (ATTENTION_CHECK_TARGET).
In practice: How to make it run?
Download questionnaire_module.zip from this repository
Places the files in your oTree project
Add the questionnaire folder to your otree main folder
Add csv_questionnaire.csv to your _static folder
Add the following configuration to the SESSION_CONFIGS list in your settings.py file:
dict(
name='questionnaire',
display_name="Flexible Survey Module",
app_sequence=['questionnaire'],
num_demo_participants=1,
)