예제 #1
0
def main():
    apps = wufoo_entry_loader.load_apps(['full_name'])
    random.shuffle(apps)

    # Save applicant IDs.
    # Index in list is their ID.
    with open(os.path.join('AppReading', 'applicant_ids.csv'), 'w') as f:
        writer = csv.writer(f)
        for i, app in enumerate(apps):
            writer.writerow([app['full_name'], str(i)])
예제 #2
0
def main():
    apps = wufoo_entry_loader.load_apps(
        fields=['full_name', 'school_year', 'gender'])
    for year in ['Freshman', 'Sophomore', 'Junior', 'Senior', 'Co-Term']:
        male, female, nonbinary = count_year_by_gender(apps, year)
        total = len(male) + len(female) + len(nonbinary)
        print('{}: {}'.format(
            make_color(year, 'bold'),
            make_color('{} applicants'.format(total), 'italic')))
        print('  {} of those are male'.format(len(male)))
        print('  {} of those are female'.format(len(female)))
        print('  {} of those are nonbinary'.format(len(nonbinary)))
        print()
예제 #3
0
def main():
    applicant_ids = load_applicant_ids()
    apps = wufoo_entry_loader.load_apps(
        fields=['full_name', 'school_year', 'gender'])

    with open(os.path.join('AppReading', 'applicant_list.csv'), 'w') as f:
        writer = csv.writer(f)

        for app in apps:
            writer.writerow([
                applicant_ids[app['full_name']], app['full_name'],
                app['school_year'], app['gender']
            ])
예제 #4
0
def make_app_pdfs(applicant_ids, anonymous):
    apps = wufoo_entry_loader.load_apps(fields=['full_name', 'questions'])
    for i, app in enumerate(apps):
        if i != 0 and i % 10 == 0:
            print('Made {}/{} Application PDFs'.format(i, len(apps)))

        app_name = app['full_name']
        app_id = applicant_ids[app_name]
        if anonymous:
            pdf_title = 'Applicant #{}'.format(app_id)
            file_name = app_id + '.pdf'
        else:
            pdf_title = '{} (#{})'.format(app_name, app_id)
            file_name = app_name + '.pdf'

        wufoo_pdf = WufooPDF()
        wufoo_pdf.append(app['questions'], pdf_title)
        wufoo_pdf.save(os.path.join('apps/', file_name))
    def make_app_packet(self):
        def get_questions(name, name_field, entries):
            for entry in entries:
                if entry[name_field] == name:
                    return entry['questions']
            raise KeyError

        packet = wufoo_pdf.WufooPDF()
        packet.add_cover_page(self.reader + '\'s Application Packet')

        apps = wufoo_entry_loader.load_apps(fields=['full_name', 'questions'])
        references = wufoo_entry_loader.load_references(
            fields=['applicant_full_name', 'questions'])

        for (name, id_) in self.assigned_applicants:
            app_questions = get_questions(name, 'full_name', apps)
            packet.append(app_questions[:-3], 'Applicant #{}'.format(id_))
            packet.add_cover_page(
                'STOP!\nGive a pre-special sauce score before looking at Special Sauce and the letter of reference.'
            )
            packet.append(app_questions[-3:])

            try:
                reference_questions = get_questions(name,
                                                    'applicant_full_name',
                                                    references)
                packet.append(reference_questions,
                              'Reference for Applicant #{}'.format(id_))
            except KeyError:
                packet.add_cover_page(
                    'Reference for Applicant #{} is missing.'.format(id_))
            packet.add_cover_page(
                'STOP!\nGive a post-reference score (including special sauce) before continuing on to the next application.'
            )

        packet.save(
            os.path.join(self.reader_dir,
                         self.reader + ' Application Packet.pdf'))
예제 #6
0
def main():
    print(make_color('This script should output no issues (besides missing references) ' +\
            'before you continue running other scripts.', 'red'))
    print()

    # submission_time allows us to differentiate entries
    apps = wufoo_entry_loader.load_apps(fields=[
        'first_name', 'last_name', 'full_name', 'email', 'submission_time'
    ])
    references = wufoo_entry_loader.load_references(fields=[
        'applicant_first_name', 'applicant_last_name', 'applicant_full_name',
        'reference_first_name', 'reference_last_name', 'reference_full_name',
        'submission_time'
    ])

    ### DUPLICATE APPS ###

    duplicate_apps = unique_tuples(join_tables(
        apps, apps,
        lambda a1, a2: a1['full_name'] == a2['full_name'] and a1 != a2),
                                   key=lambda app: app['full_name'])

    for (name, matches) in duplicate_apps.items():
        print('Applicant {} submitted {} written applications.'.format(
            make_color(name, 'red'), len(matches)))

    if len(duplicate_apps) > 0: print()

    ### DUPLICATE REFERENCES ###

    duplicate_references = unique_tuples(
        join_tables(
            references, references, lambda r1, r2: r1['applicant_full_name'] ==
            r2['applicant_full_name'] and r1 != r2),
        key=lambda reference: reference['applicant_full_name'])

    for (name, duplicates) in duplicate_references.items():
        print('Applicant {} has multiple letters of reference from {} and {}.'.
              format(
                  make_color(name, 'red'),
                  make_color(
                      ', '.join(reference['reference_full_name']
                                for reference in duplicates[:-1]), 'red'),
                  make_color(duplicates[-1]['reference_full_name'], 'red')))

    if len(duplicate_references) > 0: print()

    # This removes all matched apps and references, so we don't have to deal with them below.
    have_references = join_tables(
        apps, references,
        lambda a, r: a['full_name'] == r['applicant_full_name'])
    for (a, r) in have_references:
        if a in apps:
            apps.remove(a)
        if r in references:
            references.remove(r)

    ### REFERENCES WITHOUT APPS ###

    found = False
    for reference in references:
        matching_apps = join_tables(
            [reference], apps, lambda r, a: partial_match(a, r)
        )  # we don't want to include partial matches since those printed below
        if len(matching_apps) == 0:
            found = True
            print(
                'We have a letter of reference for {} (written by {}) but no matching application.'
                .format(make_color(reference['applicant_full_name'], 'blue'),
                        reference['reference_full_name']))

    if found:
        print()
        found = False

    ### APPS WITHOUT REFERENCES ###

    for app in apps:
        matching_references = join_tables([app], references,
                                          lambda a, r: partial_match(a, r))
        if len(matching_references) == 0:
            found = True
            print(
                'We have an application for {} ({}) but no letter of reference.'
                .format(make_color(app['full_name'], 'cyan'), app['email']))

    if found:
        print()
        found = False

    ### PARTIAL REFERENCE MATCHES ###

    for app in apps:
        matches = join_tables([app], references,
                              lambda a, r: partial_match(a, r))
        if len(matches) > 0:
            if not found:
                print(make_color('We can\'t find matching letters of reference for applicants below, but do have references for people\n' +\
                    'with partially matching names (first or last name matches).', 'bold'))
                found = True
            print('{} ({}): {}'.format(
                make_color(app['full_name'], 'green'), app['email'],
                ', '.join('{} (written by {})'.format(
                    make_color(match[1]['applicant_full_name'], 'green'),
                    match[1]['reference_full_name']) for match in matches)))