Election Web Service
First draft of the Election Web Service is up and running. I’ve implemented Plurality, IRV, Ranked Pairs, the Schulze Method, Plurality at Large, and STV.
The source code is up on GitHub for anyone interested in implementing additional voting systems or using them as Python libraries. For those that just want to send requests to a server, I have one responding to posts at vote.cognitivesandbox.com (note that the server only response to HTTP POSTs and works solely on JSON encoded requests).
Hopefully this takes some of the burden out of implementing polls and whatnot. You take care of storing the ballots, I’ll show you who won (and why).
Example Request
{
"votingSystem": "stv",
"ballots": [
{"count": 4, "ballot": ["orange"]},
{"count": 2, "ballot": ["pear", "orange"]},
{"count": 8, "ballot": ["chocolate", "strawberry"]},
{"count": 4, "ballot": ["chocolate", "sweets"]},
{"count": 1, "ballot": ["strawberry"]},
{"count": 1, "ballot": ["sweets"]}
],
"winners": 3
}
Example Response
{
"rounds": [
{
"tallies": {
"orange": 4.0,
"strawberry": 1.0,
"chocolate": 12.0,
"pear": 2.0,
"sweets": 1.0
},
"quota": 6,
"winners": ["chocolate"],
},
{
"tallies": {
"orange": 4.0,
"strawberry": 5.0,
"pear": 2.0,
"sweets": 3.0
},
"quota": 5,
"winners": ["strawberry"],
},
{
"tallies": {
"orange": 4.0,
"sweets": 3.0,
"pear": 2.0
},
"quota": 5,
"loser": "pear"
},
{
"tallies": {
"orange": 6.0,
"sweets": 3.0
},
"quota": 5,
"winners": ["orange"],
}
],
"winners": ["orange", "strawberry", "chocolate"]
}