From Primetime Home Health Services. Prepared with AI drafting assistance. This is a synthetic TypeScript example for a generic staff queue, not a live PTHHS screen or a decision about care, pay, or eligibility.
A dashboard that says “0 items” is making a claim: the last check succeeded and found none. If the request failed, a zero is the wrong default. The difference matters when an office is deciding whether anyone still needs to review the queue.
Make the difference explicit in the type
type Queue =
| { kind: "checked"; count: number; at: string }
| { kind: "stale"; at: string }
| { kind: "unavailable" };
function message(s: Queue) {
switch (s.kind) {
case "checked":
return `${s.count} items need review. Checked at ${s.at}.`;
case "stale":
return `Refresh failed. Last checked at ${s.at}; the earlier count may have changed.`;
case "unavailable":
return "Couldn’t check the list. Try refreshing.";
}
}
Here, at stands for the last completed check for this same view, formatted clearly for the reader. A new network attempt should not overwrite it with a fresh clock time. Treat a partial response as unavailable for this total rather than reporting it as a complete check. Do not carry a result across a change in the source, active view or session.
Test the exact messages
- A complete result with zero items at 09:15 should show zero and 09:15.
- A failed refresh after that check should keep 09:15, say the result may have changed, and make no current count claim.
- A failure with no usable previous result should show the retry message, not zero or a manufactured timestamp.
Keep the status readable without color. For an in-place update, test that assistive technology can announce it without pulling focus from the person’s current task. See W3C’s status-message guidance. Test with invented values, not office records.
Read the exact PTHHS original, Why Healthcare AI Should Learn From Mistakes, for the administrative context. Published from Jeremy Nwokorie’s account on behalf of Primetime Home Health Services.
Top comments (0)