Skip to content
Request a demo

Articles / HL7 integration

HL7 integration · 12/10/2026 · Marco Volpe

MSH-9 says admit, EVN-1 says update: the disagreement a FHIR conversion erases

An ADT message declares an admission in its header and an update in its EVN segment. The FHIR conversion takes the event from MSH-9 and drops EVN-1 without a warning: why that can create a duplicate Encounter, and what the report should say.

Here is a synthetic ADT message we put together as a test case for a shared collection of v2 messages that are hard to convert to FHIR:

MSH|^~\&|PAS|RIVERLAND|GW|RCVFAC|20260929091500+0930||ADT^A01^ADT_A01|TEST003|P|2.5
EVN|A08|20260929091400+0930
PID|1||441122^^^RIVERLAND^MR||TESTPATIENT^ALEX||19800101|F|||14 HIGH ST^^ADELAIDE^SA^5000^AUS^H
PV1|1|I|WARD3^BED2^RAH||||||||||||||||VN0100|||||||||||||||||||||||||20260925080000+0930

Note, 19 October 2026: the first version of this message carried a +1000 offset, which Adelaide never uses in September: local time there in that period is +0930. We have corrected it. The same message is now case 001 in our public test-case repository.

The header, in MSH-9, declares an A01: admit or visit notification. The EVN segment, which describes the event, says A08 in EVN-1: update patient information. The PV1 segment carries a visit, number VN0100, that started on 25 September, four days before the message was sent. The three clues don’t fit together: an admission announced four days late, for a visit the receiver may already know about.

And yet the message is perfectly well formed. In the HL7 v2 table of message structures, ADT_A01 is shared by the A01, A04, A08 and A13 events, so the allowed segments and fields are the same, and a structural validation has nothing to complain about. The problem isn’t the shape of the message. It’s what the message means.

How a message like this comes about

We built it around a concrete scenario. A downstream system only accepts admissions, so the integration engine in front of it has a rule that rewrites A08 updates as A01, changing MSH-9 and leaving the EVN segment as it was. It’s a local fix to keep one interface working, and as long as the message only goes to that receiver nobody notices. But the message now says one thing in its header and another in its body, and whoever receives it next has to decide which to believe.

What the FHIR conversion does

We checked what HL7’s v2-to-FHIR Implementation Guide, the guide that defines how v2 messages become FHIR resources, prescribes. The event type comes from MSH-9: the trigger event code goes into MessageHeader.eventCoding, with the code system of the v2 event table. Taking the event from the header is the sensible choice, since that’s where the message declares it.

The interesting detail is in the map for the EVN segment, which becomes a Provenance resource. The recorded time, the reason, the operator, the time the event occurred and the facility where it happened each have a target. EVN-1 is listed among the fields, but with no FHIR target at all. And the description of the activity recorded in the Provenance is built from MSH-9 as well. The result is a perfectly consistent Bundle that says A01 everywhere. The only trace that the original event was an update is gone after the conversion, without a warning.

That isn’t a flaw in the guide: EVN-1 is optional, and the message declares its event in MSH-9. But a conversion that follows the guide to the letter produces valid output that no longer holds the information you’d need to see that something upstream doesn’t add up.

Why it matters: the visit that already exists

The FHIR receiver gets an admission for visit VN0100. If it already has that visit on record, because the real admission arrived on 25 September, it has two options, and without being told it will get both wrong. It can create a second Encounter for the same visit, and from then on the patient has been admitted twice: in bed occupancy, in length-of-stay figures, in billing. Or it can treat the admission as an update to the existing one, which is the right outcome, but only if it has a reliable way to tell that this is the same visit.

The guide’s ADT_A01 message map says the PV1 segment produces a new Encounter, with the visit number from PV1-19 as an identifier of type “VN”. In its implementation considerations, the guide notes that creating Encounter resources should be carefully considered. FHIR R4 already has the mechanism: a conditional update, a PUT that finds the resource by identifier rather than by id. No match, and the server creates the resource; one match, and it updates it; several, and it returns an error. The specification itself points to this for a client such as an interface engine that doesn’t know the ids the server assigned. Two caveats: in R4 conditional interactions are still trial use and not every server supports them, and they only work if the visit identifier carries the right system, which is the problem we wrote about in who decides the register’s URI.

Who notices

We put the case forward in a public discussion on chat.fhir.org, in the channel about v2 to FHIR conversion. The developers of an open-source engine who ran it reported that they hadn’t noticed the disagreement either: the message was converted as an A01, following MSH-9, and that was it. After the test they added a warning when EVN-1 names a different event from MSH-9, and they send the Encounter as a conditional update on the visit number, so a receiver that already knows VN0100 gets an update rather than a duplicate.

That was the answer we were hoping for, and it shows why the case was worth having. The “right” Bundle matters less here than the report that comes with it. A conversion can’t know which of the two fields is telling the truth, but it can say that they disagree. A converter that picks one in silence produces clean output and a question nobody will ever ask.

The same ADT message with MSH-9 ADT^A01^ADT_A01, an admit, and EVN-1 A08, an update. In the FHIR Bundle MessageHeader.eventCoding is A01, an admission for a visit open since 25 September; EVN-1 has no FHIR target in the v2-to-FHIR maps, so the A08 is gone without a warning; the conversion report should say MSH-9 A01 differs from EVN-1 A08, flag it, and update visit VN0100 rather than duplicate it.
One message, two events: the FHIR Bundle keeps only the one in MSH-9. The conversion report has to say that the two fields disagree.

What to take away

  • When MSH-9 and EVN-1 are both populated, compare the event codes. If they differ, convert according to MSH-9, but the report has to flag it, with both values.
  • An A01 for a visit the receiver already knows should be handled as an update. That needs a visit identifier with a configured system and an operation that matches on identifier, not a blind create.
  • Integration engine rules that rewrite the event type should be inventoried. Each one is a place where the message says one thing and means another, and a FHIR conversion added later inherits that contradiction without knowing it.

Which leaves two questions to ask at the start of a project. To whoever runs the integration engine: do any rules change the event type, and when they do, do they update the EVN segment too? To whoever builds the conversion: what do you do when MSH-9 and EVN-1 disagree, and does your report say so?

Seeing a similar case in your project?

Write to us: we start from your own cases.