hbiede / Ranked-Choice-Voting

A vote parser for ranked choice voting elections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test and Lint codecov Ruby Style Guide

Rank-Choice-Voting

A Ruby tool to calculate the winner in a ranked choice voting election

Requirements

Usage

Installation

git clone https://github.com/hbiede/Ranked-Choice-Voting.git
cd Voter-Tokens

Setup

The CSV used as input is expected to have all columns with a series of columns representing the candidates. The header row should contain candidate names and the all subsequent rows should contain the preference ranking for each candidate by a single voter (rank 1 is most preferred and preference decreases as rank increases). Note: The candidates will be sorted in ascending order for each vote record, so a vote record where Candidate A gets rank 1 and Candidate B gets rank 2 is equivalent to a vote record where Candidate A gets rank 4 and Candidate B gets rank 5.

Parse Ballots

Download the CSV of your ballots to data/votes.csv and then run the following command:

ruby vote_parser.rb data/votes.csv

Parse Ballots from Google Sheets

If your ballots are stored on the first sheet of a Google Sheet in range B1:G, you can download and parse votes all in one command:

make URL="https://docs.google.com/spreadsheets/d/DOCUMENT_ID/export?exportFormat=csv&range=B1:G"

Note: you must change DOCUMENT_ID to the alphanumeric code in the link to your Google Sheet. The Sheet must be set as viewable by anyone with the link.

About

A vote parser for ranked choice voting elections

License:MIT License


Languages

Language:Ruby 98.5%Language:Makefile 1.5%