Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update file layout #3

Open
hancush opened this issue Feb 21, 2023 · 0 comments
Open

Update file layout #3

hancush opened this issue Feb 21, 2023 · 0 comments

Comments

@hancush
Copy link
Member

hancush commented Feb 21, 2023

new layout, who dis?

class MunicipalResultParser(FixedWidthParser):
    """
    Summary Export File Format           Length    Column Position

    Record type                          1         1
    Global contest order                 5         2-6
    Global choice order                  5         7-11
    # Completed precincts                5         12-16
    Votes                                7         17-23
    Contest Total registration           7         24-30
    Contest Total ballots cast           7         31-37
    Contest Name                        70         38-107
    Choice Name                         50         108-157
    Choice Party Name                   50         158-207
    Choice Party Abbreviation            3         208-210
    District Type Name                  50         211-260
    District Type Global Order           5         261-265
    # of Eligible Precincts              5         266-270
    Vote For                             2         271-272

    Source: https://chicagoelections.gov/results/ap/SummaryExportFormat.xls
    """
    record_type = OneIndexedFixedWidthField(1, 1, transform=int)
    contest_code = OneIndexedFixedWidthField(2, 5, transform=int)
    candidate_number = OneIndexedFixedWidthField(7, 5, transform=int)
    precincts_reporting = OneIndexedFixedWidthField(12, 5, transform=int)
    vote_total = OneIndexedFixedWidthField(17, 7, transform=int)
    race_total_registration = OneIndexedFixedWidthField(24, 7, transform=int)
    race_total_ballots_cast = OneIndexedFixedWidthField(31, 7, transform=int)
    race_name = OneIndexedFixedWidthField(38, 70)
    candidate_name = OneIndexedFixedWidthField(108, 50, transform=replace_single_quotes)
    party = OneIndexedFixedWidthField(158, 50)
    party_abbreviation = OneIndexedFixedWidthField(208, 3)
    reporting_unit_name = OneIndexedFixedWidthField(211, 50)
    reporting_unit_code = OneIndexedFixedWidthField(261, 5, transform=int)
    precincts_total = OneIndexedFixedWidthField(266, 5, transform=int)
    vote_for = OneIndexedFixedWidthField(271, 2, transform=int)

Update the summary module and README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant