Announcement

Collapse
No announcement yet.

How to process multiple PID, NTE, ZDR, OBR in the same file

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

  • How to process multiple PID, NTE, ZDR, OBR in the same file

    Hi All

    I need your help to figure it

    In a ORU^R01 version 2.3 LAB FILE i find this structure.

    Code:
    MSH					Message Header (One per file sent)
    {
    	PID				Patient Identification (can be several)
    	{[NTE]}				One or more Notes related to Patient Demographics
    	{[ZDR]}			One or more physicians/clients/CC’s associated with order
    	{	OBR			Observation Request
    		{[NTE]}			One or more notes related to Observation Request
    		{	OBX		Observation/Result
    			{[NTE]}		One or more notes related to Observation/Result
    			OBX		A second OBX segment within the same OBR
    			...
    		}
    		OBR			A second OBR segment within the same PID
    		...
    	}
    	PID				A second PID within the same MSH
    	...
    }					End of message (marked by end of file or by another MSH).

    Do i need to do a nesting of For each PID with a for each Nte in it With a for Each ZDR etc... to process this kind of file ?

    What is the best way to do this ?


    TIA Benzo

  • #2
    Yes, you need to do that to process all data in all possible scenarios... But it is highly unlikely that you will need to do that. For example, it is very rare that you have multiple PID segments in an ORU message. Most vendors probably do not even support it... My suggestion is to get the spec and sample messages from the vendor and code your interface to it.

    A normal ORU interface will have nested OBR, OBX, NTE loops however.
    Daniel Svanstedt
    Software Engineer
    Mirth Corporation

    Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
    Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

    Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

    Comment


    • #3
      Hi dans

      I Have the spec and a sampel file and guess what
      it contains 18 Pid Segement
      each with muiltiple obr and obx segment
      some with multiple NTE AND OBR ,OBX
      and some with multiple ZDR

      All in the same file

      What is exactly Process Batch Files? Can it help me with this kind of file

      Comment


      • #4
        Batch files contain multiple messages; for HL7 this means that you have multiple MSH segments in the file.
        JJ Mouris
        FFE Luxembourg
        IT-Department

        Comment


        • #5
          Not sure what you are needing to do with your data, but check this thread out for an example of javascript code to loop over segments in a transformer step. Not sure if that helps or not.

          Process Batch Files on the File Reader screen will split an HL7 file into separate messages by MSH I believe (someone at Mirth may correct me on this). So, for example, if your 1 file had 10 MSH segments this would flow through Mirth as 10 different messages. However, according to what you are saying about your file it will still only go through as 1 message.

          Comment


          • #6
            Im going to take a look at the thread, I only got on MSH in the file so i can't use the Process Batch

            Comment


            • #7
              Hi

              I know I have to loop for each segment PID and I still have to loop for each one of multiple different segments. This might give me a very large file java script

              Is there a way to loop through each segment PID and when I meet an NTE segment "or another type of multiple segment" , call another function that it loops through the NTE segment which is in the PID segment underway.

              Each function will add the information into a table sql

              In this case I would not have a large java script and it would be easier to debug.

              Can we use multiple destinations to do that if yes how to enable the destination at the right time. ?

              Do you have a better way to do this ?

              Comment


              • #8
                Yeah, you can define functions in javascript:

                Code:
                for(var i=0;i<msg.children().length();i++){
                   var curSeg = msg.children()[i];
                   if(curSeg.name() == "OBR"){
                       processOBR(curSeg);
                   }
                   if(curSeg.name() == "OBX"){
                       processOBX(curSeg);
                   }
                   if(curSeg.name() == "NTE"){
                       processNTE(curSeg);
                   }
                }
                
                function processNTE(msg){
                // code here
                }
                
                function processOBR(msg){
                
                }
                function processOBX(msg){
                
                }
                Daniel Svanstedt
                Software Engineer
                Mirth Corporation

                Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
                Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

                Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

                Comment


                • #9
                  Can i create the functions in the Preprocessor script ?

                  TIA
                  Benzo

                  Comment


                  • #10
                    Typically, you create them in the "Edit Code Templates" section. It is available in the channel tasks.
                    Those functions are available in all the channels.
                    You should save/export them separately, they are not included in the channels.
                    JJ Mouris
                    FFE Luxembourg
                    IT-Department

                    Comment


                    • #11
                      Thank you all for your reply I will do my tests and give you new

                      Benzo

                      Comment


                      • #12
                        It's me again

                        My function is built, In the transformer i call it with the segement as parameter

                        Code:
                        for (var i=0;i< msg.children().length();i++)
                        {
                        	var curSeg =msg.children()[i];
                        	if (curSeg.name()=="PID")
                        	{
                        		WritePid(curSeg);
                        	}
                        }

                        But in the function when i try to get the value of the PID.2.1 in my variable i got nothing in it
                        Code:
                        var vNam = msg['PID']['PID.2']['PID.2.1'].toString();
                        If i use logger to show me the value of msg i got this
                        Code:
                        [2010-07-30 11:38:38,235]  INFO  (transformer:?): mesg.:<PID><PID.1><PID.1.1>1</PID.1.1></PID.1><PID.2><PID.2.1>2222225832</PID.2.1><PID.2.2>M</PID.2.2><PID.2.3>ON</PID.2.3></PID.2><PID.3><PID.3.1>50-3006787</PID.3.1></PID.3><PID.4/><PID.5><PID.5.1>IT TESTING</PID.5.1><PID.5.2>STG5832M</PID.5.2><PID.5.3>T</PID.5.3></PID.5><PID.6/><PID.7><PID.7.1>19660322</PID.7.1></PID.7><PID.8><PID.8.1>F</PID.8.1></PID.8><PID.9/><PID.10/><PID.11><PID.11.1>32 CANELLI HEIGHTS COURT</PID.11.1><PID.11.2>THORNHILL</PID.11.2><PID.11.3>ONTARIO</PID.11.3><PID.11.4>ON</PID.11.4><PID.11.5>L6T5M3</PID.11.5></PID.11><PID.12/><PID.13><PID.13.1>(905)886-3918</PID.13.1></PID.13></PID>
                        How can i retrive the value ?

                        Thanks again for your help
                        Benzo

                        Comment


                        • #13
                          Maybe this could help...

                          This thread has some code that might be of some help.

                          http://www.mirthcorp.com/community/f...hlight=OBR+NTE

                          Comment

                          Working...
                          X