3 Representing health data
Why is a blood pressure harder to store than it looks?
In plain language
- The same fact can be stored in many ways: a sentence in a note, a cell in a spreadsheet, a row in a database or a structured message.
- Each way makes some things easy and others hard. Free text is easy to write and hard to count. Rigid tables are easy to count and hard to change.
- Good health data keeps its context: who it is about, when it was measured, what exactly was measured, and in what unit.
The core sections below build on these ideas. Sections marked "Going deeper" are optional and go further.
Why this matters for you
What it means for each role
- Students
- Every later module, from FHIR to machine learning, depends on these basic ways of shaping data.
- Physicians and residents
- When you choose between a free-text note and a structured field, you are deciding what can be counted, alerted on and researched later.
- Nurses and allied health
- Flowsheets are some of the most structured data in the record. How rows are defined decides what can be trended and reused.
- Researchers and analysts
- Wide versus long, EAV and missing units are daily problems in extracts. Recognising them saves weeks of cleaning.
- IT and administration
- Data model choices drive how hard every report, interface and upgrade will be.
One number, many shapes
At 06:40 Mira’s watch measured a heart rate of 132 and saved it in her phone’s health app. At 09:20 the ED monitor measured her heart rate again, and the triage nurse checked it, wrote “HR 130s” in a note and filed 132 as a row in the EHR’s flowsheet. Later, the flowsheet value was sent to an app as a FHIR Observation. These look like one fact, but they are two measurements, from different devices, at different times, with different reliability, and each copy has a different shape. The shape decides what can be done with the data, and whether the difference between the two measurements survives.
Structured, semi-structured and unstructured
- Structured data has a fixed form: a number in a field with a known meaning, such as a blood pressure in a flowsheet row or a coded diagnosis. Computers can count, compare and alert on it.
- Unstructured data is free text, images, audio and scanned documents. It holds most of the clinical reasoning: uncertainty, context and the story. But a computer needs natural language processing (NLP) or image analysis to use it, and those methods make mistakes.
- Semi-structured data sits between the two: it carries its own tags or sections, but what is inside them can vary, and much of it may be narrative. A CDA clinical document, with coded sections wrapped around narrative text, is a good example. JSON and XML are common semi-structured formats.
Messages and resources such as HL7 v2 and FHIR use the same JSON and XML formats, but follow a strict published structure, so they sit at the structured end of that range, with some free-text fields.
There is a real tension here. Clinicians lose time when every fact must go into a structured field, and notes become lists of checked boxes. Researchers and decision support need structure. Rosenbloom and colleagues called this the tension between structure and flexible documentation. Most good designs structure what must be counted or acted on, and leave the rest to narrative.
Four ways to lay out the same facts
Once data is structured, there are still choices about its layout.
- Wide: one row per patient, one column per measurement, like a typical spreadsheet. Easy to read, but every new measurement needs a new column.
- Long: one row per measurement, with columns for patient, time, test, value, unit and source. New tests add rows, not columns. Statisticians call a table “tidy” when each row is one observation and each column one variable. Whether a long table is tidy depends on what you treat as one observation: it is tidy if each measurement is the observation.
- Entity-attribute-value (EAV): each row holds an entity (a patient at a moment), an attribute (a number pointing to a dictionary row that says “creatinine, numeric, µmol/L”) and a value. It is a close cousin of the long table. What makes it distinctive is that the attributes are themselves data, so thousands of sparse, changing data elements fit one table. Many EHRs use EAV or EAV-like stores for flowsheets and clinical events. The cost is that even simple questions need many joins, meaning queries that combine rows from several tables.
- Resources: self-contained objects such as a FHIR Observation, which carry their own codes, units and references. Designed for exchange between systems.
Relational databases store data in linked tables that are queried with SQL. Edgar Codd described the relational model in 1970, and it is the basis of most reporting databases and research warehouses. Some major EHRs, including Epic and the US Veterans Affairs system VistA, keep their live clinical data in older MUMPS-based databases, which are hierarchical rather than relational, and copy it every night into relational databases for reporting.
Why a blood pressure is harder than it looks
A creatinine result is one number with one unit. A blood pressure such as 148/92 is two numbers that only make sense together, and its meaning depends on context: sitting or standing, which arm, the cuff size, and whether a machine or a person took it. A wide spreadsheet tends to squeeze it into one text cell, “148/92”, which cannot be averaged. A long table splits it into two rows that must be kept together by their shared time. FHIR stores it as one Observation with two parts, called components, each with its own LOINC code. The lab below shows all three.
Lab: the same facts, five ways
Start with a prediction. Then look at Mira’s and another patient’s results in each representation, and do the remaining tasks.
Predict first
ED triage note, 2 March, 09:20 HR 130s, irregular. BP 148/92 sitting. Watch alerted at home this morning. ED note, 10:40 Creatinine 80 this morning, kidney function fine. Ward note, 3 March Cr 88 today, stable. Rate now controlled (~88).
Rich and quick to write, but a computer has to guess: "Cr", "creatinine" and "kidney function fine" all refer to the same test, and "130s" is not a number.
Now use the tabs
Context must travel with the value
A number on its own is dangerous. To be safe to reuse, each value needs:
- Who: which patient, matched reliably (Module 2).
- When: the time it was measured, ideally with a time zone, not just the time it was filed.
- What: exactly what was measured, preferably with a standard code such as LOINC (Module 5).
- How much of what: the unit, preferably as a UCUM code.
- Where from: its provenance, meaning the device, lab or person, and whether it was measured, calculated or reported by the patient. Mira’s two heart rates of 132 differ only in this.
The FAIR principles for research data (findable, accessible, interoperable and reusable) say the same thing at a larger scale: data must carry enough metadata for someone else to understand and reuse it.
Going deeper Time is harder than it looks
A lab result has several times: when the sample was collected, when it was received, when it was resulted and when it was filed in the EHR. They can be hours apart. A rule that looks for a creatinine rise “within 48 hours” gives different answers depending on which time it uses. Researchers working with extracts should always ask which timestamp they have been given.
From the Failure Museum: the spreadsheet that ran out of rows
In early October 2020, England’s public health agency announced that 15,841 positive COVID-19 test results had not been passed to the contact-tracing system on time. Results from commercial laboratories arrived as text (CSV) files and were loaded into spreadsheets on the way into the national system. One step used the old Excel .xls file format, which holds at most 65,536 rows. Each test result used several rows, so once a file grew past the limit, the extra results were cut off without any error. Contact tracing for those cases was delayed by up to a week.
The fix took days. Understanding the risk would have taken a few minutes: what is the largest file this representation can hold, and what happens when it is exceeded?
Lesson: every representation has limits, and some of them fail silently. Know the limits of the formats your data passes through, and check counts at every step.
Check your understanding
Answer every question, then check. Each answer comes with an explanation. Score 80% or more to mark the module complete. Your progress is saved only in this browser.
Sources
- Codd EF. A relational model of data for large shared data banks. Commun ACM. 1970;13(6):377-387.
- Rosenbloom ST, Denny JC, Xu H, et al. Data from clinical notes: a perspective on the tension between structure and flexible documentation. J Am Med Inform Assoc. 2011;18(2):181-186.
- Dinu V, Nadkarni P. Guidelines for the effective use of entity-attribute-value modeling for biomedical databases. Int J Med Inform. 2007;76(11-12):769-779.
- Wickham H. Tidy data. J Stat Softw. 2014;59(10):1-23.
- Wilkinson MD, Dumontier M, Aalbersberg IJ, et al. The FAIR Guiding Principles for scientific data management and stewardship. Sci Data. 2016;3:160018.
- HL7 FHIR Release 4: Observation resource, including the vital signs profiles
- HL7 Clinical Document Architecture (CDA) Release 2
- Kelion L. Excel: Why using Microsoft's tool caused Covid-19 results to be lost. BBC News, 5 October 2020.