lab2clock
Read a blood-test report with an LLM, and pass a biological-age clock only numbers you can trust.
The problem
Longevity services want to estimate a person's biological age from the blood tests they already have. Clocks such as PhenoAge turn routine blood markers into an estimated age, but they expect each marker in the units of the US data they were built on, while labs in Asia report in SI units and often in Chinese. A clock is only as good as the numbers fed into it: one missed conversion, CRP in mg/L where the clock expects mg/dL, adds 2.4 years to every user's PhenoAge.
The design
The model only copies the page. Names, units and arithmetic live in tested code, because reports from different countries follow different standards and that part has to be deterministic.
- Claude reads the report, a PDF or one photo per page, and copies every result as printed: name, value, unit and page. It doesn't convert, translate or rename anything.
- Code matches the names, normalises the units, parses the values and converts them to the clock's units.
- Code checks the result: plausibility limits, duplicates, missing markers, and a cross-check of lymphocyte percentage against lymphocyte count divided by white cells.
- Each clock input comes out with the row it was read from. Anything that fails a check is withheld and listed, never guessed.
Results
I tested it on real Chinese lab reports from MedRepBench, a public dataset. I tuned the code on 39 reports and held back 142. On the held-out reports, scored with the code as it was before I looked at them, 66% of markers reached the clock correctly and 5% got through wrong. The rest went missing (27%) or came through only as a limit or unchecked.
- Copying the page is the easy part. Claude Haiku 5.5 and Opus 5.5 copy 94–96% of printed numbers exactly, and Haiku costs 1/30th as much.
- Most missing markers are lost in the data. The dataset's de-identification blurs albumin's name on most reports that print it. Leaving albumin out, 78% of markers reach the clock on the held-out reports and 81% on the 39. Many reports also print no unit, and some rows are cropped.
Where wrong values got through
A copying score can't see these errors, because the wrong values were copied exactly or guessed. My first end-to-end scorer missed the urine counts too: it checked labels with the code's own rules.
- A white-cell count hidden under a pen line, on one report, which both models guessed. The lymphocyte cross-check now withholds both values when they disagree.
- Urine results printed under blood-marker names, on 8 held-out reports: urine white-cell counts of 0 to 204 cells per µL taken as blood counts, a "-" copied as 0 and a "3+" read as 3, 20 values over three runs. White-cell counts below 1,000 per µL are now set aside as urine, a 0 is refused where no living person has 0, and "3+" is not accepted as a number.
These fixes block every wrong value seen, but they were made from the held-out set, which uses it up. That is why the clean numbers above come from the code before the fixes.
What I would tell someone building something similar
- Score what reaches the output, not what the model copied. Count wrong and missing separately; only a wrong value hurts the user.
- Hold out a set before you start fixing, and score each fix only on reports it was not made from. Once you fix from a held-out set, it is used up.
- Score with rules the code doesn't share. A urine count read as a blood count looked right to a scorer that read labels the way the code did.
Limits
- Small and narrow. 181 real reports, all Chinese and mostly in SI units. US units are tested only on synthetic reports. The labels record what was printed, not the patient's true values.
- A urine count of 1,000 per µL or more would still pass. The real fix is knowing which panel a row is printed in.
- PhenoAge stands in for other clocks. Clinical clocks built on more routine markers, such as LinAge2, need a larger dictionary, but the design carries over.
Next
- Panel-aware reading: have the model copy the panel heading above each row, such as 尿常规 (urinalysis), and compare that prompt with the current one on fresh reports.
- Several reports per person: merge a blood count from one lab with a metabolic panel from another.
How I built it
I wrote the plan and split it into small tasks, each built with Claude Code or by hand and checked before the next. The design rule came first: the model only copies the page, and everything that has to be right every time lives in tested code. Models also checked me: a Claude pass over my hand-checked labels found four unit errors I had missed, and a critique of the published results by another model found gaps I then closed.