This page contains selected code components from experiments I implemented in oTree since 2025. It focuses on parts of the implementation that are not entirely straightforward to code (or that I was particularly proud of 🤓).
My goal was to create standalone apps that can be easily integrated into broader experiments through simple parameterization. These parameters can be adjusted through the Constants in the project's init.py, or directly by modifying files in oTree’s _static folder (for example, editing CSV files or adding images).
Feel free to test the implementations, reuse or adapt them for your own projects, or reach out if you have any questions.
A two player audio/video chat
This app implements a two-player video chat using webcams and microphones and was developed in collaboration with Quentin Thévenet, lab manager at GATE. Participants can communicate in real time for a fixed duration. The system relies on WebRTC for peer-to-peer communication and uses STUN/TURN servers to ensure reliable connections across different networks.Â
Human vs AI Classification Task
This app implements a flexible image classification task for oTree in which participants categorize images as human-created or AI-generated. The app can easily be adapted for any binary image classification task. The set of images is loaded dynamically from the otree folder. Images are presented sequentially, responses can be given using on-screen buttons or keyboard shortcuts.Â
Flexible Survey Module
This app is a flexible questionnaire module for oTree that loads its questions from a CSV file making it easy to add, remove, or modify questions without changing the code. Supported question types include multiple choice, free text, numeric input, and Likert-style scales. The CSV file can also define answer options, numeric or character bounds, and scale anchors.Â
'Bomb' Risk Task
This app implements a Bomb Risk Elicitation Task (Crosetto, 2013) with built-in instructions. Two versions of the task are available: the standard version, and a second version in which earnings also accrue to another player, allowing researchers to study risk-taking under responsibility. The instructions include illustrated characters and an animation to explain how the task works.Â
Math Task
This app implements a mental arithmetic task in which participants solve addition problems for a fixed duration (Niederle & Vesterlund, 2007). A problem consists of several randomly generated numbers that must be added. Problems are presented sequentially. The number of numbers per addition, the number of digits of each number, and the task duration are parameterized.
4-AFC Perceptual Task
This app implements a perceptual discrimination task. Participants briefly observe a grid of colored symbols and must identify which symbol category appears most frequently. After responding, participants may report their confidence in their answer on a separate page. The stimulus size, display duration, symbol colors, symbol types, and difficulty level are parameterized.
Adjustable Probability Scale
This app implements a configurable scale for reporting probability. Participants indicate a value on a continuous scale within a parameterized range. The app records the selected value and the time taken to respond. Its appearance can be configured to be either vertical or horizontal, and the minimum value, maximum value, and color of the scale can also be specified. The minimum and maximum tick labels are displayed.