CouncilEx.Aggregator behaviour (CouncilEx v0.1.0)

Copy Markdown View Source

Behaviour for round-level aggregators.

Aggregators consume the per-member outputs from a round (each entry is the parsed output produced by Round.parse_output/3) and reduce them to a single winner with supporting scores.

Return shape

{:ok, %{winner: term(), scores: map(), raw: map()}}
| {:error, term()}

winner — the elected option (string, atom, nil when no Condorcet winner). scores — option → numeric weight, for display / logging. raw — implementation-specific diagnostics (tie-break mode, cycle flag, …).

Summary

Callbacks

aggregate(member_outputs, opts)

@callback aggregate(member_outputs :: %{required(atom()) => map()}, opts :: keyword()) ::
  {:ok, %{winner: term(), scores: map(), raw: map()}} | {:error, term()}