Is this possible with the engine?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Is this possible with the engine?

  • Creator
    Topic
  • #52695
    Ian Morris
    Participant

      I need to translate an ORU made up of the typical segments… MSH, PID, OBR, OBX’s, pull out certain elements of the result message, and put them in a one line output message.  I’m not sure what the best way to go about it is.  Here’s an example of what they want output:

      Code:


      |1|D011111|Last, First|F|YYYYMMDD|111-11-1111|K.PN|Doctor Office Visit|20110502|e:textfilename.rtf|PRACTICE|DOCTORNAME|FACILITY|

      ON TOP of that, they want me to increment the message number from within the engine.  The message number in this case is “1”.  But, apparently they can’t send that in their outbound message.  Instead, I’ve been instructed to magically calculate it, sequentially, for each translated message and then start back over at “1” at midnight.

      Any thoughts on this?  I was thinking about jamming everything they are asking for into the MSH field of the outbound message.  However, I don’t want “MSH…”at the beginning of each file.

      I’m thinking this whole thing can’t be done.  What do you think?

    Viewing 9 reply threads
    • Author
      Replies
      • #75144
        Scott Folley
        Participant

          Firstly I will say that there isn’t much of anything that can’t be done.

          You have several choices about how to tackle this, you can go with a completely TCL-upoc method or you can go with building your output format as a VRL with the separator being a pipe.  Once you have created the VRL and mapped the information in the segments to that VRL then you will need to handle the incrementing of the counter.  For that you can create an outbound TPS proc that reads the previous count and the date from a file, gets the current date, compares the current date against the previous date from the file to see if it is time to reset the counter, if it is time to reset the counter then the counter becomes 1 and that gets written out to the file along with the current date otherwise you take the counter from the file, increment it, and write it back out with the current date.

          That description should be enough to give you a leg up but I think that you are over thinking this one unless there is something that I am missing.

          As options, you could parse the message within the same TPS proc and skip the translate completely.  For that I would probably use the subst command since you already know what your output format needs to consist of.  Another option for tracking the counter would be database table or sqlite.

        • #75145
          Jim Kosloskey
          Participant

            For a counter you could use the Cloverleaf counter file.

            You could use something like a cron (if UNIX) job to reset it at midnight or like Scott indicated an inbound TPS proc that checks the time on each transcation and if it is the first one after midnight, initialize the counter file.

            I have a XLTP type proc that does counter file interaction. If you want to go that way, email me and I will send it to you.

            You can find documentation regarding the counter file in the Help/Reference manual.

            email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

          • #75146
            garry r fisher
            Participant

              To paraphrase Scott – Anything is possible. 🙂

              I havent done this particular process but in the past I had to take a fixed format lab output and convert it to VRL with a number whistles and bells including sequential numbers, flags, etc.

              I used inbound TPS to split my fixed format up into an array, I then used another TPS to start putting it back together in a internal format. I then used an xlate to get the VRL and also used XSLT’s where necessary. Finally I had an outbound TPS that put everything together in the correct format and then a final TPS just to add a flag and a terminiation char on the end.

              A lot of work writing and testing but it worked.

              As Scott also said – There are other ways of doing it – It depends where your strengths are and what works best for you.

              Regards

              Garry

            • #75147
              Ian Morris
              Participant

                Thank you for your responses.  A VRL looks like what’s needed here.  I haven’t done one before, but I’m going to give it a shot.

              • #75148
                Mike Campbell
                Participant

                  VRL is ‘fun’ and interesting.  I’ve done several so if you have a question don’t hesitate to ask.

                • #75149
                  Ian Morris
                  Participant

                    I knocked out the VRL really quickly.  Thank you all for your assistance on that.  I need more help with the counter, though.  I found the following in the help file.  Is this what you are talking about?

                    Code:


                    int SMAT_getMessageCount(String siteName, String indexFileName)
                    Returns the message count of the specified index file under the specified site.

                    Where:

                    siteName is the name of the site.

                    indexFileName  is the name of the index file.

                    This returns the message count.

                    Can I incorporate that command in my translation and assign that command’s result to a value on the outbound side of the translation?

                  • #75150
                    Jim Kosloskey
                    Participant

                      Ian,

                      If you want to use the counter file approach

                      Start help then select Reference, then hci Commands, then Counter Commands.

                      If you want a proc to deploy counter files inside an Xlate, email me and I will send you one we use.

                      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                    • #75151
                      Ian Morris
                      Participant

                        Thanks to all of your help I accomplished what I set out to do.  I used an HL7 -> VRL translation to perform the mapping.  For the incrementing field, I used the attached .tcl.  Most of which, I found in another post on the forums.

                        Thank you all for your help!  ðŸ˜€

                      • #75152
                        Charlie Bursell
                        Participant

                          Are you sure that works?

                          I haven’t followed closely what you want to do but it looks like here xlateOutVals will always be set to the counter value.  Am I missing something?

                          Also just so you know you will create your counter file anew every time

                          You have: set ctrfilefull /path/to/file,vtr followed by set ctrfilefull /path/to/file

                          which means ctrfilefull is set to the last value

                          file exists $ctrfilefull will never be true since CtrInitCounter $ctrfile will create a file named file.ctr.

                          A hint:

                          If you are satisfied with the defaults you never need CtrInitCounter.  If you issue the command CtrNextValue (or other counter command) and the file does not exist, it will be created

                        • #75153
                          Ian Morris
                          Participant

                            Charlie,

                            Thank you for your tips.  To anwer your questions:

                            Quote:


                            I haven’t followed closely what you want to do but it looks like here xlateOutVals will always be set to the counter value.  Am I missing something?

                            I want that field to have the value of the counter.

                            Quote:


                            Also just so you know you will create your counter file anew every time

                            You have: set ctrfilefull /path/to/file,vtr followed by set ctrfilefull /path/to/file

                            which means ctrfilefull is set to the last value

                            file exists $ctrfilefull will never be true since CtrInitCounter $ctrfile will create a file named file.ctr.

                            Yes, you are correct.  In my excitement to share what I had figured out, I missed that.  I have since corrected it in my translation.

                            Quote:


                            A hint:

                            If you are satisfied with the defaults you never need CtrInitCounter.  If you issue the command CtrNextValue (or other counter command) and the file does not exist, it will be created

                            I did not know that.  Thank you for the tip.

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