Bladeren bron

First commit

main
Adrian Short 1 jaar geleden
commit
25abf3dc73
5 gewijzigde bestanden met toevoegingen van 3040 en 0 verwijderingen
  1. +20
    -0
      LICENSE
  2. +65
    -0
      README
  3. +2038
    -0
      elections.json
  4. +781
    -0
      elections.txt
  5. +136
    -0
      twohorserace

+ 20
- 0
LICENSE Bestand weergeven

@@ -0,0 +1,20 @@
The Lil License v1

Copyright (c) 2022 Adrian Short

Permission is hereby granted by the authors of this software, to any person,
to use the software for any purpose, free of charge, including the rights
to run, read, copy, change, distribute and sell it, and including usage rights
to any patents the authors may hold on it, subject to the following conditions:

This license, or a link to its text, must be included with all copies of
the software and any derivative works.

Any modification to the software submitted to the authors may be incorporated
into the software under the terms of this license.

The software is provided "as is", without warranty of any kind, including
but not limited to the warranties of title, fitness, merchantability and
non-infringement. The authors have no obligation to provide support or updates
for the software, and may not be held liable for any damages, claims or other
liability arising from its use.

+ 65
- 0
README Bestand weergeven

@@ -0,0 +1,65 @@
TWO-HORSE RACE
==============

Generates a human-readable plain text stream of election results from JSON input.


Usage
-----

Assuming `twohorserace` is in your $PATH and executable:

Read JSON from a file:

$ twohorserace results.json

Read JSON from STDIN:

$ cat results.json | twohorserace --


Installation
------------

Tested and working with Ruby 3.1.2, which is currently the latest stable
release.

Tested and working with Ruby 2.6.10, which is currently the oldest
version supported by the Ruby project.

Will probably work with earlier versions.

There are no other dependencies.

No gems outside the standard library or databases are used. No
environment variables.

There isn't a Gemfile. You don't need Bundler.


Example files
-------------

elections.json is an example input file.
elections.txt is an example output file.

These files are for demonstration purposes only. Do not rely on them as
accurate representations of actual election results.


Roadmap
-------

Write a man page.


Repository
----------

https://git.adrianshort.org/adrian/twohorserace


Maintainer
----------

Adrian Short <adrian@adrianshort.org>

+ 2038
- 0
elections.json
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 781
- 0
elections.txt Bestand weergeven

@@ -0,0 +1,781 @@
Sutton Council
Elections: 3

--------------------------------------------------------------------------------
FULL COUNCIL ELECTION 2022
5 May 2022
The whole council is elected every four years.
55 seats were elected in 20 wards.
--------------------------------------------------------------------------------

BEDDINGTON

Nicholas Mattey Independent 1231 39% elected
Timothy Foster Independent 1162 37% elected
Jillian Green Independent 1150 37% elected
Subramaniam Kuhanathan Liberal Democrats 706 22%
Heather Howell Local Conservatives 686 22%
Julia Russell Local Conservatives 619 19%
Alison Huneke Local Conservatives 608 19%
Martin Thompson Liberal Democrats 599 19%
Thomas Badham Liberal Democrats 598 19%
Margaret Hughes Labour Party 589 18%
John Keys Labour Party 516 16%
Patricia McCarthy Labour Party 488 15%
Michael Boulton Green Party 352 11%

Total: 9304

Rejected ballots: 4


Votes by party
--------------
Independent 3543 38%
Local Conservatives 1913 20%
Liberal Democrats 1903 20%
Labour Party 1593 17%
Green Party 352 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Beddington+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/96586419-7d6e-30e5-fe14-a9b3c2e34f7e?t=1649236579001
https://www.sutton.gov.uk/-/beddington-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=97&RPID=7861100

--------------------------------------------------------------------------------

BELMONT

David Hicks Local Conservatives 1537 46% elected
Neil Garratt Local Conservatives 1531 46% elected
Jane Pascoe Local Conservatives 1414 42% elected
Samantha Bourne Liberal Democrats 1244 37%
Dean Juster Liberal Democrats 1182 35%
Samuel Weatherlake Liberal Democrats 1005 30%
Gale Blears Labour Party 586 17%
Alan Aylward Labour Party 535 16%
Marian Wingrove Labour Party 474 14%
Duncan Lambe Green Party 411 12%

