from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import numpy as np import csv import pandas as pd doc = '''Information processing game, posterior''' class Constants(BaseConstants): name_in_url = 'Information_processing_intro' players_per_group = None num_rounds = 1 #instructions_template = 'information_experiment_1/instructions.html' # Initial amount allocated to decision maker endowment = 6 conversion_rate = 0.1 payment_correct_guesses = 0.5 # CORRECT ANSWERS correct_health = -2 correct_econ = -2 correct_control = 1 # random assignment of treatments # we would like to have 50 / 50 ex ante treat_boolean = [] for i in range(150): temp_bin = [1,1,1,1,1,0,0,0,0,0] random.shuffle(temp_bin) treat_boolean += temp_bin # loading the data of first study and prepare a dict with key = prolific ID # post_information_experiment_intro_2/pre_study_data_.csv # /Users/kev/Desktop/oTree_/post_information_experiment_intro_2/pre_study_data_.csv temp_df = pd.read_csv('post_information_experiment_intro_2/pre_study_data_.csv', sep=';') list_prolid = temp_df['prol_id'].tolist() temp_lists = [] for cols_ in temp_df.drop(['prol_id'], axis=1).columns: temp_lists.append(temp_df[cols_].tolist()) # 0 = election_outcome_electoral --> 1 == Trump , 0 == Biden # 1 = election_outcome_popular --> 1 == Trump , 0 == Biden # 2 = econ_measure # 3 = health_measure temp_tuple = list(zip(temp_lists[0], temp_lists[1], temp_lists[2], temp_lists[3])) prol_dict = dict(zip(list_prolid, temp_tuple)) class Subsession(BaseSubsession): # Creating random group assignment for players # 2 Groups triangle = 1, circle = 0 def creating_session(self): for p in self.get_players(): # random number #x = random.uniform(0, 1) p.received_article = random.randint(-1, 0) ## MINIMAL GROUP DETERMINATION p.minimal_group = (0 if random.uniform(0, 1) >= 0.5 else 1) ### TREATMENT DETERMINATION: OBSERVING THE SHARES OF CORRECT URN GUESSES OR NOT # p.treatment = Constants.treat_boolean[(p.id_in_group-1)] # p.participant.vars['treatment'] = p.treatment # order determination #p.participant.vars['app_nr'] = 2 # p.participant.vars['update_order'] = random.randint(1,2) p.participant.vars['pol_order'] = random.randint(1, 2) p.participant.vars['neut_order'] = random.randint(1, 2) # Urn setting #p.participant.vars['urn'] = (0 if random.uniform(0, 1) >= 0.5 else 1) class Group(BaseGroup): pass class Player(BasePlayer): def prior_decisions(self): # information from wave 1: try: self.participant.vars['econ_guess'] = Constants.prol_dict[self.participant.label][2] self.participant.vars['health_guess'] = Constants.prol_dict[self.participant.label][3] # TESTING EXEPTION except: self.participant.vars['econ_guess'] = random.randint(-2,2) self.participant.vars['health_guess'] = random.randint(-2,2) self.participant.vars['income_health'], self.participant.vars['income_econ'] = 0, 0 if Constants.correct_health == self.participant.vars['health_guess']: self.participant.vars['income_health'] += 10 if Constants.correct_econ == self.participant.vars['econ_guess']: self.participant.vars['income_econ'] += 10 self.participant.payoff = self.participant.vars['income_econ'] + self.participant.vars['income_health'] + 3 self.participant.vars['income_guess'] = self.participant.vars['income_econ'] + self.participant.vars['income_health'] def ControlQuestion(self): if Constants.correct_control == self.mask_control: self.participant.vars['control_correct'] = 1 self.participant.payoff += 1 self.participant.vars['bonus'] = self.participant.vars['income_guess'] + 1 else: self.participant.vars['control_correct'] = 0 self.participant.vars['bonus'] = self.participant.vars['income_guess'] ######################## ## Minimal Groups ## ######################## # MINIMAL GROUP MEMBERSHIP # 0 = circle, 1 = triangle minimal_group = models.IntegerField(initial=-1) # -1 = Left, 0 = neutral, 1 = right received_article = models.IntegerField(initial=-2) ######################################################################################################################## ## OvO Tasks ## ######################################################################################################################## # MINIMAL GROUP ovo_neutral_both_triangle_p1 = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_neutral_both_circle_p1 = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_neutral_different_circle = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) # POLICY ovo_pol_both_dem_p1 = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_pol_both_rep_p1 = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_pol_different_dem = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) # STATE LEVEL IDENTIFICATION # OVO STATE LEVEL # MINIMAL GROUP ovo_state_both_in = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_state_both_out = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ovo_state_different_in = models.CurrencyField(initial=None, choices=[[1, '$1 to person 1 ------- $5 to person 2'], [2, '$2 to person 1 ------- $4 to person 2'], [3, '$3 to person 1 ------- $3 to person 2'], [4, '$4 to person 1 ------- $2 to person 2'], [5, '$5 to person 1 ------- $1 to person 2']] ) ident_state = models.IntegerField( label='How much do you identify with the state in which you currently live?', initial=None, choices=[ [0, ' Not at all'], [1, ' Weakly'], [2, ' Moderately'], [3, ' Strongly']], widget=widgets.RadioSelect ) science_trust = models.IntegerField( label='How much confidence do you have in scientists: is it a great deal of confidence, quite a lot of confidence, not very much confidence or none at all?', initial=None, choices=[ [0, ' None at all'], [1, ' Not very much'], [2, ' Quite a lot'], [3, ' A great deal']], widget=widgets.RadioSelect ) ######################################################################################################################## ## SELF-ESTEEM MEASURE ROSENBERG ## ######################################################################################################################## rosen_1 = models.IntegerField( label='On the whole, I am satisfied with myself.', initial=None, choices=[ [1, ' Strongly Disagree'], [2, ' Disagree'], [3, ' Agree'], [4, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_2 = models.IntegerField( label='At times I think I am no good at all.', initial=None, choices=[ [4, ' Strongly Disagree'], [3, ' Disagree'], [2, ' Agree'], [1, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_3 = models.IntegerField( label='I feel that I have a number of good qualities.', initial=None, choices=[ [1, ' Strongly Disagree'], [2, ' Disagree'], [3, ' Agree'], [4, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_4 = models.IntegerField( label='I am able to do things as well as most other people.', initial=None, choices=[ [1, ' Strongly Disagree'], [2, ' Disagree'], [3, ' Agree'], [4, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_5 = models.IntegerField( label='I feel I do not have much to be proud of.', initial=None, choices=[ [4, ' Strongly Disagree'], [3, ' Disagree'], [2, ' Agree'], [1, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_6 = models.IntegerField( label='I certainly feel useless at times.', initial=None, choices=[ [4, ' Strongly Disagree'], [3, ' Disagree'], [2, ' Agree'], [1, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_7 = models.IntegerField( label='I feel that I\'m a person of worth, at least on an equal plane with others.', initial=None, choices=[ [1, ' Strongly Disagree'], [2, ' Disagree'], [3, ' Agree'], [4, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_8 = models.IntegerField( label='I wish I could have more respect for myself.', initial=None, choices=[ [4, ' Strongly Disagree'], [3, ' Disagree'], [2, ' Agree'], [1, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_9 = models.IntegerField( label='All in all, I am inclined to feel that I am a failure.', initial=None, choices=[ [4, ' Strongly Disagree'], [3, ' Disagree'], [2, ' Agree'], [1, ' Strongly Agree']], widget=widgets.RadioSelect ) rosen_10 = models.IntegerField( label='I take a positive attitude toward myself.', initial=None, choices=[ [1, ' Strongly Disagree'], [2, ' Disagree'], [3, ' Agree'], [4, ' Strongly Agree']], widget=widgets.RadioSelect ) ######################################################################################################################## ## Digital Footprint ## ######################################################################################################################## dig_foot1 = models.IntegerField( label='What is your preferred web browser?', initial=None, choices=[ [1, ' Opera'], [2, ' Safari'], [3, ' Chrome'], [4, ' Edge'], [5, ' Samsung Internet'], [6, ' Firefox'], [7, ' Other']], widget=widgets.RadioSelect ) dig_foot2 = models.IntegerField( label='What operating system has the electronic device you use to participate in this study?', initial=None, choices=[ [1, ' macOS/iOS'], [2, ' Microsoft Windows'], [3, ' Linux'], [4, ' Android'], [5, ' Chrome OS'], [6, ' Ubuntu'], [7, ' Other']], widget=widgets.RadioSelect ) dig_foot3 = models.IntegerField( label='What is the domain of your personal email, i.e., the part of an email address that comes after the @ symbol?', initial=None, choices=[ [1, ' gmail.com/ googlemail.com'], [2, ' yahoo.com'], [3, ' hotmail.com'], [4, ' outlook.com'], [5, ' msn.com'], [6, ' inbox.com'], [7, ' aol.com'], [8, ' iCloud.com'], [9, ' Other']], widget=widgets.RadioSelect ) dig_foot4 = models.IntegerField( label='What is the brand of the electronic device you use to participate in this study?', initial=None, choices=[ [1, ' Apple'], [2, ' Samsung'], [3, ' Microsoft'], [4, ' Google'], [5, ' Huaweii'], [6, ' LG'], [7, ' Lenovo'], [8, ' Other']], widget=widgets.RadioSelect ) dig_foot5 = models.IntegerField( label='How do you typically access news websites?', initial=None, choices=[ [1, ' Via search engines such as Google or Yahoo'], [2, ' Directly by entering the web address in my browser'], [3, ' Via links from social media'], [4, ' Other']], widget=widgets.RadioSelect ) dig_foot6 = models.IntegerField( label='Who is your Internet Service Provider?', initial=None, choices=[ [1, ' AT&T'], [2, ' Xfinity'], [3, ' CenturyLink'], [4, ' Verizon'], [5, ' Charter Spectrum'], [6, ' Frontier Communications'], [7, ' Other']], widget=widgets.RadioSelect ) # ip_adress = models.StringField(label='', # blank=True, # initial=None) ######################################################################################################################## ## VACCINE RELATED ## ######################################################################################################################## vacc1 = models.IntegerField( label='What is your vaccination status?', initial=None, choices=[ [0, ' I am fully vaccinated (2 shots BionTech-Pfizer/Moderna, 1 shot Johnson&Johnson)'], [1, ' I have received my first out of two vaccine shots (1 shot with BionTech-Pfizer/Moderna)'], [2, ' I have not gotten vaccinated, but plan to receive one in the foreseeable future'], [3, ' I have not gotten vaccinated, and I do not plan to receive one in the foreseeable future'], [4, ' I cannot get vaccinated.'],], widget=widgets.RadioSelect ) vacc1_1 = models.LongStringField(label='Please explain briefly, why you do not intend to get vaccinated in the foreseeable future.', initial=None) vacc1_2 = models.LongStringField(label='Please explain briefly, why you have not got vaccinated, yet.', initial=None) skew = 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 you just read?', 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 = 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 you just read?', 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)']]) ######################################################################################################################## ## NEWS QUESTIONS ## /Users/kev/Downloads otree unzip BLAH.otreezip ######################################################################################################################## abc = models.IntegerField(blank=True, choices=[[1, 'ABC, NBC, or CBS']], widget=widgets.RadioSelect) cnn = models.IntegerField(blank=True, choices=[[1, 'CNN']], widget=widgets.RadioSelect) fox = models.IntegerField(blank=True, choices=[[1, 'Fox News']], widget=widgets.RadioSelect) local = models.IntegerField(blank=True, choices=[[1, 'Local TV or radio']], widget=widgets.RadioSelect) msnbc = models.IntegerField(blank=True, choices=[[1, 'MSNBC']], widget=widgets.RadioSelect) npr = models.IntegerField(blank=True, choices=[[1, 'NPR (National Public Radio) or PBS']], widget=widgets.RadioSelect) magazines = models.IntegerField(blank=True, initial=0, choices=[[1, 'Newspapers, magazines, online or in paper']], widget=widgets.RadioSelect) face = models.IntegerField(blank=True, choices=[[1, 'Facebook']], widget=widgets.RadioSelect) twit = models.IntegerField(blank=True, choices=[[1, 'Twitter']], widget=widgets.RadioSelect) other = models.StringField( blank=True, initial=None) economist = models.IntegerField(blank=True, choices=[[1, 'Economist']], widget=widgets.RadioSelect) nyt = models.IntegerField(blank=True, choices=[[1, 'New York Times']], widget=widgets.RadioSelect) wsj = models.IntegerField(blank=True, choices=[[1, 'Wall Street Journal']], widget=widgets.RadioSelect) wash_ex = models.IntegerField(blank=True, choices=[[1, 'Washington Examiner']], widget=widgets.RadioSelect) wash_pos = models.IntegerField(blank=True, choices=[[1, 'Washington Post']], widget=widgets.RadioSelect) nature = models.IntegerField(blank=True, choices=[[1, 'Nature']], widget=widgets.RadioSelect) science = models.IntegerField(blank=True, choices=[[1, 'Science']], widget=widgets.RadioSelect) other_2 = models.StringField(label='', blank=True, initial=None) ######################################################################################################################## ## OTHER ## ######################################################################################################################## zip_code = models.StringField(label='Please tell us your zip-code:', blank=True, initial=None) status_dem = models.IntegerField( label='Where would you place Democrats on this ladder? (value from 1-10, where rung 10 represents the top of the ladder and rung 1 the bottom)', initial=None, choices=[[10, 'Rung 10'], [9, 'Rung 9'], [8, 'Rung 8'], [7, 'Rung 7'], [6, 'Rung 6'], [5, 'Rung 5'], [4, 'Rung 4'], [3, 'Rung 3'], [2, 'Rung 2'], [1, 'Rung 1']]) status_rep = models.IntegerField( label='Where would you place Republicans on this ladder? (value from 1-10, where rung 10 represents the top of the ladder and rung 1 the bottom)', initial=None, choices=[[10, 'Rung 10'], [9, 'Rung 9'], [8, 'Rung 8'], [7, 'Rung 7'], [6, 'Rung 6'], [5, 'Rung 5'], [4, 'Rung 4'], [3, 'Rung 3'], [2, 'Rung 2'], [1, 'Rung 1']]) ######################################################################################################################## ## MASK WEARING ## ######################################################################################################################## mask_prior = models.IntegerField( label='What is your stand on mask wearing?', initial=None, choices=[ [0, ' Strongly supportive'], [1, ' Supportive'], [2, ' Neutral'], [3, ' Against'], [4, ' Strongly against']], widget=widgets.RadioSelect ) mask_post = models.IntegerField( label='What is your stand on mask wearing?', initial=None, choices=[ [0, ' Strongly supportive'], [1, ' Supportive'], [2, ' Neutral'], [3, ' Against'], [4, ' Strongly against']], widget=widgets.RadioSelect ) mask_control = models.IntegerField( label='The reduction in symptomatic covid-19 infections after the mask intervention was greater for older adults than for other age groups.', initial=None, choices=[ [0, 'False'], [1, 'True']], widget=widgets.RadioSelect ) ######################################################################################################################## ## IDENTITY ITEMS ## ######################################################################################################################## ident_race = models.IntegerField( label='How important do you consider your race identity as part of who you are?', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) ident_gender = models.IntegerField( label='How important do you consider your gender identity as part of who you are?', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) ident_political = models.IntegerField( label='How important do you consider your political identity as part of who you are?', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) ident_us = models.IntegerField( label='How important do you consider your American identity as part of who you are?', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) ident_state2 = models.IntegerField( label='How important do you consider your State identity as part of who you are?', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) ######################################################################################################################## ## AFFECTIVE POLARIZATION ## ######################################################################################################################## # How important is being a ‘ingroup party’ to you? aff1 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all important'], [1, ' Not very important'], [2, ' Somewhat important'], [3, ' Very important'], [4, ' Extremely important']], widget=widgets.RadioSelect ) # How well does the term ‘ingroup party’ describe you? aff2 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) # When talking about ‘ingroup party’, how often do you use ‘we’instead of ‘they’? aff3 = models.IntegerField( label='', initial=None, choices=[ [0, ' Never'], [1, ' Rarely'], [2, ' Sometimes'], [3, ' Most of the times'], [4, ' All of the times']], widget=widgets.RadioSelect ) # To what extent do you think of yourself a being a ‘ingroup party’? aff4 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all'], [1, ' Not too much'], [2, ' Somewhat'], [3, ' A good deal'], [4, ' Completely']], widget=widgets.RadioSelect ) # How comfortable are you having close personal friends who are ‘outgroup party’? aff5 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all comfortable'], [1, ' Not too comfortable'], [2, ' I feel neutral about it'], [3, ' Somewhat comfortable'], [4, ' Extremely comfortable']], widget=widgets.RadioSelect ) # How comfortable are you having neighbors on your street who are ‘outgroup party’? aff6 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all comfortable'], [1, ' Not too comfortable'], [2, ' I feel neutral about it'], [3, ' Somewhat comfortable'], [4, ' Extremely comfortable']], widget=widgets.RadioSelect ) # Suppose a daughter or son of yours was getting married. How would you feel if she/ he married a supporter of the ‘outgroup party’? aff7 = models.IntegerField( label='', initial=None, choices=[ [0, ' Not at all upset'], [1, ' Not too upset'], [2, ' Neutral'], [3, ' Somewhat upset'], [4, ' Extremely upset']], widget=widgets.RadioSelect ) # Would you say that you are a Democrat because you are for what the Democratic party represents, or are you more against what the Repiblican party represents? aff8 = models.IntegerField( label='', initial=None, widget=widgets.RadioSelect ) def aff8_choices(self): if (self.republican_1 == 1) | (self.republican_3 == 1): choices = [ [0, ' For what the Democratic party represents'], [1, ' Against what the Republican party represents']] else: choices = [ [0, ' For what the Republican party represents'], [1, ' Against what the Democratic party represents']] return choices # We would like you to rate how you feel toward Republican and Democratic voters, Republican and Democratic candidates and elected officials, and the Republican and Democratic parties in general on a scale of 0 to 100, which we call a ‘feeling thermometer’. On this feelings thermometer scale, ratings between 0 and 49 degrees mean that you feel unfavorable and cold (with 0 being the most unfavorable/coldest). Ratings between 51 and 100 degrees mean that you feel favorable and warm (with 100 being the most favorable/ warmest). A rating of 50 means you have no feelings one way or the other. aff9D = models.IntegerField( label='Using the ‘feeling thermometer’, how would you rate your feeling toward Democratic voters, Democratic candidates and elected officials, and the Democratic party in general?', initial=None, min=0, max=100 ) aff9R = models.IntegerField( label='Using the ‘feeling thermometer’, how would you rate your feeling toward Republican voters, Republican candidates and elected officials, and the Republican party in general?', initial=None, min=0, max=100, ) aff10D = models.IntegerField( label='Patriotic:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff10R = models.IntegerField( label='Patriotic:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff11D = models.IntegerField( label='Intelligent:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff11R = models.IntegerField( label='Intelligent:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff12D = models.IntegerField( label='Honest:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff12R = models.IntegerField( label='Honest:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff13D = models.IntegerField( label='Open-minded:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff13R = models.IntegerField( label='Open-minded:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff14D = models.IntegerField( label='Generous:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff14R = models.IntegerField( label='Generous:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff15D = models.IntegerField( label='Hypocritical:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff15R = models.IntegerField( label='Hypocritical:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff16D = models.IntegerField( label='Selfish:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff16R = models.IntegerField( label='Selfish:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff17D = models.IntegerField( label='Mean:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff17R = models.IntegerField( label='Mean:', initial=None, choices=[ [0, ' Not at all well'], [1, ' Not too well'], [2, ' Somewhat well'], [3, ' Very well'], [4, ' Extremely well']], widget=widgets.RadioSelect ) aff18D = models.IntegerField( label='How much of the time do you think you can trust Democratic voters, Democratic candidates and elected officials, and the Democratic party in general to do what is right for the country?', initial=None, choices=[ [0, ' Almost never'], [1, ' Once in a while'], [2, ' About half the time'], [3, ' Most of the time'], [4, ' Almost Always']], widget=widgets.RadioSelect ) aff18R = models.IntegerField( label='How much of the time do you think you can trust Republican voters, Republican candidates and elected officials, and the Republican party in general to do what is right for the country?', initial=None, choices=[ [0, ' Almost never'], [1, ' Once in a while'], [2, ' About half the time'], [3, ' Most of the time'], [4, ' Almost Always']], widget=widgets.RadioSelect ) ######################################################################################################################## ## Policy Items ## ######################################################################################################################## # POLITICAL SURVEY change_pol_ident = models.IntegerField(label='Since your participation in our experiment in January 2021, your political party affiliation, leaning, or strength of affiliation:', initial=None, choices=[ [0, ' remains the same'], [1, ' has changed']], widget=widgets.RadioSelect ) republican_1 = models.IntegerField(label='Do you consider yourself a(n)', choices=[ [1, ' Democrat'], [2, ' Republican'], [3, ' Independent'], [4, ' None of the above'] ], widget=widgets.RadioSelect ) republican_2 = models.IntegerField(label='Are you a strong or moderate Democrat/Republican?', choices=[ [1, ' Strong'], [2, ' Moderate'] ], widget=widgets.RadioSelect ) republican_3 = models.IntegerField(label='Do you consider yourself closer to the:', initial=-1, choices=[ [1, ' Democratic party'], [2, ' Republican party'] ], widget=widgets.RadioSelect ) ### STRING WITH PARTICIPANTS PARTY AFFILIATION def party_aff(self): if (self.republican_1 == 1) | (self.republican_3 == 1): self.participant.vars['party_aff'] = ['Democrat', 'Democratic', 'Republican', 'Republican'] else: self.participant.vars['party_aff'] = ['Republican', 'Republican', 'Democrat', 'Democratic']