from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import numpy as np import pandas as pd import itertools import random from django import forms author = 'Elisa Macchi' doc = """ MTurk Survey to Test for BMI Perception: Nutrition Survey and Scenarios """ class Constants(BaseConstants): name_in_url = 'survey_mturk_bmi_end' players_per_group = None num_rounds = 1 sil_pic = 'silhouettes.png' one_tenth = 'one.png' five_tenth = 'five.png' # Parameters participation_fee = c(3) bonus = c(0.03) n_questions_nk = 66 n_sections = 5 # Multiple questions bmi_scale = [["Figure 1 (body mass index 16)", "Figure 1 (body mass index 16)"], ["Figure 2 (body mass index 18)", "Figure 2 (body mass index 18)"], ["Figure 3 (body mass index 21)", "Figure 3 (body mass index 21)"], ["Figure 4 (body mass index 24)", "Figure 4 (body mass index 24)"], ["Figure 5 (body mass index 25)", "Figure 5 (body mass index 25)"], ["Figure 6 (body mass index 27)", "Figure 6 (body mass index 27)"], ["Figure 7 (body mass index 32)", "Figure 7 (body mass index 32)"], ["Figure 8 (body mass index 39)", "Figure 8 (body mass index 39)"], ["Figure 9 (body mass index 43)", "Figure 9 (body mass index 43)"]] # Correct answers: nk_answers ={'juiceserv_f3': 1, 'sweetjuice_f3': 3, 'regsoftdrink_f3': 1, 'dietsoftdrink_f3': 3, 'prepackaged_f3': 3, 'caffeine_f3': 2, 'alcohol_f3': 0, 'fruit_f5_a': 1 , 'foodwithsurgar_f5_b': 3, 'vegetables_f5_c': 1, 'fattyfood_f5_d': 3, 'saltyfood_f5_g': 3, 'water_f5_h': 1, 'unsuturatedfat_f6_a': 2, 'transfat_f6_b': 1, 'saturatedfats_f6_c': 1, 'dietcola_f7_a': 2, 'plainyoghurt_f7_b': 2, 'icecream_f7_c': 1, 'tomatoketchup_f7_d': 1, 'watermelon_f7_e': 2, 'breakfast_f8_a': 1, 'frozenbreakfst_f8_b': 2, 'bread_f8_c': 1, 'bakedbeans_f8_d': 1, 'redmeat_f8_e': 2, 'oats_f9_a': 1, 'banana_f9_b': 1, 'whiterice_f9_c': 2, 'eggs_f9_d': 2, 'potatoeswithskin_f9_e': 1, 'pasta_f9_e': 2, 'poultry_f10_a': 1, 'cheese_f10_b': 1, 'fruit_f10_c': 2, 'bakedbeans_f10_d': 1, 'butter_f10_e': 2, 'nuts_f10_e': 1, 'cheese_f11_a': 2 , 'rice_f11_b': 1 , 'irish_f11_c': 1, 'plantains_f11_e': 2, 'calciumamount_f12': 1, 'mostcalories_f13': 1, 'yoghurt_f14': 2, 'flavor_f15': 3, 'restaurant_f17': 2, 'sugardisease_f16': 2, 'heartdisprevention_f18': 3, 'expertdiabetes_f19': 1, 'raisecholestol_f20': 3, 'highglycemic_f21': 2, 'fiberdecrease_f22': 1, 'obese': 4, 'normalweight': 2 } class Subsession(BaseSubsession): def creating_session(self): options = itertools.cycle([1, 2]) players = self.get_players() for p in players: p.option = next(options) class Group(BaseGroup): pass class Player(BasePlayer): # Attention checks: attention_check_three = models.IntegerField( label='''If you are reading carefully, write the number 3 in the box:''') attention_check_weight = models.IntegerField(choices=[[1, 'She wants to keep her body weight constant.'], [2, 'She wants to not find her body weight anymore.'], [3, 'She wants to increase her body weight.'], [4, 'She wants to reduce her body weight.'], ], widget=widgets.RadioSelect, label='''If a person wants to lose weight, this means:''' ) attention_check_salt = models.IntegerField(choices=[[1, 'The answer is salt.'], [2, 'Choose the first option.'], [3, 'This option is wrong.'], [4, 'Option one is correct.'], ], widget=widgets.RadioSelect, label='''Which of these foods contains the most salt?''' ) # Income avg_income_s2 = models.IntegerField(choices=[[0, 'Below $20,000'], [1, 'Between $35,000 and $49,999'], [2, 'Between $50,000 to $74,999'], [3, 'Between $75,000 to $99,999'], [4, '$100,000 and over']], widget=widgets.RadioSelect, label=''' Please, answer with your best guess of the pre-tax annual personal income.''') avg_income_s8 = models.IntegerField(choices=[[0, 'Below $ 20,000'], [1, 'Between $35,000 and $49,999'], [2, 'Between $50,000 to $74,999'], [3, 'Between $75,000 to $99,999'], [4, '$100,000 and over']], widget=widgets.RadioSelect, label=''' Please, answer with your best guess of the pre-tax annual personal income.''') norm_q1 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income below $ 20,000?''') norm_q2 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $20,000 to $34,999?''') norm_q3 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $35,000 and $49,999?''') norm_q4 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $50,000 to $74,999?''') norm_q5 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $75,000 to $99,999?''') norm_q6 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income of $100,000 and over?''') obese_q1 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income below $20,000?''') obese_q2 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $20,000 to $34,999?''') obese_q3 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $35,000 and $49,999?''') obese_q4 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $50,000 to $74,999?''') obese_q5 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income between $75,000 to $99,999?''') obese_q6 = models.IntegerField(choices=range(0, 105, 5), label='''How many have an annual personal income of $100,000 and over? ''') # Reasons for Weight Change: ideal_weight = models.IntegerField(label='''What is your ideal weight in pounds?''') change_weight = models.IntegerField(choices=[[0,'I am at my ideal weight'], [1, 'I am trying to lose weight'], [2, 'I am trying to gain weight'], [3, 'I am trying not to gain weight'], [4, 'I am trying not to lose weight'], [5, 'None of the above']], widget=widgets.RadioSelect, label=''' If any, which among the following sentences best describes you current status:''') what_change = models.StringField(label=''' What are you doing to try and reach your ideal weight?''', blank=True) why_change = models.StringField(label=''' What is the main reason motivating your effort to reach your ideal weight?''', blank=True) lose = models.IntegerField(choices=[[1, 'Physical Health (e.g.: experience fewer diseases or live longer) '], [2, 'Mental Health (e.g.: gain confidence or feeling better about oneself)'], [3, 'Status or Wealth perception (e.g: people will be nicer to you or you might be perceived as better off)'], [4, 'Attractiveness'], [5, 'Financial reasons (e.g.: not enough money to access good food, cooking or exercising)' ], [6, 'Time reasons (e.g.: not enough time to access good food, cooking or exercising)'], [7, 'No good reasons.'], [8, 'Other reason']], widget=widgets.RadioSelect, label='''In the US, what is the most common reason to LOSE weight if overweight?''' ) not_lose = models.IntegerField(choices=[[1, 'Physical Health (e.g.: experience fewer diseases or live longer) '], [2, 'Mental Health (e.g.: gain confidence or feeling better about oneself)'], [3, 'Status or Wealth perception (e.g: people will be nicer to you or you might be perceived as better off)'], [4, 'Attractiveness'], [5, 'Financial reasons (e.g.: not enough money or time to access good food, cooking or exercising)' ], [6, 'Time reasons (e.g.: not enough time to access good food, cooking or exercising)'], [7, 'No good reasons.'], [8, 'Other reason']], widget=widgets.RadioSelect, label='''In the US, what is the most common reason NOT to LOSE weight if overweight?''' ) gain = models.IntegerField(choices=[[1, 'Physical Health (e.g.: experience fewer diseases or live longer) '], [2, 'Mental Health (e.g.: gain confidence or feeling better about oneself)'], [3, 'Status or Wealth perception (e.g: people will be nicer to you or you might be perceived as better off)'], [4, 'Attractiveness'], [5, 'Financial reasons (e.g.: not enough money or time to access good food, cooking or exercising)'], [6, 'Time reasons (e.g.: not enough time to access good food, cooking or exercising)'], [7, 'No good reasons.'], [8, 'Other reason']], widget=widgets.RadioSelect, label='''In the US, what is the most common reason to GAIN weight if normal weight?''' ) not_gain = models.IntegerField(choices=[[1, 'Physical Health (e.g.: experience fewer diseases or live longer) '], [2, 'Mental Health (e.g.: gain confidence or feeling better about oneself)'], [3, 'Status or Wealth perception (e.g: people will be nicer to you or you might be perceived as better off)'], [4, 'Attractiveness'], [5, 'Financial reasons (e.g.: not enough money or time to access good food, cooking or exercising)'], [6, 'Time reasons (e.g.: not enough time to access good food, cooking or exercising)'], [7, 'No good reasons.'], [8, 'Other reason']], widget=widgets.RadioSelect, label='''In the US, what is the most common reason NOT to GAIN weight if normal weight?''' ) other_lose = models.StringField(label="Please, specify:", blank=True ) other_gain = models.StringField(label="Please, specify:", blank=True ) other_not_lose = models.StringField(label="Please, specify:", blank=True) other_not_gain = models.StringField(label="Please, specify:", blank=True) # Nutritional Knowledge Survey: primary_shopper = models.BooleanField(choices=[[0,'No'], [1, 'Yes']], widget=widgets.RadioSelect, label = ''' Are you the primary shopper? That is, the one household member who makes the majority of your household's grocery purchase decisions ''' ) health = models.IntegerField(choices=[[1, 'Poor '], [2, 'Fair'], [3, 'Poor'], [4, 'Good'], [5, 'Very good'] ], widget=widgets.RadioSelect, label='''In general, you would say that your physical health is''' ) obese = models.IntegerField(choices=[[1, 'Underweight '], [2, 'Normal weight'], [3, 'Overweight'], [4, 'Obese'], [5, 'Not sure']], widget=widgets.RadioSelect, label=''' If someone has a Body Mass Index (BMI) of 31, what would their weight status be? (BMI is conventionally measured in kg/m2) Please select one. ''' ) normalweight = models.IntegerField(choices=[[1, 'Underweight '], [2, 'Normal weight'], [3, 'Overweight'], [4, 'Obese'], [5, 'Not sure'] ], widget=widgets.RadioSelect, label='''If someone has a Body Mass Index (BMI) of 23, what would their weight status be? (BMI is conventionally measured in kg/m2) Please select one.''' ) job = models.IntegerField( choices=[[1, 'More likely '], [2, 'Less likely'], [3, 'Does not matter'], ], widget=widgets.RadioSelectHorizontal, label='''If someone has a figure like Silhouette 5 and increases to 6, do you think he/she would be more or less likely to find a good job?''' ) loan = models.IntegerField(choices=[[1, 'More likely '], [2, 'Less likely'], [3, 'Does not matter'], ], widget=widgets.RadioSelectHorizontal, label='''If someone has a figure like Silhouette 5 and increases to 6, do you think he/she would be more or less likely to be considered for a loan?''' ) # Nutritional Survey: # q1 _ For each of the following types of drinks, please tell # us how many 12-ounce servings you drink in an average week (A normal # bottle of soda is 12-ounces) juiceserv_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' 100% fruit juice ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''') sweetjuice_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Sweetened juice drinks (for example, fruit ades, lemonade, punch, and orange drinks) ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''' ) regsoftdrink_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Regular soft drinks (soda pop) ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.''' ) dietsoftdrink_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Diet soft drinks and all other artificially sweetened drinks ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''' ) prepackaged_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Pre-packaged (i.e., canned or bottled) tea or coffee (for example, iced tea, iced coffee,' and flavored tea) ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''' ) caffeine_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Sports or energy drinks ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''' ) alcohol_f1 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "More"], ], widget=widgets.RadioSelectHorizontal, label= ''' Alcoholic drinks (Beer, Wine, Spirits) ''', doc=''' For each of the following types of drinks, please tell us how many 12-ounce servings you drink in a typical week. (A normal can of soda is 12 ounces.) ''' ) # Please indicate how much each of the following statements reflects how you typically are: eatsweets_f2_a = models.IntegerField(choices=[[4, 'Not at all'], [3, 'Somewhat'], [2, 'Mostly'], [1, 'Definitely']], widget=widgets.RadioSelectHorizontal, label = ''' I eat sweets more than I should. ''' ) eatmore_f2_b = models.IntegerField(choices=[[4, 'Not at all'], [3, 'Somewhat'], [2, 'Mostly'], [1, 'Definitely']], widget=widgets.RadioSelectHorizontal, label=''' I often eat more than than I should at lunch or dinner. ''' ) drinkmore_fe_c = models.IntegerField(choices=[[4, 'Not at all'], [3, 'Somewhat'], [2, 'Mostly'], [1, 'Definitely']], widget=widgets.RadioSelectHorizontal, label=''' I drink soda pop or other sugar-sweetened beverages more often than I should. ''' ) juiceserv_f3 = models.IntegerField(choices=[[0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' 100% fruit juice ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? Please indicate your liking by selecting a number on a scale of 1-10, with 1 being “not at all" and 10 being “very much". ''' ) sweetjuice_f3 = models.IntegerField(choices=[[0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' Sweetened juice drinks (for example, fruit ades, lemonade, punch, and orange drinks) ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? Please indicate your liking by selecting a number on a scale of 1-10, with 1 being “not at all" and 10 being “very much". ''' ) regsoftdrink_f3 = models.IntegerField(choices=[ [0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' Regular soft drinks (soda pop) ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? ''' ) dietsoftdrink_f3 = models.IntegerField(choices=[ [0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' Diet soft drinks and all other artificially sweetened drinks ''' ) prepackaged_f3 = models.IntegerField(choices=[[0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' Pre-packaged (i.e., canned or bottled) tea or coffee (for example, iced tea, iced coffee,' and flavored tea) ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? ''' ) caffeine_f3 = models.IntegerField(choices=[ [0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget=widgets.RadioSelectHorizontal, label= ''' Sports or caffeinated energy drinks ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? Please indicate your liking by selecting a number on a scale of 1-10, with 1 being “not at all" and 10 being “very much". ''') alcohol_f3 = models.IntegerField(choices=[[0, '0'], [1, "1"], [2, "2"], [3, "3"], [4, "4"] ], widget =widgets.RadioSelectHorizontal, label= ''' Alcoholic drinks (Beer, Wine, Spirits) ''', doc=''' Imagine for a moment that you could drink whatever beverages you want without any health or nutritional considerations. Leaving aside any health or nutrition considerations, how much would you say you like the taste and generally enjoy drinking the following? Please indicate your liking by selecting a number on a scale of 1-10, with 1 being “not at all" and 10 being “very much". ''' ) healthimportance_f4 = models.IntegerField(choices=[[0, "0"], [1, "1"], [2, "2"], [3, "3"], [4, "4"]], widget=widgets.RadioSelectHorizontal, label= ''' Please indicate the importance by selecting a number on a scale of 0-4, with 0 being "not at all important" and 4 being "extremely important".''' ) fruit_f5_a = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Fruit ''' ) foodwithsurgar_f5_b = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Food and drinks with added sugar. ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) vegetables_f5_c = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Vegetables ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) fattyfood_f5_d = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Fatty foods ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) redmeat_f5_e = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Processed red meat ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) wholegrain_f5_f = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Whole grain rice, maize or wheat. ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) saltyfood_f5_g = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Salty foods ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) water_f5_h = models.IntegerField(choices=[[1, 'More'], [2, 'Same'], [3, 'Less'], [4, 'Not Sure']], widget=widgets.RadioSelectHorizontal, label= ''' Water ''', doc=''' Do health experts recommend that people should be eating more, the same amount, or less of the following foods? Please select one response for each. ''' ) unsuturatedfat_f6_a = models.IntegerField(choices=[[1, "Eat less"], [2, "Not eat less"], [3, "Not sure"]], widget=widgets.RadioSelectHorizontal, label= ''' Unsaturated fats (present in fish, nuts, vegetable oils) ''', doc=''' Which of these types of fats do expert recommend that people should eat less of? Please select one response for each. ''' ) transfat_f6_b = models.IntegerField(choices=[[1, "Eat less"], [2, "Not eat less"], [3, "Not sure"]], widget=widgets.RadioSelectHorizontal, label= ''' Trans fats (present in fried food or margarine) ''', doc=''' Which of these types of fats do expert recommend that people should eat less of? Please select one response for each. ''' ) saturatedfats_f6_c = models.IntegerField(choices=[[1, "Eat less"], [2, "Not eat less"], [3, "Not sure"]], widget=widgets.RadioSelectHorizontal, label= ''' Saturated fats (present in butter, coconut oil, cheese, red meat) ''', doc=''' Which of these types of fats do expert recommend that people should eat less of? Please select one response for each. ''' ) # Q11 : Do you think these foods and drinks are typically high or low in added sugar? # Please select one response for each. dietcola_f7_a = models.IntegerField(choices=[[1, 'High in added sugar'], [2, 'Low in added sugar'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Diet cola drink ''', doc=''' Do you think these foods and drinks are typically high or low in added sugar? Please select one response for each. ''' ) plainyoghurt_f7_b = models.IntegerField(choices=[[1, 'High in added sugar'], [2, 'Low in added sugar'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Plain yogurt ''', doc=''' Do you think these foods and drinks are typically high or low in added sugar? Please select one response for each. ''' ) icecream_f7_c = models.IntegerField(choices=[[1, 'High in added sugar'], [2, 'Low in added sugar'], [3, 'Not sure']], widget= widgets.RadioSelectHorizontal, label=''' Ice cream ''', doc=''' Do you think these foods and drinks are typically high or low in added sugar? Please select one response for each. ''' ) tomatoketchup_f7_d = models.IntegerField(choices=[[1, 'High in added sugar'], [2, 'Low in added sugar'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Tomato ketchup ''', doc=''' Do you think these foods and drinks are typically high or low in added sugar? Please select one response for each. ''' ) watermelon_f7_e = models.IntegerField(choices=[[1, 'High in added sugar'], [2, 'Low in added sugar'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Melon ''', doc=''' Do you think these foods and drinks are typically high or low in added sugar? Please select one response for each. ''' ) # Q12 : Do you think these foods and drinks are typically high or low in salt? # Please select one response for each. breakfast_f8_a = models.IntegerField(choices=[[1, 'High in salt'], [2, 'Low in salt'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Breakfast cereals ''', doc=''' Do you think these foods and drinks are typically high or low in salt? Please select one response for each. ''' ) frozenbreakfst_f8_b = models.IntegerField(choices=[[1, 'High in salt'], [2, 'Low in salt'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Frozen vegetables ''', doc=''' Do you think these foods and drinks are typically high or low in salt? Please select one response for each. ''' ) bread_f8_c = models.IntegerField(choices=[[1, 'High in salt'], [2, 'Low in salt'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Bread ''', doc=''' Do you think these foods and drinks are typically high or low in salt? Please select one response for each. ''' ) bakedbeans_f8_d = models.IntegerField(choices=[[1, 'High in salt'], [2, 'Low in salt'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Baked beans ''', doc=''' Do you think these foods and drinks are typically high or low in salt? Please select one response for each. ''' ) redmeat_f8_e = models.IntegerField(choices=[[1, 'High in salt'], [2, 'Low in salt'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label= ''' Red meat ''', doc=''' Do you think these foods and drinks are typically high or low in salt? Please select one response for each. ''' ) # Q13: Do you think these foods and drinks are typically high or low in fiber? # Please select one response for each. oats_f9_a = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Oats ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) banana_f9_b = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Bananas ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) whiterice_f9_c = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' White rice ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) eggs_f9_d = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Eggs ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) potatoeswithskin_f9_e = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Potatoes with skin ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) pasta_f9_e = models.IntegerField(choices=[[1, 'High in fiber'], [2, 'Low in fiber'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Pasta ''', doc=''' Do you think these foods and drinks are typically high or low in fiber? Please select one response for each. ''' ) # Q14: Do you think these foods are a good source of protein? Please select one response for each. poultry_f10_a = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Poultry ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) cheese_f10_b = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Cheese ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) fruit_f10_c = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Fruit ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) bakedbeans_f10_d = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Baked beans ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) butter_f10_e = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Butter ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) nuts_f10_e = models.IntegerField(choices=[[1, 'Good source of protein'], [2, 'Not a good source of protein'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Nuts ''', doc=''' Do you think these foods are a good source of protein? Please select one response for each. ''' ) cheese_f11_a = models.IntegerField(choices=[[1, 'Starchy food'], [2, 'Not a starchy food'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Cheese ''', doc=''' Which of the following do expert count as starchy food? Please select one response for each. ''' ) rice_f11_b = models.IntegerField(choices=[[1, 'Starchy food'], [2, 'Not a starchy food'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Bread ''', doc=''' Which of the following do expert count as starchy food? Please select one response for each. ''' ) irish_f11_c = models.IntegerField(choices=[[1, 'Starchy food'], [2, 'Not a starchy food'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Potatoes ''', doc=''' Which of the following do expert count as starchy food? Please select one response for each. ''' ) nuts_f11_d = models.IntegerField(choices=[[1, 'Starchy food'], [2, 'Not a starchy food'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Nuts ''', doc=''' Which of the following do expert count as starchy food? Please select one response for each. ''' ) plantains_f11_e = models.IntegerField(choices=[[1, 'Starchy food'], [2, 'Not a starchy food'], [3, 'Not sure']], widget=widgets.RadioSelectHorizontal, label=''' Plantains ''', doc=''' Which of the following do expert count as starchy food? Please select one response for each. ''' ) calciumamount_f12 = models.IntegerField(choices=[[1, 'Much higher'], [2, 'About the same'], [3, 'Much lower'], [4, 'Not sure'] ], widget=widgets.RadioSelect, label=''' The amount of calcium in a glass of whole milk compared to a glass of skimmed milk is...?''' ) mostcalories_f13 = models.IntegerField(choices=[[1, 'Sugar'], [2, 'Starchy'], [3, 'Fiber'], [4, 'Fat'], [5, 'Not sure'] ], widget=widgets.RadioSelect, label=''' Which one of the following nutrients has the most calories for the same weight of food?''' ) yoghurt_f14 = models.IntegerField(choices=[[1, '0% fat cherry yogurt'], [2, 'Plain yogurt'], [3, 'Creamy fruit yogurt'], [4, 'Not sure']], widget=widgets.RadioSelect, label=''' If a person wanted to buy a yogurt at the supermarket, which one would have the least sugar?''' ) flavor_f15 = models.IntegerField(choices=[[1, 'Coconut milk'], [2, 'Plain Herbs'], [3, 'Soy sauce'], [4, 'Not sure'] ], widget=widgets.RadioSelect, label='''One healthy way to add flavor to food without adding extra fat or salt is to add?''' ) sugardisease_f16 = models.IntegerField(choices=[[1, 'High blood pressure'], [2, 'Tooth decay'], [3, 'Anemia'], [4, 'Not sure']], widget=widgets.RadioSelect, label='''Which of these diseases is related to how much sugar people eat?''' ) restaurant_f17 = models.IntegerField(choices=[[1, 'Mushroom risotto soup (field mushrooms, ' 'porcini mushrooms, arborio rice, butter, cream, parsley and cracked black pepper)'], [2, 'Carrot butternut and spice soup (carrot , butternut squash, ' 'sweet potato, cumin, red chilies, coriander seeds and lemon'], [3, 'Cream of chicken soup (British chicken, onions, carrots, ' 'celery, potatoes, garlic, sage, wheat flour, double cream)'], [4, 'Not sure']], widget=widgets.RadioSelect, label='''If a person wanted soup in a restaurant or cafe, which one would be the lowest fat option?''' ) heartdisprevention_f18 = models.IntegerField(choices=[[1, 'Taking nutritional supplements '], [2, 'Eating less oily fish'], [3, 'Eating less trans-fats'], [4, 'Not sure'], ], widget=widgets.RadioSelect, label=''' Which of these options do experts recommend to prevent heart disease?''' ) expertdiabetes_f19 = models.IntegerField(choices=[[1, 'Eating less refined foods, such as cake '], [2, 'Drinking more fruit juice'], [3, 'Eating more processed meat'], [4, 'Not sure'], ], widget=widgets.RadioSelect, label='''Which of these options do experts recommend to prevent diabetes?''' ) raisecholestol_f20 = models.IntegerField(choices=[[1, 'Eggs '], [2, 'Vegetable oils'], [3, 'Animal fat'], [4, 'Not sure'] ], widget=widgets.RadioSelect, label='''Which one of these foods is more likely to raise people's blood cholesterol?''' ) highglycemic_f21 = models.IntegerField(choices=[[1, 'Wholegrain cereals '], [2, 'White bread'], [3, 'Fruit and vegetables'], [4, 'Not sure'] ], widget=widgets.RadioSelect, label=''' Which one of these foods is classified as having a high Glycemic Index (Glycemic Index is a measure of the impact of a food on blood sugar levels, thus a high Glycemic Index means a greater rise in blood sugar after eating)?''' ) fiberdecrease_f22 = models.IntegerField(choices=[[1, 'Agree '], [2, 'Disagree'], [3, 'Not sure'] ], widget=widgets.RadioSelect, label=''' "Fiber can decrease the chances of gaining weight."''' ) # calculate the percentage of the correctly answered questions for each player: total_correct = models.IntegerField(doc=''' Records participant's total correct answers to questions ''') nk_score = models.FloatField(doc=''' Nutritional Knowledge Score ''') option = models.IntegerField() g1A = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will be overweight at age 65?;;''' ) g1B = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will have a cardiovascular disease at age 65?;;''' ) g1C = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will be alive at age 65?;;''' ) g2A = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will be overweight at age 65?;;''' ) g2B = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will have a cardiovascular disease at age 65?;;''' ) g2C = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect, label='''How many do you think will be alive at age 65?;;''' ) health_bmiscale = models.StringField(widget= forms.widgets.CheckboxSelectMultiple(choices=Constants.bmi_scale)) costs1 = models.IntegerField( min=0, max=100, label = '''Imagine 100 people of body size like figure 1. How many will be dead at age 65?''') costs2 = models.IntegerField( min=0, max=100, label = '''Imagine 100 people of body size like figure 3. How many will be dead at age 65?''') costs3 = models.IntegerField( min=0, max=100, label = '''Imagine 100 people of body size like figure 5. How many will be dead at age 65?''') costs4 = models.IntegerField( min=0, max=100, label = '''Imagine 100 people of body size like figure 7. How many will be dead at age 65?''') costs5 = models.IntegerField( min=0, max=100, label = '''Imagine 100 people of body size like figure 9. How many will be dead at age 65?''') costs_d_1 = models.IntegerField( min=0, max=100, label='''Imagine 100 people of body size like figure 1. How many have developed diabetes?''') costs_d_2 = models.IntegerField( min=0, max=100, label='''Imagine 100 people of body size like figure 3. How many have developed diabetes?''') costs_d_3 = models.IntegerField( min=0, max=100, label='''Imagine 100 people of body size like figure 5. How many have developed diabetes?''') costs_d_4 = models.IntegerField( min=0, max=100, label='''Imagine 100 people of body size like figure 7. How many have developed diabetes?''') costs_d_5 = models.IntegerField( min=0, max=100, label='''Imagine 100 people of body size like figure 9. How many have developed diabetes?''') avg_life_exp1 = models.IntegerField( label='''Imagine this person looked like figure 1. How long would he or she live?''') avg_life_exp2 = models.IntegerField( label='''Imagine this person looked like figure 5. How long would he or she live?''') avg_life_exp3 = models.IntegerField( label='''Imagine this person looked like figure 7. How long would he or she live?''') avg_life_exp4 = models.IntegerField( label='''Imagine this person looked like figure 9. How long would he or she live?''') # Payoffs right_answers = models.IntegerField() def set_payoffs(self): self.right_answers = 0 for k, v in Constants.nk_answers.items(): if getattr(self, k) == v: self.right_answers += 1 self.payoff = c(self.right_answers)*Constants.bonus