4 Messaging and FHIR
How does one registration reach twenty systems?
In plain language
- Hospitals run dozens of separate computer systems. They keep each other up to date by sending short, standard messages.
- Most messages inside hospitals still use HL7 version 2, a text format from the 1980s. Newer apps and patient access use FHIR, which works like the rest of the web.
- A message can arrive perfectly formatted and still be misunderstood if the two systems use different codes for the same thing.
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 app or study that uses hospital data depends on these messages. Knowing them lets you ask where your data really came from.
- Physicians and residents
- When a result is missing or appears twice, the cause is usually an interface. You will report it more precisely.
- Nurses and allied health
- Bed boards, medication lists and lab results on your screens all arrive as messages. Delays and duplicates you see start here.
- Researchers and analysts
- Your extracts inherit every quirk of the interfaces upstream: local codes, missing time zones and corrected results.
- IT and administration
- Interface engines, error queues and FHIR APIs are core infrastructure, and regulation now requires FHIR access.
One registration, twenty systems
When the front desk registers Mira at 09:12, the registration system knows she has arrived. The lab system, the pharmacy, radiology, the bed board, the billing system and the ED tracking screen also need to know, within seconds. None of them share a database. They learn about her from messages.
If every system sent messages directly to every other system, 12 systems would need 66 separate interfaces, and each one would break whenever either end was upgraded. Hospitals instead route messages through an interface engine: a hub that receives each message once, translates it, and forwards it to every system that subscribed. Common products include Rhapsody, Cloverleaf, InterSystems HealthShare and Mirth (NextGen) Connect. Most integration work in a hospital is done there, by interface analysts.
What does that work look like day to day? Messages travel over a simple network protocol called MLLP. The receiver replies to each message with an acknowledgement (an ACK message whose MSA segment says AA for accepted, or AE or AR for an error or a rejection). Messages that fail go to an error queue, where an analyst reads the reason, fixes the mapping or the data, and resends them. After a system has been down, messages pile up in a queue and must be replayed in order without creating duplicates. Engines are monitored around the clock, because a stopped interface can mean lab results that never reach the ward. Much of the traffic is corrections, not new data: A08 updates a patient’s details, and A40 merges two records that turned out to be the same person.
Reading HL7 version 2
HL7 v2 dates from the late 1980s and still carries most of the messages inside hospitals. A message is plain text. Each line is a segment, named by three letters. Fields are separated by |, components within a field by ^, and repeats by ~. Each message starts with an MSH segment, the header, which says who sent the message, to whom, when, and what type it is.
The message type has two parts. In ADT^A04, ADT means admit, discharge or transfer, and A04 is the trigger event: a patient was registered. The same event model runs through all of v2. ORU^R01 carries a result, and VXU^V04 reports a vaccination.
Try it below. Select any field to see what it means, edit the message to break it, and switch to the FHIR view to see the same data as resources.
Edit the message: the parse and the FHIR output update as you type. One segment per line.
- MSH Message header
- EVN Event type
- PID Patient identification
- PV1 Patient visit
- IN1 Insurance
Notice what the broken sample does. A date written as 14/05/1968 and a sex written as female are both readable to a person, and both invalid to a machine. Those are teaching examples. The failures interface analysts actually see are subtler: a local test code in OBX-3 with the LOINC code tucked into a second set of components, a result of <0.2 in a numeric field, a corrected result (OBX-11 = C) that must replace an earlier one, custom “Z-segments” that only one vendor understands, or a record number from the wrong hospital’s numbering system. v2 is permissive enough that each receiving interface has to handle these variations. That flexibility is why v2 spread so widely, and it is also why v2 interfaces cost so much to maintain.
FHIR: resources on the web
FHIR (Fast Healthcare Interoperability Resources) keeps v2’s lessons and borrows the design of the modern web: it uses HTTP, the same protocol your browser uses, in a style called REST, where each piece of data has its own web address. Data is split into resources, such as Patient, Encounter, Observation and Condition. Each resource has an id and a URL, and resources point to each other with references. Mira’s creatinine result is an Observation whose subject is Patient/mira.
Because resources live at URLs, systems can use ordinary HTTP. GET Patient/mira reads one resource. GET Observation?subject=Patient/mira searches and returns a Bundle, a resource that wraps a list of matches. Search parameters have types. A token such as code=http://loinc.org|14682-9 matches a code within its system. (LOINC is the standard code system for lab tests and measurements. In a real request, the | is written as %7C.) A date or number can take a prefix such as lt or gt. A reference such as subject=Patient/mira links one resource to another.
Going deeper FHIR in regulation, and SMART on FHIR
FHIR became the basis for health data regulation. Saudi Arabia’s national platform for insurance and health information exchange, NPHIES, carries eligibility checks, pre-authorisations and claims as FHIR resources. In the United States, the 21st Century Cures Act rules require certified EHRs to offer standard FHIR APIs. In Europe, the European Health Data Space regulation will define a European exchange format, and the specification work behind it, such as the International Patient Summary, is largely based on FHIR. SMART on FHIR adds a standard way to launch an app from inside the EHR and to authorise its access with OAuth 2.0, so the same app can plug into any EHR that supports it.
Use the playground below. It is a small FHIR server running in your browser, with 41 synthetic patients. Mira is one of them. Each challenge has a hint and a worked answer if you get stuck.
HTTP 200 · 1 match
{
"resourceType": "Bundle",
"type": "searchset",
"total": 1,
"link": [
{
"relation": "self",
"url": "[base]/Patient?name=novak"
}
],
"entry": [
{
"fullUrl": "[base]/Patient/mira",
"resource": {
"resourceType": "Patient",
"id": "mira",
"identifier": [
{
"system": "http://menaah.example.org/fhir/sid/mrn",
"value": "MRN44871"
}
],
"name": [
{
"family": "Novak",
"given": [
"Mira"
]
}
],
"gender": "female",
"birthDate": "1968-05-14",
"address": [
{
"city": "Dubai"
}
]
},
"search": {
"mode": "match"
}
}
]
}Syntax is not meaning
A message can be perfectly formed and still be misunderstood. Syntactic interoperability means the receiver can parse the structure. Semantic interoperability means the receiver understands the content the way the sender meant it. If one lab codes creatinine as 14682-9 in LOINC and another sends a local code CRE, both messages parse, but only one can be safely pooled, trended or used to fire a decision rule. FHIR does not solve this on its own. It needs shared terminologies, which are the subject of the next module.
Going deeper Time zones in v2 timestamps
There is a quieter version of the same problem in the v2 samples above. The timestamps carry no time-zone offset. Within one hospital that rarely matters, and the UAE has a single time zone with no daylight saving. The risk comes when data crosses borders: a record shared with a hospital in another country, a lab sample sent abroad, or a research network that spans time zones or daylight saving changes can reorder events in a patient’s record. FHIR requires an offset on any time of day, so an interface that converts v2 to FHIR must decide which zone to assume. Look at the FHIR view in the message lab: it flags exactly this.
Beyond one hospital: health information exchanges
Interfaces connect systems inside a hospital. A health information exchange connects hospitals and clinics to each other, so a patient’s record follows her. When Mira registers at 09:12, the same registration event is sent on to NABIDH, the Dubai Health Authority’s exchange, so any licensed provider in Dubai who later treats her can see her visits, results and medicines, unless she has opted out. Abu Dhabi’s Malaffi does the same for its emirate, and the two are linked with the federal Riayati system so records can be seen across emirates.
An exchange raises every question in this module at a larger scale: which messages are sent, how patients are matched (in the UAE, by Emirates ID), which code systems are required, and who may see what. Countries answer these differently.
How this works in… Sharing records between providers
Some places share records through a national or regional exchange, some through national records, and some mainly through each hospital's own systems. Compare a few.
UAE: Dubai Middle Eastyour setting
NABIDH, the Dubai Health Authority's exchange, launched in 2020 and by 2025 held more than 9.5 million patient records from over 1,500 providers. Records are shared automatically unless the patient opts out; DHA's consent and access-control standard sets who may see what, including in emergencies.
Checked 2026-11-30: DHA: NABIDH Clinical Portal (May 2025); DHA: Standards for Consent and Access Control (2025)
Saudi Arabia Middle Eastyour setting
NPHIES, the national platform for health and insurance exchange, began in 2020. Its health part, overseen by the Ministry of Health, is building a unified record of medicines, allergies, vaccines and visits across providers.
Checked 2026-11-30: Healthcare IT News: Understanding NPHIES, KSA's health information exchange
No checked entry for your setting yet on this topic. The others show the range of approaches.
Compare 6 more
UAE: Abu Dhabi Middle Eastyour setting
Malaffi, launched in 2019, connects over 2,700 facilities in Abu Dhabi and has a patient portal. It is integrated with Dubai's NABIDH and the federal Riayati system, so records can be seen across emirates.
Checked 2026-11-30: Department of Health Abu Dhabi: Malaffi
India South Asiayour setting
The Ayushman Bharat Digital Mission gives each person an ABHA number and links records held by different providers through consent managers: data moves only when the patient approves a request. By mid-2026, over 100 crore (1 billion) records had been linked to ABHA accounts.
Checked 2026-11-30: News on AIR, May 2026
Kenya Africayour setting
The Digital Health Act 2023 provides for a national health information exchange, with data exchange regulations made in 2025. In 2024 the High Court declared the Act unconstitutional; the Court of Appeal suspended that ruling while the appeal is heard. Many public facilities use KenyaEMR, built on OpenMRS.
Checked 2026-11-30: Court of Appeal stay, 20 September 2024; Digital Health (Data Exchange Component) Regulations 2025
Morocco North Africayour setting
There is no national exchange yet. Bill 52.26, adopted by the Government Council on 22 July 2026 and sent to parliament, would create a shared medical record, a national health identifier, a unified public hospital information system and a national agency for digitising the health system. Facilities would have up to 24 months to connect, with fines for not doing so. Private doctors' unions have asked for it to be withdrawn.
Checked 2026-11-30: Hespress FR, 23 July 2026; Le360, August 2026
England Comparisonyour setting
Shared care records join up GP, hospital and social care records within each region of England. Records are shared for direct care without asking each time; the national data opt-out covers research and planning, not direct care.
Checked 2026-11-30: NHS England: national data opt-out
United States Comparisonyour setting
There is no single national exchange. Regional exchanges, vendor networks and the national TEFCA framework connect providers, and consent rules vary by state. The information blocking rule requires most data to be shared on request.
Checked 2026-11-30: ONC: information blocking
Think it through: Mira moves from Dubai to Casablanca next year. What would her new doctor be able to see of her AF care, and how?
From the Failure Museum: two departments, one veteran
In the United States, people leaving military service move from the Department of Defense health system to the Department of Veterans Affairs. For decades their records did not move cleanly with them. In 2013, after years of work and large spending, the two departments abandoned their plan for a single joint integrated record and chose to connect their separate systems instead. This is a US case, but the pattern is common wherever health systems merge or hand patients over. Government auditors repeatedly found that the departments had not defined what “interoperable” should achieve for patients. Both departments later bought the same commercial EHR, and data sharing still required years of further work.
Lesson: interoperability is a goal about patients and clinicians, not only a technology choice. Projects that cannot say what a clinician should be able to see, and when, tend to deliver interfaces without delivering care.
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
- HL7 FHIR Release 4 specification
- HL7 FHIR R4: Search
- HL7 Version 2 product suite
- Mandel JC, Kreda DA, Mandl KD, Kohane IS, Ramoni RB. SMART on FHIR: a standards-based, interoperable apps platform for electronic health records. J Am Med Inform Assoc. 2016;23(5):899-908.
- Benson T, Grieve G. Principles of Health Interoperability: FHIR, HL7 and SNOMED CT. 4th ed. Springer; 2021.
- US Office of the National Coordinator for Health IT: 21st Century Cures Act final rule
- US Government Accountability Office. Electronic Health Records: Outcome-Oriented Metrics and Goals Needed to Gauge DOD's and VA's Progress in Achieving Interoperability. GAO-15-530; 2015.
- Dubai Health Authority. NABIDH HL7 API code tables (identity in PID-19; accepted message types). 2020.
- Dubai Health Authority. NABIDH Policies and Standards: Identity Management Policy. 2022.
- Department of Health Abu Dhabi. UAE health authorities announce successful integration between Riayati, Malaffi and NABIDH. 2023.
- Council of Health Insurance (Saudi Arabia). NPHIES FHIR implementation profiles, on Simplifier.