from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random doc = '''Information processing game''' class Constants(BaseConstants): name_in_url = 'information_experiment_processing' players_per_group = None num_rounds = 1 instructions_template = 'information_experiment_processing/instructions.html' # Initial amount allocated to decision maker incentive_mc = 0.5 endowment = c(10) conversion_rate = 0.1 # random number for articles # >= 0.5 -> Left articles are left, right are right, otherwise reverse rand_article_order = random.uniform(0, 1) update_order = random.randint(0, 1) # dem first in article appearance #dem_first = random.randint(0, 1) #random.randint(0, 1) # correct MC answers correct_mc_econ = [0,1] correct_mc_health = [2,1] # Articles article_econ_left = 'information_experiment_processing/article_econ_left.html' article_econ_right = 'information_experiment_processing/article_econ_right.html' article_health_left = 'information_experiment_processing/article_health_left.html' article_health_right = 'information_experiment_processing/article_health_right.html' class Subsession(BaseSubsession): # Random determination of whether an individual can adapt guess for econ or other task def creating_session(self): for p in self.get_players(): # determination of treatment # p.label_treatment = p.participant.vars['treatment'] #p.econ_task = p.participant.vars['econ_in_process'] p.dem_article_first = random.randint(0, 1) #(0 if random.uniform(0, 1) >= 0.5 else 1) # class Group(BaseGroup): pass class Player(BasePlayer): # TREATMENT CONDITION #label_treatment = models.IntegerField(initial=1) #processing_first = models.IntegerField(initial=1) ######################## ## Task Order ## ######################## # Econ in processing #econ_task = models.IntegerField(initial=-1) dem_article_first = models.IntegerField(initial=-1) ######################## ## MC Questions for Articles ## ######################## # ECON QUESTIONS # left control_1_econ = models.IntegerField(initial=-1, label='According to the article "‘Staggeringly High’: U.S. Jobless Claims Remained Elevated Last Week", Trump stopping the stimulus talks before the election:', choices=[ [0, '(a) Will trigger a backslide in the economy'], [1, '(b) Will be replaced by other bigger stimulus packages'], [2, '(c) Was completely expected'] ], widget=widgets.RadioSelect ) # right control_2_econ = models.IntegerField(initial=-1, label='According to the article "Unemployment Rate Points to ‘V’-Shaped Recovery: Only Biden Lockdown May End It", Trump stopping the stimulus talks before the election:', choices=[ [0, '(a) Will trigger a backslide in the economy'], [1, '(b) Will be replaced by other bigger stimulus packages'], [2, '(c) Was completely expected'] ], widget=widgets.RadioSelect ) # health QUESTIONS control_1_health = models.IntegerField(initial=-1, label='According to the article "Bidencare Would Be a Big Deal", what does Bidencare look like?', choices=[ [0, '(a) Keep everything as is'], [1, '(b) Strike down the Affordable Care Act and create a completely new healthcare system'], [2, '(c) Keep the Affordable Care Act and expand it'], [3, '(d) Keep the Affordable Care Act and shrink it'] ], widget=widgets.RadioSelect ) control_2_health = models.IntegerField(initial=-1, label='According to the article "Trumps Healthcare Plan Puts the Patient Where Obamacare Didnt: First", what does Trump’s Healthcare Plan look like?', choices=[ [0, '(a) Keep everything as is'], [1, '(b) Strike down the Affordable Care Act and create a completely new healthcare system'], [2, '(c) Keep the Affordable Care Act and expand it'], [3, '(d) Keep the Affordable Care Act and shrink it'] ], widget=widgets.RadioSelect ) pol_skew_1_econ = models.IntegerField( label='On a scale of -3 to +3, with negative numbers representing left leaning or liberal skew, positive numbers representing right leaning or conservative skew, and 0 representing neutral, how would you rate the article "‘Staggeringly High’: U.S. Jobless Claims Remained Elevated Last Week"?', initial=None, choices=[[-3, '-3 (extremely left leaning)'], [-2, '-2 (left leaning)'], [-1, '-1 (slightly left leaning)'], [0, '0 (neutral)'], [1, '1 (slightly right leaning)'], [2, '2 (right leaning)'], [3, '3 (extremely right leaning)']]) reliance_1_econ = models.IntegerField( label='On a scale of 1 to 7, 1 being not reliable at all and 7 being very reliable, how would you rate the information in the article A "‘Staggeringly High’: U.S. Jobless Claims Remained Elevated Last Week"?', initial=None, choices=[[1, '1 (Not reliable at all)'], [2, '2'], [3, '3'], [4, '4 (Fairly reliable)'], [5, '5'], [6, '6'], [7, '7 (Completely reliable)']]) pol_skew_2_econ = models.IntegerField( label='On a scale of -3 to +3, with negative numbers representing left leaning or liberal skew, positive numbers representing right leaning or conservative skew, and 0 representing neutral, how would you rate the article "Unemployment Rate Points to ‘V’-Shaped Recovery: Only Biden Lockdown May End It"?', initial=None, choices=[[-3, '-3 (extremely left leaning)'], [-2, '-2 (left leaning)'], [-1, '-1 (slightly left leaning)'], [0, '0 (neutral)'], [1, '1 (slightly right leaning)'], [2, '2 (right leaning)'], [3, '3 (extremely right leaning)']]) reliance_2_econ = models.IntegerField( label='On a scale of 1 to 7, 1 being not reliable at all and 7 being very reliable, how would you rate the information in the article "Unemployment Rate Points to ‘V’-Shaped Recovery: Only Biden Lockdown May End It"?', initial=None, choices=[[1, '1 (Not reliable at all)'], [2, '2'], [3, '3'], [4, '4 (Fairly reliable)'], [5, '5'], [6, '6'], [7, '7 (Completely reliable)']]) pol_skew_1_health = models.IntegerField( label='On a scale of -3 to +3, with negative numbers representing left leaning or liberal skew, positive numbers representing right leaning or conservative skew, and 0 representing neutral, how would you rate the article "Bidencare Would Be a Big Deal"?', initial=None, choices=[[-3, '-3 (extremely left leaning)'], [-2, '-2 (left leaning)'], [-1, '-1 (slightly left leaning)'], [0, '0 (neutral)'], [1, '1 (slightly right leaning)'], [2, '2 (right leaning)'], [3, '3 (extremely right leaning)']]) reliance_1_health = models.IntegerField( label='On a scale of 1 to 7, 1 being not reliable at all and 7 being very reliable, how would you rate the information in the article "Bidencare Would Be a Big Deal"?', initial=None, choices=[[1, '1 (Not reliable at all)'], [2, '2'], [3, '3'], [4, '4 (Fairly reliable)'], [5, '5'], [6, '6'], [7, '7 (Completely reliable)']]) pol_skew_2_health = models.IntegerField( label='On a scale of -3 to +3, with negative numbers representing left leaning or liberal skew, positive numbers representing right leaning or conservative skew, and 0 representing neutral, how would you rate the article "Trumps Healthcare Plan Puts the Patient Where Obamacare Didnt: First"?', initial=None, choices=[[-3, '-3 (extremely left leaning)'], [-2, '-2 (left leaning)'], [-1, '-1 (slightly left leaning)'], [0, '0 (neutral)'], [1, '1 (slightly right leaning)'], [2, '2 (right leaning)'], [3, '3 (extremely right leaning)']]) reliance_2_health = models.IntegerField( label='On a scale of 1 to 7, 1 being not reliable at all and 7 being very reliable, how would you rate the information in the article "Trumps Healthcare Plan Puts the Patient Where Obamacare Didnt: First"?', initial=None, choices=[[1, '1 (Not reliable at all)'], [2, '2'], [3, '3'], [4, '4 (Fairly reliable)'], [5, '5'], [6, '6'], [7, '7 (Completely reliable)']]) # setting payoffs def set_income(self): temp = 0 correct = 0 k = 0 if self.participant.vars['econ_in_process'] == 1: for i in [self.control_1_econ, self.control_2_econ]: if i == Constants.correct_mc_econ[k]: temp += Constants.incentive_mc correct += 1 k += 1 elif self.participant.vars['econ_in_process'] == 0: for i in [self.control_1_health, self.control_2_health]: if i == Constants.correct_mc_health[k]: temp += Constants.incentive_mc correct += 1 k += 1 self.payoff = temp self.participant.vars['income_processing'] = self.payoff self.participant.vars['correct_mc_processing'] = correct self.participant.vars['app_nr'] += 1 ######################## ## Guessing Update ######################## econ_measure_biden_processing = models.IntegerField(label='', initial=None, choices=[[2, 'Strong increase (10 % or higher).'], [1, 'Moderate increase (Higher than or equal to 8.5 %, but less than 10 %).'], [0, 'Stable (Higher than or equal to 7.5 %, but less than 8.5 %).'], [-1, 'Moderate decrease (Higher than or equal to 6 %, but less than 7.5 %).'], [-2, 'Strong decrease (6 % or lower).']] ) econ_measure_trump_processing = models.IntegerField(label='', initial=None, choices=[[2, 'Strong increase (10 % or higher).'], [1, 'Moderate increase (Higher than or equal to 8.5 %, but less than 10 %).'], [0, 'Stable (Higher than or equal to 7.5 %, but less than 8.5 %).'], [-1, 'Moderate decrease (Higher than or equal to 6 %, but less than 7.5 %).'], [-2, 'Strong decrease (6 % or lower).']] ) health_measure_biden_processing = models.IntegerField(label='', initial=None, choices=[[2, 'Strong improvement (Rank 12 or better).'], [1, 'Moderate improvement (Rank 13 or 14).'], [0, 'No change (Rank 15).'], [-1, 'Moderate decline (Rank 16 or 17).'], [-2, 'Strong decline (Rank 18 or worse).']] ) health_measure_trump_processing = models.IntegerField(label='', initial=None, choices=[[2, 'Strong improvement (Rank 12 or better).'], [1, 'Moderate improvement (Rank 13 or 14).'], [0, 'No change (Rank 15).'], [-1, 'Moderate decline (Rank 16 or 17).'], [-2, 'Strong decline (Rank 18 or worse).']] )