Total: 9919

Rejected ballots: 16


Votes by party
--------------
Local Conservatives 4482 45%
Liberal Democrats 3431 34%
Labour Party 1595 16%
Green Party 411 4%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Belmont+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/abf1ef76-dbac-539c-b9ab-5e6998733a6a?t=1649236301778
https://www.sutton.gov.uk/-/belmont-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=98&RPID=7861115

--------------------------------------------------------------------------------

CARSHALTON CENTRAL

Isabel Carvalho Araujo Liberal Democrats 2031 52% elected
Jake Short Liberal Democrats 1906 49% elected
Andrew Jenner Liberal Democrats 1688 43% elected
Verity Thomson Green Party 1294 33%
Melissa Zanocco Local Conservatives 1141 29%
Ethan Smith Local Conservatives 1088 28%
Gillian Sparks Local Conservatives 1083 27%
Marilynne Burbage Labour and Co-operative Party 491 12%
Anthony Thorpe Labour and Co-operative Party 474 12%
Peter Turner Labour and Co-operative Party 310 7%
Ashley Dickenson Christian Peoples Alliance 132 3%

Total: 11638

Rejected ballots: 10


Votes by party
--------------
Liberal Democrats 5625 48%
Local Conservatives 3312 28%
Green Party 1294 11%
Labour and Co-operative Party 1275 10%
Christian Peoples Alliance 132 1%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Carshalton+Central+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/bc7111a5-7955-103b-2ab1-39b607adf166?t=1649236260075
https://www.sutton.gov.uk/-/carshalton-central-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=99&RPID=7861121

--------------------------------------------------------------------------------

CARSHALTON SOUTH AND CLOCKHOUSE

Moira Butt Local Conservatives 1698 47% elected
Timothy Crowley Local Conservatives 1669 47% elected
Amy Haldane Liberal Democrats 1617 45% elected
Lynne Fletcher Local Conservatives 1544 43%
Brendan Hudson Liberal Democrats 1523 42%
Noormahamod Sumun Liberal Democrats 1317 37%
Hannah Smith Green Party 387 10%
John Clay Labour Party 329 9%
Michael McLoughlin Labour Party 286 8%
Roberta Lambert Labour Party 279 7%

Total: 10649


Votes by party
--------------
Local Conservatives 4911 46%
Liberal Democrats 4457 41%
Labour Party 894 8%
Green Party 387 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Carshalton+South+and+Clockhouse+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/f9b08d20-7102-67e4-92c3-b2f9f10a1c5e?t=1649236366686
https://www.sutton.gov.uk/-/carshalton-south-and-clockhouse-result
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=100&RPID=7861133

--------------------------------------------------------------------------------

CHEAM

Eric Allen Local Conservatives 1747 51% elected
Tony Shields Local Conservatives 1680 49% elected
Vanessa Udall Local Conservatives 1635 48% elected
Ting Chui Liberal Democrats 1213 35%
Ben Devlin Liberal Democrats 1168 34%
Harry Legge Liberal Democrats 1002 29%
Sarah McGuinness Labour Party 486 14%
John Triggs Green Party 466 13%
Simon Muir Labour Party 373 11%
George Richards Labour Party 364 10%

Total: 10134

Rejected ballots: 17


Votes by party
--------------
Local Conservatives 5062 49%
Liberal Democrats 3383 33%
Labour Party 1223 12%
Green Party 466 4%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Cheam+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/7951fe98-e273-c755-a13a-5a67d47f64e2?t=1649236337138
https://www.sutton.gov.uk/-/cheam-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=101&RPID=7861139

--------------------------------------------------------------------------------

HACKBRIDGE

David Tchilingirian Labour Party 1029 55% elected
Sheldon Vestey Labour Party 951 50% elected
Joanna Sherman Liberal Democrats 543 29%
Alexander Vicente-Machado Liberal Democrats 494 26%
David Ruthven-Murray Local Conservatives 365 19%
Emma Scully Local Conservatives 353 18%

