Electorama Logo

abiftool for ABIF

abiftool is Python-based software for working with ABIF files. "What is ABIF" you may ask? Read on to learn more....

News

abiftool 0.31.0 is out (July 11, 2025) — A release about SF 2024 elections, FPTP support, improved testing, and bug fixes for added fun!

See the announcement to the ES list to learn more.

abiftool in a nutshell

"abiftool" is a command-line tool to convert between many election-summary formats, and its companion tool (fetchmgr) fetches many published election results from the Internet and processes those results. The abiftool bundle includes the powerful "abiflib" Python library which not only handles processing of many different election aggregation formats, but tallies the results using many different election methods (including "first past the post", IRV/RCV, Condorcet/Copeland, and STAR).

Core to abiflib is a JSON-based structure called jabmod, which is a structured representation of an election. The jabmod structure is easy for programmers to understand, and provides a comprehensive view of an election. "jabmod" is short for "JSON ABIF Model". abiftool can convert ".abif" files to-and-from "jabmod", and is capable of converting many election summary formats into ABIF.

For Python developers that have pip installed on their computer, installation of abiftool and abiflib is as simple as typing the following command:

$ pip install abiftool

It's also possible to check out abiftool from git:

ABIF and abiftool

The Aggregated Ballot Information Format (or "ABIF") provides a concise, aggregated, plain-text document to describe the ballots cast in score (cardinal) elections or ranked (ordinal) elections, as well as approval-based and choose-one balloting systems.

Forms of the format were used as early as 1996 on the Election-Methods (EM) Mailing List, among other places. Over time, many online, form-based tools were created to parse forms of the format. Formalization of the format the format began in 2021, and an "abif" repo (https://github.com/electorama/abif) was started on GitHub, where discussion occured, and some early code was checked in. The EBNF file (" abif-v0.03.ebnf") represents a vaguely authoritative source for the syntax of ABIF, and the test suite included may be helpful. As of July 2025, the code in the electorama/abif repository has a simple parser that uses the "Lark" parsing library to converts ABIF into jabmod

See the following links about ABIF to learn more:

awt — the ABIF web tool

Folks that aren't familiar with Python programming (or programming in general) may appreciate the "ABIF web tool". This provides the ability to visualize elections expressed in ABIF by entering ABIF into a web form. awt then tallies the given election using the Condorcet/Copeland method, the RCV/IRV method, and the STAR method. into a web form.

Links

Conversion of ABIF to/from other formats with abiftool

abiftool converts between ABIF and other commonly-used electoral expression formats. abiftool.py calls out to "abiflib", which is a Python conversion library between various election summary formats that can be found in the electorama/abiftool source repository (as "electorama/abiftool/abiflib").

Input formats

abiftool/abiflib accepts input in the following formats:

Output formats

The 2023 version of abiftool/abiflib converts to the following formats:

Community

Please join the Electorama community to meet other people interested in ABIF

Contributing bug reports and feature ideas

Please file issues in the abiftool.py issue tracker if you notice problems with the tool that likely need to get fixed sooner rather than later. Please note your issues in one of the GitHub repos to help make this project go faster:

Chat/Email/Forum

There are many communication channels used by the Electorama community and folks interested in ABIF.

Future work

There are many tools and formats out there, and (as of January 2024), much work to be done. Visit electorama/abif#29 to discuss this topic.

License

abiftool is currently licensed under GPLv3. Visit electorama/abiftool#1 to discuss licensing, or email Rob Lanphier (robla@gmail.com).


Back to home page: Home