Medical AI · Foundations · Lesson 3 of 6
Data standards: FHIR, HL7, ICD, SNOMED CT, LOINC and OMOP
Reviewed by Dr. Ram Kumar G, MBBS, MD (Internal Medicine), MPH (USA), on · Last updated
- Beginner
- Technical focus
- About 30 minutes
- Includes exercise
Before this lesson: Healthcare data types: records, images, signals, notes and omics
In short
Healthcare data standards fall into two groups. Exchange standards such as HL7 v2 and FHIR define how data moves between systems; terminologies such as ICD, SNOMED CT and LOINC define what each item means. Research models such as OMOP put data from many sources into one shape. AI projects that ignore these standards spend most of their time reconciling codes and units by hand.
You will learn to
- Explain the difference between exchange standards, terminologies and common data models
- Recognise the purpose of FHIR, HL7 v2, DICOM, ICD, SNOMED CT, LOINC, UCUM and OMOP
- Parse a FHIR Observation in Python and read its codes and units
- Map local lab codes and units to a standard so data from two sites can be combined
Why standards matter for AI
Two hospitals can record the same HbA1c result with different local codes, different units and different names. A model trained on one site's codes cannot read the other's. Standards solve this at three levels: how data are packaged and sent, what the codes mean, and how data are arranged for analysis.
| Layer | Question it answers | Main standards |
|---|---|---|
| Exchange | How is the data packaged and sent between systems? | HL7 v2 messages, HL7 FHIR, DICOM (images) |
| Terminology | What does each item mean? | ICD (diagnoses), SNOMED CT (clinical terms), LOINC (tests and observations), UCUM (units) |
| Common data model | How is data arranged for analysis across sources? | OMOP Common Data Model |
Exchange: HL7 v2 and FHIR
HL7 version 2 is a messaging standard from the late 1980s that still carries much of the traffic inside hospitals, such as admissions and lab results, as pipe-delimited text messages. FHIR (Fast Healthcare Interoperability Resources) is HL7's modern standard: data are split into 'resources' such as Patient, Observation, Condition and MedicationRequest, exchanged as JSON or XML through web APIs.
As of October 2026, FHIR R4 (2019) is the version most widely implemented and the one required by many national programmes; R5 was published in 2023; and R6 is still being balloted and is not yet a published standard. National 'implementation guides' constrain FHIR for local use: for example US Core in the United States, and the FHIR implementation guide for India's Ayushman Bharat Digital Mission (ABDM), which is based on R4.
import json
observation_json = """
{
"resourceType": "Observation",
"status": "final",
"code": {"coding": [{"system": "http://loinc.org", "code": "4548-4",
"display": "Hemoglobin A1c/Hemoglobin.total in Blood"}]},
"subject": {"reference": "Patient/example-001"},
"effectiveDateTime": "2026-03-14",
"valueQuantity": {"value": 7.8, "unit": "%",
"system": "http://unitsofmeasure.org", "code": "%"}
}
"""
obs = json.loads(observation_json)
coding = obs["code"]["coding"][0]
quantity = obs["valueQuantity"]
print(f"{coding['display']} (LOINC {coding['code']})")
print(f"{quantity['value']} {quantity['unit']} on {obs['effectiveDateTime']}")
# Hemoglobin A1c/Hemoglobin.total in Blood (LOINC 4548-4)
# 7.8 % on 2026-03-14- The meaning of the test comes from the coding system (LOINC) and code (4548-4), not from the display text, which can vary.
- Units are coded with UCUM (unitsofmeasure.org), so software can tell '%' from 'mmol/mol' reliably.
- Real Observations often carry several codings (a local code plus LOINC), reference ranges and interpretation flags; robust code checks the system before using a code.
Terminologies: ICD, SNOMED CT and LOINC
Terminologies give each concept a stable code. They serve different purposes and are often used together: SNOMED CT for detailed clinical recording, ICD for statistics and billing, LOINC for naming tests and measurements.
| Terminology | Maintained by | Used for | Type 2 diabetes / HbA1c example |
|---|---|---|---|
| ICD-10 / ICD-11 | World Health Organization | Mortality and morbidity statistics, billing, reporting. ICD-11 came into effect on 1 January 2022; many countries still use ICD-10 or national versions | ICD-10 E11; ICD-11 5A11 (type 2 diabetes mellitus) |
| SNOMED CT | SNOMED International (national release centres in member countries) | Detailed clinical recording in EHRs: findings, disorders, procedures | 44054006 (diabetes mellitus type 2) |
| LOINC | Regenstrief Institute | Identifying lab tests and clinical observations | 4548-4 (HbA1c); 2345-7 (glucose in serum or plasma) |
| UCUM | Regenstrief Institute | Unambiguous units of measure | %, mmol/mol, mg/dL |
Licensing
- LOINC and UCUM are free to use under their licence terms. SNOMED CT is free in member countries through the national release centre, but needs a licence elsewhere. ICD is published by WHO under its own terms. Check the licence before building a product on any terminology.
Harmonising codes and units across sites
In practice, each lab system uses local codes, and the same test may be reported in different units. Before pooling data, map local codes to LOINC and convert values to one unit. The example below does this for two synthetic hospitals.
LOCAL_TO_LOINC = {
("hospital_a", "GLU"): "2345-7", # Glucose [Mass/volume] in Serum or Plasma
("hospital_b", "GLUC_P"): "2345-7",
("hospital_a", "A1C"): "4548-4", # Hemoglobin A1c/Hemoglobin.total in Blood
("hospital_b", "HBA1C_IFCC"): "4548-4",
}
def harmonise(source, local_code, value, unit):
loinc = LOCAL_TO_LOINC[(source, local_code)]
if loinc == "2345-7" and unit == "mmol/L":
value, unit = value * 18.0, "mg/dL" # glucose: 1 mmol/L ≈ 18 mg/dL
if loinc == "4548-4" and unit == "mmol/mol":
value, unit = value / 10.929 + 2.15, "%" # IFCC → NGSP master equation
return loinc, round(value, 1), unit
results = [
("hospital_a", "GLU", 126, "mg/dL"),
("hospital_b", "GLUC_P", 7.0, "mmol/L"),
("hospital_a", "A1C", 7.0, "%"),
("hospital_b", "HBA1C_IFCC", 53, "mmol/mol"),
]
for r in results:
print(r, "->", harmonise(*r))
# ('hospital_a', 'GLU', 126, 'mg/dL') -> ('2345-7', 126, 'mg/dL')
# ('hospital_b', 'GLUC_P', 7.0, 'mmol/L') -> ('2345-7', 126.0, 'mg/dL')
# ('hospital_a', 'A1C', 7.0, '%') -> ('4548-4', 7.0, '%')
# ('hospital_b', 'HBA1C_IFCC', 53, 'mmol/mol') -> ('4548-4', 7.0, '%')- After mapping, the four results collapse into two tests with consistent units: 126 mg/dL glucose and 7.0% HbA1c at both sites.
- Without this step, a model would treat 7.0 mmol/L and 126 mg/dL as different values, or 53 as an impossibly high HbA1c.
- Real mappings involve thousands of local codes and need clinical and laboratory review; tools from the OHDSI community help, but do not remove the need for checking.
OMOP: one shape for research data
The OMOP Common Data Model, maintained by the OHDSI community, defines standard tables (person, condition occurrence, drug exposure, measurement and others) and standard vocabularies. Once data from different hospitals or countries are converted to OMOP, the same analysis code runs on all of them. As of 2026, version 5.4 is the release OHDSI recommends for new work.
FHIR and OMOP do different jobs: FHIR moves individual records between systems in real time; OMOP organises large volumes of data for analysis. Many projects use both, with HL7's FHIR-to-OMOP guidance to convert between them.
| FHIR | OMOP CDM | |
|---|---|---|
| Main purpose | Exchanging data between systems | Analysing data across sources |
| Unit of work | One resource or patient at a time, via APIs | Whole populations in a database |
| Typical AI use | Feeding a deployed model with live data; agent tools | Training and validating models across many sites |
Standards and national programmes
Governments increasingly require standards. In the United States, certified EHRs must provide FHIR R4 APIs. In the European Union, the European Health Data Space Regulation (EU) 2025/327 entered into force on 26 March 2025, with its main provisions applying from March 2027 and secondary-use rules from 2029. India's ABDM uses FHIR R4 profiles and SNOMED CT through the National Resource Centre for EHR Standards. For AI developers, these programmes mean more data will arrive in standard forms, along with rules on who may use it and for what.
Exercise
Read synthetic FHIR R4 patient bundles from Synthea, extract HbA1c and glucose Observations by LOINC code, and harmonise their units into one analysis table.
Data: Synthea synthetic FHIR R4 bundles (Synthea is Apache 2.0; generated records are synthetic)
- Load a few Synthea FHIR bundles (the notebook downloads a small sample) and count the resources of each type.
- Extract every Observation with LOINC 4548-4 or 2345-7 into a pandas table with patient, date, value and unit.
- Add a second, made-up 'site' whose results use mmol/L and mmol/mol, and harmonise both sites with the mapping approach above.
- Look up 44054006 in a SNOMED CT browser and E11 / 5A11 in the WHO ICD browsers, and note how the concepts differ.
- Sketch which OMOP tables (person, measurement, condition_occurrence) each extracted item would go into.
The runnable notebook and worked solution will be published soon. You can work through the steps with the code on this page in the meantime.
Key takeaways
- Exchange standards (HL7 v2, FHIR, DICOM) move data; terminologies (ICD, SNOMED CT, LOINC, UCUM) give it meaning.
- FHIR R4 is the widely implemented version as of 2026; R6 is still in ballot.
- Map local codes and units to standards before pooling data from different sites.
- OMOP lets the same analysis run across many datasets; FHIR serves live, record-level exchange.
Terms used: DICOM, FHIR (Fast Healthcare Interoperability Resources), HL7, ICD (International Classification of Diseases), LOINC, OMOP Common Data Model, SNOMED CT, UCUM
Related: Healthcare data types, Agentic AI track: tool calling against FHIR data, Medical AI glossary
FAQ
What is the difference between HL7 and FHIR?
HL7 is the standards organisation and also the name of its older v2 messaging standard. FHIR is HL7's newer standard, which exchanges data as web resources through APIs.
Should I use ICD or SNOMED CT?
They do different jobs. SNOMED CT is designed for detailed clinical recording; ICD is designed for statistics and billing. Many systems record in SNOMED CT and map to ICD for reporting.
Which FHIR version should I build on?
As of October 2026, FHIR R4 is the version most widely implemented and required by many national programmes, including US certification and India's ABDM. R6 is not yet a published standard.
What is LOINC used for?
LOINC gives a universal code to each lab test and clinical observation, such as 4548-4 for HbA1c, so results from different labs can be recognised as the same test.
Do I need OMOP for a single-hospital project?
Not necessarily, but converting to OMOP makes it far easier to validate a model at other sites later and to use the OHDSI community's open-source tools.
Is SNOMED CT free to use?
It is free in SNOMED International member countries through their national release centre, and requires a licence elsewhere. Check the terms for your country and use case.
Sources
- HL7 International. FHIR specification, R4 (current published versions and R6 ballot status)
- HL7 FHIR Management Group. Release plan for R6
- World Health Organization. International Classification of Diseases 11th Revision (ICD-11)
- SNOMED International. SNOMED CT
- Regenstrief Institute. LOINC
- The Unified Code for Units of Measure (UCUM)
- OHDSI. OMOP Common Data Model v5.4
- Hoelzel W, et al. IFCC reference system for measurement of hemoglobin A1c in human blood and the national standardization schemes in the United States, Japan, and Sweden: a method-comparison study. Clin Chem 2004;50(1):166–174. doi:10.1373/clinchem.2003.024802
- National Resource Centre for EHR Standards (NRCeS). FHIR Implementation Guide for ABDM (R4)
- Regulation (EU) 2025/327 on the European Health Data Space. Official Journal of the EU, 5 March 2025
Educational content only. This material teaches methods; it is not clinical advice. Code, models and examples here are not validated medical devices and must not be used to make decisions about real patients without proper clinical validation, governance and any required regulatory approval. Examples use synthetic or openly licensed de-identified data only. Never paste identifiable patient information into public AI tools. Mentions of models, tools or vendors are for identification, not endorsement.