ABIF: Difference between revisions

From electowiki
Content added Content deleted
(Putting title and description in quotes so that these lines with validate with the jsonlines.org validator (and each metadata line should validate with any JSON validator))
(Changed the old "#Discussions" section to a new "#History" section)
Line 8: Line 8:
15:Chattanooga>Knoxville>Nashville>Memphis
15:Chattanooga>Knoxville>Nashville>Memphis
17:Knoxville>Chattanooga>Nashville>Memphis
17:Knoxville>Chattanooga>Nashville>Memphis
</syntaxhighlight>The example above works with some election tabulators that are still online.<ref>[[Rob LeGrand]]'s "Ranked-ballot voting calculator" supports this "EM-list format": https://cs.angelo.edu/~rlegrand/rbvote/calc.html</ref><ref>Eric Gorr's Condorcet "Voting Calculator": http://www.ericgorr.net/condorcet/</ref> The example above is also compatible with ABIF.
</syntaxhighlight>The example above works with some election tabulators that are still online.<ref name=":2">[[Rob LeGrand]]'s "Ranked-ballot voting calculator" supports this "EM-list format": https://cs.angelo.edu/~rlegrand/rbvote/calc.html</ref><ref name=":3">Eric Gorr's Condorcet "Voting Calculator": http://www.ericgorr.net/condorcet/</ref> The example above is also compatible with ABIF.


Below is a more complicated example of ABIF, expressing the same "Tennessee example" as above. The ABIF example below includes more information than the ad hoc format above, including longer descriptions of the cities, and a "rating" expressed by voters based on their respective distance from the other cities, and comment lines describing the typical sections of an ABIF file:<syntaxhighlight>
Below is a more complicated example of ABIF, expressing the same "Tennessee example" as above. The ABIF example below includes more information than the ad hoc format above, including longer descriptions of the cities, and a "rating" expressed by voters based on their respective distance from the other cities, and comment lines describing the typical sections of an ABIF file:<syntaxhighlight>
Line 31: Line 31:


ABIF uses [[W:UTF-8|UTF-8 character encoding]], but tries to clearly delineate the portions of the file within which arbitrary UTF-8 characters are allowed.
ABIF uses [[W:UTF-8|UTF-8 character encoding]], but tries to clearly delineate the portions of the file within which arbitrary UTF-8 characters are allowed.

