from otree.api import * import numpy as np from otree.models import player, participant doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'questionnaire' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): flatpayment = models.CurrencyField(initial=2) #statement1 = models.IntegerField(choices=[['1', 'I strongly disagree'], ['2',''], ['3',''], ['4',''], ['5','I strongly agree']], # widget=widgets.RadioSelect) #statement1 = models.FloatField(label = "Question1",min=0,max=5) #statement2 = models.FloatField(label = "Question2",min=0,max=5) #Demographics: gender = models.StringField( choices=['Female', 'Male', 'Non-binary', 'Transgender', 'Other', 'Prefer not to answer'], label='What gender do you identify as?') age = models.IntegerField( label='Please indicate your age in years.', min=0, max=100) #choices=['16-20', '21-24', '25-34', '35-44', '45-54', '55-64', '65-74','75 or older' ]) education = models.StringField( choices=['Pupil, attending school full-time', 'Left school without a school-leaving qualification', 'General Certificate of Secondary Education or equivalent qualification', 'A-Level (General Certificate of Education Advanced Level) or International Baccalaureate (IB) or equivalent', 'Currently enrolled in a Bachelor’s degree programme or equivalent', 'Bachelor\'s degree or equivalent', 'Master\'s degree or equivalent', 'Ph.D./Doctoral', 'Other qualification'], label='What is the highest level of education you have currently achieved?') economics = models.IntegerField( label='How good is your knowledge in the field of economics?', choices=[['1', 'very poor'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very good']], widget=widgets.RadioSelect) # Wie gut sind Ihre Kenntnisse im Bereich der Wirtschaft? technology = models.IntegerField( label='How good is your knowledge in the field of technology?', choices=[['1', 'very poor'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very good']], widget=widgets.RadioSelect) # field_of_study = models.StringField( # label='Which study programme are you currently enrolled in or were you enrolled in last? If you have not studied, please select "No study".', # choices = ['Computer Science', 'Economics & Business Sciences', 'Engineering & Technology', 'Linguistics & Cultural Studies', 'Mathematics', 'Media & Communication','Medicine', 'Natural Sciences', 'Psychology', 'Social Sciences', 'Teaching profession', 'Other', 'No study']) # Freifelder reasonusealgo = models.LongStringField(label="", blank=False) reasonnoalgo = models.LongStringField(label="", blank=False) #label='Why did you choose to use the algorithm or why not?) # Likert-Skala # questionnaire 4 (8 questions) difficult = models.IntegerField( label='How difficult were the estimations for you?', choices=[['1', 'very easy'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very difficult']], widget=widgets.RadioSelect) competence = models.IntegerField( label='How good did you find the quality of the algorithm\'s estimates in this study?', choices=[['1', 'very bad'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very good']], widget=widgets.RadioSelect, initial=100) # "Wie gut fanden Sie die Qualität der Schätzungen des Algorithmus?." performance = models.StringField( label= 'How would you rate your estimation performance (in the first estimation) relative to that of the algorithm?', choices=[['1', 'very much worse'], ['2', ''], ['3', ''], ['4', 'equal'], ['5', ''], ['6', ''], ['7', 'very much better']], widget=widgets.RadioSelect) average = models.IntegerField( label='Compared to the average of the British population, how did you perform regarding the estimations of the GDP per capita? ', choices=[['1', 'very much worse'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very much better']], widget=widgets.RadioSelect) # Ich schneide bei den Schätzungen des BIP pro Kopf besser ab als der Durchschnitt der englischen Bevölkerung. gdpknowledge = models.IntegerField( label='How familiar were you with the meaning of the GDP per capita before this study?', choices=[['1', 'not familiar at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'perfectly familiar']], widget=widgets.RadioSelect) # Waren Sie vor dieser Studie schon mit dem BIP pro Kopf vertraut? helpful = models.IntegerField( label='It was not necessary for me to use the algorithm in this study.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # Auch wenn der Algorithmus gute Schätzungen macht, ist es für mich nicht hilfreich ihn zu verwenden. useful = models.IntegerField( label='I felt uncomfortable using the algorithm in this study.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Auch wenn der Algorithmus nützlich ist, fühle ich mich unwohl ihn zu verwenden." regret = models.IntegerField( label='I regret that I have used the algorithm in this study.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect, initial=100) # "Ich bereue es, dem Algorithmus verwendet zu haben." # questionnaire 5 - Trust & Delegation vs Advice (6/8 questions but differentiation btw advice and delegation) influenceadvice = models.IntegerField( label='The algorithm influenced my estimates in this study.', choices=[['1', 'not at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'totally']], widget=widgets.RadioSelect, initial=100) # "Meine Einschätzung wurde durch den Algorithmus beeinflusst." trustalgo = models.IntegerField( label='How much did you trust the algorithm\'s estimations in this study?', choices=[['1', 'not trusted at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'totally trusted']], widget=widgets.RadioSelect) # "Wie sehr haben Sie den Einschätzungen des Algorithmus innerhalb dieses Experiments vertraut?" trustothers = models.IntegerField( label='How much do you trust other people in general?', choices=[['1', 'do not trust at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'trust totally']], widget=widgets.RadioSelect) # "Wie sehr vertrauen Sie anderen Menschen im Allgemeinen?" algovshuman = models.IntegerField( label='In general, I trust algorithms more than humans.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # Ich vertraue Algorithmen mehr als Menschen. advsupporthumanalgo = models.IntegerField( label='I would rather prefer to get advice from a human than from an algorithm for an analytical task.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], initial=100, widget=widgets.RadioSelect) # Ich erhalte lieber einen Ratschlag von einem Menschen als von einem Algorithmus. / Ich gebe eine Aufgabe lieber an einen Menschen als einen Algorithmus ab. delsupporthumanalgo = models.IntegerField( label='I would prefer to delegate an analytical task to a human rather than to an algorithm.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], initial=100, widget=widgets.RadioSelect) # Ich erhalte lieber einen Ratschlag von einem Menschen als von einem Algorithmus. / Ich gebe eine Aufgabe lieber an einen Menschen als einen Algorithmus ab. selfvsdelegation = models.IntegerField( label='I would rather delegate a task than do it myself.', choices=[['1', 'not at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'totally']], widget=widgets.RadioSelect, initial=100) # "Ich gebe eine Aufgabe lieber ab, als sie selbst erledigen." # for delegation: choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], # ['7', 'describes me perfectly']], testquestion = models.IntegerField( label='Please select does not describe me at all as your answer. This question tests if you read the questions carefully.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Bitte kreuzen Sie für diese Frage "trifft überhaupt nicht zu" an." supporttype = models.IntegerField( label='I prefer to delegate a task rather than to receive advice.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Ich gebe eine Aufgabe lieber ab, als einen Ratschlag zu erhalten." # questionnaire 6 - General & Blaming (7 questions) risk = models.IntegerField( label='Are you generally a person who is willing to take risks or do you try to avoid taking risks?', choices=[['1', 'not at all willing to take risks'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'very willing to take risks']], widget=widgets.RadioSelect) # "Versuchen Sie Risiken zu vermeiden oder Sind Sie generell ein risikobereiter Mensch?" gutfeeling = models.IntegerField( label='I trust my gut feeling when making decisions.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Ich vertraue bei Entscheidungen auf mein Bauchgefühl.' blame = models.IntegerField( label='When something bad happens to me, I often blame others.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Wenn mir etwas Schlechtes passiert, mache ich dafür häufig Andere dafür verantwortlich." blametemptation = models.IntegerField( label='I find it difficult to blame myself instead of blaming others for a mistake.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # "Fällt es Ihnen schwer die Schuld bei Ihnen selbst zu suchen, anstatt andere für einen Fehler verantwortlich zu machen?" # questionnaire - Desirability of Control Scale (7 questions) RCsthdone= models.IntegerField( label='When I see a problem I prefer to do something about it rather than sit by and let it continue.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) RCpushdecision = models.IntegerField( label='I wish I could push many of life\'s daily decisions off on someone else.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) RConevsmany = models.IntegerField( label='There are many situations in which I would prefer only one choice rather than having to make a decision.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) RCbothered = models.IntegerField( label='I like to wait and see if someone else is going to solve a problem so that I don’t have to be bothered by it.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) CStelltodo= models.IntegerField( label='I try to avoid situations where someone else tells me what to do.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) CSowndecision = models.IntegerField( label='I enjoy making my own decisions.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # Seventh page feedback = models.LongStringField(label="", blank=False) # Please give us feedback on this study at this point: # questionnaire - Overconfidence (8 questions) avoidance = models.IntegerField( label='I try to avoid using algorihms.', choices=[['1', 'does not describe me at all'], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', 'describes me perfectly']], widget=widgets.RadioSelect) # PAGES class questionnaire1(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class questionnaire2(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['gender', 'age', 'education', 'technology', 'economics'] class questionnaire3(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalwantsupport'] > 0 and player.participant.vars['totalwantsupport'] < 6 # change to number of estimations form_model = 'player' form_fields = ['reasonusealgo', 'reasonnoalgo'] class questionnaire3OnlyAlgo(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalwantsupport'] == 6 #change to number of estimations form_model = 'player' form_fields = ['reasonusealgo'] class questionnaire3OnlyOwn(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalwantsupport'] == 0 # change to number of estimations form_model = 'player' form_fields = ['reasonnoalgo'] class questionnaire4(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] >= 1 form_model = 'player' form_fields = ['difficult', 'competence', 'performance', 'average', 'gdpknowledge', 'helpful', 'useful', 'regret'] class questionnaire4Nosup(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] == 0 form_model = 'player' form_fields = ['difficult', 'performance', 'average', 'gdpknowledge', 'helpful', 'useful'] class questionnaire5NosupAdv(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] == 0 and player.participant.vars['control'] == 1 form_model = 'player' form_fields = ['trustalgo', 'trustothers', 'algovshuman', 'advsupporthumanalgo', 'selfvsdelegation', 'testquestion', 'supporttype'] class questionnaire5NosupDel(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] == 0 and player.participant.vars['control'] == 0 form_model = 'player' form_fields = ['trustalgo', 'trustothers', 'algovshuman', 'delsupporthumanalgo', 'selfvsdelegation', 'testquestion', 'supporttype'] class questionnaire5Adv(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] >= 1 and player.participant.vars['control'] == 1 form_model = 'player' form_fields = ['influenceadvice', 'trustalgo', 'trustothers', 'algovshuman', 'advsupporthumanalgo', 'selfvsdelegation', 'testquestion', 'supporttype'] class questionnaire5Del(Page): @staticmethod def is_displayed(player): return player.participant.vars['totalsupport'] >= 1 and player.participant.vars['control'] == 0 form_model = 'player' form_fields = ['trustalgo', 'trustothers', 'algovshuman', 'delsupporthumanalgo', 'selfvsdelegation', 'testquestion', 'supporttype'] class questionnaire6(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['risk', 'gutfeeling', 'blame', 'blametemptation'] class questionnaireControlScale(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['RCsthdone', 'RCpushdecision', 'RConevsmany', 'RCbothered', 'CStelltodo', 'CSowndecision'] class questionnaire7(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['feedback'] class Results(Page): form_model = 'player' @staticmethod def is_displayed(player): return player.round_number == 1 participant = player.participant player.selected_round = player.participant.vars['selected_round'] # code for Prolific # @staticmethod # def js_vars(player): # return dict( # completionlink= # player.subsession.session.config['completionlink'] # ) #pass # for testing w/o quest3 page_sequence = [questionnaire1, questionnaire2, questionnaire3, questionnaire3OnlyOwn, questionnaire3OnlyAlgo, questionnaire4Nosup, questionnaire4, questionnaire5NosupAdv, questionnaire5NosupDel, questionnaire5Adv, questionnaire5Del, questionnaire6, questionnaireControlScale, questionnaire7, Results]