Page on data quality problems within a weekly budget

Agent buildEasy10 minDatabricks and Snowflake style

Your task

Bad data keeps reaching dashboards quietly, and the data team hears about it from an executive. A sentinel agent watches pipeline quality and decides, for each finding, whether to page the owning on-call or wait for the daily digest, within a weekly page budget.

Write route_quality_alerts(severities, dataset_tiers, weekly_page_budget): the rule your agent follows for one week's findings.

  • severities (list of str): the severity of each finding, in arrival order.
  • dataset_tiers (list of int): the SLA tier of each finding's dataset, where 1 is the most important. If the list is shorter, a finding with no tier counts as tier 0.
  • weekly_page_budget (int): the most pages allowed this week.
  • Return one route per finding, in order: "page" or "digest".

Rules:

  1. Trim and lowercase each severity.
  2. A finding is page-worthy if its severity is critical and its tier is exactly 1.
  3. Go through the findings in order, counting pages. A page-worthy finding pages if the count so far is below weekly_page_budget, and the count goes up by 1.
  4. Every other finding goes to "digest", page-worthy ones included once the budget is spent.

Examples

route_quality_alerts(severities: list[str], dataset_tiers: list[int], weekly_page_budget: int) -> list[str]
Example 1
Inputroute_quality_alerts(["critical", "warning", "critical"], [1, 1, 2], 5)
Output["page", "digest", "digest"]
Example 2
Inputroute_quality_alerts(["critical", "critical", "critical"], [1, 1, 1], 2)
Output["page", "page", "digest"]
Example 3
Inputroute_quality_alerts([], [], 3)
Output[]