from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) doc = "" class Constants(BaseConstants): name_in_url = "my_survey" players_per_group = None num_rounds = 1 instructions_template = 'my_survey/instructions.html' import random import itertools class Subsession(BaseSubsession): def creating_session(self): colors = itertools.cycle(['blue', 'red', 'green']) for player in self.get_players(): player.color = next(colors) class Group(BaseGroup): pass class Player(BasePlayer): charity = models.CurrencyField(choices=currency_range(c(0), c(1.00), c(0.10))) def some_method(self): self.random_bonus = c(random.randint(1,10)) color = models.StringField() age = models.IntegerField(label="What is your age?", min=16, max=80) gender = models.IntegerField(choices=[[1, "Male"], [2, "Female"], [3, "Other"]], label="What is your gender?", widget=widgets.RadioSelect) level = models.IntegerField(choices=[[1, "Assessment"], [2, "Bachelor"], [3, "Master"], [4, "PhD"]], label="On which level do you study?", widget=widgets.RadioSelect) major = models.IntegerField(choices=[[1, "Assessment"], [2, "Economics"], [3, "Business Administration"], [4, "Law"], [5, "Law and Economics"], [6, "International Affairs"], [7, "Banking and Finance"], [8, "Accounting and Finance"], [9, "Marketing"], [10, "Other"]], label="major") semester = models.IntegerField(label="What semester are you in?", min=1, max=10) income = models.IntegerField(choices=[[1, "less than CHF 500"], [2, "CHF 500 to 1,499"], [3, "CHF 1,500 to 2,499"], [4, "CHF 2,499 to 3,499"], [5, "CHF 3,500 or more"]], label="How much money do you have at your disposal per month?", widget=widgets.RadioSelect) income_source = models.IntegerField(choices=[[1, "Scholarship"], [2, "Family"], [3, "Job"], [4, "Other"]], label="What is your main source of income?", widget=widgets.RadioSelect) risk = models.IntegerField(choices=[[1, "0 (not at all willing to take risks"], [2, "1"], [3, "2"], [4, "3"], [5, "4"], [6, "5"], [7, "6"], [8, "7"], [9, "8"], [10, "9"], [11, "10 (very willing to take risks)"]], label="How do you see yourself: are you generally a person who is fully prepared to " "take risks or do you try to avoid taking risks? Please tick a box on the scale, " "where ''the value 0 means: not at all willing to take risks and the value 10 " "means: very willing to take risks''") physical = models.StringField(choices=["More than once a week", "Once a week", "One to three times a month ", "Hardly ever, Never"], label="How often do you engage in vigorous physical activity, such as sports, " "heavy housework, or a job that involves physical labor?", widget=widgets.RadioSelect) health = models.IntegerField(choices=[[1, "Excellent"], [2, "Very good"], [3, "Good"], [4, "Fair"], [5, "Poor"]], label="Would you say your health is...", widget=widgets.RadioSelect) birth = models.StringField(choices=["Caesarean section", "Natural birth", "Don\'t know", "Prefer not to say"], label="Was your birth by caesarean section or natural birth?", widget=widgets.RadioSelect) allaisKnow = models.StringField(label="Have you ever heard of the 'Allais Paradox'?", choices=["Yes", "No"], widget=widgets.RadioSelect) allaisDescr = models.StringField(label="Could you describe the 'Allais Paradox'?", choices=["Yes", "No"], widget=widgets.RadioSelect) title = models.StringField(verbose_name="What are the results of the following products? (Use mental" "arithmetics") mathLiteracy1 = models.IntegerField(label=" 0.70 x 0.40 =") mathLiteracy2 = models.IntegerField(label=" 0.80 x 0.90 =") mathLiteracy3 = models.IntegerField(label=" 0.60 x 0.60 =") mathLiteracy4 = models.IntegerField(label=" 0.20 x 0.50 =") mathLiteracy5 = models.IntegerField(label=" 0.25 x 0.40 =") mathLiteracy6 = models.IntegerField(label=" 0.05 x 0.80 =") mathLiteracy7 = models.IntegerField(label=" 0.95 x 0.01 =") mathLiteracy8 = models.IntegerField(label=" 0.40 x 0.70 =") mathLiteracy9 = models.IntegerField(label=" 0.45 x 0.20 =") mathLiteracy10 = models.IntegerField(label=" 0.95 x 0.01 =") finHappiness = models.IntegerField(choices=[[1, "Very"], [2, "Moderately"], [3, "Not much"], [4, "Not at all"]], label="How happy are you with your current financial situation?", widget=widgets.RadioSelect) happiness = models.IntegerField(choices=[[1, "Very good"], [2, "Pretty good"], [3, "Not very good"], [4, "Not good at all"]], label="How did you usually feel during the last month?", widget=widgets.RadioSelect) fitness = models.IntegerField(choices=[[1, "Almost always"], [2, "Frequently"], [3, "A couple of times"], [4, "Almost never"]], label="How often did you wake up feeling fit and well rested during the last" "month?", widget=widgets.RadioSelect) satisfaction = models.IntegerField(choices=[[1, "Very"], [2, "Moderately"], [3, "Not very"], [4, "Not at all"]], label="How fulfilling was your live during the last month?", widget=widgets.RadioSelect) burnout = models.IntegerField(choices=[[1, "Almost always"], [2, "Frequently"], [3, "A couple of times"], [4, "Almost never"]], label="How often did you feel tired or burned out?", widget=widgets.RadioSelect) stress = models.IntegerField(choices=[[1, "Almost always"], [2, "Frequently"], [3, "A couple of times"], [4, "Almost never"]], label="How often did you experience stress or" "pressure during the last month?", widget=widgets.RadioSelect) mood = models.IntegerField(choices=[[1, "Very good"], [2, "Pretty good"], [3, "Not very good"], [4, "Not good at all"]], label="How is your day so far?", widget=widgets.RadioSelect) propStocks = models.IntegerField(label="What percentage of your wealth is invested in stocks, options" "or futures?", min=0, max=100) propBonds = models.IntegerField(label="What percentage of your wealth is invested in bonds?", min=0, max=100) propBank = models.IntegerField(label="What percentage of your wealth is on a bank account?", min=0, max=100) healthDeductible = models.IntegerField(choices=[[1, "Very high"], [2, "High"], [3, "Rather low"], [4, "As low as possible"]], label="How high do you choose your deductible (Selbstbehalt) for your" "health insurance?", widget=widgets.RadioSelect) carInsurance = models.IntegerField(choices=[[1, "Yes"], [2, "No"]], label="Did you buy additional insurance the last time you rented a car?", widget=widgets.RadioSelect) gambling = models.IntegerField(choices=[[1, "Yes"], [2, "No"]], label="Do you participate in gambling multiple times a year (e.g. lotteries," "sport bets, card games for money or casinos)?", widget=widgets.RadioSelect) workload = models.IntegerField(label="What is your workload besides your studies (in percent)?", min=0, max=100) property = models.StringField(choices=["car", "house", "bike", "yacht"], label="Which of the following items do you own?") weller8 = models.IntegerField(label="If the chance of getting a disease is 10 percent, how many people would be" "expected to get the disease out of 1,000?", min=0, max=1000) weller7 = models.IntegerField(label="If the chance of getting a disease is 20 out of 100, this would be the same" "as having a ____% chance of getting the disease.", min=0, max=100) weller6 = models.IntegerField(label="Imagine that we roll a fair, six-sided die 1000 times. Out of 1000 rolls, how" "many times do you think the die would come up as an even number?", min=0, max=1000) weller5 = models.IntegerField(label="In the BIG BUCKS LOTTERY, the chances of winning a $10.00 prize are 1%. " "What is your best guess about how many people would win a $10.00 prize if " "1000 people each buy a single ticket from BIG BUCKS?", min=0, max=1000) weller2 = models.IntegerField(label="A bat and a ball cost CHF 1.10 in total. The bat costs CHF 1.00 more than " "the ball. How much does the ball cost?", choices=range(c(0), c(1.00), c(0.10))) crt2 = models.IntegerField(label="If it takes 5 machines 5 minutes to make 5 widgets, how long would it take 100 " "machines to make 100 widgets?", min=0, max=100) weller3 = models.IntegerField(label="In a lake, there is a patch of lily pads. Every day, the patch doubles in " "size. If it takes 48 days for the patch to cover the entire lake, how long " "would it take for the patch to cover half of the lake?", min=0, max=100) weller4 = models.IntegerField(label="In Daily Times Sweepstakes, the chance of winning a car is 1 in 1000. What " "percent of tickets to Daily Times Sweepstakes win a car?", min=0, max=100) weller1 = models.IntegerField(label="Suppose your friend just had a mammogram. The doctor knows from previous " "studies that, of 100 women like her, 10 have tumors and 90 do not. Of the 10 " "who do have tumors, the mammogram correctly finds 9 with tumors and " "incorrectly says that 1 does not have a tumor. Of the 90 women without " "tumors, the mammogram correctly finds 80 without tumors and incorrectly says " "that 10 have tumors. The table below summarizes this information. Imagine" " that your friend tests positive (as if she had a tumor), what is the " "likelihood that she actually has a tumor?", min=0, max=100) smokingever = models.IntegerField(choices=[[1, "Yes"], [2, "No"]], label="Have you ever smoked cigarettes, cigars, cigarillos or a pipe daily for " "a period of at least one year? ", widget=widgets.RadioSelect) smokingpresent = models.IntegerField(choices=[[1, "Yes"], [2, "No"]], label="Do you smoke at the present time?", widget=widgets.RadioSelect) oftendrinkany = models.StringField(choices=["Almost every day", "Five or six days a week", "Three or four days a week","Once or twice a week", "Once or twice a month","Less than once a month", "Not at all in the last 6 months"], label="During the last six months, how often have you drunk any alcoholic" " beverages like beer, cider, wine, spirits or cocktails?") oftendrinkmore = models.StringField(choices=["Almost every day", "Five or six days a week", "Three or four days a week","Once or twice a week", "Once or twice a month","Less than once a month", "Not at all in the last 6 months"], label="During the last six months, how often have you had more than two " "glasses of alcoholic beverages in a single day?") oftendrinkmore = models.StringField(choices=["Almost every day", "Five or six days a week", "Three or four days a week","Once or twice a week", "Once or twice a month","Less than once a month", "Not at all in the last 6 months"], label="During the last six months, how often have you had more than two " "glasses of alcoholic beverages in a single day?") healthinscomp = models.StringField(choices=["Agrisano", "AMB Assurances SA","Aquilana","Arcosana","Assura-Basis SA", "Atupri","Avenir Krankenversicherung AG Bildende Künstler/Innen", "Birchmeier","Compact","CONCORDIA","CSS", "Easy Sana Krankenversicherung AG EGK", "Einsiedeln Fenaco-Mitgliedgenossenschaften GALENOS","Gewerbliche", "Glarner","Helsana","Hotela","Ingenbohl","INTRAS","KLuG","Kolping", "KPT/CPT","KVF Krankenversicherung AG Lumneziana", "Luzerner Hinterland","Metallbaufirmen","Moove Sympany AG", "Mutuel Krankenversicherung AG ÖKK", "Philos Krankenversicherung AG Progrès","PROVITA","rhenusana","sana24", "Sanagate","sanavals","Sanitas","Simplon","SLKK","sodalis", "Steffisburg","Stoffel","Sumiswalder","SUPRA-1846 SA","SWICA", "Vallée d’Entremont","Ville de Neuchâtel","Visana","Visperterminen", "vita surselva","Vivacare","Vivao Sympany","Wädenswil", "I'm not covered under the Swiss Basic Health Care Insurance " "because I have comparable coverage form abroad"], label="From which of the following insurance companies have you bought " "mandatory health insurance coverage?") healthinsmodel = models.StringField(choices=["Standard","HMO(Note: HMO-insured are obliged to first consult a " "physician at their HMO health center before being " "transferred to a specialist physician.)", "Hausarzt model (Note: insured in the Hausarzt model" " (general practitioner model) do not have free choice of physicians" " but are obliged to first consult their general practitioner " "before being transferred to a specialist physician.)", "Telmed modell (Note: insured in the Telmed modell are obliged to " "first call the medical advice unit of their health insurer before " "being transferred to a physician.)","Other"], label="Which of the following insurance models have you chosen under the " "mandatory health insurance plan? [only if 1. is not 51]") healthinsded = models.IntegerField(choices=["300CHF", "500 CHF", "1000 CHF", "1500 CHF", "2000 CHF", "2500 CHF", "Don't know"], label="Which of the following deductible levels have you chosen under the " "mandatory health insurance plan? (Note: the deductible is the amount " "per year you have to pay out of pocket (e.g., for doctor visits, " "hospitalization))") haveinsurance = models.StringField(choices=["Private supplementary health insurance", "Disability insurance", "Accident insurance", "Foreign travel health insurance", "Private liability insurance", "Auto insurance", "Term life insurance","Whole life insurance", "Homeowners or renters insurance","Legal expenses insurance", "Insurance for consumer goods (e.g., smartphone)","Other"], label="Which of the following insurance products do you have?") haveinsuranceother = models.StringField(label="Which other insurance products do you have?") premiums = models.IntegerField(choices=["300CHF", "500 CHF", "1000 CHF", "1500 CHF", "2000 CHF", "2500 CHF", "Don't know"], label="Please provide an estimate of your total annual spending for insurance " "premiums (in CHF).") submit = models.StringField() outcome = models.IntegerField( # blank = True, min = 0, label = "" ,s ) HEXACO1 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I wouldn't use flattery to get a " "raise or promotion at work.", widget=widgets.RadioSelectHorizontal) HEXACO2 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="If I knew that I could never get " "caught, I would be willing to steal a " "million dollars.", widget=widgets.RadioSelectHorizontal) HEXACO3 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="Having a lot of money is not " "especially important to me.", widget=widgets.RadioSelectHorizontal) HEXACO4 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I think that I am entitled to more " "respect than the average person is.", widget=widgets.RadioSelectHorizontal) HEXACO5 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="If I want something from someone, I " "will laugh at that person's worst jokes.", widget=widgets.RadioSelectHorizontal) HEXACO6 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I would get a lot of pleasure from " "owning expensive luxury goods.", widget=widgets.RadioSelectHorizontal) HEXACO7 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I want people to know that I am an " "important person of high status.", widget=widgets.RadioSelectHorizontal) HEXACO8 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I wouldn't pretend to like someone " "just to get that person to do favors for me.", widget=widgets.RadioSelectHorizontal) HEXACO9 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I wouldn't pretend to like someone " "just to get that person to do favors for me.", widget=widgets.RadioSelectHorizontal) HEXACO10 = models.IntegerField(choices=[1, 2, 3, 4, 5], label="I'd be tempted to use counterfeit " "money, if I were sure I could get away with it.", widget=widgets.RadioSelectHorizontal)