Description
Tally weighted single-choice ballots and report the unweighted number of empty ballot records.
A ballot record is an explicit selection or ordered list of literal candidate IDs. A tally depends on its rule: first choice, approval, positional scores and pairwise comparisons use different evidence. Partial rankings do not by themselves define a preference for or against omitted candidates. Counts and weights describe supplied records, not certified voters.
Tally weighted single-choice ballots and report the unweighted number of empty ballot records.
When to use this tool
Use weighted single-choice tallying when each record carries an explicit nonnegative contribution weight.
How to use the tool and how it works
- Enter candidates, ballotsJson, weights using the definitions below. Serialize JSON text fields in the decoded shape shown below.
- Run the operation. Resolve input-format errors before interpreting an output.
- Read result.tally, result.abstentions, using the stated boundary, ordering, sign and absence conventions.
Require each ballot to contain zero or one known candidate and one aligned nonnegative weight per ballot. Add a ballot’s weight to its selected candidate and count empty ballots separately.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| candidates | Distinct literal candidate IDs in the output row/column order. | Dense list of at most 128 literal strings, each at most 8,192 UTF-16 units. |
| ballotsJson | JSON array of ballot arrays of literal candidate IDs. Each row is a selection or partial ranking according to this operation; empty ballots are allowed. | Text, at most 8,192 UTF-16 code units; narrower grammar/range rules also apply. |
| weights | Nonnegative finite ballot weights aligned one-to-one with ballotsJson; counts in abstentions remain unweighted. | Dense list of at most 128 finite numbers, under the stated integer/range rules. |
These decoded structures show the examples inside JSON text fields. Supply their serialized JSON strings as input.
{
"ballotsJson": [
[
"a"
],
[
"b"
],
[]
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.tally | Candidate records in declared bank order with support, count or score fields determined by this operation. |
| result.abstentions | Number of empty ballot records, without weighting. |
{
"input": {
"candidates": [
"a",
"b"
],
"ballotsJson": "[[\"a\"],[\"b\"],[]]",
"weights": [
2,
3,
1
]
},
"output": {
"result": {
"tally": [
{
"candidate": "a",
"support": 2
},
{
"candidate": "b",
"support": 3
}
],
"abstentions": 1
}
}
} Limitations and assumptions
- The abstentions output counts empty ballot records without weighting. A zero-weight nonempty ballot contributes zero support but is not an abstention.
- Candidate banks use distinct exact string IDs. Unless an audit explicitly accepts them for reporting, unknown IDs and repeated IDs within a ballot are rejected. Rankings may be partial. These operations do not authenticate records, infer voter intent or apply jurisdiction-specific election rules.
- Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
- Numeric outputs must remain finite and within safe-integer magnitude. Original record indexes and cell coordinates are zero-based; stated half-open ranges exclude their end.
Alternative or Complementary methods
Choose a tally rule before comparing outcomes. Audit candidate identity and repeated entries first, retain the treatment of empty and partial ballots, and apply any election-specific eligibility or tie-breaking procedure separately.
References
Similar or alternative tools
- Single Choice Ballot Count Tally
Count single-choice ballots per candidate and report empty ballots as abstentions.
- Approval Set Ballot Weight Tally
Tally nonnegative weights for unique-candidate approval sets.