Announcement

Collapse
No announcement yet.

Mapping Multiple Segments

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

  • Mapping Multiple Segments

    Hello! I'm sure this is a very simple inquiry but I very stumped. I have been receiving hl7 messags that I wish to convert into more "standardized" versions. I am having problems with multiple OBX lines as different tests may have different numbers of OBX segments. For example, if I were to process a urinalysis, I would receive something like:

    OBX|1|ST|CBC^Complete Blood Count||""||||||I
    OBX|2|NM|HGB^Hemoglobin||""|g/L|130 - 170||||I|||||
    OBX|3|NM|HCT^Hematocrit||""||0.40 - 0.50||||I|||||
    OBX|4|NM|RBC^Total RBC||""||4.63 - 6.08||||I|||||
    OBX|5|NM|MCV^ MCV||""|fL|79.0 - 92.0||||I|||||
    OBX|6|NM|MCH^ MCH||""|pg|25.7 - 32.2||||I|||||
    OBX|7|NM|MCHC^ MCHC||""|g/dL|32.3 - 36.5||||I|||||
    OBX|8|NM|WBC^Total WBC||""|x 10\S\9/L|4.00 - 10.00||||I|||||
    OBX|9|NM|NEUT^ Neutrophils||""|%|0.40 - 0.80||||I|||||
    OBX|10|NM|LYMPH^ Lymphocytes||""|%|0.20 - 0.40||||I|||||
    OBX|11|NM|EOSI^ Eosinophils||""|%|0.01 - 0.06||||I|||||
    OBX|12|NM|MONO^ Monocytes||""|%|0.02 - 0.10||||I|||||
    OBX|13|NM|BASO^ Basophils||""|%|0.00 - 0.02||||I|||||
    OBX|14|NM|PLT^Platelet||""|cumm|150,000 - 400,000||||I|||||

    If I always have tests with 14 OBX segments, I can just use an outbound template as so:
    MSH|^~\&|||||||^|||2.5
    PID|||||^^|||
    PV1|||||||||||||||||||||||||||||||||||||||||||||
    ORC||||||||||^^^||^^^^|||||||||||
    OBR||||^||||||||||||^^^||||||||||||||||&&&^^|&&&^^ |&&&^^|&&&^^||||||||||||||||^^|^^|^^|^^|^^|^^|^^|| ||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||
    OBX|||||||||||||||||^^||

    However, depending on the tests, I may have just 1 OBX segment or 5 OBX segments. It's not always going to be 14 segments. Is there a way to add in an outbound template but with a condition of "make new OBX segments based on how many OBX segments were from the inbound hl7?"

    I know it's a very noob question but I would really appreciate the help!

  • #2
    Personally, I would leave the OBXes out of the outbound template and build those as needed with a JavaScript transformer based on logic.

    -= 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
      I see so I should just use this template:

      MSH|^~\&|||||||^|||2.5
      PID|||||^^|||
      PV1|||||||||||||||||||||||||||||||||||||||||||||
      ORC||||||||||^^^||^^^^|||||||||||
      OBR||||^||||||||||||^^^||||||||||||||||&&&^^|&&&^^ |&&&^^|&&&^^||||||||||||||||^^|^^|^^|^^|^^|^^|^^ || ||

      and then use message builders for them?

      How would I do the OBX segments then? I've been trying to read up on the for each javascript but it doesn't seem to be working for me hehe

      Comment


      • #4
        Yes, just like that, then add segments using:

        Code:
        var i = 0;
        
        var obx = createSegment('OBX', tmp, i++);
        obx['OBX.2']['OBX.2.1'] = "test #1 ";
        
        var obx = createSegment('OBX', tmp, i++);
        obx['OBX.2']['OBX.2.1'] = "test #2 ";

        -= 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


        • #5
          I think I'm starting to get it. If it's not too much of a hassle, can you please help guide me in simple mapping without changing anything first? Say I have

          OBX|1|ST|CBC^Complete Blood Count||""||||||F
          OBX|2|NM|HGB^Hemoglobin||120|g/L|130 - 170|L|||F|||20191015001740|CTRLAB^CENTRAL LAB|JMDELACRUZ^Jessica May E. Dela Cruz PRC 0078638
          OBX|3|NM|HCT^Hematocrit||0.386||0.40 - 0.50|L|||F|||20191015001740|CTRLAB^CENTRAL LAB|JMDELACRUZ^Jessica May E. Dela Cruz PRC 0078638

          I want to map just OBX-1 so that I will have outbound

          OBX|1
          OBX|2
          OBX|3

          For my transformer javascript, should it be
          var i = 0;

          var obx = createSegment('OBX', tmp, i++);
          obx['OBX.1']['OBX.1.1'] = msg['OBX.1']['OBX.1.1'];

          Comment


          • #6
            Because there are multiple OBXes in the incoming message, you will have to ITERATE through the OBXes in msg to have it do the creation of the OBX in the tmp as it hits each OBX in the msg. You can have it copy the whole OBX if you want...

            Code:
            var i = 0;
            
            for each (seg in msg..OBX)
            	{
            	createSegment('OBX', tmp, i);
            	tmp['OBX'][i] = seg.copy();
            	i++;
            	}
            or just the OBX.3 of each:

            Code:
            var i = 0;
            
            for each (seg in msg..OBX)
            	{
            	var obx = createSegment('OBX', tmp, i);
            	obx['OBX.3']['OBX.3.1'] = seg['OBX.3']['OBX.3.1'].toString();
            	obx['OBX.3']['OBX.3.2'] = seg['OBX.3']['OBX.3.2'].toString();
            	i++;
            	}

            -= 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
              I understand the iteration now!!!

              Thanks a lot!

              Comment


              • #8
                If you would like some training / help on specific projects or topics, please let me know!

                -= 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
                  Thanks for the offer

                  Right now this really opens up a lot of doors for me. Will experiment on my own a bit

                  Thanks again!

                  Comment


                  • #10
                    Of course! I'm here if you need me!

                    -= 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