Announcement

Collapse
No announcement yet.

Message_Segments_HL7

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Message_Segments_HL7

    Hello,I am trying to do something like this,if anyone has done similar to this your help is appreciated.
    I have a message like this:
    MSH|^~\&|NIIT|ABCD|System|EFGH|20191011182900||ADT ^A08|777777777|P|2.6
    PID|1||99999^^^ABCD^^||GOSAVI^MICHAEL^^^^||1955110 9|Male||3080a7b8-0999-4cae-b839-199886122061^White|888 A AAAAA 10^^PPPPPP^AA^860139999||||a4444406-adf3-890c-8888-6c4b5aaaaa92^English|Married|||119942678|||dd33333 e-1111-4444-b000-099a230ar5b1^Not Hispanic or Latino|||||N|||N

    When I extract data for a segment lets say gender PID.8,it should give M in case of Male and F in case of Female or if M,F are there then the same value should be returned.For PID 10(Race) the field PID10.1 or 10.2 which has value like 'White' or 'Asian' should be returned.
    Basically I am trying to use conditional statements.If anyone has done then please help.
    I am using mirth connect 3.8.1

  • #2
    Mano,

    Without using some kind of conversion table, you are bound to what is in the message.

    Male > M and Female to F is easy using msg['PID']['PID.8']['PID.8.1'].toString().substring(0,1);

    The race you can pull using msg['PID']['PID.10']['PID.10.2'].toString()

    Is that what you are looking to do?

    -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
    -= [email protected]
    -= Mirth Connect (Advanced)-certified
    -= Gold member of HL7.org
    -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

    Comment


    • #3
      Thank you Jack for the reply.I appreciate it.I want to extract race,language too.Sometimes the value I need is present in 10.1 and sometime 10.2 for race,I am confused to get the value.I think a conditional statement will help.Also sometimes it contains numbers.Your help will be appreciated.

      Comment


      • #4
        Lets say I have 5 different HL7 messages and I am giving here the PID 10.1,10.2 values here
        Message-1 PID.10.1-4171a7b9-0092-4eac-b732-198785162151 PID.10.2-White
        Message-2 PID.10.1-WHITE PID.10.2-No value
        Message-3 PID.10.1-Unknown PID.10.2-No value
        Message-4 PID.10.1-3 PID.10.2-No value
        Message-5 PID.10.1-No value PID.10.2-8
        I want Race value for these 5 messages.Sometimes its present in 10.1 and sometimes in 10.2.

        Comment


        • #5
          I would recommend that you create a race table and additional tables for anything else like this.

          var race;
          if(msg['PID']['PID10']['PID.10.1'].toSting() in table) //code needed to do this
          {
          race = msg['PID']['PID10']['PID.10.1'].toSting() ;
          }
          else if(msg['PID']['PID10']['PID.10.2'].toSting() in table) //code needed to do this
          {
          race = (msg['PID']['PID10']['PID.10.2'].toSting()
          }
          else
          {
          race = '';
          }

          Comment


          • #6
            If the first spot is always blank when it's NOT what you want to use:

            Code:
            var race = "unknown";
            
            if (msg['PID']['PID.10']['PID.10.1'].toString() != "")
               race = msg['PID']['PID.10']['PID.10.1'].toString();
            else if (msg['PID']['PID.10']['PID.10.2'].toString() != "")
               race = msg['PID']['PID.10']['PID.10.2'].toString();
            
            logger.info("Race: " + race);

            -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
            -= [email protected]
            -= Mirth Connect (Advanced)-certified
            -= Gold member of HL7.org
            -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

            Comment


            • #7
              @jackwhaines. The first sample doesn't work...

              Message-1 PID.10.1-4171a7b9-0092-4eac-b732-198785162151 PID.10.2-White

              There is a value in 10.1 but the value wanted is in 10.2

              Comment


              • #8
                Right... I don't know your logic... What determines whether it's the correct race a bad data? A length < 10 ?

                var race = "unknown";

                if (msg['PID']['PID.10']['PID.10.1'].toString().length < 10)
                race = msg['PID']['PID.10']['PID.10.1'].toString();
                else if (msg['PID']['PID.10']['PID.10.2'].toString().length < 10)
                race = msg['PID']['PID.10']['PID.10.2'].toString();

                -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
                -= [email protected]
                -= Mirth Connect (Advanced)-certified
                -= Gold member of HL7.org
                -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

                Comment


                • #9
                  I really appreciate to all of your suggestions.
                  @Cory can you please explain how to create race table or anything like this and how to use it in code?
                  I am very new to mirth.Your help will be appreciated.Thank you again.

                  Comment


                  • #10
                    Thanks for the reply Cory,I appreciate it.Can you please explain how and where to create race table or anything like this and how to use it in code?
                    I am very new to mirth.Your help will be appreciated.Thank you again.

                    Comment


                    • #11
                      There are multiple ways. You can create one in the database or you can create an array in Mirth with the possible race values. I would also generate some kind of alert if there is no match. This will give you an opportunity to add something that you missed. It depends on your access and your what you are comfortable with.

                      Comment


                      • #12
                        Originally posted by cory_cole View Post
                        There are multiple ways. You can create one in the database or you can create an array in Mirth with the possible race values. I would also generate some kind of alert if there is no match. This will give you an opportunity to add something that you missed. It depends on your access and your what you are comfortable with.
                        How to do using array in mirth.If you can please explain or any sample code will help.

                        Comment


                        • #13
                          Mano, you're gonna get a lot more out of Mirth by reading the documentation and/or searching the forums rather than asking on each little subject. =)

                          -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
                          -= [email protected]
                          -= Mirth Connect (Advanced)-certified
                          -= Gold member of HL7.org
                          -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

                          Comment

                          Working...
                          X