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 author = 'Elisa Macchi' doc = """ Obesity and Income - Identify prospective borrowers for matching """ class Constants(BaseConstants): name_in_url = 'borrowers' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): h1 = models.IntegerField(choices=[[1, 'go to a bank'], [2, 'go to a money lender']], widget=widgets.RadioSelectHorizontal, label=''' If you needed to borrow 5 million shillings and could not ask to family/friends would you rather: ''' ) h2 = models.IntegerField(choices=[[1, 'No, never. '], [2, 'Yes, only from banks.'], [3, 'Yes, only from informal money lenders.'], [4, 'Yes, from both banks and informal money lenders'], ], widget=widgets.RadioSelect, label='''Did you ever borrow money or receive a loan from a non family member?''' ) h3 = models.IntegerField(choices=[[0, 'No'], [1, 'Yes']], widget=widgets.RadioSelectHorizontal, label=''' Are you currently in need of a loan / could a loan help you out at the moment? ''' ) h4 = models.IntegerField(choices=[[1, '1 million shillings'], [2, '5 million shillings']], widget=widgets.RadioSelectHorizontal, label=''' Which amount is closest to the loan amount you would ask to a bank ? ''', blank=True ) h5 = models.IntegerField(choices=[[1, 'Unlikely to receive it.'], [2, 'I am currently applying.'], [3, 'It is not urgent.'], [4, 'Do not know how to apply.'], [5, 'Do not have time to apply.'], [6, 'Other reason.']], widget=widgets.RadioSelect, label=''' If you need a loan, why did you not apply for it already? ''', blank=True ) h6 = models.LongStringField( label=''' Please, specify which other reasons: ''', blank=True ) interest = models.IntegerField(choices=[[0, 'No'], [1, 'Yes']], widget=widgets.RadioSelectHorizontal, label=''' Are you interested in the referrals? ''' ) comments = models.LongStringField(blank=True) issues = models.LongStringField(blank=True) # For enumerator height = models.StringField(label=''' Height in cm: ''' ) weight = models.StringField(label=''' Weight in kg: ''' ) enumerator_comments = models.LongStringField(label='''Any comments to this survey: ''', blank=True) enumerator_name = models.StringField(label='''Enumerator name: ''' ) enumerator_number = models.StringField(label='''Enumerator number: ''' )