HL7 message received on port into a file for receiving sys

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf HL7 message received on port into a file for receiving sys

  • Creator
    Topic
  • #48749
    Ariba Jones
    Participant

      I need to be able to take HL7 charge (DFT^P03) messages received on Cloverleaf via tcp/ip port connection and put those messages into a file to ftp to a directory for the receiving system.  

      I will receive all HL7 charge messages (i.e. radiology, lab, pharmacy, etc.) from the sending system on one tcp/ip port.  I then need to filter only the charge messages for outreach client billing and send them to the receiving system in a file.  I need to ftp that file (of only outreach client charge messages) to a directory for the receiving system.

      Does anyone know how to do something like this?  I am familiar with using xlates.  I actually have an xlate for the outbound thread to the receiving system to do some other manipulation already.

      Thanks in advance,

      Ariba Jones

    Viewing 4 reply threads
    • Author
      Replies
      • #59564
        William Grow
        Participant

          Hi,

          I had an interface similar to the one that you describe with the exception that it was for a state ED monitoring agency. Essentially, I created an xlate that contained logic to suppress messages if the transaction didn’t meet certain criteria (such as having an ED admit source). The outbound  communications thread used the file protocol and wrote all transactions to a specific file in the exec directory of the process that the thread belonged to.  A route was set up using the xlate to route the transactions to the outbound file protocol thread. I then used a second thread that used the UPOC protocol with advanced sceduling. The UPOC thread executed a script that made some non HL7 standard modifications to file containing the batch of messages. It also added a batch header segment, and a batch trailer segment and then used the tcl FTP package to ftp the file to the sending system. I favored the approach of using the advanced sceduling feature of the UPOC protocol over cron so that the process would be documented via the netconfig as opposed to being less obvious by being part of a cron job.

        • #59565
          Ariba Jones
          Participant

            William,

            I am a little confused here.  First, I have been trying to setup the SUPPRESS in my xlate and haven’t been able to get that to work.  This is my first time using the SUPPRESS function in the xlate, so, I think I am not understanding something here.

            Also, you indicate that you setup a second route to use the UPoc protocol with advanced scheduling.  Was this second route necessary to put the messages in the directory on the receiving system?  I don’t understand.

          • #59566
            Anonymous
            Participant

              Ariba,

              you need to write the xlate as normal say …

                if is true

                then suppress.

              I prefer doing this in tclprocs

              For DFT message extract the message.

              Then write the if state as follows:

                If

                then KILL

                else continue.

              For this type tclprocs will be faster.

              Hope this helps.

              Reggie

            • #59567
              Ariba Jones
              Participant

                Reggie,

                I have never written a TCL proc before.  That’s why I was trying to work with the xlate.

                My issue is I don’t seem to be using this SUPPRESS command correctly.  I have my IF statement setup.  I have put the SUPPRESS command within that IF, but I am not sure how to make it suppress the entire message.

                Thanks,

                Ariba

              • #59568
                Anonymous
                Participant

                  Here is a code skeleton I would provide. Modify as you as necessary. This proc was wriiten as to filter out A08 messages. In your case look in the MSH segment 8th field. see if it is P03, if so replace in this script A08 with P03.

                  save the file. That means your proc should be same name as the file name. Compile it in tclprocs directory.

                  Test it.

                  Deploy it.

                  -Reggie-

                  proc Kill_A08_from_hmm { args } {

                     keylget args MODE mode                      ;# Fetch mode

                     keylget args ARGS.CODE code

                     set dispList {}                             ;# Nothing to return

                     switch -exact — $mode {

                         start {

                             # Perform special init functions

                             # N.B.: there may or may not be a MSGID key in args^M

                         }

                         run {

                             # ‘run’ mode always has a MSGID; fetch and process it

                           keylget args MSGID mh

                             # Here we retrieve the data from our original message

                             set msg [msgget $mh]

                             # Now we need to determine our field and subcomponent seperators

                             set field_sep [csubstr $msg 3 1]    ;# HL7 field separator

                             set sub_sep [csubstr $msg 4 1]      ;# HL7 subfield separator

                             # Here we spilt the original message into a list of the segments contained wit

                  hin

                             set segmentList [split $msg r]

                             set msh_8 “”

                             set msh_8_1 “”

                             # Now we iterate over each segment in our list.

                             foreach segment $segmentList {

                                 if [cequal [crange $segment 0 2] MSH] {

                                         set fieldList [split $segment $field_sep]

                                         set msh_8 [lindex $fieldList 8]

                                         set subfldList [ split $msh_8 $sub_sep]

                                         set msh_8_1 [lindex $subfldList 1]

                                 } else {

                                 }

                             }

                  # The following command is used to select specific patient types.

                                 if {[regexp {A08} $msh_8_1]} {

                                 lappend dispList “KILL $mh”

                                 return $dispList

                             } else {

                                 lappend dispList “CONTINUE $mh”

                                 return $dispList

                            }

                            }

                            time {

                                 # Timer-based processing

                                 # N.B.: there may or may not be a MSGID key in args

                            }

                         shutdown {

                             # Doing some clean-up work

                         }

                            default {

                                 error “Unknown mode ‘$mode’ in Kill_A08_from_hmm.tcl”

                            }

                         }

                         return $dispList

                  }

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