from statistics import mean from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from django import forms import random class Constants(BaseConstants): name_in_url = 'NormElicitation' players_per_group = None num_rounds = 11 max_points = c(100) # Likert scale categories likely_choices = [ [-2, 'Very Unlikely'], [-1, 'Somewhat Unlikely'], [0, 'Not Sure'], [1, 'Somewhat Likely'], [2, 'Very Likely'] ] familiarity_choices = [ [-2, " Completely Unfamiliar"], [-1, "Somewhat Unfamiliar"], [0, "Unsure"], [1, "Somewhat Familiar"], [2, "Very Familiar"] ] Trust_choices = [ [-2, "Cannot be trusted at all"], [-1, "Cannot be trusted"], [0, "Not sure"], [1, "Can be trusted"], [2, "Can be trusted a lot"] ] gender_choices = [ [1, "Male"], [2, "Female"], [3, "Other"], [4, "Prefer not to say"] ] age_choices = [ [1, "18 - 24"], [2, "25 - 34"], [3, "35 - 44"], [4, "45 - 54"], [5, "55 - 64"], [6, "65 +"] ] gen_soc_trust_choices = [ [1, "Most people can be trusted"], [2, "It depends on the person"], [3, "It depends on the situation"], [4, "You can't be too careful in dealing with people"], [5, "I don't know"], ] Prosocial_choices = [ [1, "Not at all important"], [2, "Slightly important"], [3, "Moderately important"], [4, "Very important"], [5, "Extremely important"], ] literacy_choices = [ [1, 'No formal education above age 16'], [2, 'Formal or Technical education after age of 16'], [3, 'School education up to age of 18'], [4, 'Degree(Bachelors) or equivalent'], [5, 'Degree(Masters) or other postgraduate qualification'], [6, 'Doctorate'] ] Compliance_choices = [ [1, 'Washing your hands more often'], [2, 'Touching your face less'], [3, 'Using Alcohol-based sanitizer more often'], [4, 'Avoiding social events (e.g., parties, family gatherings)'], [5, 'Avoiding Public Transport'], [6, 'Eating out less at restaurants'], [7, 'Working from home more often'], [8, 'Maintaining social distance in public'] ] SMedia_Use_Frequency_choices = [ [1, 'Daily'], [2, 'Every other day'], [3, 'Every two days'], [4, 'Once a week'], [5, 'Every hour'] ] SMedia_TimeSpent_choices = [ [1, 'Less than 30 mins'], [2, 'An Hour'], [3, '1-2 Hours'], [4, '3-4 Hours'], [5, 'More than 4 Hours'] ] vaccine_status_choices = [ [1, 'Yes'], [2, 'No'] ] class Subsession(BaseSubsession): pass # # Print the payoffs to verify their values # print("Payoff:", self.individual_payoff) class Group(BaseGroup): pass class Player(BasePlayer): Example = models.IntegerField(label="On a scale from 0 to 100 percent, what are the chances that most people " "believe it will rain tomorrow?", min=0, max=100, blank=False, ) # Personal Beliefs Act1 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that you will decide to get vaccinated in the " "given scenario?", min=0, max=100, blank=False, ) Act2 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that you believe vaccines are safe in the given " "scenario?", min=0, max=100, blank=False, ) Act3 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that you believe vaccines are effective in the " "given scenario?", min=0, max=100, blank=False, ) # Reference groups Act4 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that your work colleagues believe vaccines are " "safe in the given scenario?", min=0, max=100, blank=False, ) Act5 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that your neighbors believe vaccines are safe " "in the given scenario?", min=0, max=100, blank=False, ) Act6 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that your friends believe vaccines are safe in " "the given scenario?", min=0, max=100, blank=False, ) # First order Normative Act7 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that most people will choose to get vaccinated " "in this scenario?", min=0, max=100, blank=False, ) # Second order normative beliefs Act8 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that most people believe vaccines are safe " "in the given scenario?", min=0, max=100, blank=False, ) Act9 = models.IntegerField( label="On a scale from 0 to 100 percent, what are the chances that most people believe that vaccines are " "effective in the given scenario?", min=0, max=100, blank=False, ) # Misinformation Plausibility = models.IntegerField( label="What is the likelihood that the above headline is true?", choices=Constants.likely_choices, widget=widgets.RadioSelectHorizontal, blank=False, ) Familiarity = models.IntegerField( label="Are you familiar with the above headline (have you seen or heard about it before)?", choices=Constants.familiarity_choices, widget=widgets.RadioSelectHorizontal, blank=False, ) # Demographics gender = models.IntegerField( label="What gender do you identify as?", choices=Constants.gender_choices, widget=widgets.RadioSelect, blank=True, ) age = models.IntegerField( label="How old are you?", choices=Constants.age_choices, widget=widgets.RadioSelect, blank=True, ) # Frequency of interaction with neighbors neighbor_interaction = models.IntegerField( label="How often do you interact with your neighbors?", choices=[ [1, "Rarely or never"], [2, "Occasionally"], [3, "Moderately often"], [4, "Frequently"], [5, "Very frequently"], ], widget=widgets.RadioSelect, blank=False, ) # Frequency of interaction with work colleagues colleague_interaction = models.IntegerField( label="How often do you interact with your work colleagues?", choices=[ [1, "Rarely or never"], [2, "Occasionally"], [3, "Moderately often"], [4, "Frequently"], [5, "Very frequently"], ], widget=widgets.RadioSelect, blank=False, ) # Frequency of interaction with family members family_interaction = models.IntegerField( label="How often do you interact with your family members?", choices=[ [1, "Rarely or never"], [2, "Occasionally"], [3, "Moderately often"], [4, "Frequently"], [5, "Very frequently"], ], widget=widgets.RadioSelect, blank=False, ) # Frequency of interaction with friends friend_interaction = models.IntegerField( label="How often do you interact with your friends?", choices=[ [1, "Rarely or never"], [2, "Occasionally"], [3, "Moderately often"], [4, "Frequently"], [5, "Very frequently"], ], widget=widgets.RadioSelect, blank=False, ) gen_soc_trust = models.IntegerField( label="Generally speaking, would you say most people can be trusted, or that you can't be too careful in " "dealing with people?", choices=Constants.gen_soc_trust_choices, widget=widgets.RadioSelect, blank=False, ) Prosocial = models.IntegerField( label="To what extent do you think it’s important to do things for the benefit of others and society, " "even if they have some costs to you personally?", choices=Constants.Prosocial_choices, widget=widgets.RadioSelect, blank=False, ) literacy = models.IntegerField( label="Please indicate your highest educational qualification:", choices=Constants.literacy_choices, widget=widgets.RadioSelect, blank=True, ) Compliance = models.IntegerField( label="Which of the following steps, if any, have you taken during the pandemic to prepare for the possibility" "of many cases of the coronavirus/COVID-19 in your community? Select all that apply", choices=Constants.Compliance_choices, widget=widgets.RadioSelect, blank=False, ) SMedia_Use_Frequency = models.IntegerField( label="How often do you check-in to your social media accounts in any given week?", choices=Constants.SMedia_Use_Frequency_choices, widget=widgets.RadioSelect, blank=False, ) SMedia_TimeSpent = models.IntegerField( label="On average, how much time do you spend on social media?", choices=Constants.SMedia_TimeSpent_choices, widget=widgets.RadioSelect, blank=False, ) vaccine_status = models.IntegerField( label="Have you been vaccinated against Coronavirus infection?", choices=Constants.vaccine_status_choices, widget=widgets.RadioSelect, blank=False, ) # # Post Elicitation # # Act12 = models.IntegerField( # label="What is the likelihood that other people will choose to get vaccinated in this scenario?", # choices=Constants.likely_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act13 = models.IntegerField( # label="What do other people believe about the safety of vaccines in protection against the pandemic?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act14 = models.IntegerField( # label="What is the likelihood that you will choose to get vaccinated in the given scenario", # choices=[ # [-2, 'Very Unlikely'], # [-1, 'Somewhat Unlikely'], # [0, 'Not sure'], # [1, 'Somewhat Likely'], # [2, 'Very Likely'] # ], # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act15 = models.IntegerField( # label="How safe do you think vaccines are in protection against the virus?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act16 = models.IntegerField( # label="How sure are you about your response in the previous question?", # choices=Constants.sure_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act17 = models.IntegerField( # label="What do your family members think about the safety of vaccines in protection against the pandemic?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act18 = models.IntegerField( # label="What do your friends think about the safety of vaccines in protection against the pandemic?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # # Act19 = models.IntegerField( # label="What do your neighbors think about the safety of vaccines in protection against the pandemic?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # Act20 = models.IntegerField( # label="What do your work colleagues think about the safety of vaccines in protection against the pandemic?", # choices=Constants.safe_choices, # widget=widgets.RadioSelectHorizontal, # blank=False, # ) # Act21 = models.IntegerField( # label="How effective vaccines will be in protection against the virus infection in " # "this situation?", # choices=Constants.effective_choices, # widget=widgets.RadioSelect, # blank=False, # # ) # # Act22 = models.IntegerField( # label="What do most people think about the effectiveness of vaccines in protection against the virus " # "infection in this situation?", # choices=Constants.effective_choices, # widget=widgets.RadioSelect, # blank=False, # # )