NULL://projects / P-02
P-02
- LLM
- RETRIEVAL
- EVAL
ICD-11 Note Coder
Retrieval-augmented clinical coding against an 18,375-code catalogue
- YEAR
- 2026
- STATUS
- COMPLETE
- Dev notes, top-1
- 60 / 60
- 181 multilingual notes, top-3
- 167
- Pooled proxy score, 241 notes
- 96.4
- Cost per 600 notes
- ≈ $2.60
[01] Overview
Reads a consult note (typed, short, or an ambient transcript, in any language) and proposes up to three ICD-11 MMS 2026-01 codes, best first. Python standard library only.
[02] Constraints
- 600 unseen notes in 60 minutes on CPU, with a model budget of about one cent per note.
- At run time the network is model APIs only, through an HTTPS proxy. Every index ships in the image.
- With no API key, every note must still get an answer.
[03] Architecture
Local guess
written first
Extract
Haiku
Retrieve
fused BM25 · 80
Shortlist
top 10
Decide
Sonnet + siblings
Leaf code
≤ 3
- Local first: a no-model guess is written for every note immediately, with negated findings removed and abbreviations expanded.
- Extraction turns any-language notes into English diagnosis terms; several BM25 queries over titles and WHO index terms are fused into 80 candidates.
- The final model sees the top ten plus their sibling and child codes, so it can choose the right specificity.
[04] Reliability
- If a stage fails, the earlier stage's answer stands. Flaky models pause rather than being dropped.
- A rejected TLS certificate is treated as permanent for that provider, so the run finishes promptly on the local fallback.
- Provider failover to an OpenAI-only path; hard budget cap and deadline controls.
[05] Evaluation
- WHO hierarchy and index terms for all 18,375 codes crawled from the WHO ICD API.
- A change ships only if the pooled score rises and the generalisation slice drops by no more than 0.5/25.
- Retrieval changes replayed offline on saved extractions first, at no model cost.
- Pooled proxy score: 87.7 → 93.3 (WHO terms) → 96.4 (Sonnet reranking).
[06] Where the AI tooling was wrong
- Codex assumed every WHO entity URI ends in a numeric ID. A real URI ending in /other would have broken the crawler; the fix accepts residual suffixes and verifies every URL first.
- AI-written retry logic treated a rejected certificate as a temporary network error and would have retried until the deadline.
- A decision log overstated how a test set had been checked. It was corrected and the set marked provisional.