== History ==
The ABIF format has only been called "ABIF" since 2021. However, as early as 1996, people have used the following format to describe "ordinal voting" elections:
quantity ":" candtoken [ ">" or "=" candtoken]*
In April 1996, [[Rob Lanphier]] published a Perl script which tabulated elections using something similar to this format (requiring numbers for the candidates).<ref>{{cite web|url=http://lists.electorama.com/pipermail/election-methods-electorama.com//1996-April/098306.html|title=Condorcet computer count|date=April 6, 1996|website=lists.electorama.com Mailing Lists|access-date=February 2, 2024|ref={{sfnref | lists.electorama.com Mailing Lists | 1996}}}}</ref> The script was published in ''The Perl Journal'', later that year.<ref>{{cite journal|last=Lanphier|first=Rob|year=1996|title=The Perl Journal|url=https://robla.blog/2018/07/15/voting-methods-in-the-perl-journal/|url-status=live|journal=The Perl Journal|access-date=2024-02-02|ref={{sfnref | RoBlaBlog | 2018}}}}</ref> Others wrote similar scripts, allowing letters and names to describe candidates.<ref name=":2" /><ref name=":3" /> Many messages to the [[election-methods mailing list]] over the years also used the format. Below is a theoretical election tha that used the "<code>quantity:candtoken>candtoken</code>" format:
quantity ":" candtoken [ ">" or "=" candtoken]*

In May 2021, "[https://reddit.com/u/jman722 /u/jman722]" posted to the [[EndFPTP subreddit|/r/EndFPTP subreddit]] asking "''Have you ever noticed that ordinal ballots have a nice, compact, universally understood notation for ballot sets, but notation for cardinal ballots seems to be aLl OvEr ThE pLaCe?''"<ref name="robla-comment-reddit-2020-05-26">https://www.reddit.com/r/EndFPTP/comments/nkm2cd/standardizing_cardinal_ballot_notation/gzls6pj/</ref>. They suggested a format that is similar to the comma-separated values (CSV) format typically offered as an export format in spreadsheets:
12: Allie/5, Billy/5, Candace/4, Dennis/3, Edith/3, Frank/2, Georgie/1, Harold/0
7: Allie/4, Billy/0, Candace/2, Dennis/3, Edith/1, Frank/0, Georgie/5, Harold/3
5: Allie/0, Billy/3, Candace/2, Dennis/3, Edith/4, Frank/5, Georgie/3, Harold/4

Some discussion ensued on reddit and on the [[EM-list]].<ref name="EM-post-2788">http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002788.html</ref><ref>http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002789.html</ref> As part of these discussions of the name, Lanphier suggested "ABIF", which stood for "aggregated ballot image format".<ref>{{cite web|url=https://www.reddit.com/r/EndFPTP/comments/nkm2cd/standardizing_cardinal_ballot_notation/gzoz52s/?rdt=44026|title=Re: Standardizing Cardinal Ballot Notation|last=Lanphier|first=Rob|website=Reddit|url-status=live|access-date=February 2, 2024|ref={{sfnref | Reddit}}}}</ref> Election auditing expert [[User:Nealmcb|Neal McBurnett]] disliked that "I" stood for "Image", and thus the "I" came to stand for "Information". Discussions shifted from reddit to GitHub, and continued through the summer of 2021.<ref name=":0">{{Cite web|url=https://github.com/electorama/abif/issues|title=electorama/abif issue tracker on GitHub|url-status=live}}</ref><ref name=":1">{{Cite web|url=https://github.com/electorama/abif/issues?q=is%3Aissue+is%3Aclosed|title=electorama/abif closed issues on GitHub|url-status=live}}</ref>

In August 2023, [[User:RobLa]] published "abiftool.py" on GitHub, hoping this could become a good interchange tool between election result analysis tools.<ref>https://github.com/electorama/abiftool</ref>

==Test cases==
==Test cases==


Line 41: Line 57:
==Implementations==
==Implementations==


*https://github.com/electorama/abif &mdash; An early (2021) implementation in Python started by [[User:RobLa]], using the Lark library and licensed under the Apache 2.0 License. This version was intended as a reference implementation, but at this point, it's mainly useful for the EBNF files describing the syntax of ABIF.<ref>EBNF files describing ABIF: </ref>
*[https://github.com/electorama/abif '''github.com/electorama/abif'''] &mdash; An early (2021) implementation in Python started by [[User:RobLa]], using the Lark library and licensed under the Apache 2.0 License. This version was intended as a reference implementation, but at this point, it's mainly useful for the EBNF files describing the syntax of ABIF.<ref>EBNF files describing ABIF: </ref>
*https://github.com/electorama/abiftool &mdash; A later (2023) implementation in Python also started by [[User:RobLa]], using regular expressions and licensed under GPL 3.0. As of October 2023, this implementation has support for converting from a few formats (e.g. Debian's format, PrefLib format), and may soon have support for converting into many other formats.
*[https://github.com/electorama/abiftool '''github.com/electorama/abiftool'''] &mdash; A later (2023) implementation in Python also started by [[User:RobLa]], using regular expressions and licensed under GPL 3.0. As of October 2023, this implementation has support for converting from a few formats (e.g. Debian's format, PrefLib format), and may soon have support for converting into many other formats. The tool also has suppport for basic pairwise comparisons.
*https://github.com/simberaj/votelib/tree/abif &mdash; An branch of VoteLib started by Jan Šimbera. VoteLib is "''Votelib is a package to evaluate results of elections under various systems. It aims to provide reliable implementations of many voting systems so that they may be evaluated as they are used in real-world conditions and compared. [...] Votelib does not aim to be an end-to-end tool for managing elections; it does not (and will not) provide user interfaces or concern itself with other parts of the election process than determining the result from the votes cast.''"
*[https://github.com/simberaj/votelib/tree/abif '''github.com/simberaj/votelib/tree/abif'''] &mdash; An branch of VoteLib started by Jan Šimbera. VoteLib is "''Votelib is a package to evaluate results of elections under various systems. It aims to provide reliable implementations of many voting systems so that they may be evaluated as they are used in real-world conditions and compared. [...] Votelib does not aim to be an end-to-end tool for managing elections; it does not (and will not) provide user interfaces or concern itself with other parts of the election process than determining the result from the votes cast.''"

==Discussions==
The discussions about ABIF have been happening in several places:

*In May 2021, the main discussions were on the /r/[[EndFPTP]] subreddit and on the [[EM-list]].<ref name="EM-post-2788">http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002788.html</ref><ref name="robla-comment-reddit-2020-05-26">https://www.reddit.com/r/EndFPTP/comments/nkm2cd/standardizing_cardinal_ballot_notation/gzls6pj/</ref><ref>http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002789.html</ref>
*In June 2021, the discussions shifted over to the EM-list, and then mostly on the GitHub issue tracker.<ref name=":0">{{Cite web|url=https://github.com/electorama/abif/issues|title=electorama/abif issue tracker on GitHub|url-status=live}}</ref><ref name=":1">{{Cite web|url=https://github.com/electorama/abif/issues?q=is%3Aissue+is%3Aclosed|title=electorama/abif closed issues on GitHub|url-status=live}}</ref>
*In July 2021, conversations were dying down, but then [[User:RobLa]] published an [[W:EBNF|EBNF]] file describing ABIF. More activity occurred on GitHub.<ref name=":0" /><ref name=":1" />
*By August 2021, conversations mostly shifted over to GitHub. [[User:RobLa]] opened [https://github.com/electorama/abif/discussions the "Discussions" area on electorama/abif on GitHub], and provided an update on the project.<ref>{{Cite web|url=https://github.com/electorama/abif/discussions/18|title=August 2021 progress on ABIF|last=Lanphier|first=Rob|date=2021-08-28|website=electorama/abif on github.com|url-status=live}}</ref>
*By April 2022, [[User:RobLa]] put a poll on [[Project:GitHub|GitHub]]: https://github.com/electorama/abif/discussions/31
*In August 2023, [[User:RobLa]] published "abiftool.py" on GitHub, and is optimistic that this could become a good interchange tool between election result analysis tools.<ref>https://github.com/electorama/abiftool</ref>


==Footnotes==
==Footnotes==

Revision as of 05:19, 2 February 2024

ABIF stands for "aggregated ballot information format"[1], a format for expressing aggregated ballot sets resulting from elections (either real elections or theoretical elections).

Description

Tennessee's four largest cities used in the "Tennessee example", and their respective placement within the state.
Memphis, Nashville, Chattanooga, and Knoxville are Tennessee's four largest cities, and are used in the "Tennessee example". The map above shows each city's respective placement within the state.

ABIF is a format designed to be a universal format for expressing aggregated ballot sets from elections, regardless of whether voters are asked to provide rankings (i.e. "ordinal voting") or ratings (i.e. "cardinal voting"). The format is loosely based on a format that has been used on the election-methods mailing list and in other places for many years, in which a quantity (of ballots) is followed by a colon, and then a ranking. Here is how the "Tennessee example" is expressed in this ad hoc format:

42:Memphis>Nashville>Chattanooga>Knoxville
26:Nashville>Chattanooga>Knoxville>Memphis
15:Chattanooga>Knoxville>Nashville>Memphis
17:Knoxville>Chattanooga>Nashville>Memphis

The example above works with some election tabulators that are still online.[2][3] The example above is also compatible with ABIF. Below is a more complicated example of ABIF, expressing the same "Tennessee example" as above. The ABIF example below includes more information than the ad hoc format above, including longer descriptions of the cities, and a "rating" expressed by voters based on their respective distance from the other cities, and comment lines describing the typical sections of an ABIF file:

# Section 1 - metadata
{"title": "Tennessee capitol example"}
{"description": "Hypothetical example of selecting capitol of Tennessee, frequently used on Wikipedia and electowiki."}
# Section 2 - candidate descriptions
=Memph:[Memphis, TN]
=Nash:[Nashville, TN]
=Chat:[Chattanooga, TN]
=Knox:[Knoxville, TN]
# Section 3 - votelines
# Ratings are 400 miles minus crow-flying mileage to city 
42:Memph/400>Nash/200>Chat/133>Knox/45
26:Nash/400>Chat/290>Knox/240>Memph/200
15:Chat/400>Knox/296>Nash/290>Memph/133
17:Knox/400>Chat/296>Nash/240>Memph/45

The section order (and even line order) is purely convention, and is not mandated by the specification. Comments are any line (or portion of a line) that begins with a hash mark ("#"). Lines that begin with an open curly brace ("{") are metadata lines. Lines that begin with an equal sign ("=") are "candlines" (candidate description lines). Lines that begin with numbers are "votelines", where each voteline has roughly the following format:

quantity ":" candtoken [ "/" rating] [ [ ">" or "=" or "," ] candtoken [ "/" rating] ]*

Each line represents "quantity" number of ballots of voters that expressed the preferences represented in the remainder of the line. Each "candtoken" represents a candidate, and are required to be in order of preference if the delimiter is ">" or "=". If comma (",") is the delimeter, then allcandtokensare required to have a "rating" associated with it.

ABIF uses UTF-8 character encoding, but tries to clearly delineate the portions of the file within which arbitrary UTF-8 characters are allowed.

History

The ABIF format has only been called "ABIF" since 2021. However, as early as 1996, people have used the following format to describe "ordinal voting" elections:

quantity ":" candtoken [ ">" or "=" candtoken]*

In April 1996, Rob Lanphier published a Perl script which tabulated elections using something similar to this format (requiring numbers for the candidates).[4] The script was published in The Perl Journal, later that year.[5] Others wrote similar scripts, allowing letters and names to describe candidates.[2][3] Many messages to the election-methods mailing list over the years also used the format. Below is a theoretical election tha that used the "quantity:candtoken>candtoken" format:

quantity ":" candtoken [ ">" or "=" candtoken]*

In May 2021, "/u/jman722" posted to the /r/EndFPTP subreddit asking "Have you ever noticed that ordinal ballots have a nice, compact, universally understood notation for ballot sets, but notation for cardinal ballots seems to be aLl OvEr ThE pLaCe?"[6]. They suggested a format that is similar to the comma-separated values (CSV) format typically offered as an export format in spreadsheets:

12: Allie/5, Billy/5, Candace/4, Dennis/3, Edith/3, Frank/2, Georgie/1, Harold/0
7: Allie/4, Billy/0, Candace/2, Dennis/3, Edith/1, Frank/0, Georgie/5, Harold/3
5: Allie/0, Billy/3, Candace/2, Dennis/3, Edith/4, Frank/5, Georgie/3, Harold/4

Some discussion ensued on reddit and on the EM-list.[7][8] As part of these discussions of the name, Lanphier suggested "ABIF", which stood for "aggregated ballot image format".[9] Election auditing expert Neal McBurnett disliked that "I" stood for "Image", and thus the "I" came to stand for "Information". Discussions shifted from reddit to GitHub, and continued through the summer of 2021.[10][11]

In August 2023, User:RobLa published "abiftool.py" on GitHub, hoping this could become a good interchange tool between election result analysis tools.[12]

Test cases

The normative set of test cases are on GitHub, and we'll be expanding them there:

Note: some test cases were designed to fail, and some examples that are marked as passing tests may be marked as "fail" in the future.

Implementations

  • github.com/electorama/abif — An early (2021) implementation in Python started by User:RobLa, using the Lark library and licensed under the Apache 2.0 License. This version was intended as a reference implementation, but at this point, it's mainly useful for the EBNF files describing the syntax of ABIF.[13]
  • github.com/electorama/abiftool — A later (2023) implementation in Python also started by User:RobLa, using regular expressions and licensed under GPL 3.0. As of October 2023, this implementation has support for converting from a few formats (e.g. Debian's format, PrefLib format), and may soon have support for converting into many other formats. The tool also has suppport for basic pairwise comparisons.
  • github.com/simberaj/votelib/tree/abif — An branch of VoteLib started by Jan Šimbera. VoteLib is "Votelib is a package to evaluate results of elections under various systems. It aims to provide reliable implementations of many voting systems so that they may be evaluated as they are used in real-world conditions and compared. [...] Votelib does not aim to be an end-to-end tool for managing elections; it does not (and will not) provide user interfaces or concern itself with other parts of the election process than determining the result from the votes cast."

Footnotes

  1. https://github.com/electorama/abif/issues/2
  2. a b Rob LeGrand's "Ranked-ballot voting calculator" supports this "EM-list format": https://cs.angelo.edu/~rlegrand/rbvote/calc.html
  3. a b Eric Gorr's Condorcet "Voting Calculator": http://www.ericgorr.net/condorcet/
  4. "Condorcet computer count". lists.electorama.com Mailing Lists. April 6, 1996. Retrieved February 2, 2024.
  5. Lanphier, Rob (1996). "The Perl Journal". The Perl Journal. Retrieved 2024-02-02.
  6. https://www.reddit.com/r/EndFPTP/comments/nkm2cd/standardizing_cardinal_ballot_notation/gzls6pj/
  7. http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002788.html
  8. http://lists.electorama.com/pipermail/election-methods-electorama.com/2021-May/002789.html
  9. Lanphier, Rob. "Re: Standardizing Cardinal Ballot Notation". Reddit. Retrieved February 2, 2024.
  10. "electorama/abif issue tracker on GitHub".
  11. "electorama/abif closed issues on GitHub".
  12. https://github.com/electorama/abiftool
  13. EBNF files describing ABIF: