from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = 'Elisa Macchi' doc = """ Baseline Demographic Survey """ class Constants(BaseConstants): name_in_url = 'demographics' players_per_group = None num_rounds = 1 sil_pic = 'black_men.png' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Demographics country = models.StringField(label='''In which country do you currently reside?''') zip = models.StringField(label='''What is your zip code?''') age = models.IntegerField(choices=range(0, 101, 1), label='''How old are you in years?''' ) gender = models.BooleanField(choices=[[1, 'Male'], [0, 'Female']], label='''Are you:''' ) household_composition = models.IntegerField(min=0, max= 20, label = "How many individuals live in your household?") household_income = models.CurrencyField( choices = [[1, "Less than $10,000"], [2, "$10,000 to $14,999"], [3, "$15,000 to $19,999"], [4, "$20,000 to $29,999"], [5, "$30,000 to $34,999"], [6, "$35,000 to $39,999"], [7, "$40,000 to $44,999"], [8, "$45,000 to $49,999"], [9, "$50,000 to $54,999"], [10, "$55,000 to $59,999"], [11, "$60,000 to $64,999"], [12, "$65,000 to $69,999"], [13, "$70,000 to $74,999"], [14, "$75,000 to $79,999"], [15, "$80,000 to $84,999"], [16, "$85,000 to $89,999"], [17, "$90,000 to $94,999"], [18, "$95,000 to $99,999"], [19, "$100,000 to $149,999"], [20, "More than $150,000"]], label=''' Information about income is very important to understand. Would you please give us your best guess? Please indicate the answer that includes your entire household income in 2019 before taxes.''') marital_status = models.IntegerField(choices=[[1, 'Single'], [2, 'Married'], [3, 'Living as married'], [4, 'Separated'], [5, 'Divorced'], [6, 'Widowed']], widget=widgets.RadioSelectHorizontal, label=''' Which of the following best describes your current relationship status?''' ) race = models.IntegerField(choices=[[1, 'Black'], [2, 'White'], [3, 'Hispanic'], [4, 'American Indian or Alaska Native'], [5, 'Asian'], [6, 'Other']], label='''What is your race? Please, select the option that ''') education = models.IntegerField(choices=[[1, 'Primary school'], [1, 'Secondary school'], [2, 'Technical/Vocational training'], [3, 'Some College'], [4, '2 Years Degree'], [5, '4 Years Degree'], [6, 'Post-graduate degree']], widget=widgets.RadioSelect, label=''' What is the highest level of education you have completed?''' ) height = models.IntegerField(choices=range(120, 216, 1), label=''' What is your height in cm? Please, provide your best guess.''') weight = models.IntegerField(choices=range(30, 451, 1), label=''' What is your weight in kg? Please, provide your best guess.''') health = models.IntegerField(choices=[[1, 'Poor '], [2, 'Fair'], [3, 'Good'], [4, 'Very good'] ], widget=widgets.RadioSelectHorizontal, label='''In general, you would say that your health is''')