Skip to content

Add total votes to consensus reducer output#1679

Open
lcjohnso wants to merge 2 commits into
masterfrom
enhance-consensus-reducer
Open

Add total votes to consensus reducer output#1679
lcjohnso wants to merge 2 commits into
masterfrom
enhance-consensus-reducer

Conversation

@lcjohnso
Copy link
Copy Markdown
Member

It is common for project teams to write a retirement rule based on consensus reducer outputs where the conditions are:

  • for a certain answer (["eq", ["lookup", "consensus.most_likely", ""], ["const", "2"]])
  • subject agreement higher than some threshold (["gte", ["lookup", "consensus.agreement", 0], ["const", 0.8]])
  • total classifications greater than some threshold (["gte", ["lookup", "count.classifications", 0], ["const", 10]])

It is annoying that a second reducer is required to track the total classification count, when the consensus reducer computes that value internally (as part of the agreement calculation: num_votes / total_votes).

Furthermore: the num_votes metric, which represents the number of classifications tallied for the most_likely answer, is frequently mistaken for the total number of votes during configuration.

This PR adds a total_votes key to the consensus reducer data output for convenience.

Comment thread app/models/reducers/consensus_reducer.rb
Comment thread app/models/reducers/consensus_reducer.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
Comment thread spec/models/reducers/consensus_reducer_spec.rb
@lcjohnso lcjohnso marked this pull request as ready for review May 13, 2026 16:56
@lcjohnso lcjohnso requested review from Tooyosi May 13, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant