from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from django import forms author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'FL' num_rounds = 130 players_per_group = None ETHNICITIES = ['African American', 'AI', 'AS', 'HL', 'W', 'O'] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): prolific_id = models.LongStringField(blank=False, label="") AA = models.BooleanField(blank=True, label='African American', initial=False) AI = models.BooleanField(blank=True, label='American Indian', initial=False) AS = models.BooleanField(blank=True, label='Asian', initial=False) HL = models.BooleanField(blank=True, label='Hispanic/Latino', initial=False) W = models.BooleanField(blank=True, label='White/Caucasian', initial=False) O = models.BooleanField(blank=True, label='Other', initial=False) new_option_similar = models.BooleanField() endowment = models.IntegerField() environment = models.IntegerField() solution = models.BooleanField() payoff_values = models.IntegerField() payoff_firststage = models.IntegerField() payoff_secondstage = models.IntegerField() option_1_samp = models.IntegerField(initial=0, label="Actaeon", blank=True) option_2_samp = models.IntegerField(initial=0, label="Achelous", blank=True) option_3_samp = models.IntegerField(initial=0, label="Actaeon", blank=True) option_4_samp = models.IntegerField(initial=0, label="Option N", blank=True) draws_1 = models.IntegerField() draws_2 = models.IntegerField() draws_3 = models.IntegerField() materials_1 = models.IntegerField() materials_2 = models.IntegerField() materials_3 = models.IntegerField() materials_4 = models.IntegerField() materials_4ds = models.IntegerField() error_1 = models.IntegerField() error_2 = models.IntegerField() error_3 = models.IntegerField() error_4 = models.IntegerField() error_4ds = models.IntegerField() draw_sampling = models.IntegerField urn_chosen = models.StringField() payoff_1_samp = models.CurrencyField() payoff_2_samp = models.CurrencyField() payoff_3_samp = models.CurrencyField() urn_draws_1_samp = models.StringField() urn_draws_2_samp = models.StringField() urn_draws_3_samp = models.StringField() option_1 = models.IntegerField(initial=0, label="Option T") option_2 = models.IntegerField(initial=0, label="Option C") option_3 = models.IntegerField(initial=0, label="Option S") urn_draws_1 = models.StringField() urn_draws_2 = models.StringField() urn_draws_3 = models.StringField() urn_draws_4 = models.StringField() payoff_1 = models.IntegerField() payoff_2 = models.IntegerField() payoff_3 = models.IntegerField() payoff_4 = models.IntegerField() endowment_after_sampling = models.IntegerField() instru_page = models.IntegerField(initial=1) questionnaire_page = models.IntegerField(initial=1) controls = models.IntegerField(initial=0) comprehension_page = models.IntegerField(initial=1) completion_code = models.StringField() sampling_round = models.IntegerField(initial=1) points_sampling = models.IntegerField(initial=0) decision_1_page = models.IntegerField(initial=1) decision_2_page = models.IntegerField(initial=1) round_lastblock = models.IntegerField(initial=0) rounds_after = models.IntegerField() uncertain_rounds = models.BooleanField() ##FKT FKT_1 = models.IntegerField(initial=0, label="Honziorus", blank=True) FKT_2 = models.IntegerField(initial=0, label="Dochuipra", blank=True) FKT_3 = models.IntegerField(initial=0, label="Tinkinda", blank=True) FKT_4 = models.IntegerField(initial=0, label="Ubbarvis", blank=True) round_fkt = models.IntegerField(initial=1) materials_1_fkt = models.IntegerField() materials_2_fkt = models.IntegerField() materials_3_fkt = models.IntegerField() materials_4_fkt = models.IntegerField() error_fkt_1 = models.IntegerField() error_fkt_2 = models.IntegerField() error_fkt_3 = models.IntegerField() error_fkt_4 = models.IntegerField() ################################# # Comprehension Questions ####### ################################# cq1 = models.IntegerField( choices=[ [9, 'Yes, choosing a planet in one round increases the probability to excavate materials in the future'], [1, 'No, my choices do not affect how many materials I can excavate in future rounds'], [99, 'Yes, choosing a planet in one round decreases the probability to excavate materials in the future'], [999, 'Yes, choosing a planet in one round decreases the amount of materials I can excavate in the future'], ], widget=widgets.RadioSelect, blank=False, label='In this HIT you repeatedly choose between three different planets. Do your choices in one round affect a planet\'s productivity in future rounds?', initial=0 ) cq2 = models.IntegerField( choices=[ [1, 'the materials gathered in two randomly drawn rounds'], [9, 'the materials gathered in one randomly drawn round'], [99, 'the average amount of materials gathered over all 80 rounds'], [999, 'my performance in comparison to other participants'], ], widget=widgets.RadioSelect, blank=False, label='My total earnings depend on', initial=0 ) cq3 = models.IntegerField( choices=[ [999, 'I only receive information about the materials gathered on the planet I chose'], [9, 'I receive cumulative information about all rounds and all planets'], [99, 'I do not receive any information about the a planet\'s material output'], [1, 'I receive information about the materials gathered on the planet I chose as well as the two planets I did not choose'], ], widget=widgets.RadioSelect, blank=False, label='Each round, you receive information about the success of your decision. What information do you receive in each round?', initial=0 ) access_device = models.IntegerField( choices=[ [0, 'Smartphone'], [1, 'Laptop'], [0, 'Tablet computer'], [1, 'Desktop PC'], ], widget=widgets.RadioSelect, blank=False, label="", ) attention_check_1 = models.IntegerField( choices=[ [0, 'Never'], [0, 'Less than once a month'], [0, '1-3 times a month'], [0, 'Once a week'], [0, '2-3 times a week'], [0, '4-5 times a week'], [0, 'More than 5 times a week'], [1, 'Other'], ], widget=widgets.RadioSelect, blank=False, label="", ) attention_check_2 = models.StringField(blank=True, label="") ################################# # Questions ##################### ################################# q_risk = models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'] ], widget=widgets.RadioSelect, label="How do you see yourself: are you generally a person who is fully prepared to take risks or do you try to avoid taking risks?", blank=False ) q_exploration_strategy =models.LongStringField(blank=False, label="") q_sampling_strategy =models.LongStringField(blank=False, label="") q_firm =models.LongStringField(blank=False, label="") q_fadein =models.LongStringField(blank=False, label="") q_fadeout =models.LongStringField(blank=False, label="") q_saving =models.LongStringField(blank=False, label="") q_wealth =models.LongStringField(blank=False, label="") q_function = models.IntegerField( choices=[ [1, 'Yes'], [2, 'No'], ], widget=widgets.RadioSelect, label="", blank=False ) q_function_yes = models.LongStringField(blank=False, label="") q_year = models.IntegerField(label="", blank=False, min=1900, max=2019) q_sex = models.IntegerField( choices=[ [1, 'Male'], [2, 'Female'], [3, 'Prefer not to answer'], ], widget=widgets.RadioSelect, label="", blank=False ) q_employment = models.IntegerField( choices=[ [1, 'Working (paid employee)'], [2, 'Working (self-employed)'], [3, 'Not working (temporary layoff from a job)'], [4, 'Not working (looking for work)'], [5, 'Not working (retired)'], [6, 'Not working (disabled)'], [7, 'Not working (other)'], [8, 'Prefer not to answer'] ], widget=widgets.RadioSelect, label="", blank=False ) q_education = models.IntegerField( choices=[ [1, 'Less than high school degree'], [2, 'High school graduate (high school diploma or equivalent including GED)'], [3, 'Some college but no degree'], [4, 'Associate degree in college (2-year)'], [5, 'Bachelor’s degree in college(4 - year)'], [6, 'Master’s degree'], [7, 'Doctoral degree'], [8, 'Professional degree (JD, MD)'], ], widget=widgets.RadioSelect, label="", blank=False ) OPTIONS = ( ('AA', 'African American'), ('AI', 'American Indian'), ('AS', 'Asian'), ('H', 'Hispanic/Latino'), ('W', 'White/Caucasian'), ('O', 'Other'), ) q_ethnicity = models.StringField(widget=forms.CheckboxSelectMultiple(choices=OPTIONS), label='', blank=False) q_functions = models.LongStringField(blank=False, label="") def option_1_max(self): if self.session.config['choice']: return Constants.endowment_choice else: return Constants.endowment_points def option_2_max(self): if self.session.config['choice']: return Constants.endowment_choice else: return Constants.endowment_points def option_3_max(self): if self.session.config['choice']: return Constants.endowment_choice else: return Constants.endowment_points def option_safe_max(self): if self.session.config['choice']: return Constants.endowment_choice else: return Constants.endowment_points def fiveitems(label): return models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], ], widget=widgets.RadioSelectHorizontal, blank=False, label=label ) def sixitems(label): return models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], ], widget=widgets.RadioSelectHorizontal, blank=False, label=label ) def sevenitems(label): return models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], ], widget=widgets.RadioSelectHorizontal, blank=False, label=label, ) def thirteenitems(label): return models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [11, '11'], [12, '12'], [13, '13'], ], widget=widgets.RadioSelectHorizontal, blank=False, label=label ) q_epo_1 = sevenitems('Before I act I consider what I will gain or lose in the future as a result of my actions.') q_epo_2 = sevenitems('I try to anticipate as many consequences of my actions as I can.') q_epo_3 = sevenitems('Before I make a decision I consider all possible outcomes.') q_epo_4 = sevenitems('I always try to assess how important the potential consequences of my decisions might be.') q_epo_5 = sevenitems('I try hard to predict how likely different consequences are.') q_epo_6 = sevenitems('Usually I carefully estimate the risk of various outcomes occurring.') q_epo_7 = sevenitems('I keep a positive attitude that things always turn out all right.') q_epo_8 = sevenitems('I prefer to think about the good things that can happen rather than the bad.') q_epo_9 = sevenitems('When thinking over my decisions I focus more on their positive end results.') q_epo_10 = sevenitems('I tend to think a lot about the negative outcomes that might occur as a result of my actions.') q_epo_11 = sevenitems('I am often afraid that things might turn out badly.') q_epo_12 = sevenitems('When thinking over my decisions I focus more on their negative end results.') q_epo_13 = sevenitems('I often worry about what could go wrong as a result of my decisions.') q_cur_1 = fiveitems('I actively seek as much information as I can in new situations.') q_cur_2 = fiveitems('I am the type of person who really enjoys the uncertainty of everyday life.') q_cur_3 = fiveitems('I am at my best when doing something that is complex or challenging.') q_cur_4 = fiveitems('Everywhere I go, I am out looking for new things or experiences.') q_cur_5 = fiveitems('I view challenging situations as an opportunity to grow and learn.') q_cur_6 = fiveitems('I like to do things that are a little frightening.') q_cur_7 = fiveitems('I am always looking for experiences that challenge how I think about myself and the world.') q_cur_8 = fiveitems('I prefer jobs that are excitingly unpredictable.') q_cur_9 = fiveitems('I frequently seek out opportunities to challenge myself and grow as a person.') q_cur_10 = fiveitems('I am the kind of person who embraces unfamiliar people, events, and places.')