Smat file reporting utliity

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Smat file reporting utliity

  • Creator
    Topic
  • #52786
    Peter Heggie
    Participant

      I’ve written this utility in TCL to print reports of data in Smat files that show only certain data elements, using a query syntax that lets me identify discrete data. I am posting it here hoping that others find it useful; it has saved me a lot of time. I’ll attach the TCL file, along with same other files that are associated with it, including documentation.

      Here is an example of a report:

      Search criteria:                                              

       msgtype = A60   allnm = ‘^[a-z]’                            

                                                                   

      MID        TIME                visit        allcd    allnm    

      441864390  2011/11/04 12:53:31 11112222     00004812 ketorolac

      441872516  2011/11/04 12:58:37 33334444     00004116 paclitaxel

      441896182  2011/11/04 13:14:35 55556666     00001545 morphine  

      442022471  2011/11/04 14:26:43 77778888     00001545 morphine  

      442033306  2011/11/04 14:32:31 99990000     00001545 morphine  

                                                                   

      messages read from smat file 6726                              

      messages found and matched   5                

      The visit number is changed but the rest of the information is the same as produced by the report. If you change the font to Courier New, all the columns will line up.

      The query syntax that generated this report is ‘HL7-like’ :

      msgtype.0 MSH#9[1]=A60 visit.12+1 PID#3[0] allcd.8+1 IAM#3[0] allnm.20+1 IAM#3[1]=’^[a-z]’

      The attached documentation spells out the syntax, but basically you use pairs of header and element criteria, and the header specifies that column name and width. A width of 0 means it will not be printed but it will be used for matching. This case matches only A60 messages and looks for allergy names with a leading lowercase character.

      This is more of a brute-force search tool than a small and elegant program. There is no capability to use OR conditions across segments but you can use regular expressions to match each data element. Equals and not equals is supported, as is exists and not exists.

      I’ll also try to attach a crude GUI application that works in AIX and may work in other UNIX operating systems. Your mileage may vary. This tool works with ASCII and ebcdic smat files, but I can’t guarantee that your ebcdic conversion will work. This tool works with data coming from Invision on z/os and accomodates length encoding and some Invision control metadata that you may have to change the program to make work with your own ebcdic data.

      I have borrowed from many posters here including Charlie Bursell, Jim Kosloskey, Russ Ross and others, and I thank you for your posts and contributions. The errors here are my own.

      If you use the smatr GUI TCL, you need to edit the program to point to your own property files and locations. These are tested on Cloverleaf 5.8.4 and AIX 6.1.

      I’ve added more global variables in the smatrpt.tcl than necessary but I had to make it executable from the other TCL, the smatr.tcl GUI. I’ll be at a Cloverleaf class next week but I can answer questions at night.

      Peter

      Peter Heggie

    Viewing 5 reply threads
    • Author
      Replies
      • #75469
        Peter Heggie
        Participant

          additional documentation and property files for the GUI program

          Peter Heggie

        • #75470
          Peter Heggie
          Participant

            sample shell script that invokes the batchsmatrpt.tcl

            this is run using the hci userid

            Peter Heggie

          • #75471
            Jim Rawls
            Participant

              Hi Peter,

              Rather than reinvent the wheel, you may want to look at a powerful utility called HL7Spy (http://www.hl7spy.com/).  It’s fairly inexpensive per license and easy to use.  ðŸ™‚

              Regards,

              Jim

            • #75472
              Peter Heggie
              Participant

                Hi Jim, thank you. I can see that HL7Spy is a great tool, fully functional. I guess I’ve been reinventing the wheel! At least I’ve gotten a better look at TCL.

                If my organization would pay for it, I’m sure we would purchase it. Does it read Smat files located on another server? Is there a batch interface?

                HL7Spy has a great SQL syntax; I also like my compact batch syntax. Is there an easy way to print the value of a subfield in an unknown occurance related to another known subfield in the same occurance?

                Peter

                Peter Heggie

              • #75473
                Peter Heggie
                Participant

                  We still can’t afford HL7Spy, and I don’t know if it can directly read smat files. I’ve seen the regular expressions that people use for searching smat files, but I can’t say it shows an easy to read report that covers multiple messages, or even multiple smat files.

                  So I am uploading an update (bug fixes) to the original utility and also uploading shell scripts I use to run the utiity against multiple smat files and hopefuly someone will find it useful.

                  Even though I built a GUI for AIX, I haven’t used it, in favor of the command line, so I won’t support it.

                  Peter Heggie

                • #75474
                  Peter Heggie
                  Participant

                    Other required shell script for report.

                    Peter Heggie

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