Ejemplo n.º 1
0
def age_bins(require=False):
    return Select('How old are you?', [
        '', 'Younger than 18', '18-24', '25-29', '30-34', '35-39', '40-44',
        '45-49', '50-54', '55-59', '60-64', '65 or older'
    ],
                  var='AgeBins',
                  validate=V.require() if require else None)
Ejemplo n.º 2
0
def occupation(require=False):
    occupation_q = Select('''
        To which occupational group do you belong?
        
        If you have multiple jobs, select the option for your main job. If you are not employed, select the option for your most recent job.
        ''', [
        '',
        ('Professional and technical (for example: doctor, teacher, engineer, artist, accountant, nurse)',
         'professional'),
        ('Higher administrative (for example: banker, executive in big business, high government official, union official)',
         'admin'),
        ('Clerical (for example: secretary, clerk, office manager, civil servant, bookkeeper)',
         'clerical'),
        ('''
                Sales (for example: sales manager, shop owner, shop assistant, 
                insurance agent, buyer)
                ''', 'sales'),
        ('Service (for example: restaurant owner, police officer, waitress, barber, caretaker)',
         'service'),
        ('Skilled worker (for example: foreman, motor mechanic, printer, seamstress, tool and die maker, electrician)',
         'skilled'),
        ('Semi-skilled worker (for example: bricklayer, bus driver, cannery worker, carpenter, sheet metal worker, baker)',
         'semi-skilled'),
        ('Unskilled worker (for example: laborer, porter, unskilled factory worker, cleaner)',
         'unskilled'), ('Farm worker', 'farm worker'),
        ('Farm proprietor or manager', 'farm manager'),
        ('Never had a job', 'none')
    ],
                          var='Occupation',
                          validate=V.require() if require else None)
    return _debug_choices(occupation_q, require)
Ejemplo n.º 3
0
def marital_status(require=False):
    status_q = Select('What is your marital status?', [
        '', 'Married', 'Living together as married', 'Divorced', 'Separated',
        'Widowed', 'Single'
    ],
                      var='MaritalStatus',
                      validate=V.require() if require else None)
    return _debug_choices(status_q, require)
Ejemplo n.º 4
0
def save_money(require=False):
    save_q = Select('In the last year, did your family:', [
        '', ('Save money', 'save'), ('Just get by', 'get by'),
        ('Spent some savings', 'spent'),
        ('Spent savings and borrowed money', 'borrowed')
    ],
                    var='Savings',
                    validate=V.require() if require else None)
    return _debug_choices(save_q, require)
Ejemplo n.º 5
0
def social_class(require=False):
    social_q = Select(
        'Which social class would you describe yourself as belonging to?', [
            '', ('Upper class', 'upper'),
            ('Upper middle class', 'upper middle'),
            ('Lower middle class', 'lower middle'),
            ('Working class', 'working'), ('Lower class', 'lower')
        ],
        var='SocialClass',
        validate=V.require() if require else None)
    return _debug_choices(social_q, require)
Ejemplo n.º 6
0
def country(require=False):
    residence = Select('What country are you currently living in?',
                       countries.copy() + [('Other', 'other')],
                       default='US',
                       var='CountryOfResidence')
    birth = Select('What country were you born in?',
                   [('I live in the country I was born in', 'same')] +
                   countries.copy(),
                   default='same',
                   var='CountryOfBirth',
                   submit=S(_check_for_same_country, residence))
    citizen = Select(
        'What is your country of primary citizenship?',
        ([('I live in my country of primary citizenship', 'same')] +
         countries.copy()),
        default='same',
        var='CountryOfCitizenship',
        submit=[
            S(_check_for_same_country, residence),
            S(_immigration_status, residence)
        ])
    return [_debug_choices(q, require) for q in (residence, birth, citizen)]
Ejemplo n.º 7
0
def sector(require=False):
    sector_q = Select('''
        Are you working for the government or public institution, for private business or industry, or for a private nonprofit organization? 
        
        If you are not employed, select the option for your most recent job.
        ''', [
        '', ('Government or public instution', 'public'),
        ('Private business or industry', 'private'),
        ('Private non-profit organization', 'non-profit'),
        ('Never had a job', 'none')
    ],
                      var='Sector',
                      validate=V.require() if require else None)
    return _debug_choices(sector_q, require)
Ejemplo n.º 8
0
def employment(require=False):
    employment_q = Select('''
        What is your employment status?
        
        If you have multiple jobs, select the option for your main job.
        ''', [
        '', ('Full time employment (30 or more hours/week)', 'full'),
        ('Part time employment (fewer than 30 hours/week)', 'part'),
        ('Self employed', 'self'), ('Retired/pensioned', 'retired'),
        ('Stay at home spouse not otherwise employed', 'home'),
        ('Student', 'student'), ('Unemployed', 'unemployed')
    ],
                          var='Employment',
                          validate=V.require() if require else None)
    return _debug_choices(employment_q, require)
Ejemplo n.º 9
0
def education(require=False):
    educ_q = Select(
        'What is the highest educational level you have completed? (Values in parentheses are for the U.S. school system.)',
        [
            '', ('Early childhood education or no education', 0),
            ('Primary education (elementary school)', 1),
            ('Lower secondary education (middle school)', 2),
            ('Upper secondary education (high school/GED)', 3),
            ('Post-secondary non-tertiary education (vocational training)', 4),
            ('Short-cycle tertiary education (2-year college)', 5),
            ('Bachelor or equivalent', 6), ('Master or equivalent', 7),
            ('Doctoral or equivalent', 8)
        ],
        var='Education',
        validate=V.require() if require else None)
    return _debug_choices(educ_q, require)
Ejemplo n.º 10
0
def religion(require=False):
    religion_q = Select(
        'Which religion or religious denomination do you belong to, if any?', [
            '', 'None', 'Roman Catholic', 'Protestant',
            ('Orthodox (Russian, Greek, etc.)', 'Orthodox'), 'Jewish',
            'Muslim', 'Hindu', 'Buddhist', 'Other'
        ],
        var='Religion',
        validate=V.require() if require else None)
    _debug_choices(religion_q, require)
    specify = Input(
        'Please specify your religion or religious denomination.',
        var='RelgionSpecify',
    )
    show_on_event(specify, religion_q, 'Other')
    return religion_q, specify
Ejemplo n.º 11
0
def language(require=False):
    language_q = Select('What language do you normally speak at home?',
                        languages.copy() + [('Other', 'other')],
                        default='en',
                        var='Language')
    return _debug_choices(language_q, require)
Ejemplo n.º 12
0
def birth_year(require=False):
    years = list(range(1900, datetime.now().year))
    years.sort(reverse=True)
    return Select('What year were you born in?', [''] + years,
                  validate=V.require() if require else None)