CLINICAL DATA STRUCTURING / CASE RECORDS
Case data structuring: field mapping from medical record front pages to electronic medical records and examination reports
Medical record front pages, electronic medical records, and examination reports each have their own standards, and directly combining them often produces incomparable data. This article breaks down the three-layer work of field mapping—text retrieval from documents, field extraction, and semantic normalization—discusses the division of labor among ICD, SNOMED CT, and LOINC, the approach to timeline reconstruction, and the acceptance criteria for quality spot checks and delivery documentation, before offering an assessment for the next 12 to 24 months.
Hospitals do not lack data; they lack data that can be aligned. Medical record front pages have consistent standards but too few fields, electronic medical records are information-rich but consist entirely of free text, and examination reports fall somewhere in between. Combining the three into trainable case data is not primarily a modeling task; the real workload lies in the three unglamorous tasks of field mapping, terminology normalization, and timeline reconstruction. This article explains how to proceed across four stages—data source, extraction, normalization, and quality control—and where the process can go wrong.
1. What problem is structuring actually solving?
Most hospital data sits in business systems: visible but difficult to mobilize. To understand one patient’s complete course of illness, you must open the inpatient physician workstation, nursing system, laboratory system, imaging archive system, and pathology system at the same time. The field names, time standards, and coding versions differ across all five interfaces. The IT department can export data, but the exports are often dozens of tables that fail to match one another—for example, the inpatient encounter number in one table appears as the visit sequence number in another.
The goal of structuring is not to turn every word into a field, but to make key variables computable. Which variables count as key depends on what the downstream work requires: cohort studies need diagnoses, staging, treatment, and outcomes; model training needs input features and labels; quality control needs time points and operation records. Different goals require different field lists. Define the goal before defining the fields; reversing the order wastes effort.
In practice, the work is usually divided into three layers. The first layer extracts text from scanned files, PDFs, and images, solving whether the information exists. The second layer extracts field values, solving where the value is and what it is. The third layer performs semantic normalization, solving whether two expressions refer to the same concept. If only the first two layers are completed, the data may work within your own hospital but become incomparable outside its walls. Only when merging data across hospitals does it become clear that two instances of “diagnosis time” differ by half a month.
The delivery format should also be decided in advance. Wide tables suit statistical analysis, long tables suit multi-center pooling, FHIR resources suit system integration, and the OMOP Common Data Model suits cross-institutional research. Choosing the wrong format does not merely require redoing the work; every added variable later requires changing the table structure, and each change triggers another round of quality control.
2. Medical record front pages: where statistical and clinical standards diverge
Medical record front pages were created for settlement and statistics. Fields such as the principal diagnosis, other diagnoses, principal surgical procedures, condition at admission, and discharge disposition directly determine the DRG or DIP grouping result. Hospitals therefore have both the incentive and standardized training to complete them accurately. At the same time, this is one of the few structured tables in a hospital that is consistent in standard, reported annually, and comparable across institutions.
Its value is underestimated. Using the front page for initial cohort screening and then supplementing details from electronic medical records is the lowest-cost route. Conversely, attacking full-text medical records from the outset often stalls at the first 10,000 records: extraction rules have not yet stabilized, and people are already exhausted. The front page contains few fields, but the screening boundaries it provides are clear.
The pitfalls lie in the details. The rule for choosing the principal diagnosis is “consumption of the most medical resources,” which does not always match what clinicians consider the “most severe diagnosis.” For cancer patients, the principal diagnosis on the front page is sometimes a complication rather than the cancer itself. The four options for condition at admission are often filled with default values, making it impossible to distinguish “already present at admission” from “newly developed after admission”—and that distinction is precisely the foundation of complication analysis.
The ceiling of the front page is also clear. It has no staging, dosage, laboratory values, or follow-up. TNM stage for cancer, targeted drug names, radiotherapy dose, and recurrence time do not appear on it. Expecting the front page to directly train a predictive model will lead to disappointment; treating it as an index and filter is the appropriate use.
3. Electronic medical records: from free text to computable records
Information density in electronic medical records varies enormously. The admission record provides background, the first progress note records the basis for diagnosis, daily progress notes record changes, ward-round notes reflect the senior clinician’s judgment, consultation notes contain specialty opinions, operation records contain intraoperative findings, and discharge summaries are the most condensed. The truly valuable sections are the basis for diagnosis and the discharge summary; the most verbose is the daily progress note, which also occupies most of the text.
The difficulty of extraction lies not in recognizing entities but in judging semantics. Negations and hypotheses such as “no metastasis seen,” “tuberculosis excluded,” and “follow-up recommended” are easily missed by rules. When past medical history and family history are mixed into the present illness history, temporal attribution becomes wrong. Template boilerplate occupies most of the text; failing to remove it cleanly pollutes features and teaches the model to rely on meaningless sentences such as “general condition acceptable.”
A more hidden problem is copy-and-paste. Wording from one record is carried into the next, sometimes even into another patient’s record, creating cross-patient contamination. If quality inspection only checks whether fields are empty, this will not be detected. The necessary approach is to compare text similarity across multiple records within the same time period and manually review pairs with unusually high similarity.
A practical approach is a pipeline: split sections by subsection headings first, then extract entities, extract relationships, and normalize at the end. End-to-end generative extraction is generally less stable than a pipeline when annotation volume is limited, because when an error occurs, you cannot tell whether it occurred during segmentation, recognition, or normalization. At minimum, division into stages allows errors to be located, reworked, and handed over.
4. Breaking down fields in examination and imaging reports
Laboratory reports are relatively structured, with five core elements: item code, result value, unit, reference range, and abnormality flag. The problem is nomenclature: the same item may have different names in different hospitals, the same name may refer to different methodologies, and units may switch between mg/dL and mmol/L. Performing statistics without unifying units produces absurd conclusions—and the errors are quiet enough that no one notices.
Imaging reports are divided into “findings” and “diagnostic impression.” The former describes location, size, number, density or signal, and enhancement pattern; the latter provides conclusions and recommendations. Structuring requires extracting the examined body part, examination method, lesion characteristics, staging conclusion, and follow-up instructions such as “recommend further examination,” which are critical for building follow-up cohorts.
Report structuring and image annotation are two different things and are often conflated. Reports provide textual conclusions; annotations provide pixel locations. When the two cannot be aligned, using report conclusions for weak supervision is a common compromise, but the noise must be accepted. A report may say “suspected malignancy” while pathology proves the lesion benign; such samples can teach the model the wrong thing, and they are not rare.
Pathology reports have another set of fields: specimen site, histologic type, grade, margins, lymph nodes, and immunohistochemistry. There are not many fields, but each one is an outcome variable. Extracting even one incorrectly changes the endpoint of the entire cohort. This part usually requires pathologists to help define the standards; relying only on an engineering team’s assumptions can easily send the specification off course.
5. Entity extraction: combining rules, dictionaries, and models
Rules, dictionaries, and models each have their own boundaries. Rules are fast and interpretable but costly to maintain; dictionaries are accurate but narrow in coverage and slow to incorporate new terms; models generalize well but require annotation and are difficult to explain when wrong. These are not substitutes for one another but a division of labor: use whichever is cheapest first, and whichever provides fallback coverage later.
Layering is a more practical approach. Use rules first for segmentation and normalization, unifying dates, numeric values, units, and ranges. Then use dictionaries to match high-frequency entities such as drug names, laboratory items, and anatomical sites. Finally, use models for long-tail cases and semantic judgments such as negation, temporal order, and causality. The advantage of this order is that each layer can be evaluated independently, and problems can be traced to a specific layer.
More important than model selection is the annotation specification. For the same “time of discovery,” should the report time, sampling time, or order time be used? Unless the specification is explicit, three annotators can produce three different results, and the model learns only confusion. The specification should include examples; providing several positive and negative examples is far more useful than an abstract definition.
6. Terminology normalization: the division of labor among ICD, SNOMED CT, and LOINC
ICD is a classification and statistical system used to classify diseases and causes of death. Its granularity follows the chapter-and-section catalog, making it suitable for reporting and grouping but not for describing clinical details. During the years when ICD-10 and ICD-11 coexisted, the mapping table itself became an independent project. If it was done poorly, dangling entries appeared where “the new code existed but the old code had nowhere to go.”
SNOMED CT is a clinical terminology ontology with concepts in the hundreds of thousands, rich relationships, and suitability as a semantic layer. In China, its implementation is mostly used for mapping and post-coordination; there are few scenarios where the original codes are used directly for reporting. Its learning curve is steep, so the team needs a dedicated person; otherwise, use will gradually degrade into a collection of custom codes.
LOINC governs observations: laboratory items, vital signs, and scale items. Its value lies in converging “alanine aminotransferase,” “ALT,” and the Chinese equivalent onto the same code, making data comparable across hospitals. Observation codes number in the hundreds of thousands. Mapping local dictionaries to standard codes is the main workload and also the most tedious part.
The three are not substitutes: ICD serves statistics, SNOMED serves semantics, and LOINC serves observations. A common engineering practice is to build a mapping table from local dictionaries to standard codes, with version numbers and confidence scores, and human review for high-risk items. The mapping table is an asset, not a one-off script; it needs to be maintained and reviewed like code.
7. Timeline reconstruction: restoring scattered records into a course of illness
Medical records contain three kinds of time: recording time, event time, and system time. Recording time is when the record was completed, event time is when the event occurred, and system time is when it entered the database. Retrospective entries, proxy signatures, and template reuse can make the three diverge. Divergence of a few days is common, and divergence of months is not unusual. Which one you need depends on the analytical objective.
Reconstruction must be sorted by event time. When it is missing, infer it from adjacent records, but mark the inference; never fill it silently. Relative time must be converted: “day 5 of admission” and “3 days postoperation” must be mapped back to absolute dates, otherwise records cannot be compared across cases. The conversion rules must be written into the data dictionary so that the next person who takes over knows how day 5 was counted.
The value of a timeline lies in sequential features: the order of medication adjustments and laboratory changes, the interval between surgery and complications, and the interval between recurrence and follow-up. A single-point value describes only that moment; only a sequence can describe a trend. Many prediction tasks fail not because features are insufficient, but because sequences were flattened and all ordering information was lost.
The most common mistake is treating the recording time of a discharge summary as the event time. All events are compressed onto the day of discharge, every sequence feature is distorted, and the model learns only the empty statement that “people discharged are stable.” This problem appears easily in first-version data, so the time distribution must be checked specifically during acceptance.
8. Quality spot checks: sampling, adjudication, and rework
Spot checks must be stratified. Stratify by department, record type, and field type. Randomly selecting 100 records as a matter of course will mostly yield routine cases. Rare fields and critical outcome fields should be checked in full and excluded from the sampling pool. The sampling plan must be written clearly; otherwise, the conclusions of two spot checks cannot be compared.
The acceptance criteria must be executable: field-level correctness, whether values fall within the valid range, whether units are consistent, whether times can be parsed, and whether codes hit. Conclusions should be divided into three levels—passed, needs review, and incorrect—which is more useful than assigning a single composite score, because rework is done by field, not by the entire record.
For consistency, have two annotators independently label the same batch, calculate the agreement rate or Kappa, adjudicate disagreements in a meeting, and write the decisions into the specification. If the specification is not updated, the same disagreements will recur next week. The spot-check report should retain the disagreement records; these are material for subsequent training and the most persuasive evidence at acceptance.
9. Common pitfalls and signs of failure
The first pitfall is treating OCR as structuring. Recognizing text from a scanned file does not mean the fields are usable: coordinates may be lost, table structure lost, and checkboxes lost. A laboratory form may contain five values on one row, but recognition turns them into a single sentence, leaving the rest to guesswork—and the guessed part is often the most critical abnormal value.
The second pitfall is taking a single-hospital model directly to another hospital. Templates, abbreviations, and departmental habits all change, causing recall to drop off a cliff. Conduct a small-sample evaluation before changing hospitals. Do not assume that “systems from the same vendor should be similar”; template differences between different versions from the same vendor are enough to invalidate rules.
The third pitfall is keeping no version record. If a field definition has changed three times, no one knows which version the current data batch corresponds to, and failed reproduction can only start from scratch. The fourth pitfall is leaving spot checks until the end. By the time problems are found, the data has already been delivered, rework costs double, and both parties must renegotiate responsibility boundaries.
10. How to write acceptance and delivery documentation
There should be at least four deliverables: data dictionary, extraction specification, quality-control report, and version record. If any one is missing, subsequent maintenance will degenerate into verbal agreements and break down as soon as personnel change. These four documents are not a facade for the client; they are the evidence that you can continue working six months from now.
The data dictionary must clearly state the field name, Chinese meaning, type, valid range, unit, source system, extraction rule, and meaning of missing-value codes. Missing-value codes are especially important: “test not performed” and “test performed but no result” must be separated, otherwise statistics will treat patients who were never tested as having normal results.
The quality-control report should include the sampling method, sample size, field-level metrics, and disagreement adjudication records. Acceptance criteria should be written as measurable items—for example, the missing rate of a given field must not exceed an agreed proportion, and critical fields must have zero errors in spot checks. This is far more useful than emphasizing quality in a presentation. Only measurable criteria enable accountability, and only accountability drives improvement.
11. Forward-looking assessment for the next 12 to 24 months
First, common data models will appear more frequently in domestic projects. Growing demand for cross-hospital joint analysis will force field naming and value standards to converge, and intermediate layers such as FHIR and OMOP will appear more often in project documents rather than remaining only in papers.
Second, the role of large models in extraction will shift from “end-to-end generation” to “candidate generation plus human adjudication.” The need for reviewability in healthcare has not decreased. A model that can show evidence locations and be spot-checked is more likely to enter production than one with slightly higher accuracy but unclear reasoning.
Third, terminology mapping will move from project level to regional level. Building one shared mapping table for a region is cheaper and easier to explain during review than having every hospital build its own. Whoever establishes the mapping table and versioning mechanism first will have influence in subsequent projects; the return from this lasts longer than annotating 10,000 more images.
The first beneficiaries will be institutions with established data governance and long-term follow-up. Teams with only an extraction tool and no specification or spot checks will see quality deteriorate as project volume grows, eventually relying on low prices to survive. For teams preparing to invest, the most important action now is not buying a model, but first settling field standards, missing-value codes, and the spot-check process.
Langhui's Engineering Capabilities Along This Path
Langhui has produced AI training data since 2016. In the healthcare domain, we cover the design of acquisition specifications, structured annotation, quality control, and consistency reports for CT, MR, PET, mammography, ultrasound, and other modalities. In case-data projects, we handle field-standard alignment, extraction-specification writing, data dictionary and version-record organization, and spot-check plans and quality-control reports, so every batch of data can be reviewed.
It is important to clarify our boundaries: natural language processing of medical record text is not a platform capability of ours, and official mappings for terminology systems also require the hospital’s medical records and information departments to lead confirmation. Our work is the data-side engineering—making field definitions, missing-value codes, time conversions, and spot-check records solid, so that subsequent extraction and modeling have a reliable basis.
If your team is organizing historical medical records, preparing a disease-specific cohort, or needs to align medical record front pages and examination reports into a usable table, send us the data source types, target diseases, and downstream uses. We will provide an executable field plan and quality-control recommendations.
FAQ
Can a medical record front page be used directly to train a model?
Not recommended. The front page has few fields, no staging or laboratory values, and no follow-up; training with it can only learn grouping logic. A more suitable use is initial cohort screening and indexing: use the front page first to identify the target population, then supplement staging, medication, laboratory results, and outcomes from electronic medical records and examination reports.
Why is structuring electronic medical records harder than annotating images?
The boundary of image annotation is pixels, so interpretation standards can be written as geometric rules. The boundary of a medical record is semantics: the same wording means different things in different departments, and negations, hypotheses, and past medical history are mixed within the same passage. The difficulty of medical record structuring lies in specifications and adjudication, not tools. If the specification is unstable, the resulting annotations cannot be reused.
Do ICD, SNOMED CT, and LOINC all need to be implemented at the same time?
It depends on the purpose. For statistical reporting alone, ICD plus a local laboratory-item dictionary is sufficient. SNOMED CT and LOINC are needed for cross-hospital semantic analysis and research. Implementing all three coding systems at once significantly increases mapping workload and maintenance costs; without a dedicated team member, the effort is likely to be abandoned halfway.
How should missing times be handled during timeline reconstruction?
Infer them from adjacent records, but the inference must be marked; never fill them silently. Relative times must be converted to absolute dates, and the conversion rules must be recorded. During acceptance, examine the time distribution specifically. If a large number of events are concentrated on the day of discharge, the recording time of the discharge summary was treated as the event time.
How many records should be sampled for quality spot checks?
There is no universal ratio; it depends on field risk and batch size. Routine fields can be sampled by batch using stratification, while rare fields and critical outcome fields should be checked in full. More importantly, the adjudication criteria and rework rules must be written into the delivery documentation in advance: if problems found in a spot check exceed the threshold, the entire batch should be reworked rather than repaired record by record.
- World Health Organization. Classification of diseases (ICD) https://www.who.int/standards/classifications/classification-of-diseases
- SNOMED International. SNOMED CT https://www.snomed.org/
- LOINC. Logical Observation Identifiers Names and Codes https://loinc.org/
- HL7. FHIR Release 4 Specification https://hl7.org/fhir/
- Johnson AEW, et al. MIMIC-III, a freely accessible critical care database. Scientific Data, 2016 https://www.nature.com/articles/sdata201635
- OHDSI. OMOP Common Data Model https://ohdsi.github.io/CommonDataModel/
