spacr.qt.widgets.qc_summary

One verdict for a project, assembled from verdicts that already exist.

Every check spaCR can make is already implemented somewhere – segmentation scorecards, leakage audits, the units stamp on every measurement row. What is missing is a place to see them together, so “is this run usable?” does not require opening five screens and remembering which of them was run last.

Nothing here computes a verdict. The rule comes from spacr.qt.prerun, which states it plainly: opening a plate’s masks costs seconds to minutes, and a screen that pays that on every visit is a screen nobody keeps. So each reader here does a directory listing, a stat and a parse, and reports what it found – including that it found nothing, which is emphatically not the same as finding nothing wrong.

Staleness follows the same rule. seg_qc.read_digest dates each scorecard against its mask stack and reports one written before its masks as out of date; this module carries that through to the card rather than re-deriving it, and applies the same idea to the other sources against their own inputs.

The vocabulary is borrowed, not reinvented. A segmentation flag’s explanation comes from spacr.seg_qc.FLAG_GUIDANCE, which is where those sentences were written and where they will be maintained.

Classes

Dashboard

Every card for one project, plus the verdict they add up to.

QCCard

One check, as it was found on disk.

Functions

format_dashboard(→ str)

The dashboard as plain text, for a log or a copy-paste.

read_dashboard(→ Dashboard)

Read every verdict already on disk for one project. Computes none.

worst_verdict(→ str)

The worst of several verdicts, by VERDICT_ORDER.

Module Contents

class spacr.qt.widgets.qc_summary.Dashboard[source]

Every card for one project, plus the verdict they add up to.

Variables:
  • root – the project folder the cards were read from.

  • verdict – the worst card verdict.

  • headline – one sentence naming the worst finding.

  • cards – the cards, in a fixed order so the screen does not reshuffle between refreshes.

  • checked_at – when the read happened.

  • blocks_run – constant False. Advisory by construction, and the field exists to say so in code rather than only in a docstring – the same posture spacr.seg_qc.QCDigest takes.

card(key: str) → QCCard | None[source]

The card with this key, or None.

Parameters:

key – a card identifier such as "segmentation", "leakage", "units", "plate" or "agreement".

property stale: bool[source]

Whether any card is older than the thing it describes.

class spacr.qt.widgets.qc_summary.QCCard[source]

One check, as it was found on disk.

Variables:
  • key – stable identifier – segmentation, leakage, units, plate, agreement.

  • title – what goes on the card.

  • verdict – one of VERDICT_ORDER.

  • headline – the one line worth reading.

  • detail – the sentences behind it, already in plain language. For segmentation these come from spacr.seg_qc.FLAG_GUIDANCE – the same words that screen uses, because two vocabularies for one flag is how a codebase ends up disagreeing with itself.

  • source – the file the verdict was read from, or "".

  • mtime – that file’s modification time, or 0.0.

  • stale – whether its inputs are newer than it is. A stale card is not downgraded to a worse verdict – it describes the previous run accurately, and pretending otherwise would hide which of the two is the problem.

  • how_to_produce – for a missing card, the one thing to run.

property display_verdict: str[source]

The verdict as it should be labelled, staleness included.

spacr.qt.widgets.qc_summary.format_dashboard(dashboard: Dashboard) → str[source]

The dashboard as plain text, for a log or a copy-paste.

Parameters:

dashboard – the dashboard to format: its verdict and headline first, then one line per card with that card’s details indented under it.

spacr.qt.widgets.qc_summary.read_dashboard(src: Any, *, segmentation_reader=None) → Dashboard[source]

Read every verdict already on disk for one project. Computes none.

Parameters:
  • src – project folder, plate folder, or a list of either.

  • segmentation_reader – substitute for spacr.seg_qc.read_digest(), for tests.

Returns:

a Dashboard. verdict == "missing" means no check has been run, which is not the same as "ok".

spacr.qt.widgets.qc_summary.worst_verdict(verdicts: Sequence[str]) → str[source]

The worst of several verdicts, by VERDICT_ORDER.

Parameters:

verdicts – verdict strings, each one of VERDICT_ORDER ("ok" best to "error" worst); unknown strings are ignored, and none known gives "missing".