from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from .otree_tool_fields import MultipleChoiceModelField doc = '' class Constants(BaseConstants): name_in_url = 'covid_survey' players_per_group = None num_rounds = 1 salience_choices = [ 'Risk tolerance', 'Patience', 'Perseverance', 'Altruism', 'Trust in others', 'Preference for redistribution', 'Cooperation', 'Comfort with a competitive environment' ] time_to_normal_choices = [ 'A few weeks', 'Some months', 'A few years', 'I do not think we will go back to the pre-crisis situation' ] parents_choices = [ 'Yes, my mother', 'Yes, my father', 'Yes, both', 'No' ] exposure_infected_choices = [ 'You', 'Your parents or siblings', 'Your grandparents', 'Another member of your family', 'A friend', 'Someone from your house', 'One of your teachers ' ] exposure_time_on_info_choices = [ 'Less than 15 minutes', 'Between 15 and 30 minutes', 'Between 30 minutes and 1 hour', 'Between 1 hour and 2 hours', 'More than 2 hours' ] exposure_media_choices = [ 'The daily newspaper', 'Online newspapers', 'Facebook', 'Other sources' ] mechanism_contact_frequency_choices = [ 'Everyday', '2-3 times a week', 'Once a week', 'Once a month', 'Never' ] mechanism_sibling_choices = [ 'Yes, an older sibling (s)', 'Yes, a younger sibling (s)', 'I have no siblings' ] importance_choices = ['Not important at all ',' Not very important ', 'Important', 'Very important'] change_choices = ['reduced', 'remains constant', 'increased'] compliance_choices = ['Never', 'From time to time', 'Most of the time', 'All of the time'] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # importance covid_risk_importance = models.StringField(label='Risk tolerance', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_present_importance = models.StringField(label='Patience', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_grit_importance = models.StringField(label='Perseverance', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_altruism_importance = models.StringField(label='Altruism', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_trust_importance = models.StringField(label='Trust in others', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_redistribution_importance = models.StringField(label='Preference for redistribution', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_cooperation_importance = models.StringField(label='Cooperation', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_competition_importance = models.StringField(label='Comfort with a competitive environment', choices=Constants.importance_choices, widget=widgets.RadioSelectHorizontal, blank=True) salience = MultipleChoiceModelField(label='', min_choices=0, max_choices=3, blank=True) usage = MultipleChoiceModelField(label='', min_choices=0, max_choices=3, blank=True) # conformism covid_risk_change = models.StringField(label='Risk tolerance', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_present_change = models.StringField(label='Patience', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_grit_change = models.StringField(label='Perseverance', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_altruism_change = models.StringField(label='Altruism', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_trust_change = models.StringField(label='Trust in others', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_redistribution_change = models.StringField(label='Preference for redistribution', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_cooperation_change = models.StringField(label='Cooperation', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) covid_competition_change = models.StringField(label='Comfort with a competitive environment', choices=Constants.change_choices, widget=widgets.RadioSelectHorizontal, blank=True) three_words = models.LongStringField(label='What three words do you think best sum up the past two months?', blank=True) time_to_normal = models.StringField(choices=Constants.time_to_normal_choices, label='How long do you think it will take to get back to a normal life, as pre-crisis?', widget=widgets.RadioSelect, blank=True) # exposure exposure_parents = MultipleChoiceModelField(label='', blank=True) exposure_infected = MultipleChoiceModelField(label='', blank=True) exposure_hospitalized = MultipleChoiceModelField(label='', blank=True) exposure_time_on_info = models.StringField( choices=Constants.exposure_time_on_info_choices, label='', widget=widgets.RadioSelect, blank=True) exposure_media = models.StringField(choices=Constants.exposure_media_choices, label='', widget=widgets.RadioSelect, blank=True) exposure_media_newspaper = models.StringField(label='What newspaper do you read the most frequently?', blank=True) exposure_media_other = models.StringField(label='Which ones?', blank=True) # compliance compliance_mask = models.StringField(label='Wearing a mask (if one is available)', choices=Constants.compliance_choices, widget=widgets.RadioSelectHorizontal, blank=True) compliance_wash_hands = models.StringField(label='Washing your hands', choices=Constants.compliance_choices, widget=widgets.RadioSelectHorizontal, blank=True) compliance_greet = models.StringField(label='Greeting without shaking hands', choices=Constants.compliance_choices, widget=widgets.RadioSelectHorizontal, blank=True) compliance_distance = models.StringField(label='Standing physically 1 meter apart from others', choices=Constants.compliance_choices, widget=widgets.RadioSelectHorizontal, blank=True) # mechanism mechanism_classmate_contact = models.StringField( choices=Constants.mechanism_contact_frequency_choices, label='', widget=widgets.RadioSelect, blank=True) mechanism_teacher_contact = models.StringField( choices=Constants.mechanism_contact_frequency_choices, label='', widget=widgets.RadioSelect, blank=True) mechanism_parents_at_home = MultipleChoiceModelField(label='', blank=True) mechanism_siblings_at_home = MultipleChoiceModelField(label='', blank=True) mechanism_household_size = models.IntegerField(label='', choices=list(range(1, 21)), blank=True) mechanism_parents_unemployed = MultipleChoiceModelField(label='', blank=True) mechanism_feedback = models.LongStringField(label='', blank=True)