System Note 03 · Enterprise Systems

Duration Calculation Engine

Bell Canada

PythonPandasAlgorithm DesignData Engineering
Live
What it is

A Python routine that measures how long each stage of an agent work cycle takes, across events that do not always arrive in order.

Why I built it

The old numbers were wrong whenever events landed out of sequence, and duration was a metric leadership actually watched.

What went wrong
  1. 01
    Events out of order
    Broke
    Durations came out wrong — sometimes negative — whenever an event log arrived out of sequence.
    Why
    The first version walked the events in a single pass and assumed they were already sorted in time. Real data is not that polite.
    Fix
    Rebuilt it as a two-pass group-by: anchor each cycle first, then propagate and backfill durations. Deterministic, and QA defects went to zero.
Outcome
3duration metrics

Evidence before confidence.

← Back to Build Notes