from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random import itertools author = 'Neha Bose' doc = """ Online Survey Experiment """ class Constants(BaseConstants): name_in_url = 'Study' players_per_group = None num_rounds = 1 AgreeChoices = [ [1, 'Disagree strongly'], [2, 'Disagree moderately'], [3, 'Disagree a little'], [4, 'Neither agree nor Disagree'], [5, 'Agree a little'], [6, 'Agree moderately'], [7, 'Agree strongly'], ] LikelihoodChoices = [ [1, 'Very unlikely'], [2, 'Unlikely'], [3, 'Somewhat unlikely'], [4, 'Neither likely nor unlikely'], [5, 'Somewhat likely'], [6, 'Likely'], [7, 'Very likely'], ] class Group(BaseGroup): pass class Player(BasePlayer): treatment = models.PositiveIntegerField() payoff = models.CurrencyField() participationfee = models.CurrencyField(initial=c(2.00)) bonusamount = models.CurrencyField(initial=c(1.00)) #Participation Agreement agreement = models.IntegerField(label="", choices=[ [1, 'I voluntarily consent to participate in this study']], widget=widgets.RadioSelect ) # Prior Ecological Beliefs prior1 = models.IntegerField( label='The balance of nature is very delicate and easily upset by human activities.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior2 = models.IntegerField( label='Ecological, rather than economic, factors must guide our use of natural resources.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior3 = models.IntegerField( label='We attach too much importance to economic measures of well being in our society.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior4 = models.IntegerField( label='We are approaching the limit of the number of people the earth can support.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior5 = models.IntegerField( label='When humans interfere with nature, it often produces disastrous consequences.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior6 = models.IntegerField( label='Humans must live in harmony with nature in order to survive.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) prior7 = models.IntegerField( label='There are limits to growth beyond which our industrialized society cannot expand.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) #Concern for climate change concern = models.IntegerField( label='How concerning do you think climate change is?', choices=[ [1, 'Not at all concerning'], [2, 'Slightly concerning'], [3, 'Somewhat concerning'], [4, 'Moderately concerning'], [5, 'Extremely concerning']], widget=widgets.RadioSelect ) #actions to combat climate change action1 = models.StringField(max_length=100, label="What actions could you take personally to reduce climate change? Please mention 3 actions you can think of. Leave the boxes empty if you cannot think of any.", blank=True) action2 = models.StringField( label="", blank=True) action3 = models.StringField( label="", blank=True) #Theory of planned Behaviour before intervention efficacy_pre1 = models.IntegerField( label='Individual effort is effective in combating climate change.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) efficacy_pre2 = models.IntegerField( label='Humans have very little effect on climate temperature.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) #currentdiet currentdiet = models.IntegerField( label="How many days in an week do you eat meat? Please indicate a number from 0 to 7 days.", min=0,max=7) #bias assimilation_pre agreepre = models.IntegerField( label="There is a relationship between climate change and people's food choices.", choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) #Intervention read and understand read1 = models.IntegerField(choices=[[1,'']],widget=widgets.RadioSelect) read2 = models.IntegerField(choices=[[1,'']], widget=widgets.RadioSelect) readT = models.IntegerField(choices=[[1,'']], widget=widgets.RadioSelect) #bias assimilation_post agreepost = models.IntegerField( label="The information I read made me feel there is a relationship between climate change and people's food choices.", choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) # Theory of planned Behaviour after intervention efficacy_post1 = models.IntegerField( label='Individual effort is effective in combating climate change.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) efficacy_post2 = models.IntegerField( label='Humans have very little effect on climate temperature.', choices=Constants.AgreeChoices, widget=widgets.RadioSelect ) diet_change = models.IntegerField( label="After reading the information provided, how many days in an week will you eat meat? Please indicate a number from 0 to 7 days.", min=0,max=7) #Intention for political participation participation1 = models.IntegerField( label='Contact government officials to urge them to take action to reduce climate change.', choices=Constants.LikelihoodChoices, widget=widgets.RadioSelect ) participation2 = models.IntegerField( label='Participate in a rally or protest in support of action to reduce cliamte change.', choices=Constants.LikelihoodChoices, widget=widgets.RadioSelect ) participation3 = models.IntegerField( label='Sign a petition in support of taking action to reduce climate change.', choices=Constants.LikelihoodChoices, widget=widgets.RadioSelect ) participation4 = models.IntegerField( label='Join or volunteer with an organization working to reduce climate change.', choices=Constants.LikelihoodChoices, widget=widgets.RadioSelect ) participation5 = models.IntegerField( label='Donate money to an organization working to reduce climate change.', choices=Constants.LikelihoodChoices, widget=widgets.RadioSelect ) # actions to combat climate change post_action1 = models.StringField( label="What actions could you take personally to reduce climate change? Please mention 3 actions you can think of. Leave the boxes empty if you cannot think of any.", blank=True) post_action2 = models.StringField( label="", blank=True) post_action3 = models.StringField( label="", blank=True) #recall information from intervention recall = models.LongStringField( label="Please write down everything you can recall from the evidence presented to you.") #morality of information provider morality = models.IntegerField(label="Is it morally wrong to show people the consequences of their own behaviour?", choices=[ [1, 'Not at all'], [2, 'Slightly'], [3, 'Moderately'], [4, 'Considerably'], [5, 'Completely']], widget=widgets.RadioSelect ) age = models.IntegerField( min=14,max=100) gender = models.IntegerField( choices=[[1,'Male'], [2,'Female'], [3,'Other'], [4,'Prefer not to say']], widget=widgets.RadioSelectHorizontal ) education = models.IntegerField( choices=[[1,'None'], [2,'High/Secondary School'], [3,'Vocational Training'], [4,'Bachelor'], [5,'Master'], [6,'PhD']], widget=widgets.RadioSelect ) nationality = models.StringField(max_length=3, choices=[ ('AFG', 'Afghanistan'), ('ALA', 'Aland Islands'), ('ALB', 'Albania'), ('DZA', 'Algeria'), ('ASM', 'American Samoa'), ('AND', 'Andorra'), ('AGO', 'Angola'), ('AIA', 'Anguilla'), ('ATA', 'Antarctica'), ('ATG', 'Antigua and Barbuda'), ('ARG', 'Argentina'), ('ARM', 'Armenia'), ('ABW', 'Aruba'), ('AUS', 'Australia'), ('AUT', 'Austria'), ('AZE', 'Azerbaijan'), ('BHS', 'Bahamas'), ('BHR', 'Bahrain'), ('BGD', 'Bangladesh'), ('BRB', 'Barbados'), ('BLR', 'Belarus'), ('BEL', 'Belgium'), ('BLZ', 'Belize'), ('BEN', 'Benin'), ('BMU', 'Bermuda'), ('BTN', 'Bhutan'), ('BOL', 'Bolivia'), ('BIH', 'Bosnia and Herzegovina'), ('BWA', 'Botswana'), ('BRA', 'Brazil'), ('VGB', 'British Virgin Islands'), ('IOT', 'British Indian Ocean Territory'), ('BRN', 'Brunei Darussalam'), ('BGR', 'Bulgaria'), ('BFA', 'Burkina Faso'), ('BDI', 'Burundi'), ('KHM', 'Cambodia'), ('CMR', 'Cameroon'), ('CAN', 'Canada'), ('CPV', 'Cape Verde'), ('CYM', 'Cayman Islands'), ('CAF', 'Central African Republic'), ('TCD', 'Chad'), ('CHL', 'Chile'), ('CHN', 'China'), ('HKG', 'Hong Kong, SAR China'), ('MAC', 'Macao, SAR China'), ('CXR', 'Christmas Island'), ('CCK', 'Cocos (Keeling) Islands'), ('COL', 'Colombia'), ('COM', 'Comoros'), ('COG', 'Congo (Brazzaville)'), ('COD', 'Congo, (Kinshasa)'), ('COK', 'Cook Islands'), ('CRI', 'Costa Rica'), ('CIV', "Ivory Coast (Côte d'Ivoire)"), ('HRV', 'Croatia'), ('CUB', 'Cuba'), ('CYP', 'Cyprus'), ('CZE', 'Czech Republic'), ('DNK', 'Denmark'), ('DJI', 'Djibouti'), ('DMA', 'Dominica'), ('DOM', 'Dominican Republic'), ('ECU', 'Ecuador'), ('EGY', 'Egypt'), ('SLV', 'El Salvador'), ('GNQ', 'Equatorial Guinea'), ('ERI', 'Eritrea'), ('EST', 'Estonia'), ('ETH', 'Ethiopia'), ('FLK', 'Falkland Islands (Malvinas)'), ('FRO', 'Faroe Islands'), ('FJI', 'Fiji'), ('FIN', 'Finland'), ('FRA', 'France'), ('GUF', 'French Guiana'), ('PYF', 'French Polynesia'), ('ATF', 'French Southern Territories'), ('GAB', 'Gabon'), ('GMB', 'Gambia'), ('GEO', 'Georgia'), ('DEU', 'Germany'), ('GHA', 'Ghana'), ('GIB', 'Gibraltar'), ('GRC', 'Greece'), ('GRL', 'Greenland'), ('GRD', 'Grenada'), ('GLP', 'Guadeloupe'), ('GUM', 'Guam'), ('GTM', 'Guatemala'), ('GGY', 'Guernsey'), ('GIN', 'Guinea'), ('GNB', 'Guinea-Bissau'), ('GUY', 'Guyana'), ('HTI', 'Haiti'), ('HMD', 'Heard and Mcdonald Islands'), ('HND', 'Honduras'), ('HUN', 'Hungary'), ('ISL', 'Iceland'), ('IND', 'India'), ('IDN', 'Indonesia'), ('IRN', 'Iran, Islamic Republic of'), ('IRQ', 'Iraq'), ('IRL', 'Ireland'), ('IMN', 'Isle of Man'), ('ISR', 'Israel'), ('ITA', 'Italy'), ('JAM', 'Jamaica'), ('JPN', 'Japan'), ('JEY', 'Jersey'), ('JOR', 'Jordan'), ('KAZ', 'Kazakhstan'), ('KEN', 'Kenya'), ('KIR', 'Kiribati'), ('PRK', 'Korea (North)'), ('KOR', 'Korea (South)'), ('KWT', 'Kuwait'), ('KGZ', 'Kyrgyzstan'), ('LAO', 'Lao PDR'), ('LVA', 'Latvia'), ('LBN', 'Lebanon'), ('LSO', 'Lesotho'), ('LBR', 'Liberia'), ('LBY', 'Libya'), ('LIE', 'Liechtenstein'), ('LTU', 'Lithuania'), ('LUX', 'Luxembourg'), ('MKD', 'Macedonia, Republic of'), ('MDG', 'Madagascar'), ('MWI', 'Malawi'), ('MYS', 'Malaysia'), ('MDV', 'Maldives'), ('MLI', 'Mali'), ('MLT', 'Malta'), ('MHL', 'Marshall Islands'), ('MTQ', 'Martinique'), ('MRT', 'Mauritania'), ('MUS', 'Mauritius'), ('MYT', 'Mayotte'), ('MEX', 'Mexico'), ('FSM', 'Micronesia, Federated States of'), ('MDA', 'Moldova'), ('MCO', 'Monaco'), ('MNG', 'Mongolia'), ('MNE', 'Montenegro'), ('MSR', 'Montserrat'), ('MAR', 'Morocco'), ('MOZ', 'Mozambique'), ('MMR', 'Myanmar'), ('NAM', 'Namibia'), ('NRU', 'Nauru'), ('NPL', 'Nepal'), ('NLD', 'Netherlands'), ('ANT', 'Netherlands Antilles'), ('NCL', 'New Caledonia'), ('NZL', 'New Zealand'), ('NIC', 'Nicaragua'), ('NER', 'Niger'), ('NGA', 'Nigeria'), ('NIU', 'Niue'), ('NFK', 'Norfolk Island'), ('MNP', 'Northern Mariana Islands'), ('NOR', 'Norway'), ('OMN', 'Oman'), ('PAK', 'Pakistan'), ('PLW', 'Palau'), ('PSE', 'Palestine'), ('PAN', 'Panama'), ('PNG', 'Papua New Guinea'), ('PRY', 'Paraguay'), ('PER', 'Peru'), ('PHL', 'Philippines'), ('PCN', 'Pitcairn'), ('POL', 'Poland'), ('PRT', 'Portugal'), ('PRI', 'Puerto Rico'), ('QAT', 'Qatar'), ('REU', 'Réunion'), ('ROU', 'Romania'), ('RUS', 'Russian Federation'), ('RWA', 'Rwanda'), ('BLM', 'Saint-Barthélemy'), ('SHN', 'Saint Helena'), ('KNA', 'Saint Kitts and Nevis'), ('LCA', 'Saint Lucia'), ('MAF', 'Saint-Martin (French part)'), ('SPM', 'Saint Pierre and Miquelon'), ('VCT', 'Saint Vincent and Grenadines'), ('WSM', 'Samoa'), ('SMR', 'San Marino'), ('STP', 'Sao Tome and Principe'), ('SAU', 'Saudi Arabia'), ('SEN', 'Senegal'), ('SRB', 'Serbia'), ('SYC', 'Seychelles'), ('SLE', 'Sierra Leone'), ('SGP', 'Singapore'), ('SVK', 'Slovakia'), ('SVN', 'Slovenia'), ('SLB', 'Solomon Islands'), ('SOM', 'Somalia'), ('ZAF', 'South Africa'), ('SGS', 'South Georgia and the South Sandwich Islands'), ('SSD', 'South Sudan'), ('ESP', 'Spain'), ('LKA', 'Sri Lanka'), ('SDN', 'Sudan'), ('SUR', 'Suriname'), ('SJM', 'Svalbard and Jan Mayen Islands'), ('SWZ', 'Swaziland'), ('SWE', 'Sweden'), ('CHE', 'Switzerland'), ('SYR', 'Syrian Arab Republic (Syria)'), ('TWN', 'Taiwan, Republic of China'), ('TJK', 'Tajikistan'), ('TZA', 'Tanzania, United Republic of'), ('THA', 'Thailand'), ('TLS', 'Timor-Leste'), ('TGO', 'Togo'), ('TKL', 'Tokelau'), ('TON', 'Tonga'), ('TTO', 'Trinidad and Tobago'), ('TUN', 'Tunisia'), ('TUR', 'Turkey'), ('TKM', 'Turkmenistan'), ('TCA', 'Turks and Caicos Islands'), ('TUV', 'Tuvalu'), ('UGA', 'Uganda'), ('UKR', 'Ukraine'), ('ARE', 'United Arab Emirates'), ('GBR', 'United Kingdom'), ('USA', 'United States of America'), ('UMI', 'US Minor Outlying Islands'), ('URY', 'Uruguay'), ('UZB', 'Uzbekistan'), ('VUT', 'Vanuatu'), ('VEN', 'Venezuela (Bolivarian Republic)'), ('VNM', 'Viet Nam'), ('VIR', 'Virgin Islands, US'), ('WLF', 'Wallis and Futuna Islands'), ('ESH', 'Western Sahara'), ('YEM', 'Yemen'), ('ZMB', 'Zambia'), ('ZWE', 'Zimbabwe')] ) political_belief=models.IntegerField(label="How would you rate your political beliefs at the moment?", choices=[[1, 'Far Left'], [2,'Left'], [3,'Center Left'], [4,'Center'], [5,'Center Right'], [6,'Right'], [7,'Far Right']], widget=widgets.RadioSelect ) disease = models.IntegerField( label="Have you or any member of your immediate family (father, mother, siblings, and grandparents) had or suffered from heart disease, stroke, cancer, diabetes, high blood pressure or high cholesterol?", choices=[[1,'Yes'], [0,'No']], widget=widgets.RadioSelectHorizontal ) #donate to Climate Change fund donate = models.IntegerField( label = "Do you want to donate your bonus earnings to The Adaptation Fund?", choices=[[0,'Yes'], [1,'No']], widget=widgets.RadioSelectHorizontal ) class Subsession(BaseSubsession): def before_session_starts(self): treatments = itertools.cycle([1,2,3,4]) for p in self.get_players(): p.treatment = next(treatments) #only for testing. REMOVE BEFORE MAIN EXPERIMENT def creating_session(self): for p in self.get_players(): if 'treatment' in self.session.config: # demo mode p.treatment = self.session.config['treatment'] else: # live experiment mode p.treatment = random.choice([1,2,3,4])