No announcement yet.

Using "Use Strict Parser" a hl7 message without PID doesn't rejected

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using "Use Strict Parser" a hl7 message without PID doesn't rejected

    I'm very new with Mirth.
    I'm using Mirth 3.5.1
    I flagged the two options :
    Use Strict Parser and Validate in Strict Parser
    I sent a message ADT^A08^ADT_A01 without the PID segment,

    I don't understand why the message is processed and I don't receive any parsing message error, but if i send the message with an incomplete MSH I receive a parsing error.

    I would like to avoid to write a lot of filters to handle the mandatory segments.

    Thank you

  • #2
    This is a surprise.

    The validation is done using HL7 v2 XML schemas, which will work only uptil version 2.6. It starts to throw an error when using 2.7.

    Per the v2 XML of ADT_A01 message( cos A01 shares the same structure as A08), PID is mandatory. I tried the same thing as you did but it does not throw an error for a missing PID. It however throws an error if MSH is missing the version.

    So I concur with what you found, but don't know why this is happening.
    HL7v2.7 Certified Control Specialist!


    • #3
      Originally posted by siddharth View Post
      So I concur with what you found, but don't know why this is happening.
      This sounds like just the segments themselves are checked (if mandatory fields are filled, if values correspond to reference tables) but not the message structure (meaning if the segment correspond to the message type/trigger event).


      • #4
        Yes. Here is a snippet from the Mirth user guide 3.5, which says it "allows" automatic validation. I don't know what purpose it would serve -

        Attached Files
        Last edited by siddharth; 12-14-2017, 03:22 AM. Reason: foo
        HL7v2.7 Certified Control Specialist!


        • #5
          Thank you for the answers.
          just for completeness I'm using HL7 v. 2.5.
          As Siddarth wrote, in the documentation is written:
          " The strict mode parses messages into and from XML according to the official XSD, and allows automatic validation against the HL7 specification."
          The official XSD the cardinality of the PID in a ADT_A01 structure is equal to 1

          <xsd:complexType name="ADT_A01.CONTENT">
          <xsd:element ref="MSH" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="SFT" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:element ref="EVN" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="PID" minOccurs="1" maxOccurs="1”/>

          there is somebody that have some suggestion form me?
          Thank you


          • #6
            I wonder where did you get that official XSD? Mirth uses HAPI for strict parsing, which in it turns uses it's own default validator. Default validator is able to handle datatypes and that kind of thing but not the message structure.

            See Validating Messages section at

            To perform message structure validation one needs to define conformance profile, which looks more like the one produced by MessagingWorkbench. And then apply HAPI validation with such profile in context.

            To give a sense, this is the A31 profile available with HAPI source(significantly reduced, see my cuts):

            <HL7v2xConformanceProfile HL7Version="2.4" ProfileType="HL7">
              <MetaData Name="update person information" OrgName="UHN" Version="HL7 2.4" Status="" Topics="confsig-UHN-2.4-profile-accNE_accAL-Deferred"/>
              <DynamicDef AccAck="NE" AppAck="AL" MsgAckMode="Deferred"/>
              <HL7v2xStaticDef MsgType="ADT" EventType="A31" MsgStructID="ADT_A05" EventDesc="update person information" Role="Sender">
                <MetaData Name="update person information" OrgName="UHN" Version="HL7 2.4" Status="" Topics="confsig-UHN-2.4-static-ADT-A31-null-ADT_A05-HL7 2.4--Sender"/>
                <Segment Name="MSH" LongName="Message Header" Usage="R" Min="1" Max="1">
                <Segment Name="EVN" LongName="Event Type" Usage="R" Min="1" Max="1">
                <Segment Name="PID" LongName="Patient identification" Usage="R" Min="1" Max="1">
                  <Field Name="Set ID - PID" Usage="X" Min="0" Max="*" Datatype="SI" Length="4" ItemNo="00104">
                  <Field Name="Patient ID" Usage="X" Min="0" Max="*" Datatype="CX" Length="20" ItemNo="00105">
                    <Component Name="ID" Usage="O" Datatype="ST" Length="3">
            Last edited by Shamil; 12-20-2017, 11:57 AM.


            • #7
              thank you,
              but I continue to don't understand why Mirth accept message also without PID segment.
              (in Strict Parser Mode)

              I downloaded the official XSD from this link



              • #8
                "However the schema is not in itself a normative part of this specification.". There is no normative HL7v2 XML Schema.

                Again, HAPI library does not validate the message structure (unless you use Conformance profiles). That's why Mirth cannot do the same.