from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): q1 = models.IntegerField( label="I'd rather depend on myself than others.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q2 = models.IntegerField( label="I rely on myself most of the time; I rarely rely on others.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q3 = models.IntegerField( label="I often do my own thing.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q4 = models.IntegerField( label="My personal identity, independent of others, is very important to me.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q5 = models.IntegerField( label="It is important that I do my job better than others.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q6 = models.IntegerField( label="Winning is everything.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q7 = models.IntegerField( label="Competition is the law of nature.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q8 = models.IntegerField( label="When another person does better than I do, I get tense and aroused.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q9 = models.IntegerField( label="If a coworker gets a prize, I would feel proud.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q10 = models.IntegerField( label="The well-being of my coworkers is important to me.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q11 = models.IntegerField( label="To me, pleasure is spending time with others.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q12 = models.IntegerField( label="I feel good when I cooperate with others.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q13 = models.IntegerField( label="Parents and children must stay together as much as possible.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q14 = models.IntegerField( label="It is my duty to take care of my family, even when 1 have to sacrifice what I want.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q15 = models.IntegerField( label="Family members should stick together, no matter what sacrifices are required.", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) q16 = models.IntegerField( label="It is important to me that I respect the decisions made by my groups. ", widget=widgets.RadioSelectHorizontal, choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ) # PAGES class Questions(Page): form_model = "player" form_fields = ["q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15", "q16"] class ResultsWaitPage(WaitPage): pass class Results(Page): pass page_sequence = [Questions] def custom_export(players): #header row yield ['participantSessionId', 'participantNum', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9', 'q10', 'q11', 'q12', 'q13', 'q14', 'q15', 'q16'] #now, data rows: for p in players: participant = p.participant #player = p.player session = p.session subsession = p.subsession group = p.group #put all variable names in the following list, including class, for ex: participant.choice, session.cellColors, group.rewardLeft yield [participant.id_in_session, participant.code, p.q1, p.q2, p.q3, p.q4, p.q5, p.q6, p.q7, p.q8, p.q9, p.q10, p.q11, p.q12, p.q13, p.q14, p.q15, p.q16]