from otree.api import * import numpy as np import time doc = """ This app serves as a pre-screening. """ class C(BaseConstants): NAME_IN_URL = 'survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 # TEMPLATES INSTRUCTIONS_TEMPLATE = 'survey/InstructionsTemplate.html' # FOR IndividualQsMis.HTML ONLINE_ACTIVITY = [ dict(name='wikipedia', label="Editing Wikipedia"), dict(name='onlineReview', label="Leaving a review for a business on Yelp, Google Maps, etc."), dict(name='factCheck', label="Fact-checking an online content"), dict(name='newsWebsite', label="Leaving a comment on a news website"), dict(name='userContent', label="Contributed to any other user-generated content"), ] MISLEADING = [ dict(name='factualError', label="It contains a factual error"), dict(name='manipulatedMedia', label="It contains manipulated media"), dict(name='outdatedInformation', label="It contains outdated information that may be misleading"), dict(name='misrepresentation', label="It is a misrepresentation or missing important context"), dict(name='disputedClaim', label="It presents a disputed claim as fact"), dict(name='satire', label="It is satire/a joke that may be misinterpreted"), dict(name='other', label="Other"), ] # FOR IndividualQsNotMis.HTML NOT_MISLEADING = [ dict(name='factualCorrect', label="It expresses a factually correct claim"), dict(name='outdated', label="The tweet was correct when written, but is out of date now"), dict(name='joking', label="It is clearly satirical/joking"), dict(name='personalOpinion', label="It expresses a personal opinion"), dict(name='otherNOTMIS', label="Other"), ] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): prolific_id = models.StringField(label="Enter your Prolific ID:") image = models.StringField() evidenceEval_IND = models.IntegerField( label="Based on the latest available evidence, the tweet is:", choices=[ [1, 'Misinformed, or potentially misleading'], [2, 'Somewhat misleading'], [3, 'Not misleading'], ] ) suggestedEdit_IND = models.LongStringField( label="Text edit", max_length=4000, ) fewBelieve = models.BooleanField( label="If the tweet was widely spread, its message would likely be believed by:", choices=[[True, 'Few'], [False, 'Many']], ) littleHarm = models.BooleanField( label="If many believed the tweet, it might cause:", choices=[[True, 'Little harm'], [False, 'Considerable harm']], ) easyInfo = models.BooleanField( label="Finding and understanding the correct information would be:", choices=[[True, 'Easy'], [False, 'Challenging']], ) # labels for C.MISLEADING factualError = models.BooleanField(blank=True) manipulatedMedia = models.BooleanField(blank=True) outdatedInformation = models.BooleanField(blank=True) misrepresentation = models.BooleanField(blank=True) disputedClaim = models.BooleanField(blank=True) satire = models.BooleanField(blank=True) other = models.BooleanField(blank=True) # labels for C.ONLINE_ACTIVITY wikipedia = models.BooleanField(blank=True) onlineReview = models.BooleanField(blank=True) factCheck = models.BooleanField(blank=True) newsWebsite = models.BooleanField(blank=True) userContent = models.BooleanField(blank=True) # labels for C.NOT_MISLEADING factualCorrect = models.BooleanField(blank=True) outdated = models.BooleanField(blank=True) joking = models.BooleanField(blank=True) personalOpinion = models.BooleanField(blank=True) otherNOTMIS = models.BooleanField(blank=True) def assignImage(player): # 1448274095653756936.png ID: 5bb7ecafdd840f0001d863c8 # 1520108070151536641.png ID: 5d1b4ec634783e0001336019 if player.prolific_id == '5bb7ecafdd840f0001d863c8': image = '1448274095653756936.png' else: image = '1520108070151536641.png' return image # PAGES class Education(Page): form_model = 'player' form_fields = ['prolific_id'] class IndividualEval(Page): form_model = 'player' form_fields = ['suggestedEdit_IND', 'evidenceEval_IND'] @staticmethod def vars_for_template(player: Player): player.image = assignImage(player) return dict(image_path='images/' + player.image) @staticmethod def before_next_page(player, timeout_happened): # init participant vars participant = player.participant participant.misleading_IND = True if player.evidenceEval_IND == 3: # 3: not misleading participant.misleading_IND = False class IndividualQsMis(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): online_activity = [online['name'] for online in C.ONLINE_ACTIVITY] misleading = [reason['name'] for reason in C.MISLEADING] other_qs = ['fewBelieve', 'littleHarm', 'easyInfo'] return online_activity + misleading + other_qs @staticmethod def is_displayed(player: Player): return player.participant.misleading_IND class IndividualQsNotMis(Page): form_model = 'player' @staticmethod def get_form_fields(player: Player): return [online['name'] for online in C.ONLINE_ACTIVITY] + \ [reason['name'] for reason in C.NOT_MISLEADING] @staticmethod def is_displayed(player: Player): return not player.participant.misleading_IND class IndividualSuccess(Page): pass page_sequence = [Education, IndividualEval, IndividualQsMis, IndividualQsNotMis, IndividualSuccess]