Total: 3735

Rejected ballots: 14


Votes by party
--------------
Labour Party 1980 53%
Liberal Democrats 1037 27%
Local Conservatives 718 19%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Hackbridge+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/37cfd391-64b6-55f1-4ddd-4f6d8980545a?t=1649236402178
https://www.sutton.gov.uk/-/hackbridge-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=102&RPID=7861165

--------------------------------------------------------------------------------

NORTH CHEAM

Michael Dwyer Local Conservatives 1640 47% elected
James McDermott-Hill Local Conservatives 1628 47% elected
Paramalingham Vivehanandha Local Conservatives 1600 46% elected
Laura Cooney Liberal Democrats 1237 36%
Jason Stone Liberal Democrats 1167 33%
Carl Nichols Liberal Democrats 1134 33%
Jane Davies Labour Party 549 15%
David Owen Labour Party 453 13%
Raymond Eveleigh Labour Party 446 12%
Christopher Beard Green Party 347 10%
Renos Costi Independent 105 3%

Total: 10306

Rejected ballots: 18


Votes by party
--------------
Local Conservatives 4868 47%
Liberal Democrats 3538 34%
Labour Party 1448 14%
Green Party 347 3%
Independent 105 1%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/North+Cheam+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/39752e0a-b14f-b924-88f5-69a5bf1c39d3?t=1649236730645
https://www.sutton.gov.uk/-/north-cheam-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=103&RPID=7861171

--------------------------------------------------------------------------------

SOUTH BEDDINGTON AND ROUNDSHAW

Jonathan Pearce Local Conservatives 1232 42% elected
Edward Joyce Liberal Democrats 1201 40% elected
Patrick Magnus Local Conservatives 1188 40% elected
Ryan Stoneman Local Conservatives 1183 40%
Drew Heffernan Liberal Democrats 1166 39%
Srividhya Koteeswaran Liberal Democrats 1101 37%
Jacqueline McLoughlin Labour Party 434 14%
David Towler Labour Party 377 12%
Kiran Nawaz Labour Party 372 12%
Helene McDonagh Green Party 192 6%
Hannah Hamilton Independent 147 5%
Katie Bickel Independent 103 3%
Joseph Prowse Independent 70 2%
Steven Kelleher Social Democratic Party 33 1%

Total: 8799

Rejected ballots: 7


Votes by party
--------------
Local Conservatives 3603 40%
Liberal Democrats 3468 39%
Labour Party 1183 13%
Independent 320 3%
Green Party 192 2%
Social Democratic Party 33 0%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/South+Beddington+and+Roundshaw+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/8afd08b1-9082-d002-d7c3-5ec44d62f624?t=1649236465460
https://www.sutton.gov.uk/-/south-beddington-and-roundshaw-result
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=104&RPID=7861046

--------------------------------------------------------------------------------

ST HELIER EAST

Paul Cole Liberal Democrats 643 41% elected
Gemma Munday Liberal Democrats 631 40% elected
Sarah Gwynn Labour Party 499 32%
Grace Platt Labour Party 439 28%
Matthew Drew Local Conservatives 386 24%
Ann Page Local Conservatives 370 23%
Nicola Williams Green Party 121 7%

Total: 3089

Rejected ballots: 12


Votes by party
--------------
Liberal Democrats 1274 41%
Labour Party 938 30%
Local Conservatives 756 24%
Green Party 121 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/St+Helier+East+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/7b34fed8-4e8d-14ab-addd-ed9fe952901f?t=1649236437455
https://www.sutton.gov.uk/-/st-helier-east-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=103&RPID=7861171

--------------------------------------------------------------------------------

ST HELIER WEST

Shiela Berry Labour Party 848 35% elected
Steven Alvarez Local Conservatives 823 34% elected
Wendy Clark Local Conservatives 808 34% elected
Paul McCarthy Labour Party 776 32%
Ethan Windsor Local Conservatives 751 31%
Omavally Narayana Pillay Liberal Democrats 729 30%
Peter Chubb Liberal Democrats 703 29%
Nicholas Diamantis Labour Party 702 29%
Jean Crossby Liberal Democrats 702 29%
Peter Mead Green Party 243 10%

