HL7 / Labs - Common Duplicate Rejections
This article covers the logic MacPractice uses when handling HL7 Messages with Lab results, and some common reasons why a message would be rejected as a duplicate.
Before proceeding, we recommend that you ensure the "Sends Preliminary Results" checkbox is enabled in Preferences > Labs. You can find Preferences by navigating to the MacPractice Menu and selecting Preferences.Â
When we first look at an HL7 message, we're looking for some specific things. Let's use this example HL7 message:
MSH|^~\&|STUDYCAST||||20210831094400||ORU^R01^ORU_R01|8e6f7780-a134-4578-9add-c558cb911d47|P|2.5.1
PID|||17631-1||Tester^Chester^||19700101|F
OBR||12422834|12422834|001000^Ultrasound^CSICW01|||20210827113025|||||||||^Unassigned OMNY||||||20210831094304|^OMNY-TESTHL7&OMNY-TESTHL7||F|||||||&Administrator&CSI&&&
OBX|1|RP|000010^Study Images URL^CSICW01|1|https://app.corestudycast.com/coreweb/studies/view?id=12422834||||||F
OBX|2|ED|000050^Study PDF Report^CSICW01|1|
The first thing to check is the HL7 Message ID. This is located on the MSH line (MSH stands for Message Header and should always be on the top). If MacPractice has already processed any HL7 message at all with the same ID as the one seen in the MSH line, it'll always be rejected. All HL7 messages will have a unique ID.
In the above example, the HL7 ID is on the first line leading with MSH.
"8e6f7780-a134-4578-9add-c558cb911d47" is the HL7 id. It is underlined in the above example for convenience.
Next, check for a line that start with OBR. (OBR stands for Observation Request). This line will contain the Order ID for the lab result. Each lab study should have it's own ID with the lab. If MacPractice receives several messages with the same Order ID in this OBR segment, we can assume they're for the same lab result, but they may have different statuses.
 In the above example, let's take a look at the OBR segment:
OBR||12422834|12422834|001000^Ultrasound^CSICW01|||20210827113025|||||||||^Unassigned OMNY||||||20210831094304|^OMNY-TESTHL7&OMNY-TESTHL7||F|||||||&Administrator&CSI&&&
The two things to identify in this message are the Order ID and the Status Flag. These are underlined so you can easily spot them. In this example, the Order ID is 12422834, and the Status Flag is F.
If you have received an HL7 message that has a matching Order ID in a OBR segment that we've received before, MacPractice checks the status flag in the previous message to determine how to handle the new message. There are three potential statuses:
Status flags of P are for Preliminary Results. If the previous message contained a Status Flag of P, then MacPractice will accept P, F, or C messages with the same Order ID.
Status flags of F are for Final Results. If the previous message contains a Status flag of F, all subsequent messages with a Status of P or F will be rejected.
Status flags of C are for Corrected Results. This is used to update a Final Result with updated information. Subsequent messages will only be accepted if they have a status of C.
If we get any order with a matching ID that doesn't follow this pattern, it will be rejected as a duplicate.