Announcement

Collapse
No announcement yet.

Proper way to start a project

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

  • Proper way to start a project

    Hi there, i am new to the Mirth tool, only done a few channels for laboratory requests, and now i have a new challenge and would like the opinion of the community.

    So, I have to store in my DB certain OBX segments line by line, certain OBX meaning the value from OBX.3.2 must be for example (=="a" or =="b").

    My thought is, first i have to create a channel to see if the HL7 message has some OBX segment with this 2 values in the various OBX.3.2 that can exist in the HL7 message( here i can't proceed because it filters all messages except the ones where the OBX are only "a" or "b"), i want to be possible to see if the message has an OBX.3.2 with this values not necessarily all.

    this code is in the filter area.

    Code:
    for each( obx in msg.OBX){
    if(obx.elements('OBX.3.2') == "a" || obx.elements('OBX.3.2') == "b")
    return true
    }
    Then i want to send the accepted message to another channel where i will only get the OBX.3.2 with the values of "a" and "b" to store in a DB.
    Here i think i have to make mappings with javascript.

    Please tell me what you think and how would you do it
    REgards

  • #2
    Made it already to send the HL7 messages that have in any of the OBX segments, in the field OBX.3.2 the values "a" and "b" and to filter that ones that don't pass this rule.

    Code:
    var i = 0;
    while(msg['OBX']['OBX.3']['OBX.3.2'][i] != null) {
    
    	if( msg['OBX']['OBX.3']['OBX.3.2'][i] == "a" || msg['OBX']['OBX.3']['OBX.3.2'][i] == "b")
    {	
    	return true;
    	}
    	i =i+1;
    	
    	}

    Still thinking what is the better way now to store this values, do i in the same channel map the elements i want and in destinations store in DB with a loop again throught the OBX segments to store line by line in the table, OR do I send to another channel to do this ?

    Regards

    Comment


    • #3
      So I got a view of other solutions for the problem i presented in the comment above and I decided to transform in the destination each of my desired OBX segments, the OBX.3.2 = "a" or "b", so that each segment is sent alone as delimited text to another channel, i accomplished this with this code.

      Code:
      var i = 0;
      while(msg['OBX']['OBX.3']['OBX.3.2'][i] != null) {
      
      	if(msg['OBX']['OBX.3']['OBX.3.2'][i] == "a" || msg['OBX']['OBX.3']['OBX.3.2'][i] == "b")
      {	
      	var result = msg['OBX']['OBX.3']['OBX.3.2'][i].toString();
      		
      		router.routeMessageByChannelId('detination-channel-id-here',result);
      	}
      	i =i+1;
      	
      }
      This loops throught the OBX segments to search for the desired values in certain field, this case the OBX.3.2, and then it send the string value from that segment to another channel, where this will be stored in a database after some transforms i need to do.

      Regards

      Comment

      Working...
      X