Total: 7085

Rejected ballots: 15


Votes by party
--------------
Local Conservatives 2382 33%
Labour Party 2326 32%
Liberal Democrats 2134 30%
Green Party 243 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/St+Helier+West+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/595d24cf-1656-1af5-3a91-07842d1996dd?t=1649236494976
https://www.sutton.gov.uk/-/st-helier-west-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=106&RPID=7861198

--------------------------------------------------------------------------------

STONECOT

Robert Beck Liberal Democrats 996 44% elected
Muttucumaru Sahathevan Liberal Democrats 936 41% elected
Paul Campbell Local Conservatives 852 38%
William Townsend Local Conservatives 795 35%
Victoria Richer Labour Party 440 19%
Victoria Wright Labour Party 302 13%
Karin Andrews Jashapara Green Party 137 6%

Total: 4458

Rejected ballots: 12


Votes by party
--------------
Liberal Democrats 1932 43%
Local Conservatives 1647 36%
Labour Party 742 16%
Green Party 137 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Stonecot+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/1107dcc3-c42e-88d7-a711-d15ef34ab4d3?t=1649236543726
https://www.sutton.gov.uk/-/stonecot-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=107&RPID=7861204

--------------------------------------------------------------------------------

SUTTON CENTRAL

David Bartolucci Liberal Democrats 1228 44% elected
Edward Parsley Liberal Democrats 1102 40% elected
Cryss Mennaceur Liberal Democrats 1038 37% elected
John McGeachy Labour Party 858 31%
Kerrie Peek Labour Party 834 30%
Natalie Wright Labour Party 816 29%
Barry Russell Local Conservatives 722 26%
Terence Woods Local Conservatives 657 23%
Venu Sood Local Conservatives 643 23%
Peter Friel Green Party 351 12%

Total: 8249

Rejected ballots: 15


Votes by party
--------------
Liberal Democrats 3368 40%
Labour Party 2508 30%
Local Conservatives 2022 24%
Green Party 351 4%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Sutton+Central+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/848aa70d-1e4f-2188-cf14-037093075a08?t=1649236630475
https://www.sutton.gov.uk/-/sutton-central-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=108&RPID=7861210

--------------------------------------------------------------------------------

SUTTON NORTH

Ruth Dombey Liberal Democrats 1343 41% elected
Sam Cumber Liberal Democrats 1342 41% elected
Bryony Linsday-Charlton Local Conservatives 1308 40% elected
Aamir Haroon Local Conservatives 1263 39%
Ramachandran Mathanmohan Local Conservatives 1241 38%
Christopher Hawton Liberal Democrats 1189 36%
Gregory Charles Labour Party 590 18%
Teresa O'Brien Labour Party 538 16%
Lyndon Edwards Labour Party 509 15%
Phoebe Connell Green Party 380 11%

Total: 9703

Rejected ballots: 13


Votes by party
--------------
Liberal Democrats 3874 39%
Local Conservatives 3812 39%
Labour Party 1637 16%
Green Party 380 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Sutton+North+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/ba9a0e60-85bd-391f-966b-c19eb4a94eee?t=1649236691762
https://www.sutton.gov.uk/-/sutton-north-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=109&RPID=7861216

--------------------------------------------------------------------------------

SUTTON SOUTH

Richard Clifton Liberal Democrats 1718 49% elected
Patricia Fivey Liberal Democrats 1691 48% elected
Louise Phelan Liberal Democrats 1521 43% elected
Chandra Alapati Local Conservatives 1434 41%
Victoria Shields Local Conservatives 1302 37%
Arif Syed Local Conservatives 1179 33%
Tessa Cornell Labour Party 579 16%
Stephen Blears Labour Party 550 15%
Graham Terrell Labour Party 461 13%

Total: 10435

Rejected ballots: 24


Votes by party
--------------
Liberal Democrats 4930 47%
Local Conservatives 3915 37%
Labour Party 1590 15%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Sutton+South+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/bace4f2e-721d-8f34-0dae-da3de14924cb?t=1649236662916
https://www.sutton.gov.uk/-/sutton-south-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=110&RPID=7861225

