Case Study: The Phone System
Build It, Then Try to Prove It Wrong
The Trap in Phone Data: Legs
One customer calls. Four phones ring. One person picks up. Many phone systems record that as four separate legs: one answered, three not.
Count legs as calls and you report four calls and a 75% miss rate. What actually happened: one call, answered, 0% missed. The code ran perfectly. The number was garbage.
So find the ID that ties legs together and roll them up before counting:
SELECT COUNT(*) AS calls,
SUM(answered = 0) AS missed
FROM (
SELECT call_id, MAX(answered) AS answered
FROM call_legs
GROUP BY call_id
);
One row per call. If any leg was answered, the call was answered. (That's SQLite. Voicemail needs care: make sure the vendor doesn't mark a voicemail pickup as "answered.")
Prove It on One Day
- Make test calls. Answer one. Let one go to voicemail. Hang up on one fast. Transfer one. Find all four in your data and check each field.
- Match the vendor's own report for a full day. If it's off, explain every call of the difference. "Close enough" is how a leg bug survives.
- Trace five numbers backward, from the chart to the rows to the vendor's screen.
- Ask the people on the phones. If it says Tuesday was dead and they got crushed, go look.
Then have AI attack its own work:
Assume this report is wrong. List the five likeliest reasons,
and for each one, a check I can run against the vendor's screen.
Cover: legs, transfers, time zones, voicemail, missing pages,
and internal calls.
The Finished Thing
- A nightly pull that re-reads the last three days
- A live snapshot on a schedule, for what the vendor won't keep
- An alert when either one goes quiet
- One page: missed calls by hour and weekday, with the definition and the last updated time printed on it
AI wrote the code. You picked the question, set the definition and caught the 75%. That's the job.
One customer call rings four phones and one person answers. A report shows four calls and a 75% miss rate. What went wrong?