SMAT regular expression compound search

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf SMAT regular expression compound search

  • Creator
    Topic
  • #54664
    Max LaFollette
    Participant

      For years I have searched SMAT files via SMAT-View- Add Specified Messages To View- Add A Regular Expression Condition with this very simple regular expression |ORM.*|NW|. This would find any ORM order records with any number of characters after the ORM and then look for |NW| for a new order status. This  no longer works. I can search with the |ORM or search with the |NW| but I can’t combine them with the .* (zero or more characters) anymore. Anyone else seen this and know a way around it?

    Viewing 18 reply threads
    • Author
      Replies
      • #82473
        Keith McLeod
        Participant

          What Operating System and Cloverleaf Version are you using?

        • #82474
          Charlie Bursell
          Participant

            Are you sure this worked before?  I don’t see how.

            Your regular expression says look for a pipe (|) followed by ORM.  Since ORM is the fist three characters of the segment  there should be no pipe (|) before it, just a CR.  It seems to me your expression would be something like:

            rORM.*|NW|

            Of course there are better, more explicit, regular expressions you could use

            Don’t take this as gospel.  I haven’t tested any of this just looking at the regexp.

          • #82475
            Keith McLeod
            Participant

              I did a test on 5.7 and 6.1.  The expression worked in 5.7 but not in 6.1.  Maybe I should test some of the other expressions that I routinely use.

            • #82476
              Max LaFollette
              Participant

                Keith – We are running cloverleaf 6.0 on an AIX server. And as you observed on your second post this worked in 5.7 but not on 6.0 and apparently 6.1 for you which we will move to this summer.

                Charlie – The ORM I am looking for is in MSH-9 and the NW is ORC-2. This was just a simple example of a compound regex search I use a lot. It is a simple way to look for all records with MSH-9 = ORM AND ORC-2 = NW. I can do a single search for either component just fine. I can’t find a combination to do more than one.

                This is not an earth-shaking change but it is a functionality that I used a lot and was really helpful. Am I missing another way to do this SMAT search in 6.0?

                Thanks for any input!

              • #82477
                David Barr
                Participant

                  Can you try this?  |ORM(.|r)*|NW|.

                • #82478
                  Keith McLeod
                  Participant

                    I see that in 6.X you can add in multiple lines of criteria, however when using something like

                    Regular Expression

                         Include

                                 Expression |ORM^O01

                                 Expression |NW|

                    It gets treated as an ‘OR’ condition

                    It doesn’t appear to round the bend very well past r segment termination characters….I am guessing….That could be a problem…

                  • #82479
                    Max LaFollette
                    Participant

                      David – It appears your option works. In a quick and limited test I found 139 ORM records in a SMAT file.

                      I searched with:

                      |ORM(.|r)*|NW| and got 50 records.

                      |ORM(.|r)*|XO| and got 89 records.

                      I’ll try it further and spend some time analyzing the syntax to understand the change.

                      Thanks for the tip. This may seem like a small issue but I didn’t realize how much I used it till it didn’t work anymore.

                      Thanks again to Keith, Charlie and David for the replies!!!!!!

                    • #82480
                      glen goldsmith
                      Participant

                        we’re on 5.8.5 and I do compound searches occasionally.

                        Frankly, if I had to do several compound, I just converted the SMAT file at the command line and used grep or awk for my searches.

                      • #82481
                        Sergey Sevastyanov
                        Participant

                          I just ran a quick test.

                          On CL 5.7 (Windows Server 2003) search on SMAT file with 600 messages:

                          |MDM.*|OPN| – runs in 2 seconds – gives 94 messages

                          |MDM(.|r)*|OPN| – runs in 22 seconds – gives the same 94 messages

                          On CL 6.1 (Windows Server 2008 R2) search on the same SMAT file:

                          |MDM.*|OPN| – immediatly says no messages found

                          |MDM(.|r)*|OPN| – as I am writing this the search already goes for 10+ minutes and the CL GUI is non-responsive anymore. Have to kill it through the task manager

                        • #82482
                          David Barr
                          Participant

                            Try this:

                            (?s)|MDM.*|OPN|

                          • #82483
                            Sergey Sevastyanov
                            Participant

                              David,

                              That worked! And very fast!

                              Thanks a lot!

                              Sergey

                            • #82484
                              David Barr
                              Participant

                                Someone should make a bug fix request for this. It looks like in older versions of Cloverleaf (maybe pre-5.8) dot would match the CR character, and now it doesn’t. There’s some information about how to enable that here:

                                <a href="http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL&#8221; class=”bbcode_url”>http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL

                              • #82485
                                Max LaFollette
                                Participant

                                  I opened a ticket with Infor and got the reply below:


                                  Please see below from development…

                                  We changed to use java build-in regular expression since 6.0 I.

                                  In the build-in regular expression, this dot does not match line terminators by default.

                                  Please advice user try with

                                  (?s)|ORM.*|XO|        (same as a user posted above)


                                  I’ll ask if this is listed as a bugfix.

                                  Max

                                • #82486
                                  David Barr
                                  Participant

                                    Yeah, they should be able to change the default setting.

                                  • #82487
                                    Adam Qualls
                                    Participant

                                      I get the above searches are basically searching SMAT for item 1 and item 2.  Is there a way to do a single search of SMAT for item 1 OR item 2?  

                                      Example:  Blood.*201 would return records that state Blood and also have the number 201 in each record.  

                                      What would I type if I wanted to return records that have Blood OR records that have 201?  

                                      So say I have 10 records and 2 say Blood and 3 other records say 201.  I want a single query that will return the 2 records that say Blood and the 3 records that say 201 for a total of 5 results.  

                                      Thanks!

                                    • #82488
                                      Sergey Sevastyanov
                                      Participant

                                        Blood|201

                                        I didn’t test it though

                                      • #82489
                                        Adam Qualls
                                        Participant

                                          Sergey Sevastyanov wrote:

                                          Blood|201

                                          I didn’t test it though

                                          Thanks!  That worked.

                                        • #82490
                                          Steve Williams
                                          Participant

                                            For those who do not know this expression to work around the change to Cloverleaf’s regex when searching multiline strings (like HL7 messages):

                                            (?s) – this tells the regex parser to run with effective flag: s

                                            Where the s modifier means Dot expression matches newline characters.

                                            Here’s a really good online tool I use to test complex regular expressions: regex101.com

                                          • #82491
                                            Steve Williams
                                            Participant

                                              FYI – I tried replicating this issue on our updated engine (v6.1.3 on WinServer 2012) against HL7 messages stored in encrypted SMATDB. The search was ‘|ORU.*|RP|’ and it worked as expected. I tried many permutations and never needed to add the (?s) flag to work around the issue. 🙂

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