--------------------------------------------------------------------------------

SUTTON WEST AND EAST CHEAM

Luke Taylor Liberal Democrats 1572 47% elected
Christopher Woolmer Liberal Democrats 1519 45% elected
Qasim Esak Liberal Democrats 1505 45% elected
Lily Bande Local Conservatives 1369 41%
Catherine Gray Local Conservatives 1331 39%
Mukesh Rao Local Conservatives 1266 38%
Nicolas Carter Liberal Democrats 552 16%
Chibweka Kavindele Labour Party 452 13%
Carlos Thibaut Labour Party 427 12%

Total: 9993

Rejected ballots: 15


Votes by party
--------------
Liberal Democrats 5148 51%
Local Conservatives 3966 39%
Labour Party 879 8%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Sutton+West+and+East+Cheam+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/2d7655ce-1835-2e3e-5327-1d57043a1595?t=1649236764567
https://www.sutton.gov.uk/-/sutton-west-east-cheam-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=111&RPID=7861236

--------------------------------------------------------------------------------

THE WRYTHE

Bobby Dean Liberal Democrats 1492 47% elected
Colin Stears Liberal Democrats 1337 42% elected
Patrick Ogbonna Liberal Democrats 1225 39% elected
Edward Dwight Local Conservatives 1175 37%
Robert Okpuru Local Conservatives 1138 36%
Daisy Pierce Local Conservatives 1084 34%
David Grant Labour Party 534 17%
Margaret Thomas Labour Party 488 15%
Cecil Tate Labour Party 468 15%
Faye Burnett Green Party 394 12%

Total: 9335

Rejected ballots: 9


Votes by party
--------------
Liberal Democrats 4054 43%
Local Conservatives 3397 36%
Labour Party 1490 15%
Green Party 394 4%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/The+Wrythe+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/036c2f84-5086-1eb4-2050-6fea5414178f?t=1649236792221
https://www.sutton.gov.uk/-/the-wrythe-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=112&RPID=7861242

--------------------------------------------------------------------------------

WALLINGTON NORTH

Sunita Gordon Liberal Democrats 1502 45% elected
Marian James Liberal Democrats 1451 43% elected
Barry Lewis Liberal Democrats 1332 40% elected
Joel Freeman Local Conservatives 785 23%
Alexander Dabysing Local Conservatives 773 23%
Christopher Wortley Local Conservatives 716 21%
Kingsley Hamilton Independent 592 17%
Pamela Marsh Independent 581 17%
Katie Travers Independent 560 16%
Mary Towler Labour Party 522 15%
Marcia Turner Labour Party 388 11%
Ahmad Wattoo Labour Party 375 11%
Christopher Donnelly Green Party 361 10%

Total: 9938

Rejected ballots: 11


Votes by party
--------------
Liberal Democrats 4285 43%
Local Conservatives 2274 22%
Independent 1733 17%
Labour Party 1285 12%
Green Party 361 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Wallington+North+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/0b2edbca-a22d-08e9-6611-796d937f56b7?t=1649236912302
https://www.sutton.gov.uk/-/wallington-north-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=113&RPID=7861248

--------------------------------------------------------------------------------

WALLINGTON SOUTH

Jayne McCoy Liberal Democrats 1830 56% elected
Samuel Martin Liberal Democrats 1728 52% elected
Muhammad Sadiq Liberal Democrats 1585 48% elected
Malcolm Brown Local Conservatives 916 28%
Martin Simms Local Conservatives 838 25%
Hilary Wortley Local Conservatives 804 24%
Eliot Carroll Labour Party 584 17%
Kausar Kamran Labour Party 444 13%
Maximillian Whelton Labour Party 389 11%
Maeve Tomlinson Green Party 314 9%
Daryl Gardner Independent 188 5%
Geoffrey Stone Independent 97 2%
David Wightwick Independent 83 2%

Total: 9800

Rejected ballots: 4


