Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Project: release a support breach monitoring packet

Last updated: 7 Oct 20265 min read
project
IntermediateBy AITrove Editorial

Build a daily late-response monitor with variable-denominator limits, target flags, baseline provenance and an explicit release gate.

Freeze the metric and baseline

Define a late response from a case’s eligible start timestamp and first qualifying response timestamp. Keep one case ID per eligible interaction and a fixed extraction cutoff. Use five illustrative baseline days: (5,100), (7,120), (6,110), (4,90), (8,130). Their pooled center is 30/550. Archive query version, case-ID reconciliation and the baseline period before evaluating new days. The service target of 0.03 remains separate from the chart center.

Evaluate a new day by its denominator

For a new day with 140 eligible cases, compare 12 late responses and then 21 late responses against limits calculated from that day’s denominator and the frozen center. The first day’s share is about 0.0857 and stays below the illustrative upper limit; the second is 0.15 and signals. Both miss the 0.03 service target. Save the count and the rate, because a screenshot of percentages cannot reveal whether a denominator changed. The p-chart supplies the calculation.

Track small persistent changes separately

For equal-size 200-case monitoring subgroups, run a fixed-weight EWMA from the frozen baseline center to detect a sustained modest shift. Do not use that fixed-count setup on the 140-case day without adjusting the variance model. Store every daily input and the resulting EWMA state so a corrected historical day can be replayed. The EWMA lesson states its restricted assumptions.

Run an incident check before release

A signal triggers case-ID reconciliation, timestamp coverage inspection, query-version comparison, and a review of routing and staffing evidence. Record whether the cause is a data incident, a process change, or unresolved. A version mismatch blocks publication even if the chart formula runs. An unresolved alert can remain visible internally with a clear status; it should not become a confident public performance claim. The alert workflow keeps that distinction.

Publish a compact, inspectable packet

Include baseline counts and version, new-day numerator and denominator, center, daily limits, target miss, process signal, investigation disposition, and the next action owner. The code below constructs the numerical portion; production release also needs the underlying case reconciliation and signed-off status mapping. If the binary-case independence assumption fails because workload shocks cluster cases within days, redesign the chart model before relying on its false-alarm rate.

Implementation

python
from math import sqrt

def support_breach_packet(baseline_days, late_cases, eligible_cases,
                          service_target, baseline_query, current_query):
    if not baseline_days or any(total <= 0 or not 0 <= late <= total
                                for late, total in baseline_days):
        raise ValueError("invalid baseline")
    if eligible_cases <= 0 or not 0 <= late_cases <= eligible_cases:
        raise ValueError("invalid new day")
    if not 0 <= service_target <= 1:
        raise ValueError("invalid target")
    center = sum(late for late, _ in baseline_days) / sum(
        total for _, total in baseline_days)
    spread = 3 * sqrt(center * (1 - center) / eligible_cases)
    upper = min(1.0, center + spread)
    lower = max(0.0, center - spread)
    observed = late_cases / eligible_cases
    return {"rate": observed, "center": center, "lower": lower,
            "upper": upper, "target_miss": observed > service_target,
            "process_signal": observed < lower or observed > upper,
            "publishable": bool(baseline_query)
                           and baseline_query == current_query}

baseline = [(5, 100), (7, 120), (6, 110), (4, 90), (8, 130)]
ordinary = support_breach_packet(baseline, 12, 140, 0.03, "v3", "v3")
signaled = support_breach_packet(baseline, 21, 140, 0.03, "v3", "v3")
assert ordinary["target_miss"] and not ordinary["process_signal"]
assert signaled["target_miss"] and signaled["process_signal"]
assert not support_breach_packet(baseline, 21, 140, 0.03, "v3", "v4")["publishable"]

Performance and operating cost

Pooling B baseline days costs O(B) time and O(1) additional space. Each monitored day is O(1) after baseline preparation; a D-day replay is O(D). The release cost includes reconciling individual cases and examining chart assumptions, not only calculating limits.

Common Mistakes

  • Do not publish the chart when the current extraction is incompatible with the baseline.
  • Do not collapse target miss and process signal into one flag.
  • Do not apply fixed-count EWMA limits to a variable-count p-chart series.

Read next

ai-data
data-science
Storage details