GithubHelp home page GithubHelp logo

osvtac / osv-results-reporter Goto Github PK

View Code? Open in Web Editor NEW
9.0 6.0 4.0 1.58 MB

Open Source Voting Results Reporter (ORR) - election results report generator (HTML/PDF/XLSX)

License: GNU General Public License v3.0

Python 57.49% HTML 39.60% Dockerfile 0.37% Shell 0.51% CSS 1.27% JavaScript 0.76%
election san-francisco voting government open-source-voting

osv-results-reporter's People

Contributors

carl3 avatar catrope avatar cjerdonek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

osv-results-reporter's Issues

Indicate success/failure of measures

Thanks to #16, we now have contest.success for measures, which indicates whether the measure passed or failed. We could indicate this with a green check / red X, or some other visual indication.

Data model should include result stats for each RCV round

"Result stats" (the number of registered voters, total ballots, undervotes, overvotes, etc) are currently only recorded for the overall contest. For RCV contests, some of these stats change from round to round, and should be recorded separately for each round. Specifically, we need the number of continuing ballots, the number of exhausted ballots, and the number of ballots "exhausted" by overvotes.

Indicate vote threshold where relevant

For contests that can pass or fail and have a vote threshold (measures, retentions, recalls), we should:

  • Print something like "This measure requires 50%+1 affirmative votes to pass" (or 55%, or 66โ…”%) above/below the measure
  • Draw the dotted line at the threshold

Thanks to #16 this data is now available

Build dynamic UI to view per-precinct/neighborhood results

Now that we have the TSV files, we can use JavaScript to build a much nicer UI for the detailed results page than the giant table we have there right now. We could let the user select a precinct/neighborhood/district, and see the results for that area.

Display runoff information

The data added in #16 includes contest.runoff_date and contest.runoff_type. Display this information above/below contests where applicable.

Need helper function to return numeric approval required

The contest.approval_required exists for yes/no votes (measures, recall, retention) and is a printable string, e.g. "{contest.approval_required} Approval Required" is meaningful. [I would advocate simpler representations rather than 50%+1 and long message.] Values are "Majority", \d/\d or \d+%.

In order to draw a threshold line, a property or filter, e.g. approval_required_fraction, should return a numeric value, e.g. .5, .55, .666666666667 so the threshold line can be drawn.

Note for a conditional runoff, there is a 50% threshold (e.g. Superior Court judges), if a candidate gets >50%, then there is no runoff. There is one city in CA that has a conditional runoff for city council with vote for more than 1. In that case, candidates that get >50% of ballots cast are elected, any remaining under 50%, the top n+1 advance to the runoff, where n is remaining seats to be filled. The detailed winning status has this info for all choices.

Excess whitespace in html output

There is lots of unnecessary whitespace in the generated html, making file storage and transfer inefficient. The templates should use {%- instead of {% to remove whitespace used for template readability. The trim_blocks and lstrip_blocks options can also be enabled.

Remove dotted line where not applicable/useful

Right now we draw the dotted line for every contest, whether or not it makes sense to draw it, and always at 50%. For contests where no choice got 50%, we draw the dotted line outside the table, and then hide it with CSS (overflow: hidden).

Instead, we should only draw the dotted line for:

  • Yes/no contests (measures, retentions, recalls), and draw it at the approval threshold (see also #19).
  • Single-winner RCV contests (the winner's final round percentage will always be >50%)
  • Maybe also for single-winner two-choice contests? (E.g. general elections after a top-2 primary)

Distinguish between choices and result stats in per-precinct data

The data model used by the detailed reports page (templates/test-minimal/extra/results-detail.html) does not distinguish between "real" choices (e.g. candidates or yes/no) and result stats (e.g. undervotes, overvotes). To make this page look better, the template will have to know the difference.

Make "winner" a candidate attribute

Right now, the data model doesn't indicate whether a candidate is a winner. This can't be computed (easily) from the vote totals, because some elections have multiple winners (e.g. school board), and some ballot measures require more than 50% (e.g. special tax measures require 2/3). Whether a candidate has won should be an attribute in the input data of the results reporter.

Distinguish between individual precincts and aggregations of precincts in result-detail data model

The data model used by the detailed reports page (templates/test-minimal/extra/results-detail.html) breaks down vote totals by precinct, neighborhood and district, but it doesn't distinguish between these things. At the very least, it should distinguish between individual precincts and aggregations thereof, and ideally it would further distinguish different types of aggregations (supe districts, asm/sen/cong districts, neighborhoods, "all")

Generate JSON, CSV or other machine-readable output

We already generate an HTML table for every contest with per-precinct vote totals. We could export these tables as JSON/CSV/TSV. It would also be nice to have rotated versions of this: a table for each precinct with per-contest totals.

Chris points out that the entire vote total matrix wouldn't be that large (~2MB), so we could also generate a single file that has every vote total for every candidate/choice for every contest in every precinct.

Use contest.no_voter_precincts somehow

contest.no_voter_precincts (added by #16) is a list of precinct IDs that have no registered voters. Figure out where we might want to use this information, and use it. We could hide these in per-precinct result tables, for example.

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.