from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from otree_tools.models import fields as tool_models import random import string author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'survey' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def yesno(yes, no,label): return models.StringField( choices=[yes, no], label=label, widget=widgets.RadioSelect, ) def multchoice( labels): return tool_models.MultipleChoiceModelField(label=labels) class Player(BasePlayer): age = yesno("yes"," no", "Are you at least 18 years old ?") active = multchoice( "Do you usually perform some sports activities, such as walking and running? You can choose more than one option. " ) mobilephone = yesno("yes", "no", "Do you have a mobile phone") kind = multchoice("What kind of mobile phone(s) do you have?") yearofmakephone = models.StringField( choices=["2017-2019", "2016-2014","Older than 2014" ], label= "Please indicate the year of make of the phone you currently use.", widget=widgets.RadioSelect, ) apps = multchoice("What kind of mobile fitness app(s) are you using to record walking or running? [Please indicate only apps of which you use the free version, and no paid and upgraded version.]") otherapps = models.StringField(label="What other apps are you using") datafromapps = multchoice(" What kind of data can you read out from your fitness app(s)? You can choose more than one option. ") otherdatafromapps = models.StringField(label="What other kind of data can you read from your app(s)?") personaldataphone = yesno("yes","no"," Did you enter, or would you be willing to enter any personal data (e.g. gender, height, weight, age) into your fitness app(s)?") hasfitdev = yesno("yes","no", " Do you own any wearable fitness devices that you could use during a study that requires reporting of fitness data?") dev = multchoice("Please select all brands of fitness devices that you own and could use. You can choose more than one option. ") otherdev = models.StringField(label = "What other brand do you own ?") yearofmakedev = models.StringField( choices=["2017-2019", "2016-2014","Older than 2014" ], label= "Please indicate the year of make", widget=widgets.RadioSelect, ) personaldatadev = yesno("Yes, I entered personal data.","No, I did not enter personal data"," Did you enter any personal data (e.g. gender, height, weight, age) into your fitness device(s)?") baselinetest = multchoice("Did your device require you to perform any baseline fitness tests for calibration? (You can choose more than one option.)") otherbaselinetest = models.StringField(label ="What other baseline test did you perform ?") devdata = multchoice("What kind of data can you read out from your fitness device(s)? (You can choose more than one option.)") otherdevdata = models.StringField(label = "What other kind of data can you read from your device(s)") willingreport = yesno("yes","no"," Would you be willing to download a specific app to your phone, and read out and report us fitness data from that app? Reported data would consist of 4-6 measures, for example, distance of a walk or run, duration of sports activity, calories burnt, etc. ") exercisetype = multchoice("In the study we will ask you to download a specific app and use that to report data on a sports activity. This sports activity should ideally be an activity that you usually do. We will post a limited amount of the following activities. Please tell us which of these activities you would be willing to perform, indicate all potential options:") fixedreward =models.StringField( choices=["At least $0.5","At least $1","At least $2","More"], label= " What do you expect the fixed part of the reward to be?", widget=widgets.RadioSelect, ) fixedmore = models.StringField(label ="Please specify how much you expect the fixed reward to be.") rewardphone = models.StringField( choices=["At least $0.5","At least $1","At least $2","More"], label= "- by a mobile fitness app", widget=widgets.RadioSelect, ) phonemore = models.StringField(label ="Please specify how much you expect the variable reward when you read data from your phone.") rewarddev = models.StringField( choices=["At least $0.5","At least $1","At least $2","More"], label= "- wearable fitness device", widget=widgets.RadioSelect, ) devmore = models.StringField(label ="Please specify how much you expect the variable reward when you read data from your device.") timecomplete = models.StringField( choices=["1 day", "2 days","3 days" ], label= "What do you think, how long would you need for submitting your fitness report after accepting the task ?", widget=widgets.RadioSelect, ) interest = yesno("yes","no","Would you be interested in participating in a study that requires you to report fitness data on one occasion?") gender = models.StringField( choices=["Male", "Female","Other" ], label= "What is your gender?", widget=widgets.RadioSelect, ) agerange = models.StringField( choices=["18-30", "31-50","51-70","Above 70" ], label= "What is your gender?", widget=widgets.RadioSelect, ) code = ''.join(random.choice(string.digits) for i in range(6)) code = code + ''.join(random.choice(string.ascii_letters) for i in range(2)) code = models.CharField(initial = code,blank = "true")