oTree Workshop Materials

Introductory Workshop on Programming Experiments with oTree

Workshop Duration: Sixteen Academic Hours
Prerequisites: No programming experience required; however, familiarity with basic Python concepts and introductory oTree tutorials is recommended.
Suggested Pre-Workshop Resources:


Main Program

1. Programming Experiments Overview

Click to see the content
1.1 Popular Tools for Experimentation
  • Overview of popular platforms: Ztree, Google Forms, jsPsych, Qualtrics, and oTree.

1.2 Core Concepts of Coding Experiments

  • Core experimental logic: stimulus presentation and response collection.
  • Basics of server-client relationships, including roles of the server (database, task manager, web app) and client (web browser).

1.3 oTree Overview

  • Advantages and limitations of oTree for experimental research.
  • Demonstration: oTree admin panel and basic settings.
  • Sample experiment: Guessing Game (Chapkovski example).
  • Introduction to the Model-View-Controller (MVC) framework:
  • Models: Core and Database (Starlette, SQLite/PostgreSQL).
  • Pages: Page logic and settings (Starlette).
  • Templates: Front-end structure with HTML, CSS (quazi-Jinja2, Bootstrap), and JavaScript.

Click to see the slides

2. Programming Experiments with oTree

Click to see the content

2.1 Setting Up the Environment

  • Development setup: Conda, IDEs, (optionally Git and Heroku client).
  • Creating virtual environments and starting a new oTree project.
  • Local deployment of an oTree app.

2.2 Detailed Structure and Workflow in oTree

  • Building blocks of experimental games.
  • Understanding oTree’s data processing capabilities.
  • Anatomy of an oTree page and available page methods.
  • Reviewing the event sequence diagram for experiment flow and oTree instruments (roles, stages, payoffs, etc).

2.3 Hosting and Resources for

  • Comparison of hosting solutions (Heroku vs. self-hosting).
  • Brief overview of oTree3 vs. oTree5, oTree Studio, oTree Lite, and oTree Hub.
  • Online Recruitment Solutions. Introduction to online recruitment platforms: Toloka, Prolific, and MTurk.

Click to see the slides

3. Expanding Experiment Capabilities

Click to see the content

3.1 Brief Overview of Advanced Options in oTree

  • Capabilities and Customization. Reviewing group-based experiments, live pages, randomization, and custom templates, timeouts, adaptive experimental designs, etc.

3.3 Development Patterns (if have time)

  • Designing user-flow diagrams and planning user scenarios before coding, Implementing test-first methodologies to verify experiment flow.
  • Helpers: jsfiddle, cursor, etc
  • Function calls, monitoring server workload (Bots, browser bots), etc.

———————

Click to see the slides
Bonus

4. How to integrate oTree into neuroimaging Devices

Click to see the slides


———Suggested Post-Workshop Resources:———

Example guessing-game Code:  github.com/gregory-ch/otree_workshop

Otree-hub demo:https://public-class-demo-5ecbf9d50b20.herokuapp.com/demo

More demos:: https://otree-more-demos.herokuapp.com/demo

Otree3: tools (github.com/otree-tools/otree_tools) oTree HR (github.com/chkgk/otree-hr)

Guides: Git Guide | Why Use oTree Hub? | oTree hub Deployment Tutorial | oTree Heroku Setup Guide | Platforms and Panels for Online Behavioral Research | oTree on Prolific

Other: Heroku Developer Program | oTree Hub | bootstrap | jsfiddle.net | cursor.com