Report Text Extraction

The pipeline converting narrative pathology reports into structured, analysable fields — the entry point for every text-mining study in the group.

The pipeline converting narrative pathology reports into structured, analysable fields — the entry point for every text-mining study in the group.

What it is

Four stages, each with its own failure mode.

1. Acquisition. Reports leave the LIS as PDF, HL7 messages, or RTF. extract-report-text handles the format conversion to plain text. Encoding is a real concern for a bilingual corpus — Turkish characters survive some conversion paths and not others.

2. De-identification. Runs before anything reaches a repository. Research repos consume cleaned tables only, and accession numbers are hashed — see De-identification.

3. Field extraction. Turning prose into fields. Two approaches coexist. Rule-based methods (regular expressions, pattern matching) are transparent, deterministic, and easy to audit but brittle to phrasing variation; the ecosystem notes record a regex-based labelling file used in production. LLM-based extraction generalises better across phrasings but is non-deterministic and needs its own validation — see LLM Report-Quality Checking. gleason_extraction is the group’s worked example of extracting one specific structured field.

4. Analysis. pathology-reports-text-analysis runs NLP over the extracted corpus.

The stage that determines everything downstream is 3. Extraction error does not announce itself: a field silently mis-parsed in 5% of cases becomes a 5% misclassification in every cohort built on it, and nothing downstream will flag it.

The alternative this page has never considered

Every option above is a way of recovering structure after the fact. There is another answer, and a country has been running it since 1971.

Siebers 2026 — The Dutch Nationwide Pathology Databank (Palga) describes the Dutch approach: the pathologist writes a coded one-line diagnosis summary at sign-out, as part of authorising the report. It is a series of asterisk-separated terms carrying at minimum the topography, the technique used to obtain the material, and at least one diagnosis term, drawn from a published national thesaurus and mapped automatically to hierarchical codes and to SNOMED CT. Their worked example: “Cervical biopsy showing an hrHPV-positive adenocarcinoma” becomes cervix*biopsy*adenocarcinoma*high-risk HPV type positive.

The mechanism that makes it work is not the vocabulary. It is that a control module checks the summary during authorisation, and a report it flags cannot be authorised or submitted until it is corrected. The structure is not requested, encouraged, or audited afterwards — it is a precondition of signing out.

Two consequences worth sitting with:

The codes being hierarchical does most of the analytical work. Querying T67 returns both colon and ascending colon, and synonyms collapse onto one code, so cohort definition becomes a prefix query rather than a synonym list somebody has to maintain. That is a property this pipeline has to simulate with a mapping table, badly.

It relocates the cost rather than removing it. Their reported error surface is not parser brittleness but pathologist compliance and coding correctness — and notably, the source reports no coding accuracy figure at all. A structurally valid coded line can still be clinically wrong, nothing there measures how often, and that number would bound every study built on code-based retrieval. So the honest comparison is not “structured input beats extraction”; it is that both approaches have an unmeasured error rate, and neither of the two systems has measured its own.

The reason this belongs on the page: when the extraction accuracy gap below is finally addressed, the comparator should not only be “a better parser”. For any field the group actually needs repeatedly, a mandatory structured field with a blocking validator at sign-out is a competing intervention — organisational rather than technical, considerably harder to introduce, and it makes the extraction problem disappear rather than shrink. The named barriers to that route are on Synoptic Reporting, and they are about clinician workload and workflow, not software.

Why it matters for my work

This is the canonical extractor for narrative report content coming out of the LIS, and it feeds several projects directly: Konsultasyon uses it to parse outside-lab narratives for comparison against Memorial’s diagnosis, and the report-quality work in Pathology Report Checker Skills consumes its output. Historical corpora live in patolojirapor and patolojiraporlari.

The onboarding first step — run the extractor on one de-identified PDF and confirm the JSON round-trips through the skills collection — is a sensible smoke test but is not an accuracy evaluation.

How it connects

Patoloji Bilgi Yönetim Sistemi (LIS) — the upstream source, including which fields are reliable and which are not.

Synoptic Reporting — the more synoptic the source report, the less this pipeline has to infer, and the lower the silent error rate.

LLM Report-Quality Checking — the LLM layer built on top of the extracted text.

De-identification — a mandatory stage, not an optional one.

Konsultasyon — a direct consumer, for parsing referring-lab reports.

LLM Adaptation Techniques — the ladder the LLM half of stage 3 sits on; useful for deciding how far up it a given extraction actually needs to go, since a crisp field is better served by a regex than by any rung.

Siebers 2026 — The Dutch Nationwide Pathology Databank (Palga) — the organisational alternative to this whole pipeline: structure written at sign-out and enforced by a validator that blocks authorisation.

Record Linkage Under Pseudonymisation — what happens to the extracted rows afterwards. Stage 2 hashes the accession number, and from that point on “all reports for this patient” is a probabilistic decision rather than a lookup — which is a silent error source sitting immediately downstream of this pipeline and counted nowhere.

Open questions

  • There is no recorded extraction-accuracy evaluation. For a pipeline that defines cohorts downstream, this is the most important gap on this page. A few hundred manually-verified reports would establish per-field precision and recall.
  • Is the pipeline validated separately on Turkish and English reports? Performance will differ and the corpus is bilingual. [unverified]
  • Where rule-based and LLM extraction overlap, is there a comparison? That would be a cheap, useful internal result.
  • Stage 2 now has a concrete off-the-shelf candidate, and a concrete reason not to use it yet. OpenMed ships the Turkish PII assets this pipeline has never had — a checksum-validated TCKN detector, Turkish month-name and +90/05xx phone and cadde/sokak/mahalle address patterns, day-first date handling, and 62 Turkish PII checkpoints — and it runs offline. Three things block it. Its default text path misclassifies ordinary pathology vocabulary as SWIFT/BIC bank codes: FORMALIN, INVASIVE, SURGICAL, PATOLOJI, MAKROSKOPIK and INCELEME all come back as bic spans in both English and Turkish, verified directly against the merger. Its only folder-level command takes no --lang and no --encoding, so a cp1254 export — the normal Turkish LIS encoding — aborts the whole batch. And no Turkish clinical layer exists at all: no section headers, no negation cues, and no Macroscopy/Microscopy/Diagnosis labels in any language, so the section segmentation stage 3 depends on would have to be written locally regardless.
  • The accuracy gap above and the Turkish question are the same piece of work. Whatever reaches stage 2 or stage 3 — regex, LLM, or an outside package — needs a held-out set of locally de-identified Turkish reports with manually annotated fields and names. That set does not exist, and every open question on this page is blocked on it rather than on tooling.
  • The obstacles to an LLM extractor have now been named by someone running a national corpus, and they are not the ones usually cited. Siebers 2026 — The Dutch Nationwide Pathology Databank (Palga) reports that the difficulty of applying LLMs to Dutch pathology text is not data volume but “highly specialized terminology, extensive use of abbreviations, and heterogeneity of reporting practices across institutions and time periods”. Every one of those transfers to this corpus and two are worse here — abbreviation use in Turkish reports is undocumented, and the corpus spans institutions with no shared template at all. It is a useful corrective: the instinct is to assume more reports would fix extraction, and the group with 92 million of them says otherwise. It also means the held-out set above should be stratified by era and by source institution rather than sampled at random, or it will measure the easy middle of the corpus.