Choose which metric moves a digest may report

Agent buildEasy10 min

Your task

Product managers drown in dashboards, so an agent writes a weekly digest of what moved. The failure that kills digest agents is inventing trends, so a metric is only mentioned when it moved beyond its normal seasonal range.

Write select_digest_claims(names, current, baseline_mean, baseline_std, band_sigma): the rule your agent follows to pick what the digest may claim.

  • names (list of str): the metric names.
  • current (list of float): this week's value of each metric.
  • baseline_mean, baseline_std (list of float): each metric's seasonal mean and standard deviation.
  • band_sigma (float): how many standard deviations count as normal movement.
  • Return the claims, in input order, each written "<name> up" or "<name> down".

Rules:

  1. Index i in each list is one metric. Stop at the end of the shortest list.
  2. If band_sigma is 0 or less: return [].
  3. Skip a metric whose standard deviation is 0 or less.
  4. A metric earns a claim when abs(current - mean) is strictly greater than band_sigma * std. A value exactly on the edge does not.
  5. The claim is "<name> up" if the current value is above the mean, otherwise "<name> down".

Examples

select_digest_claims(names: list[str], current: list[float], baseline_mean: list[float], baseline_std: list[float], band_sigma: float) -> list[str]
Example 1
Inputselect_digest_claims(["signups", "crashes", "revenue"], [1200, 45, 98000], [1000, 50, 100000], [50, 10, 3000], 2)
Output["signups up"]
Example 2
Inputselect_digest_claims(["latency_p95", "churn"], [180, 0.02], [200, 0.05], [5, 0.01], 2)
Output["latency_p95 down", "churn down"]
Example 3
Inputselect_digest_claims(["signups", "revenue"], [1010, 99500], [1000, 100000], [50, 3000], 2)
Output[]