from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random class Constants(BaseConstants): name_in_url = 'Survey1' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): for p in self.get_players(): # create list of numbes in random order which will be used to determine in which order tasks are shown if p.id_in_group == 1 or p.id_in_group == 3 or p.id_in_group == 5 or p.id_in_group == 7 or p.id_in_group == 9 or p.id_in_group == 11 or p.id_in_group == 13 or p.id_in_group == 15 or p.id_in_group == 17 or p.id_in_group == 19: p.participant.vars['rand_num'] = 0 elif p.id_in_group == 21 or p.id_in_group == 23 or p.id_in_group == 25 or p.id_in_group ==27 or p.id_in_group == 29: p.participant.vars['rand_num'] = 0 else: p.participant.vars['rand_num'] = 1 class Group(BaseGroup): pass class Player(BasePlayer): # Welcome Page infected = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='Are you currently infected with COVID-19 or have you been infected previously?', widget=widgets.RadioSelectHorizontal) incorrect_attempts = models.IntegerField() # Control Questions cq1 = models.IntegerField( choices=[ [1, '$5'], [2, '$10'], [3, '$15'], ], label='What is the value of the gift card you can win at the end of this study?', ) cq2 = models.IntegerField( choices=[ [1, '7 days'], [2, '14 days'], [3, '28 days'], ], label='How long can the gift card be used?', ) cq3 = models.IntegerField( choices=[ [1, 'I can pass on the gift card to other persons I know'], [2, 'I can only by products, which I will eat inside the café'], [3, 'I can only buy take-away products'], ], label='Which of the following statements is correct', ) # Survey risk_cafe = models.IntegerField( choices=[[1, '1 - Not at all dangerous (like before COVID-19)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'],], label='How dangerous do you think is it currently for you personally to visit a café in Lund?', ) risk_cafe_others = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous do you think would it be for other persons if you visited a café like Starbucks or Dunkin', ) risk_gym = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to go to a gym?', ) risk_wedding = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to attend larger, private social gatherings (e.g. a wedding)?', ) risk_pubtrans = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to use means of public transportation?', ) risk_indoor = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous do you think is it currently to meet people indoors?', ) risk_outdoor = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to meet people outdoors?', ) risk_demo = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to attend a demonstration?', ) risk_supermarket = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to go to the supermarket?', ) risk_sportevent = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous do you think is it currently for you personally to go to go to a concert or a sport event (assuming it is allowed to do so)?', ) risk_travel = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous is it currently for you personally to travel longer distances by plane or train?', ) risk_overall_risk = models.IntegerField( choices=[[1, '1 - Not at all risky'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very risky'], ], label='How would you assess the overall risk of COVID-19 for you personally?', ) risk_1830 = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous do you think is COVID-19 for a person in the age group 18 to 30 in general?', ) risk_70 = models.IntegerField( choices=[[1, '1 - Not at all dangerous'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very dangerous'], ], label='How dangerous do you think is COVID-19 for a person who is 70 years old?', ) num_infected = models.IntegerField( label='How many people in your close environment (e.g. members of your household, local friends or colleagues) are or have been infected with COVID-19?', min=0, max=100) meet_indoor = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='Meeting other people indoors is fine.', ) meet_outdoor = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='Meeting other people outdoors is fine.', ) avoid_meetings = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I avoid meeting other people.', ) avoid_cafes = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I avoid going to cafés, bars or restaurants.', ) avoid_pubtrans = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I avoid using means of public transportation.', ) worried_med = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I am worried about the medical situation in my region.', ) want_infected = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I would prefer to get infected with COVID-19 to become immune against it in the future.', ) concerned_others = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='I am more concerned about other people than about myself.', ) approp_cafe = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to visit a café, bar or restaurant?', ) approp_gym = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to go to the gym?', ) approp_wedding = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to attend larger social gatherings (e.g. weddings)?', ) approp_indoor = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to meet other people indoors?', ) approp_outdoor = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to meet other people outdoors?', ) approp_pubtrans = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to use means of public transportation?', ) approp_travel = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to travel longer distances by plane or train?', ) approp_sportevent = models.IntegerField( choices=[[1, '1 - Strongly disagree'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Strongly agree'], ], label='How appropriate is it to go to a concert or a sport event (assuming that this is allowed to do)?', ) num_cafe = models.IntegerField( label='How many times have you approximately visited a café, bar or restaurant during the last month?', min=0, max=31) num_gym = models.IntegerField( label='How many times have you approximately gone to the gym during the last month?', min=0, max=31) num_pubtrans = models.IntegerField( label='How many times have you approximately used public transportation during the last month?', min=0, max=31) num_indoor = models.IntegerField( label='How many times have you approximately met other people indoors during the last month?', min=0, max=31) num_outdoor = models.IntegerField( label='How many times have you approximately met other people outdoors during the last month?', min=0, max=31) num_memrisk = models.IntegerField( label='How many friends or close relatives do you have that are part of the risk group of the Coronavirus? ' '(People in the risk group are for example people who are older than 65, people who have a weak immune ' 'system or people with a long-term medical condition) ', min=0, max=100) mask = models.IntegerField( choices=[[1, '1 - Not at all'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 - Very much'], ], label='How much do you think would it help if people in public spaces were forced to wear a face mask?', ) mask_you = models.IntegerField( choices=[[1, 'Yes'], [0, 'No'], ], label='Do you wear a face mask in public spaces?', ) gender = models.StringField( choices=['Female', 'Male', 'Other'], label='What is your gender?', widget=widgets.RadioSelectHorizontal) age = models.IntegerField( label='How old are you in years', min=16, max=100) patience = models.StringField( choices=['1 - not at all', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very much'], label='How willing are you to give up something that is beneficial for you today in order to benefit more from that in the future?', widget=widgets.RadioSelect) risk = models.StringField( choices=['1 - not at all', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very much'], label='In general, how willing are you to take risks?', widget=widgets.RadioSelect) health = models.StringField( choices=['1 - very bad', '2', '3', '4', '5', '6', '7', '8', '9', '10 - very good'], label='In your opinion, how is your health condition?', widget=widgets.RadioSelect, blank=True) alcohol = models.IntegerField( blank =True, min=0, max=7, label='How many days per week do you consume alcoholic beverages?', ) smoke = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='Do you smoke?', widget=widgets.RadioSelectHorizontal) exercise = models.IntegerField( blank =True, min=0, max=7, label='How many days per week do you exercise?', ) severe_loss = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], blank=True, label='Have you experienced the loss of a close family member or friend?', widget=widgets.RadioSelectHorizontal)