Creating a Catchall Matching Rule
What is a "Catchall" matching rule?
HL7 has lots and lots of messages. Often times we want to ignore most of them. This is where having a “catchall” rule which just matches everything that you don't want to match and just parses the header MSH segment of a message is super helpful.
Editing the Matching Rules in IguanaX
On the previous page we created a vmd file. Now it is time to add “Catchall” and create matching rules:
Create a catchall message definition
-
You should have an ADT^A01 message imported already.
-
Click + ADD MESSAGE:
![]()
-
Edit the message:
![]()
-
Change the name to “Catchall” and add a “MSH” type, then SAVE:
![]()
Add a new catchall matching rule
-
Click “Matching Rules”
![]()
-
Edit the Matching Rules:
![]()
-
Add a rule like the screenshot and SAVE:
Matching rule order matters. The order defined here is what IguanaX uses to match inbound messages. If the * catchall rule is defined before any rules, the proceeding rules will not take effect.
![]()
Parse a HL7 message in your main function
![]()
Use the code here:
function main(Data)
-- PARSE HL7 Message
local Out, MsgType, err = hl7.parse{vmd="hl7.vmd", data=Data}
trace(Out)
end
Add another sample message with an ADT^A04 message
![]()
Here is the sample message to copy in:
MSH|^~\&|MESA_ADT|XYZ_ADMITTING|iFW|ZYX_HOSPITAL|||ADT^A04|103102|P|2.4||||||||
EVN||200007010800||||200007010800
PID|||583295^^^ADT1||DOE^JANE||19610615|M-||2106-3|123 MAIN STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10|123456789|9-87654^NC
NK1|1|BATES^RONALD^L|SPO|||||20011105
PV1||E||||||5101^NELL^FREDERICK^P^^DR|||||||||||V1295^^^ADT1|||||||||||||||||||||||||200007010800||||||||
PV2|||^ABDOMINAL PAIN
OBX|1|HD|SR Instance UID||1.123456.2.2000.31.2.1||||||F||||||
AL1|1||^PENICILLIN||PRODUCES HIVES~RASH
AL1|2||^CAT DANDER
DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|F||
PR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123
ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^SMITH^ELLEN|199505011201
GT1|1122|1519|BILL^GATES^A
IN1|001|A357|1234|BCMD|||||132987
IN2|ID1551001|SSN12345678
Change sample message and notice the new output
Use the Sample Data arrows to navigate sample messages and view results in the Annotations.
![]()