Combining messages based on order codes

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Combining messages based on order codes

  • Creator
    Topic
  • #50234
    Skip Williams
    Participant

    We have a client that does not send mulitple orders in the same message.  They send each OBR segment in a separate message.  Several messages may have the same order code in OBR.4

    Our Lab system will not accept multiple messages with the same order code.  I need to extract and append to the original order message any OBR segments from subsequent messages that have the same order code in OBR.4 for the same patient.

    Orders will be sent twice a day in batches, but it is not guaranteed that the messages will be back to back – that is, sending all orders for a single patient before sending an order for a different patient.

    I have considered turning each batch of messages into a list of messages and then looping over those messages to find the ones to combine.  But I am not sure how to set up a variable to hold the original message and maintain it if I encounter a new patient before I get the last message for the original patient  (Does that make sense?  🙂  

    Has anyone out there dealt with a similar issue and if so, would you mind sharing?

    Thank you for your time.

    Skip Williams

Viewing 1 reply thread
  • Author
    Replies
    • #65287
      Robert Kersemakers
      Participant

      Hi Skip,

      Never had this problem, but I do understand your problem. I assume you have already tried to convince your client to send multiple OBRs in one message…

      What I would do in this situation is take all messages and write the fields needed for the Lab-system into one big (VRL) file. Then after the batch has been run and this big file has been created, read it in as ‘single’ so you can loop over all lines. You then need to combine all lines of the same order, make one HL7 message of these lines and then send this HL7 message further on.

      Hope this helps. As I start thinking about it, is sounds easier than it is…

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #65288
      John Mercogliano
      Participant

      Hi Skip,

        I’ve done something similar with batches.  I used an array and in your case you would use the order id as the index.  Although I was just removing dups the concept should still work.  Here is a code fragment to give you an idea:

      Code:


      set fdOrig [open $strOrgFileName r]
      fconfigure $fdOrig -translation crlf
      set strMsg [gets $fdOrig]
      while { ! [eof $fdOrig] } {
      set strPID [getHL7Segment $strMsg PID]
      set strMRN [getHL7Field $strPID 3]
      set arrMsgs($strMRN) $strMsg
      set strMsg [gets $fdOrig]
      }
      close $fdOrig
      set fdNew [open $strProcessedFileName w+]
      set lstArrayNames [array names arrMsgs]
      foreach strArrayName $lstArrayNames {
      puts $fdNew “$arrMsgs($strArrayName)r”
      }
      close $fdNew

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

Viewing 1 reply thread
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,042
Forums
28
Topics
9,200
Replies
34,023
Topic Tags
267