from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'it_a_e' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.StringField( label='What is your age?', choices=[('Y', '18-24'), ('M', '25-39'), ('A', '40-59'), ('O', '60+')], widget=widgets.RadioSelect, ) gender = models.StringField( choices=[('M', 'Male'), ('F', 'Female'), ('O', 'Non-binary'), ('P', 'Prefer not to say')], label='What is your gender?', widget=widgets.RadioSelect, ) education = models.StringField( label='What is the highest level of education you have completed?', choices=[('H', 'High School Degree or equivalent'), ('B', "Bachelor's Degree"), ('A', "Advanced Degree (Master's, Doctorate, etc.)"), ('O', 'Other')], widget=widgets.RadioSelect, ) field_of_work = models.StringField( label='', choices=[('F', 'Finance/Banking/Insurance'), ('I', 'Information Technology/Software'), ('P', 'Professional Services (Consulting, Legal, Accounting, etc.)'), ('H', 'Healthcare/Pharmaceutical'), ('R', 'Retail/Consumer Services/Hospitality'), ('E', 'Education/Academia'), ('M', 'Manufacturing/Industry/Engineering'), ('A', 'Real Estate/Construction/Architecture'), ('G', 'Public Sector/Government/Nonprofit'), ('O', 'Other:')], widget=widgets.RadioSelect, ) field_of_work_other = models.StringField( blank=True, label='Please specify:', ) q1 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q2 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q3 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q4 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q5 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q6 = models.IntegerField(choices=[1, 2, 3, 4, 5]) a1 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q7 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q8 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q10 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q11 = models.IntegerField(choices=[1, 2, 3, 4, 5]) q12 = models.IntegerField(choices=[1, 2, 3, 4, 5]) algorithms_1 = models.IntegerField( label='I believe algorithms can improve decision quality in many domains', choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal, ) algorithms_2 = models.IntegerField( label='Overall I can trust algorithms to be reliable, even when I do not fully understand how they work', choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal, ) algorithms_3 = models.IntegerField( label='I believe that algorithms are beneficial to society', choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal, ) algorithms_4 = models.IntegerField( label='I feel uneasy relying on algorithms for important decisions', choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal, ) text_box = models.LongStringField( label="Lastly, what influenced your choices during the games? In a few words, please describe your strategy:", blank=True ) familiarity = models.IntegerField( label='I regularly use AI-based tools (e.g., ChatGPT, recommendation systems)', choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal, ) total_experiment_time = models.FloatField() # PAGES class End(Page): pass class Survey(Page): form_model = 'player' form_fields = ['age', 'gender', 'education', 'field_of_work', 'field_of_work_other', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'a1', 'q7', 'q8', 'q10', 'q11', 'q12', 'algorithms_1', 'algorithms_2', 'algorithms_3', 'algorithms_4', 'text_box', 'familiarity'] @staticmethod def vars_for_template(player): return dict( statements=[ ('q1', 'I can get others to listen to what I say'), ('q2', 'I see myself as someone who is curious about many different things'), ('q3', 'My life is determined by my own actions'), ('q4', 'I tend to feel comfortable relying on others'), ('q5', 'I see myself as someone who is relaxed and handles stress well'), ('q6', 'I often found that what is going to happen will happen, regardless of my actions'), ('a1', 'Please select "Strongly Disagree"(1) for this statement'), ('q7', 'I prefer work that is routine'), ('q8', 'Most people are trustworthy'), ('q10', 'My wishes do not carry much weight'), ('q11', 'I am confident that I could deal effectively with unexpected situations'), ('q12', 'I see myself as someone who worries a lot'), ], options=[1, 2, 3, 4, 5], ) @staticmethod def before_next_page(player, timeout_happened): from time import time begin = player.participant.vars.get('experiment_start_time') if begin is not None: player.total_experiment_time = time() - begin page_sequence = [Survey, End]