Check whether a brief echoes its loudest source

Agent buildEasy10 min

Your task

Product leadership plans each cycle from sales asks, support pain and strategy, and the loudest deal usually wins. An agent writes the planning brief, and a check measures whether each source's share of the brief matches its share of the evidence.

Write audit_brief_source_balance(channels, evidence_counts, brief_lines): the check every brief passes through.

  • channels (list of str): the source channels, such as "sales".
  • evidence_counts (list of int): how many pieces of evidence each channel contributed.
  • brief_lines (list of int): how many lines of the brief each channel got.
  • Index i in each list is one channel. Return one verdict per channel, in order, written "<channel>=over", "<channel>=under" or "<channel>=balanced".

Rules:

  1. A channel's evidence share is its evidence count divided by the total evidence. Its brief share is its lines divided by the total lines. When a total is 0, every share of it is 0.
  2. The skew is the brief share minus the evidence share.
  3. A skew above 0.10: "over". Below -0.10: "under". Otherwise: "balanced".
  4. Each channel is judged on its own numbers, even when two channels have the same name.

Examples

audit_brief_source_balance(channels: list[str], evidence_counts: list[int], brief_lines: list[int]) -> list[str]
Example 1
Inputaudit_brief_source_balance(["sales", "support", "strategy"], [5, 90, 5], [60, 30, 10])
Output["sales=over", "support=under", "strategy=balanced"]
Example 2
Inputaudit_brief_source_balance(["sales", "support", "strategy"], [16, 12, 4], [16, 12, 4])
Output["sales=balanced", "support=balanced", "strategy=balanced"]
Example 3
Inputaudit_brief_source_balance(["sales", "support"], [0, 50], [20, 20])
Output["sales=over", "support=under"]