Skip to content

chapkovski/toloka-otree-connector

Repository files navigation

How connect oTree to Toloka:

  1. Create a new project in toloka, copying content toloka_inner/project_html into html section, and toloka_inner/project.js to js section of a new project.

  2. Create two fields - one input field called session_url, one output field called otree_code:

    Fields: fields

  3. Add JQuery and bootstrap to your project dependencies:

    Dependecies: dependencies

    NB: Adding JS is crucial, because it let otree know the assignment id, generated by Toloka and that is the way we later process the payments, accept/reject the assignments etc.

  4. Set environmental variables listed in env_example file, or put them into .env file (remember, **do not share .env file on github or anywhere else, because that would expose your api keys)

  5. add requests and optionally (if you use .env file) django-dotenv to requirements_base.txt.

  6. Add two variables to your session config: toloka and toloka_sandbox:

        dict(
            name='example',
            num_demo_participants=1,
            app_sequence=['example', 'last'],
            toloka=True,
            toloka_sandbox=True
        ),
  7. Add following lines to settings.py:

        INSTALLED_APPS = ['otree' ]
        EXTENSION_APPS = ['tolokaregister']
        TOLOKA_API = environ.get('TOLOKA_API')
        SANDBOX_TOLOKA_API = environ.get('SANDBOX_TOLOKA_API')
  8. You are good to go. As soon as you start your session with toloka = True, it will be recognized by tolokaregister as a potential toloka session, and it will list it in a data section. If you run session in Toloka sandbox, set toloka_sandbox to True, otherwise set it to False.

Data section:t3

Toloka sessions:t1

Individual participants:t2

You can check/update the status, check if the code they provided at the end of the study is correct, accept the assignment and pay the bonus

THE BONUS IS PAID IN USD. SO IF YOU USE ANOTHER CURRENCY THIS CODE WILL NOT DO ANY CURRENCY CONVERSION. THAT MEANS THAT IF THEIR PAYOFF IS 100 RUBLES, AND YOU PAY THEM IT VIA THIS INTERFACE, THEY WILL GET $100.

About

description of procedure, plus small helper to connect oTree and Yandex.Toloka

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published