depthfirst.dev
public TCGA data, no PHI

pathledger

The layer under LLM abstraction of pathology reports: it lets the extractor say unknown, checks every answer against the public registry, keeps a ledger of where they disagree, records exactly how each result was produced, and fails the build when quality drops.

Built on the same public reports used in the Rasool Lab consensus framework (Tripathi, Waqas et al., Laboratory Investigation, 2025), to answer what that paper leaves open.

60reports evaluated
92.0%mean coverage, answered rather than UNKNOWN
78.7%mean agreement with GDC on answered fields
156fields settled by rules before any model call
60reports that needed a model call

Why this exists

Cancer registries abstract stage, grade, histology, site and laterality from every surgical pathology report, by hand. The Rasool Lab showed that eleven locally deployed language models with three reasoning judges can do this with pathologist validated accuracy in the high eighties to high nineties on TCGA reports. Read as an infrastructure engineer, three questions follow.

What if the system may say unknown?

A forced consensus value hides the coverage versus accuracy curve that a registry manager needs to set a threshold.

Can the registry be the gold set?

GDC structured fields exist for the same cases. Where the report and the registry disagree, one of them is wrong, and that is the finding.

Is a result reproducible six months later?

Every run is content addressed. A rerun is a cache hit, a changed prompt is a new namespace, and a gate fails the build when quality drops.

How it works

Rules first and free, the model only for what rules could not settle, every answer either verbatim evidence or UNKNOWN, every run content addressed, a gate at the end.

Public reports TCGA-Reports, 9,523 texts Registry fields GDC clinical, same cases Rules, versioned settle or abstain, no model Model, only the rest verbatim evidence or UNKNOWN Cache and manifest report, prompt, rules, model hashes Normalise both sides one vocabulary, inspectable Evaluate coverage curve, calibration Disagreement ledger adjudicated by a person Gate: fails the build when agreement drops or coverage collapses
Deterministic rules are versioned and allowed to abstain. The model must quote evidence that is verified as an exact substring of the report, or the field becomes UNKNOWN. Both sides are normalised into one vocabulary before comparison.

Try it in your browser

Pick a report from the published run to see the full result, rules and model, exactly as it was produced, embedded in this page. Or paste any de-identified public report: the rules run right here, with no model calls or external requests.

Report

This browser demo runs local rules and embedded examples only. No API key is required; unresolved fields remain UNKNOWN.

Extracted fields

rulesmodelunknown, abstained

Evidence in the text

Pick a sample or press Extract.

Results

Coverage is the share of reports where the system committed to an answer. Agreement is measured on answered fields against the GDC registry value.

Read this before the numbersThe published column is pathologist agreement on consensus outputs from Tripathi, Waqas et al., Laboratory Investigation, 2025; medRxiv 2025.04.22.25326217. This project reports registry agreement on outputs that were allowed to abstain. Different metric, different sample; shown for orientation only. Different metric, different sample. Shown for orientation only, never as a head to head comparison. Verify against the paper before publishing.
field answered coverage agreement with GDC rules share published, pathologist reviewed local model, subset
stage 50 / 60 83.3% 62.0% 83.3% 89.0% 68.8%
grade 49 / 60 81.7% 95.6% 81.7% 96.0% 93.8%
histology 60 / 60 100.0% 51.7% 0.0% 99.0% 45.0%
site 60 / 60 100.0% 100.0% 0.0% 95.0% 100.0%
laterality 57 / 60 95.0% 84.2% 95.0% 88.0% 85.0%
coverage_accuracy
Accuracy at each coverage level as the abstention bar rises. This curve is what a forced consensus value hides.
reliability
Stated confidence against observed agreement. Model stated confidence is not a calibrated probability; this shows by how much.

Disagreements are data quality findings

Where the report and the GDC field disagree, one of three things is true: the extractor is wrong, the registry is wrong, or the report is ambiguous. A person adjudicated a sample.

9registry wrong
6extractor wrong
5ambiguous
field case extracted registry conf evidence adjudication

Provenance and cost

Deterministic rules settled 156 field values across 60 reports; a model was needed for 60. Every extraction is content addressed on report hash, prompt hash, rules version, backend and model. A rerun is a cache hit. A changed prompt is a new namespace and never mixes with the old one.

run_idf831b36e138a78f8
started2026-09-13T17:32:22
backendpreview
modelsynthetic-template
promptembedded-prompt-v1
prompt_hash32c0f6c31744eb80
rules_versionrules-v1
code_commitnogit
pathledger_version0.2.0
sample_hash7ee972e8b2672ce6
n_reports60
cache_hits0
llm_calls60
rules_settled156
finished2026-09-13T17:32:22

Run ledger

started backend model prompt rules commit n cache hits model calls
2026-09-13T17:32:21 fake none 32c0f6c31744eb80 rules-v1 nogit 3 0 3
2026-09-13T17:32:21 fake none 32c0f6c31744eb80 rules-v1 nogit 3 3 0
2026-09-13T17:32:22 preview synthetic-template 32c0f6c31744eb80 rules-v1 nogit 60 0 60

Reproduce this run

python pathledger.py fetch --projects TCGA-BRCA TCGA-LUAD --per-project 100
python pathledger.py extract --backend anthropic
python pathledger.py evaluate && python pathledger.py check

Limitations

Written before the results, on purpose
  • Registry agreement is not pathologist agreement, and GDC fields may have been abstracted from these same reports, so agreement is partly circular. Disagreements are still informative.
  • A few hundred reports across two cancer types, not 6,100 across ten organ systems.
  • Hosted API for throughput; the local model column is a subset run. Stated confidence is not calibrated.
  • Built by one person in a few days on public data as a design argument with numbers. Not a medical device, no clinical claims.

What this would become inside an institution

Organ specific TNM to stage group mapping instead of string comparison. mCODE aligned output so the structured fields land in a registry without a second transform. Per modality governance on the derived artifacts, since an extraction ledger is derived data with its own re-identification profile. And the gate wired to the nightly job, so a prompt or model upgrade cannot change registry numbers without failing a build first.