Forum Replies Created
-
AuthorReplies
-
Thanks Paul and Charlie!
After some extensive testing using both suggestions, the solution I chose to use was Charlie’s suggestion to read in the whole file using the “single” setting and create new messages from each one in the file. The load on the engine was not as big as I thought it would be doing it that way and even the larger multi-MB files were processed and sent to an outbound thread very quickly.
After working with Jim on several different ways to accomplish this task, I decided to go with chaining xlates for its simplicity.
Xlate #1 does a pathcopy on all of the segments of the MDM^T02 message which do not need modification. It also uses the String action to map the \.br\ to a ~ (tilde) in OBX-5.
Xlate #2 then does another pathcopy on the same segments that don’t need to be changed, and performs an iterate on the OBX-5, now as a repeating field, to create the OBX segments.
Attached are the screenshots of the xlate actions from both to illustrate what is going on.
A big thanks to Jim for taking the time to work with me on Friday to get this done!
Attachments:
You must be logged in to view attached files.Rob,
After Jonathan showed that all parameters that are entered in the Java class ‘Args’ box can be accessed with userArgs object, the Cloverleaf 19.1 documentation made more sense.
I can’t say anything specific is missing from the documentation, but my complaint with the documentation in general is its lack of real world examples. The documentation is written as if the reader should already know how every feature in Cloverleaf works. This has been a problem for me in every new version of Cloverleaf where new features are added. How am I supposed to know how to take advantage of new features if the documentation doesn’t elaborate on how they work or how to use them? Infor doesn’t provide free training on anything so I’m always stuck spending weeks or months trying to figure it out on my own.
For the Python and JavaScript support for example, I had no idea that you could execute the Jython runtime by executing ‘java -jar jython-standalone-2.7.1.jar -m <module>’ or even where the Jython standalone jar file was. This was not covered in the documentation. I don’t even know how the hcipython command fits into all of this, other than as an interactive command prompt, since it doesn’t seem to work the same way that executing the Jython stand alone jar does. As in, executing ‘hcipython -m <module_name>’ does not actually run a module.
My suggestion for the Cloverleaf documentation is to provide more details about how new features actually work in the context of Cloverleaf’s implementation with the inclusion of examples so Cloverleaf customers/ end users can get up to speed and start using them more quickly.
Also, I do have a question for you. In what version of Cloverleaf is Python and JavaScript fully supported? It appears to be 19.1 since my 19.1 installation on my dev box has the ‘jython-standalone-2.7.1.jar’ file, along with a few other files, in $HCIROOT/lib/java/ where in my 6.2.2 installation used in test and production does not. The included BOX’d site for Python and Javascript contains the files, including the Jython stand-alone file, in the site created from it, but that doesn’t look like global support; just something to use for testing.
Awesome! I was completely over complicating the matter. I’m all set for now. Thank you much for all of your help Jonathan! Now I am off to experiment further in Cloverleaf and continue learning Python.
Yeah, I don’t know what I was doing before, but it works great now. What I mean with the userArgs was how to populate userArgs from the Java args in the TPS properties where you set…
Java Class: ScriptTPS
Args: {LANG python} {FILE Tps_py_template.py} {FUNC __MODULE_NAME__}
There has got to be an ARGS parameter or something that tells the ScriptTPS Java class to populate the userArgs object/ parameter so it can be used from within the Python script.
Success! I got a test Python script to work correctly in a site other than the BOXed JavaScript/Python site using the ‘scripts’ directory and your instructions. I’m not sure what I was doing before to get the errors.
One more question for you. How do you supply the userArgs to the Java class ‘ScriptTPS’?
Jonathan,
Thanks for your input. After following your instructions, I was able to use easy_install but I can’t get pip to work. I think I just need to read more about pip to get it to work though. I’m new to the whole Python world and the Jython piece is raising the learning curve since I know nothing about Java.
Using easy_install though, I was able to reinstall the python-hl7 package…
java -jar jython-standalone-2.7.1.jar -m easy_install hl7
Then I deleted that ‘hl7’ directory from my ‘pythonmodules’ directory from the JavaScript/Python BOX and my test script still worked. I switched back to using the BOXed site for testing because using the ‘scripts’ directory just didn’t work right for me.
I see that Python packages are installed to $HCIROOT/lib/java/Lib/site-packages
It is worth mentioning I’m doing this testing on a Windows machine running Cloverleaf 19.1. All of my real work is done on AIX boxes running Cloverleaf 6.2.2.
Can you elaborate on how you are getting your script TPS modules to work? Are you able to use user arguments in the TPS Properties ‘args’ box?
I can’t seem to get the Cloverleaf documentation method of using the ScriptTPS Java class plus the {LANG python}{FILE <file_name>} {FUNC <func_name>} args to work properly. Why does it ask me for a func name?
But I can use the method used in the BOX example of using the JythonTPSBeta Java class with the args {MODULE <file_name>}
This is an old question, but I have been playing with Python support in Cloverleaf 19.1.
Here is what I did to get a 3rd party Python library called ‘python-hl7’ to work from hcipython. I will create a new thread for an issue I am having running Python scripts as a UPoC. More on that later.
According to the 19.1 documentation, the Python scripts need to be put in the $HCISITEDIR/scripts directory as Cloverleaf searches this directory and subdirectories for Python and Javascript files. This is different from how the site in the JavascriptAndPython.box file works where Python scripts are put in the $HCISITEDIR/pythonmodules directory.
I downloaded the python-hl7 library from the developer’s GitHub page at https://github.com/johnpaulett/python-hl7 then copied the directory containing the Python scripts, called ‘hl7’, to the $HCISITEDIR/scripts/ directory.
From there, I could load up the hcipython interpreter, import the python-hl7 library, and start using all of the classes according to the developer’s instructions. I couldn’t get any Python package manager to work such as pip or easy_install. The generic Jython documentation doesn’t seem to work with the Cloverleaf implementation so it looks like the only way to use a Python library is to download the Python source code and copy it to the $HCISITEDIR/scripts/directory.
It all breaks down for me when I use the Cloverleaf 19.1 documentation to run a Python script as a TPS UPoC though. At least it works from hcipython so that is the first step.
If there have been any new developments on using Python libraries in Cloverleaf since the original question was asked, please let me know. 🙂
- This reply was modified 4 years, 8 months ago by Lonnie Davis.
Thanks Jim. I looked up xpmstore and that led me to the FRL configurator where I could see all of the ‘hci data types’.
- ai = integer
- ch = string
- ts = timestamp
I also noticed that Cloverleaf appears to do some kind of mapping between HL7 data types and the hci data types.
What is also interesting is that the integer comparison operators in an xlate IF statement can recognize an integer value if it has a string (ch) data type.
- This reply was modified 4 years, 9 months ago by Lonnie Davis.
- This reply was modified 4 years, 9 months ago by Lonnie Davis.
Thanks everyone for your input. Since Cloverleaf doesn’t have built-in functionality to use Advanced Scheduling for outbound direction, I decided to go with a pure TCL approach using the UPoC protocol as Charlie suggested. I already have an interface doing this; I just wanted to know for sure if it was possible using Advanced Scheduling.
The 6.2.1 patch was applied to the production server at my facility on Sunday night and it went smoothly. The only aspect of the install that raised some eyebrows was that the installation script took longer than expected to change ownership on files. I don’t know what files it was changing ownership on, but it took a few minutes. Other than that, there were no issues at all.
One day post installation I haven’t seen any real noticeable differences in performance from last week. However, since my facility is running AIX we did have a problem in one site as a result of the error database this patch was to fix. That problem was corrected on the spot by replacing the error database file for that one site only. I expect this patch will prevent the issue from happening in the future with other sites.
I guess I can consider it a good thing that there isn’t much to report. Our production environment is running normally with no noticeable changes good or bad.
Thanks Jeff and Rob! I will report back here with details on any issues encountered.
We too are scheduled to install the 6.2.1 patch soon to resolve performance issues we have been having with AIX caused by the error DB.
The change with the error DB got me thinking about the recovery DB. Is the application of this update destructive to the recovery DB? There is a good chance we will have data in the recovery DB during the installation of this patch and I was wondering if installing this patch will destroy messages there.
David Barr wrote:Set the inbound protocol to use binary mode (FTP protocol properties, FTP options tab, Data Type: image/binary).
Thank you David! That solved the problem!
Thanks for the replies. I’m on my way to getting it sorted out. After making this post I found other topics here on discussing what tools developers use to write TCL scripts and thought I would try one called Komodo Edit. The challenge I am facing with this monster proc is cutting it down into manageable fragments to see what and where variables are changing. The Komodo Edit program has some TCL support and it can group all of the IF statements and expand and collapse them in the editor. That has been a big help and makes the code more manageable.
To Charlie…
The point of “reverse engineering” this particular proc is to figure out what it does. It is something that has been in place problem free for about 12 years and the people who defined the business rules and wrote it have been long gone from our organization. It’s never an issue until something doesn’t go according to plan for the lab team then they ask the interface team what went wrong. The functionality/ proc itself works fine and never requires debugging. To figure out what it does exactly and why its there will take “reverse engineering” the code as well as having a talk with two different teams to figure out the why.
To Jeff…
I think I will spare the Clovertech community from looking at this proc. Besides, it checks for so many different conditions I couldn’t even provide an example message for each one! Thanks for the offer though!
In conclusion, I am still interested to learn how developers tackle tasks like these and what tools are used. Thanks for the input so far!
-
AuthorReplies