Votes by party
--------------
Liberal Democrats 5143 52%
Local Conservatives 2558 26%
Labour Party 1417 14%
Independent 368 3%
Green Party 314 3%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Wallington+South+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/0c76e123-e246-44f4-b15a-714bee0cc6ef?t=1649236852725
https://www.sutton.gov.uk/-/wallington-south-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=114&RPID=7861254

--------------------------------------------------------------------------------

WORCESTER PARK NORTH

Thomas Drummond Local Conservatives 1233 47% elected
Joe Quick Local Conservatives 1086 41% elected
Jenny Batt Liberal Democrats 919 35%
James Appleby Liberal Democrats 877 33%
Elizabeth Martin Labour Party 515 19%
Mehdi Kabash Labour Party 380 14%
Virginia Boyd Green Party 234 8%

Total: 5244

Rejected ballots: 13


Votes by party
--------------
Local Conservatives 2319 44%
Liberal Democrats 1796 34%
Labour Party 895 17%
Green Party 234 4%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Worcester+Park+North+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/e6762095-9872-426a-7f2a-c1dfb6ec2ca2?t=1649236884288
https://www.sutton.gov.uk/-/worcester-park-north-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=115&RPID=7861260

--------------------------------------------------------------------------------

WORCESTER PARK SOUTH

Martina Allen Local Conservatives 1191 51% elected
Peter Geiringer Local Conservatives 1109 47% elected
Lauren Fivey Liberal Democrats 831 35%
Barry Reed Liberal Democrats 764 32%
John Flowers Labour Party 372 16%
Ann Morrison Labour Party 370 15%

Total: 4637

Rejected ballots: 18


Votes by party
--------------
Local Conservatives 2300 49%
Liberal Democrats 1595 34%
Labour Party 742 16%


Sources
-------
https://www.sutton.gov.uk/documents/20124/738907/Worcester+Park+South+-+Statement+of+Persons+Nominated+and+Situation+of+Poll.pdf/2d457983-c329-7c67-25d3-c970a0144bb0?t=1649236819314
https://www.sutton.gov.uk/-/worcester-park-south-results
https://moderngov.sutton.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=116&RPID=7861266

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
WALLINGTON NORTH BYELECTION
28 March 2019
1 seats were elected in 1 wards.
--------------------------------------------------------------------------------

WALLINGTON NORTH

Barry Lewis Liberal Democrat 1039 38% elected
Charlotte Leonard Conservative 709 26%
Gervais Sawyer Independent 381 14%
Sheila Berry Labour 301 11%
Verity Thomson Green Party 166 6%
John Bannon UK Independence Party 104 3%
Ashley Dickenson Christian People's Alliance 17 0%

Total: 2717

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
FULL COUNCIL ELECTION 2018
3 May 2018
The full council is elected every four years.
54 seats were elected in 18 wards.
--------------------------------------------------------------------------------

BEDDINGTON NORTH

Nick Mattey Independent 1285 36% elected
Tim Foster Independent 1047 29% elected
Jillian Green Independent 948 26% elected
Malcolm Brown Conservative 911 25%
Pathumal Ali Liberal Democrat 837 23%
Sarah Gwynn Labour 829 23%
Alison Huneke Conservative 815 23%
Andy Williams Conservative 784 22%
John Keys Labour 725 20%
Brendan Husdon Liberal Democrat 713 20%
Charlie Mansell Labour 663 18%
Nighat Piracha Liberal Democrat 660 18%
Shasha Khan Green Party 208 5%
Hannah Hamilton UK Independence Party 106 2%
Kingsley Hamilton UK Independence Party 94 2%

Total: 10625


Votes by party
--------------
Independent 3280 30%
Conservative 2510 23%
Labour 2217 20%
Liberal Democrat 2210 20%
Green Party 208 1%
UK Independence Party 200 1%

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
UK Parliament
Elections: 1

--------------------------------------------------------------------------------
2019 GENERAL ELECTION
12 December 2019
2 seats were elected in 2 constituencies.
--------------------------------------------------------------------------------

CARSHALTON AND WALLINGTON

