Giter Club home page Giter Club logo

adem-analyzer's Introduction

ADEM ballot analyzer

Goal

This tool's purpose is to independently audit the 2021 ADEM election.

ADEM is the California Democratic Party's Assembly District Election Meeting. Every year, people in every Assembly District run to be an Assembly District Delegate (ADD) to the Democratic Party. Candidates and voters must be registered Democrats.

In 2021, the ADEM was all-vote-by-mail because of the covid pandemic, and it was… kind of a mix. The overall design was good, but overly-ambitious deadlines and ballots that arrived in some voters' hands after the deadline to return them have disenfranchised an unknown number of voters, and some folks have found results in their AD to be surprising, even questionable.

The Party is posting all of the scanned ballots as PDFs. This tool will analyze the distribution of ballots and, with an appropriate ballot scanner, the votes therein. It will generate a searchable index of voter ID numbers so voters can see whether their ballot was received and whether it was counted.

This tool will also compare its own results to the results posted by the Party.

Usage

analyze.py expects a variety of input files in a certain layout, in the same directory/folder as the tool.

  • ballots/
    • ballots/AD 99
      • ballots/AD 99/AD 99 Invalid Ballots/
      • ballots/AD 99/AD 99 Valid Ballots/
        • CADEM_….pdf
  • posted-results/
    • ad-99.html

analyze.py will create as output:

  • output/report.txt: A plain-text report of its findings, based at minimum upon the distribution of files in the ballots/ directory, and comparison of the votes found in those ballots to the posted results if possible.
  • output/posted-results.csv: A comma-separated values file containing a list of candidates and their vote totals from the posted results, with the following columns:
    • relative pathname (e.g., posted-results/ad-99.html)
    • Assembly district (e.g., 99)
    • candidate name
    • SIF or OSIF
    • the number of votes they got
    • won if they were a top-seven vote-getter in their gender category; otherwise lost
    • eboard if they ran for and won a seat on the Executive Board; otherwise empty
  • output/ballot-index.csv: A comma-separated values file containing a list of every ballot found, with the following columns:
    • relative pathname (e.g., ballots/AD 99/AD 99 Valid Ballots/CADEM_…_99.pdf)
    • Assembly district (e.g., 99)
    • voter ID number (note: ? will be present in place of each digit that couldn't be scanned or wasn't marked)
    • valid, invalid-overvote, invalid-no-voter-ID, or invalid-unknown

How can I help?

Take a look at the issues and see what needs working on.

This suite is written in Python 3.

adem-analyzer's People

Contributors

boredzo avatar

Watchers

 avatar  avatar  avatar

adem-analyzer's Issues

Ballot scanning

We probably shouldn't reinvent the wheel and write a whole new ballot-scanner; there may be existing open-source projects that can accurately detect the optical-scan marks, and we should use one of those if possible.

Some voters may have filled in bubbles completely, or made a mark in the bubble but not even partially “filled” the bubble in any sense.

We need two things:

  • Scanning the voter ID number (ten columns, one per digit)
  • Scanning the candidate selections (as many as 60 on a page)

If necessary, the voter ID number can be represented as a series of 10-candidate “races”, and the “winners” converted into the digits of the ballot's voter ID number in a post-processing step.

Tool to diff posted-results CSVs

Brandon Harami (a candidate) tweeted today that the posted results have changed, with a couple of screenshots. I grabbed copies of the pages yesterday and just downloaded a fresh set, so it'd be possible for me to diff them.

#4 may include a tool to convert the HTML files to digestible CSVs; this issue covers a new tool to diff those CSVs and report:

  • which candidates' vote totals changed
  • the old/delta/new numbers
  • which candidates entered or exited the top 7 for their gender category (i.e., became a winner or loser)

Option to generate CSV from HTML pages in specified directory

Rather than only assuming the HTML pages are in a directory with a constant name, there should be an option to specify a path to that directory.

Using this option should foreclose other analyses like the ballot inventory (though there should probably be similar options for those analyses, and using multiple such options should deliver whatever analyses are requested).

There should also be an option to direct the CSV output to a file at a specified path.

Ingest posted results and analyze/compare them

If you have a copy of all the Assembly District pages with the posted results (including vote counts!) on them, it should be possible to compare those vote counts to our own counts of votes found in valid ballots.

This will likely involve using Beautiful Soup to scrape the HTML in each file.

Tool to fill in voter ID numbers in the index

analyze.py generates a CSV file where one column is the voter ID number scanned from each ballot (depending on #1). If the scan yielded a partial number (either because it was incompletely filled in or couldn't be scanned confidently), a human will need to look at that ballot to see whether any missing digits can be filled in.

There should be a tool with usage like:

./update-voter-ID.py path/to/ballot.pdf correct-voter-ID-number

that will update the appropriate row for that ballot in the CSV.

The same tool could have an option --list-needed that lists off ballots with partial or missing voter ID numbers.

Report generation

There needs to be a tool, analyze.py, that generates a report summarizing the results (as best it can, depending on whether #1 is present) and an index of ballots by Assembly district, voter ID number, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.