PrefVote’s primary vote input file format uses YAML to structure input data about a vote, including metadata about the voting topic and ballots containing the votes.
The file is separated by two or more YAML “documents”, or separate file sections. Each document in the YAML file is separated by a “—” line. If there are more than two, then additional document sections are for testing purposes.
The first document in the file defines the vote including the voting method/algorithm.
The second document contains a list of ballots. These should have been assembled into the YAML file from wherever the votes were submitted and assembled.
The first YAML document/section contains a definition of the vote - the voting algorithm, what the topic is, how many seats are up for election, what the choices are (with an abbreviation string and description for each).
At the top level are two items. Both are required.
The params structure contains the following items.
An example from a test vote shows a vote called “Test Vote” with 1 available seat and 6 choices, which for testing purposes start with the letters A through F and have whimsical names.
--- method: RankedPairs params: name: Test Vote seats: 1 choices: ABNORMAL: abnormal and antisocial BORING: boring as anything CHAOTIC: chaotic unpredictable DYSFUNCTIONAL: dysfunctional incompetent EVIL: evil villain FACTIOUS: factious/divisive --- [...second YAML document section contains ballots...]
The second YAML document contains a list of ballots. Each ballot item in the list is an array containing the choices in order from highest to lowest preference.
Example: ordering for 5 of the available 6 choices.
- [BORING, EVIL, FACTIOUS, ABNORMAL, CHAOTIC]
If input ties/equality are allowed by the voting method and the vote configuration, they may be indicated by a list within the list at the proper placement for the tied/equal items.
Example: two items tied for 2nd place
- [BORING, [EVIL, FACTIOUS], ABNORMAL, CHAOTIC]
An optional third YAML document may contain data for use in testing. This section may also be placed in a file in the same directory with the same basename and a “-test.yaml” suffix. The internal document option was the original method of including expected test results with the YAML test vote data. The external file option was added to allow the same capability alongside Condorcet Election Format (CEF) files, which do not have a method to include test results in the file.
The test document/section YAML has a top-level hash where the keys are a voting method name, such as Core, STV, Schulze and RankedPairs. Within those entries are data trees which must match the internal data structures of the voting method, and as internal data will not be documented here. Each item of data is considered a separate test which the run data must match to pass. Also as test cases, each list and hash must have the correct number of members.
(more detail in progress)