Question on Regular Expression routing

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Question on Regular Expression routing

  • Creator
    Topic
  • #48212
    Rentian Huang
    Participant

    Greetings Cloverleafers!!!

    I am trying to route A01,02,03,06,07,08,11,13,17 with the below regular expression, with “Wild Card Route” unchecked. Doesn’t work…

    Code:

    ADT_A(0[1-3])|(0[6-8])|11|13|17

    I tried check the “Wild Card Route” also, but it doesn’t work neither.

    Can someone help?

    Thanks,

    Sam  8)

Viewing 11 reply threads
  • Author
    Replies
    • #58015
      David Gordon
      Participant

      edit:  Sorry, I thought I saw something, but I was mistaken…

    • #58016
      Charlie Bursell
      Participant

      The Wildcard must be checked for regular expressions to work.

      The regular expression is applied to the TRXID only.  Make sure you have selected to route an HL7 message so that  it is parsing the message for the message type and applying the regular expression against that.

      The regular expression looks OK to me but could be simplified a bit

      ADT_A(0[1-36-8])|(1[137])

    • #58017
      Rick Brown
      Participant

      I did a search on the word “wildcard” and the info in the thread below turned up.

    • #58018
      Rentian Huang
      Participant

      Just FYI..

      I was having error with ADT_A(0[1-36-8])|(1[137]), but the following does whatever I need: ADT_A(0[1-36-8]|(1[1237])), with the “Wild Card Route” checked, of course.

      Thanks Charlie and Rick!

      Sam  ðŸ˜€

    • #58019
      Troy Morton
      Participant

      Possibly your first example

      Code: ADT_A(0[1-3])|(0[6-8])|11|13|17

      was erroring because the entire regular expression is not in parenthesis ().  You have |11|13|17 hanging outside the parenthesis.

      I think this could have been corrected by simply adding another set of parenthesis around the whole thing like so:

      ADT_A((0[1-3])|(0[6-8])|11|13|17)

      Cheers

    • #58020
      Troy Morton
      Participant
    • #58021
    • #58022
      Gary Atkinson
      Participant

      Use this:

      Code:

      ADT.A(01|02|03|06|07|08|11|13|17)

    • #58023
      Peter Heggie
      Participant

      I’m thinking of using a regular expression in a route specification, not for HL7 but for file routing. I’m wondering if this is a bad idea.

      I have a source FTP thread that picks up multiple files several times a day. There are seven different destination threads which will receive the files/messages based on the file name. The file names are all fixed length and have a naming standard that designates the type of file, the facility they belong to, if they are for physician billing etc.

      Currently we use logic in a pre-translate filter to read DRIVERCTL to get the file name and then parse the components of the file name and KILL or CONTINUE the message based on the requirements for that destination.

      it occurs to me that I could use a TRXID tcl to return just the file name, and then use a regular expression in the route specification. Seems a lot simpler, smaller code, and an administrator can just look at the route specification to know what the requirements are for each route, instead of opening up each filter tcl to find out how that destination is being determined.

      Does this make sense?

      Here is an example of a regular expression (I am not very good with it but this one seems to work):

      ^835.{6}01.*.08430.*

      it is an 835 file (starts with 835), from SSI, and then six characters later I’m looking for ’01’ (billing type?) and then after that, one of the nodes (separated by periods) (the hospital facility id) is equal to ‘08430’.

      Peter Heggie

    • #58024
      Charlie Bursell
      Participant

      The regular expression used to route a message is applied to a portion of the message itself not the file name.  Unless the file type is embedded in the message somewhere I don’t see how you would use regular expression wildcard routing.

      You could use a TRXID proc and extract the file name from metadata and route it that way

    • #58025
      Peter Heggie
      Participant

      I’m going to try that – thank you – let you know.

      Peter Heggie

    • #58026
      Peter Heggie
      Participant

      That worked – thank you

      This is the trxid proc:

      Code:

      proc trxidFileName { msgId } {
         set msg [msgget $msgId]

         set debug 1
         set module “trxidFileName”
         if {$debug > 2} {echo “$module msg: $msg”}

         # Get the metadata portion that contains the inbound filename with directory path.
         set driverctl [msgmetaget $msgId DRIVERCTL]
         if {$debug > 1} {echo “$module input file path key: $driverctl”}

         # If the output file name is already set, use that name, else use default input file name
         set obfilepos [string first “OBFILE” “$driverctl”]
         if {$obfilepos > -1} {
             set result [keylget driverctl FILESET.OBFILE filename]
           } else {
             set result [keylget driverctl FILENAME filename]
           }
         if {$debug > 1} {echo “$module keylget filename result: $result filename: $filename”}

         # check for error getting the filename from DRIVERCTL – set trxid to error text for visibility in process log
         if {$result eq 0} {
             echo “$module ERROR – unable to keylget filename from DRIVERCTL $driverctl”
             return “ERROR_filename”
         }

         set basename [file tail “$filename”]
         if {$debug > 1} {echo “$module input file name: $basename”}

         set trxid “$basename”
         if {$debug} {echo “$module trxid: $trxid”}

         return $trxid        
      }

      I have attached a picture of the routing.

      I’m trying to strike a balance between a clever solution that requires no dynamic routing logic in each pre-translate proc (andwhich is also ‘self-explanatory’ in the routing syntax), and a ‘normal’ solution that requires only a basic understanding of Cloverleaf filtering in tcl.

      Peter Heggie

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

Forum Statistics

Registered Users
5,119
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10