Skip to content

Extracting from medical records

Coded clinical data — diagnoses, medications, labs and vitals — where the coding system is the hard part and the handling obligations are real.

A clinical document is not free text with some numbers in it. Almost every field worth extracting is governed by a published coding system with a structure you can check: ICD-10-CM says which character carries laterality, the NDC has three segments and two incompatible digit lengths, LOINC identifies a lab result by six axes rather than by its printed name, and a prescriber’s NPI carries a check digit that tells you the transcription is arithmetically sound. The interesting work is not getting a model to emit JSON. It is knowing what the emitted value is supposed to look like, and what it means when it does not.

These pages are written for an organisation that already holds the records lawfully and needs the data out of them. Every example is synthetic. Where a handling obligation genuinely attaches — minimum necessary on the field list, redaction before a page reaches somebody else’s model, a business associate agreement covering the provider that sees it — it is named at the point it attaches, and nowhere else. None of this is clinical advice: the subject is parsing a document, not deciding what to do about its contents.

Extracting Diagnosis Codes From a Medical Record

How to tell a printed ICD-10-CM code from a diagnosis that exists only as a sentence, and why deriving the second one is a coding decision rather than an extraction problem.

10 min read

Extracting Medication Lists From a Medical Record

Why one chart contains several medication lists that disagree on purpose, and how RxNorm and the NDC's three segments give you something stable to normalise onto.

11 min read

Extracting Vital Signs From a Clinical Note

Vitals appear as a narrative sentence and as a flowsheet column in the same note, the units are usually implied rather than printed, and only one of the two unit errors is caught by a range check.

9 min read

Extracting Allergies and Adverse Reactions From a Medical Record

The only field in the chart where the valuable answer is usually a negative, and where an empty array and an explicit statement of none must never collapse into the same value.

10 min read

Extracting Reference Ranges and Flags From a Lab Report

A reference range belongs to the run that produced the result, not to the analyte, and a single misaligned row shifts every range down the column onto the wrong test.

10 min read

Extracting Analyte Results From a Multi-Page Lab Panel

A worked method for carrying the patient header, the specimen and the column definitions from page one onto every continuation page of a lab panel.

11 min read

Extracting Critical-Value Flags From a Lab Report

The flag is an assertion the performing laboratory made under its own critical-value policy, which is why it needs its own field and why you must transcribe it rather than recompute it.

9 min read

Extracting Drug Name, Dosage and Sig From a Prescription

The sig is a compositional grammar in abbreviated Latin, several of whose tokens are on published error-prone lists because humans misread them, and a lookup table beats a model that thinks it knows them.

11 min read

Extracting Refill Counts and Prescriber Details From a Prescription

The prescriber's NPI and DEA number both carry check digits, so these two fields can be validated arithmetically rather than merely extracted — and only one of them has a public registry.

10 min read

Extracting Findings and Impressions From a Radiology Report

Findings and Impression are different speech acts — observation versus conclusion — and merging them destroys the hedging and the incidental findings that the sections exist to keep apart.

10 min read

Extracting Measurements From a Radiology Report

Measurement text is a small grammar with an implied unit at the end, an axis convention that differs for lymph nodes, and a prior value in the same sentence that a naive parser grabs.

10 min read

Extracting Eligibility Criteria From a Clinical Trial Protocol

Criteria are numbered, cross-referencing and amended, so the extraction problem is atomicity plus stable identity — a criterion is a predicate with a comparator, a unit and a time window, not a sentence.

10 min read

Extracting Dosing Schedules From a Clinical Trial Protocol

The schedule of activities is a matrix of relative days inside repeating cycles with visit windows, and expanding it into a calendar has an off-by-one that no schema check will catch.

10 min read

Other topics