from otree.api import * import data as dt import scripts as sc doc = """Big 5 personality test""" class C(BaseConstants): NAME_IN_URL = 'bigfive' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass def bigfive(label): return models.IntegerField(label=label, choices=[1,2,3,4,5], widget=widgets.RadioSelect, min=1, max=5) class Group(BaseGroup): pass class Player(BasePlayer): app2 = models.IntegerField(min=1, max=2) date_payment = models.StringField() payment_id_m = models.StringField() payoff_zhang = models.CurrencyField() payoff_ming = models.CurrencyField() q1 = bigfive('...is talkative') q2 = bigfive('...tends to find fault with others') q3 = bigfive('...does a thorough job') q4 = bigfive('...is depressed, blue') q5 = bigfive('...is original, comes up with new ideas') q6 = bigfive('...is reserved') q7 = bigfive('...is helpful and unselfish with others') q8 = bigfive('...can be somewhat careless') q9 = bigfive('...is relaxed, handles stress well') q10 = bigfive('...is curious about many different things') q11 = bigfive('...is full of energy') q12 = bigfive('...starts quarrels with others') q13 = bigfive('...is a reliable worker') q14 = bigfive('...can be tense') q15 = bigfive('...is ingenious, a deep thinker') q16 = bigfive('...generates a lot of enthusiasm') q17 = bigfive('...has a forgiving nature') q18 = bigfive('...tends to be disorganized') q19 = bigfive('...worries a lot') q20 = bigfive('...has an active imagination') q21 = bigfive('...tends to be quiet') q22 = bigfive('...is generally trusting') q23 = bigfive('...tends to be lazy') q24 = bigfive('...is emotionally stable, not easily upset') q25 = bigfive('...is inventive') q26 = bigfive('...has an assertive personality') q27 = bigfive('...can be cold and aloof') q28 = bigfive('...perseveres until the task is finished') q29 = bigfive('...can be moody') q30 = bigfive('...values artistic, aesthetic experiences') q31 = bigfive('...is sometimes shy, inhibited') q32 = bigfive('...is considerate and kind to almost everyone') q33 = bigfive('...does things efficiently') q34 = bigfive('...remains calm in tense situations') q35 = bigfive('...prefers work that is routine') q36 = bigfive('...is outgoing, sociable') q37 = bigfive('...is sometimes rude to others') q38 = bigfive('...makes plans and follows through with them') q39 = bigfive('...gets nervous easily') q40 = bigfive('...likes to reflect, play with ideas') q41 = bigfive('...has few artistic interests') q42 = bigfive('...likes to cooperate with others') q43 = bigfive('...is easily distracted') q44 = bigfive('...is sophisticated in art, music, or literature') age = models.IntegerField(label='What is your age?', min=10, max=100) gender = models.IntegerField( choices=[[1, 'Male'], [2, 'Female'], [3, 'Other'], [4, 'Prefer not to tell']], label='What is your gender?', widget=widgets.RadioSelect, min = 1, max = 4 ) nationality = models.StringField(choices = dt.list_of_countries, label = 'Nationality') education = models.IntegerField( choices=[[1, 'State exam or diploma'], [2, 'High School'], [3, 'Bachelor'], [4, 'Master'], [5, 'Doctoral']], label='The highest degree you completed', min = 1, max = 5 ) major = models.IntegerField( choices=[[1, 'American Studies'], [2, 'Ancient History'], [3, 'Anthropology'], [4, 'Art History and Museology(Heidelberg and Paris)'], [5, 'Assyriology'], [6, 'Biochemistry'], [7, 'Biology'], [8, 'Biomedical Engineering'], [9, 'Biosciences'], [10, 'Byzantine Archaeology and Art History'], [11, 'Chemistry'], [12, 'Chinese Studies'], [13, 'Christianity and Culture'], [14, 'Classical and Modern Literature'], [15, 'Classical Archaeology'], [16, 'Communication and Society in Ibero-America'], [17, 'Computational Linguistics'], [18, 'Computer Engineering'], [19, 'Conference Interpreting'], [20, 'Corporate Restructuring'], [21, 'Cultural Heritage and Protection of Cultural Goods'], [22, 'Dentistry'], [23, 'Development, Environment, Societies, and History in South Asia'], [24, 'Earth Sciences'], [25, 'East Asian History'], [26, 'East Asian Studies'], [27, 'Eastern European and East Central European Studies'], [28, 'Economics'], [29, 'Editorial Theory and Textual Criticism'], [30, 'Education Studies'], [31, 'Education Studies with a Focus on Organisational Development'], [32, 'Egyptology'], [33, 'English Studies'], [34, 'European Art History'], [35, 'French/Romance Studies'], [36, 'French/transcultural Studies'], [37, 'Geoarchaeology'], [38, 'Geography'], [39, 'German as a Second Language'], [40, 'German Studies'], [41, 'German-French Master Degree in History (Heidelberg and Paris)'], [42, 'Gerontology, Health, and Care'], [43, 'Global History'], [44, 'Governance of Risk and resources'], [45, 'Greek/Classical Philology'], [46, 'Health and Society in South Asia'], [47, 'health Services Research and Implementation Science in Health Systems'], [48, 'Historical Methodology'], [49, 'History'], [50, 'International Health'], [51, 'International Law'], [52, 'Interprofessional Health Care'], [53, 'Interreligious Studies'], [54, 'Islamic and Middle Eastern Studies'], [55, 'Italian/Italy in Contact'], [56, 'Italian/Romance Studies'], [57, 'Japanese Studies'], [58, 'Jewish Studies'], [59, 'Latin/Classical Philology'], [60, 'Law'], [61, 'Management, Ethics and Innovation in the Non-Profit Sector'], [62, 'Mathematics'], [63, 'Matter to Life'], [64, 'Medical Biometry/Biostatistics'], [65, 'Medical Education'], [66, 'Medical Education'], [67, 'Medical Informatics'], [68, 'Medicine (study location Heidelberg)'], [69, 'Medicine (study location Mannheim)'], [70, 'Medieval Studies'], [71, 'Molecular Biosciences'], [72, 'Molecular Biotechnology'], [73, 'Musicology'], [74, 'Near Eastern Archaeology'], [75, 'Near Eastern Studies'], [76, 'pharmacy'], [77, 'Philosophy'], [78, 'Physics'], [79, 'Political Science'], [80, 'Portuguese/Romance Studies'], [81, 'Pre- and Protohistory'], [82, 'Protestant Theology'], [83, 'Psychology'], [84, 'Public Law'], [85, 'Religous Studies'], [86, 'Scientific Computing'], [87, 'Semitic Studies'], [88, 'Slavic and Eastern European Studies'], [89, 'Slavic Studies'], [90, 'Sociology'], [91, 'South Asian Cultural and Religious History/Classical Indology'], [92, 'South Asian Studies'], [93, 'Spanish/Ibero-American Studies'], [94, 'Spanish/Romance Studies'], [95, 'Sport Science'], [96, 'Transcultural Studies'], [97, 'Translation Studies'], [98, 'Translation Studies for Information Technologies'], [99, 'Translation Medical Research'], [100, 'Others']], label='What is your major?', min = 1, max = 100 ) living_cost = models.IntegerField( label = 'How much money do you have available to spend per month after paying for rent? (€)', min = 0, max = 3000 ) income_father = models.IntegerField( choices = [[1, 'less than 1000 €'], [2, '1001~2000 €'], [3, '2001~3000 €'], [4, '3001~4000 €'], [5, '4001~5000 €'], [6, '5001~6000 €'], [7, '6001~7000 €'], [8, 'more than 7000 €'], [9, 'I have no idea']], label='How much does your father earn one month?', widget=widgets.RadioSelect, min = 1, max = 9 ) income_mother = models.IntegerField( choices=[[1, 'less than 1000 €'], [2, '1001~2000 €'], [3, '2001~3000 €'], [4, '3001~4000 €'], [5, '4001~5000 €'], [6, '5001~6000 €'], [7, '6001~7000 €'], [8, 'more than 7000 €'], [9, 'I have no idea']], label='How much does your mother earn one month?', widget=widgets.RadioSelect, min = 1, max = 9 ) education_father = models.IntegerField( choices=[[1, 'Mandatory schooling'], [2, 'Vocational training'], [3, 'High-School'], [4, 'University (Bachelor/Master Degree)'], [5, 'University (PhD)'], [6, 'I have no idea']], label='What is the education of father?', widget=widgets.RadioSelect, min = 1, max = 5 ) job_father = models.IntegerField( choices=[[1, 'full-time job'], [2, 'part-time job'], [3, 'currently not employed'], [4, 'retired'], [5, 'I have no idea']], label='The occupation of father', widget=widgets.RadioSelect, min = 1, max = 5 ) education_mother = models.IntegerField( choices=[[1, 'Mandatory schooling'], [2, 'Vocational training'], [3, 'High-School'], [4, 'University (Bachelor/Master Degree)'], [5, 'University (PhD)'], [6, 'I have no idea']], label='What is the education of mother?', widget=widgets.RadioSelect, min = 1, max = 5 ) job_mother = models.IntegerField( choices=[[1, 'full-time job'], [2, 'part-time job'], [3, 'currently not employed'], [4, 'retired'], [5, 'I have no idea']], label='The occupation of mother', widget=widgets.RadioSelect, min = 1, max = 5 ) class Instruction(Page): form_model = 'player' class BigFive(Page): form_model='player' form_fields = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9', 'q10', 'q11', 'q12', 'q13', 'q14', 'q15'] class BigFive1(Page): form_model = 'player' form_fields = ['q16', 'q17', 'q18', 'q19', 'q20', 'q21', 'q22', 'q23', 'q24', 'q25', 'q26', 'q27', 'q28', 'q29', 'q30'] class BigFive2(Page): form_model = 'player' form_fields = ['q31', 'q32', 'q33', 'q34', 'q35', 'q36', 'q37', 'q38', 'q39', 'q40', 'q41', 'q42', 'q43', 'q44'] class Questionnaire(Page): form_model = 'player' form_fields = ['age', 'gender', 'nationality', 'education', 'major', 'living_cost', 'income_father', 'income_mother', 'education_father', 'job_father', 'education_mother', 'job_mother'] @staticmethod def app_after_this_page(player: Player, upcoming_apps): player.payoff = player.participant.payoff2 * 0.5 + 3.0 player.app2 = player.participant.app1 player.participant.payment_id = sc.name_gen_LC(8) player.payment_id_m = player.participant.payment_id player.payoff_ming = player.participant.payoff2 * 0.5 + 3.0 class Results(Page): form_model = 'player' class Payment_zero1(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 1 and player.participant.payoff2 == 0: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' class Payment_zero2(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 2 and player.participant.payoff2 == 0: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' class Payment_soon8(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 1 and player.participant.payoff2 == 8: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' class Payment_future12(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 1 and player.participant.payoff2 == 12: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'four weeks later' class Payment_future4(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 1 and player.participant.payoff2 == 4: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'four weeks later' class Payment_soon82(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 2 and player.participant.payoff2 == 8: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' class Payment_soon4(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 2 and player.participant.payoff2 == 4: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' class Payment_soon12(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): if player.field_maybe_none('app2') == 2 and player.participant.payoff2 == 12: return player.id_in_group == player.id_in_group @staticmethod def before_next_page(player: Player, timeout_happened): player.date_payment = 'tomorrow' page_sequence = [Instruction, BigFive, BigFive1, BigFive2, Questionnaire, Payment_future4, Payment_future12, Payment_soon4, Payment_soon8, Payment_soon12, Payment_soon82, Payment_zero1, Payment_zero2]