Elliot Colburn Conservative 20822 42% elected
Tom Brake Liberal Democrat 20193 41%
Ahmad Wattoo Labour 6081 12%
James Woudhuysen The Brexit Party 1043 2%
Tracey Hague Green Party 759 1%
Ashley Dickenson Christian People's Alliance 200 0%

Total: 49098

--------------------------------------------------------------------------------

SUTTON AND CHEAM

Paul Scully Conservative 25235 49% elected
Hina Bokhari Liberal Democrat 16884 33%
Bonnie Craven Labour 7200 14%
Claire Jackson-Prior Green Party 1168 2%

Total: 50487

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

+ 136
- 0
twohorserace Bestand weergeven

@@ -0,0 +1,136 @@
#!/usr/bin/env ruby

# All modules must be in the standard library. No third-party gems.
require 'json'
require 'date'
require 'pp'

def date_format(d)
d.strftime("%-d %B %Y")
end

def divider
puts '-' * 80
end

def first_word(s)
s.split(" ").first
end

def subhead(s)
puts
puts
puts s
puts '-' * s.length
end

# FIXME
# Need to be clear what the input and output of this function should be.
# We should return an array of hashes (sorted?) not an array of arrays.
# This is essentially a reduce function. Do it generically?
# https://riptutorial.com/ruby/example/3624/inject--reduce
# https://ruby-doc.org/core-3.1.2/Enumerable.html#method-i-reduce
# https://stackoverflow.com/questions/4453511/group-hashes-by-keys-and-sum-the-values
# Return party names and aggregate sum of votes for each party.
def votes_by_party(ary_of_candidate_hashes)
#pp ary_of_candidate_hashes
output = {}
ary_of_candidate_hashes.each do |candidate|
if output.key?(candidate['party'])
output[candidate['party']] += candidate['votes']
else
output[candidate['party']] = candidate['votes']
end
end
#pp output
output
end

# Load JSON data
unless (param = ARGV.shift)
abort "Usage: #{$0} [FILE] or #{$0} -- to read from STDIN."
end

if param == '--'
# Read JSON data from STDIN
json = ARGF.read
else
# Load JSON from file
json = File.read(param)
end

data = JSON.parse(json)

# Bodies
data['bodies'].each do |body|
puts body['name']
puts "Elections: %d" % body['elections'].size

# Elections
sorted_elections = body['elections'].sort_by { |h| h['date'] }.reverse
sorted_elections.each do |election|
puts
divider
puts election['name'].upcase
puts date_format(Date.parse(election['date']))
puts election['reason'] if election['reason']
puts "%d seats were elected in %d %s." % [ election['seats'],
election['districts'], body['district_name_plural'] ]
divider

# Polls
sorted_polls = election['polls'].sort_by { |h| h['district'] }
sorted_polls.each do |poll|
puts
puts poll['district'].upcase
puts

# Candidates
sorted_candidates = poll['candidates'].sort_by { |h| h['votes'] }.reverse
sorted_candidates.each do |candidate|
percentage = candidate['votes'].to_f / poll['votes'] * 100.0 *
poll['seats']
candidate['elected'] ? elected = "elected" : ""
puts "%-31s %-30s %5d %2d%% %s" % [
first_word(candidate['forenames']) + ' ' + candidate['surname'],
candidate['party'], candidate['votes'], percentage, elected ]
end

# Total votes in this poll
if poll['votes']
puts
puts "Total: %d" % poll['votes']
end

# Rejected ballots in this poll
if poll['rejected']
puts
puts "Rejected ballots: %d" % poll['rejected']
end

# Votes by party
# Omit for single-seat polls as meaningless there.
unless poll["seats"] == 1
subhead("Votes by party")
vbp = votes_by_party(poll['candidates'])
# Sort array of arrays by the value in element [1], descending
sorted_vbp = vbp.sort { |a,b| b[1] <=> a[1] }
#pp sorted_vbp
sorted_vbp.each do |party|
puts "%-30s %5d %2d%%" % [ party[0], party[1], party[1].to_f /
poll["votes"] * 100.0 ]
end
end

# Sources
if poll["sources"]
subhead("Sources")
poll["sources"].each { |source| puts source }
end

puts
divider
end
divider
end
end

Laden…
Annuleren
Opslaan