/* EXAMPLE ONLY: an extract from the Superbill Review prototype, kept as reference for porting. ECW/eClinicalWorks, Tebra, 'Example Client', SPB_* tables and patient/ticket wording are that project's examples. Don't copy them into a new project. */
import { BAND_VAR } from '../bands'
import type { Run } from '../types'
/**
* The batch in one line: how much runs unattended, how much needs a person.
*
* This is the number the whole pipeline exists to produce. Reading it off a list
* of cards means counting, so it is stated once at the top — and stated as
* documents, not fields, because the decision it supports ("what do I have to
* look at today") is made per document.
*/
export function StatsBar({ runs }: { runs: Run[] }) {
const done = runs.filter((r) => r.status === 'done')
const clean = done.filter((r) => flagged(r) === 0)
const needs = done.filter((r) => flagged(r) > 0)
const busy = runs.filter((r) => r.status === 'queued' || r.status === 'running')
const failed = runs.filter((r) => r.status === 'failed')
const fields = done.reduce((n, r) => n + flagged(r), 0)
if (runs.length === 0) return null
return (
{fields > 0 && (
)}
{busy.length > 0 && }
{failed.length > 0 && }
)
}
function flagged(run: Run): number {
if (run.review) return run.review.total
const s = run.summary
return s ? s.amber + s.red + s.unscored + s.blank_critical : 0
}
function Stat({
n,
label,
tone,
}: {
n: number
label: string
// "accent" ties to the brand ramp (this stat means "went straight through,"
// the same semantic as the confirm/approve action elsewhere); the rest are
// theme tokens for the state they report.
tone: 'accent' | 'amber' | 'slate' | 'blue' | 'red'
}) {
// `slate` stays on the runbar's own ink — a stat with no state to report
// should not borrow a colour that means one.
const colour = {
accent: 'var(--accent-1)',
amber: 'var(--verify)',
slate: '',
blue: 'var(--accent-2)',
red: 'var(--review)',
}[tone]
return (
{n} {label}
)
}
/**
* What the colours mean, on the page rather than in a document nobody opens.
* The caveat is part of the legend on purpose: the bands rate how legibly the
* source was printed, and a reviewer who reads them as "verified" will trust a
* confident misread.
*/
export function BandLegend() {
return (
print clarity, not correctness ⓘ
)
}
function Swatch({ band, label }: { band: 'green' | 'amber' | 'red'; label: string }) {
return (
{label}
)
}