· Oct 15, 2021 2m read

How to update result reference range and abnormal flag accordingly using HL7

In this article I will demonstrate the following :

  • Update ReferencesRange(OBX:7) against ObservationIdentifier(OBX:3.1)[TestCode] from database by using custom utility function
  • Update Abnormal Flag(OBX:8) against ObservationIdentifier(OBX:3.1)[TestCode]  and ObservationValue(OBX:5)[Result] from database utility function
  • Route Message based on Abnormal Flag(OBX:8)

Below is the primary and transformed HL7 2.5 ORU_R01 message:

Step 1: First of all we need to save reference ranges in database, for this I used TestRanges Persistent class:

Step 2 :We need to create a custom function to get reference range, for this I created GetReferenceRange() ClassMethod function in utility class. Please note this class should be Extends from EnsRule.FunctionSet 

We need to create an other function to set Abnormal Flag, for this I created SetAbnormalFlag() ClassMethod function in utility class

Step 3: Now we will use these functions in Data Transformation (UpdateReferenceRangesDTL). We need to use foreach loop against the repeating segments:

Please note that in order to get Abnormal flag we have to pass OBX:ObservationValue (Result) along with OBX:ObservationIdentifier(TestCode)

Step 4: We will transform the message from "ResultsDTRule" Business rule and send message to "ResultsRule" Business rule again to send message to "ToCriticalResultsFile" operation in case of Abnormal flag is set otherwise if will send to "ToCriticalResultsFile" operation:
Following Visual Trace Below Visual Trace is for the message successfully send to "ToCriticalResultsFile" Operation


Discussion (6)1
Log in or sign up to continue

Hey Muhammad, I hope you are well. 

I hope you don't mind if I provide some feedback.

First, the serious feedback - It is important that reference ranges are linked to the unit of measure provided in the result. This is because a change to the units used in the source could then mean that you provide the incorrect reference range/flag. This could then in turn lead to someone misinterpreting the results in the destination system and impact the treatment of a patient.

Now to the less serious feedback - Some systems have extended the high/low flag so as to differentiate between something being slightly high, and something being extremely high. In the versions I have seen, this has been done as:

LLL - Extremely Low
LL - Severely Low
L - Moderately Low
N - Normal
H - Moderately High
HH - Severely High
HHH - Extremely High

It could make for an interesting expansion on what you have done so far.

Hi Muhammad,

Your video is now on InterSystems Developers YouTube:

⏯ LabResultsVerification-HL7 Demo
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

Thanks for your contribution! 👏🏼