from otree.api import * c = Currency doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'peq' players_per_group = None num_rounds = 1 fields_integer = ['estimate_lying', 'dishonest_1', 'dishonest_2', 'dishonest_3', 'risk_aversion'] fields_integer_with_radio = ['dishonest_1', 'dishonest_2', 'dishonest_3', 'risk_aversion'] fields_string_with_radio = ['instr_clarity', 'most_participants_report', 'players_should_report', 'location', 'concentration'] scale_agree = ['Completely agree', 'Agree', 'Neither agree nor disagree', 'Disagree', 'Completely disagree'] scale_justifiable = [ (1, '1 - Never justifiable'), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, '10 - Always justifiable') ] peq = { 'age': { 'label': "What is your age?", 'choices': ['18-20', '21-25', '26-30', '31-35', '36-40', '41-45', '46-50', '51-55', '56-60', 'over 60'] }, 'gender': { 'label': "What is your gender?", 'choices': ['Male', 'Female', 'Non-binary'] }, 'profession': { 'label': "Which category described your professional situation best?", 'choices': [ 'Student without employment', 'Student with employment', 'Part-time employed', 'Full-time employed', 'Self-employed', 'Unemployed', 'Not working (and not searching employment)', 'Retired' ] }, 'income': { 'label': "What is your monthly available income (for all expenses including rent):", 'choices': [ 'below 500 pounds', 'between 500 and 750 pounds', 'between 750 and 1000 pounds', 'between 1000 and 1500 pounds', 'between 1500 and 2000 pounds', 'between 2000 and 3000 pounds', 'between 3000 and 4000 pounds', 'above 4000 pounds' ] }, 'native_english': { 'label': "Is English one of the native languages you grew up with?", 'choices': ['Yes', 'No', 'Other'] }, 'estimate_lying': { 'label': "Out of 10 players in this experiment, how many do you think reported a number that was higher " "than what they should have reported in one of the three rounds in part 1?", 'choices': list(range(1, 11)) }, 'instr_clarity': { 'label': "The instructions for the three parts were clear and easy to understand.", 'choices': scale_agree }, 'most_participants_report': { 'label': "I assume that most participants report a higher value than they should have when they had the " "chance in part 2 and part 3 (when they interact with another participates). ", 'choices': scale_agree }, 'players_should_report': { 'label': "I think that A players should report a higher value when they have the chance.", 'choices': scale_agree }, 'dishonest_1': { 'label': "i) Being dishonest if it benefits another person:", 'choices': scale_justifiable }, 'dishonest_2': { 'label': "ii) Being dishonest if benefits oneself:", 'choices': scale_justifiable }, 'dishonest_3': { 'label': "iii) Being dishonest if it benefits oneself and another person:", 'choices': scale_justifiable }, 'location': { 'label': "During the experiment you were mainly:", 'choices': [ 'Alone in a closed room (e.g. at home)', 'Alone in a public space (coffee shop, library, etc.)', 'Not alone', 'Other' ] }, 'concentration': { 'label': "During the experiment you were:", 'choices': [ 'Always concentrated on the experiment', 'Mostly concentrated but sometimes distracted (by emails, messages, etc.)', 'Often distracted', 'Other' ] }, 'risk_aversion': { 'label': "Would you say that you are generally a person who likes to take risks or a " "person who avoids risks?", 'choices': [ (0, '0 - I always avoid risk'), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, '10 - I always like to take risks') ] }, 'comment': { 'label': "In case you want to leave a comment (concerning the experiment, the questionnaire, etc.):" } } class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): for n, q in Constants.peq.items(): if n in Constants.fields_integer_with_radio: locals()[n] = models.IntegerField(label=q['label'], choices=q['choices'], widget=widgets.RadioSelect, blank=True) elif n in Constants.fields_integer: locals()[n] = models.IntegerField(label=q['label'], choices=q['choices'], blank=True) elif n in Constants.fields_string_with_radio: locals()[n] = models.StringField(label=q['label'], choices=q['choices'], widget=widgets.RadioSelect, blank=True) elif n == 'comment': locals()[n] = models.LongStringField(label=q['label'], blank=True) else: locals()[n] = models.StringField(label=q['label'], choices=q['choices'], blank=True) del n, q # PAGES class PEQ1(Page): form_model = 'player' form_fields = ['age', 'gender', 'profession'] class PEQ2(Page): form_model = 'player' form_fields = ['income', 'native_english'] class PEQ3(Page): form_model = 'player' form_fields = ['estimate_lying'] class PEQ4(Page): form_model = 'player' form_fields = ['instr_clarity', 'most_participants_report', 'players_should_report'] class PEQ5(Page): form_model = 'player' form_fields = ['dishonest_1', 'dishonest_2', 'dishonest_3'] class PEQ6(Page): form_model = 'player' form_fields = ['location', 'concentration'] class PEQ7(Page): form_model = 'player' form_fields = ['risk_aversion', 'comment'] page_sequence = [PEQ1, PEQ2, PEQ3, PEQ4, PEQ5, PEQ6, PEQ7]