Forum Replies Created
-
AuthorReplies
-
Hi Dirk:
I am not sure on this – since the databases I was working with were not using encryption, this was not something I explored.
If I can find my old code, I can try and work through this again to see what I can determine. I will get back to you some time next week once I look through my repository to see if I retained the code or not – if not, I will do my best to try and re-explore and see what I can figure out!
I agree with you about the Swagger documentation though, I had hoped that would have improved a bit by now.
Honestly I have not looked at this in quite some time and may not have the code anymore since moving on to different employers.
Are you still having this issue? If so, I can try to find my code or look at the API again but it might take me some time to get you an answer.
I don’t know why I missed this suggestion or why I didn’t think of it as well. Oh well, too late now.
Thanks anyway, Charlie!
It was a Meditech extract from it’s DR database and I think, if I remember correctly, we ultimately ended up splitting up the extract into multiple files and doing the following:
<code>
set RESULTID [lindex $s 7]
set systemTime [clock seconds]
set dateTime [clock format $systemTime -format %Y%m%d%H%M%S]### retrieve MRN from flat file
set pathfile “/opt/cloverleaf/cis6.2/integrator/_xcon_note01/data/Meditech/gbResultID.TXT”
set fileID [open $pathfile]
set prevRESULTID [read $fileID]
close $fileIDif {$RESULTID != $prevRESULTID && $pt != “” && [string range $MRN 0 2] == “HSM”} {
# normal logic here
} else {
### OBX logic
set obx “”
#echo “entering OBX logic…”
set MRN [lindex $s 0]
set OriginiationTimestamp [lindex $s 9]; set yyyymm [string range $OriginiationTimestamp 0 5]
#set OBSERVATIONVALUE [lindex $s 15]
set OBSERVATIONVALUE [lindex $s 36]
set OBSERVATIONVALUE [string map {$EndofSegment “~”} $OBSERVATIONVALUE]#set SEQNUM [lindex $s 16]
set SEQNUM “1”
#set OBX3VALUE [lindex $s 15];
set OBX3VALUE “”
set obx “OBX|$SEQNUM|TX|$OBX3VALUE||$OBSERVATIONVALUE”
if {$OBSERVATIONVALUE != “” && $OBSERVATIONVALUE != “ReportText” } {
#echo $obx
set fn_suffix “HOS_FR_SHMT_”;
append fn_suffix $yyyymm;
append fn_suffix “_HL7_”;
append fn_suffix $MRN;
append fn_suffix “.txt”
#set pathfile2 “/opt/cloverleaf/cis6.2/integrator/_xcon_note01/data/SHMT_HOSP/$fn_suffix”
#set pathfile2 “/opt/cloverleaf/cis6.2/integrator/_xcon_note01/data/2020/conv_MeditechNotesSampleHL7.txt”
#set pathfile2 “/home/hci/Conversions/epicextract07/Summit Conversion/_xcon_trans01/data_in/TRANS_DLTA_SHMT/Final/HL7_$fn_delta”set pathfile2 “/home/hci/Conversions/epicextract07/Summit Conversion/_xcon_trans01/data_in/TRANS_DLTA_SHMT/Final/HL7_$fn_delta.txt”
set HL7file [open $pathfile2 a+]
puts -nonewline $HL7file $obx; puts -nonewline $HL7file $EndofSegment
close $HL7file}
</code>
- This reply was modified 3 years, 3 months ago by Jonathan Souders.
- This reply was modified 3 years, 3 months ago by Jonathan Souders.
- This reply was modified 3 years, 3 months ago by Jonathan Souders.
Finally ended up getting this working with the below syntax (I asked Infor to update their documentation because part of this criteria I needed to use is not mentioned anywhere in Swagger or in the Java classes I decompiled while troubleshooting).
For message search (content of message):
{
“files”:
[
“$HCIROOT/<site_name>/exec/processes/<process_name>/<file_name>”
],
“criteria”:
[
{“type”:”plain”,”itemName”:”MESSAGECONTENT”,”operator”:”regular expression”,”val1″:<search_text_or_regex_query>}
],
“sort”:{“ascending”:”true”},
“pageNum”:1,
“msgNumPerPage”:10
}For message search (metadata example):
{
“files”:
[
“$HCIROOT/<site_name>/exec/processes/<process_name>/<file_name>”
],
“criteria”:
[
{“type”:”plain”,”itemName”:”MID”,”operator”:”==”,”val1″:<cloverleaf_mid_value>}
],
“sort”:{“ascending”:”true”},
“pageNum”:1,
“msgNumPerPage”:10
}For message resend (example of outbound thread message resend – most values can be pulled from the other CLAPI requests for SMAT):
{
“defaultEncoding”: “UTF-8”,
“encoding”: “UTF-8”,
“includeMeta”: “true”,
“messageType”: “DATA”,
“passwords”: {},
“priority”: 5120,
“resend_type”: “DATA”,
“criteria”: [
{
“type”: “plain”,
“itemName”: “MID”,
“operator”: “==”,
“val1”: <cloverleaf_mid_value>
}
],
“srcThreadName”: “<thread_name>”,
“destThread”: “<thread_name>”,
“metatdataDestThreads”: “<thread_name>”,
“filename”: “<file_name>”,
“files”: [
“$HCIROOT/<site_name>/exec/processes/<process_name/<file_name>”
],
“modifiedmessages”: [
{
“cloverMsgprofile”: {
“mid”: “0.0.10648074”,
“sendingTime”: 1608657356535,
“fileRelativePath”: “/exec/processes/<process_name/<file_name>”,
“marked”: false,
“indexRecordOffset”: 0,
“indexRecordLength”: 0,
“modified”: false,
“rowId”: “67”,
“smatInfoVersion”: 258,
“dispTimeFmtVersion”: 258,
“offsetMap”: {},
“filePath”: “$HCIROOT/<site_name>/exec/processes/<process_name/<thread_name>.smatdb”,
“fileName”: “<file_name>”
},
“metadata”: {
“TIMEXLT”: “1608657356534”,
“STATE”: “14”,
“PRIORITY”: “5120”,
“SKIPXLT”: “0”,
“TIMEIN”: “1608657356534”,
“USERECOVERDB”: “3”,
“SAVECONTEXT”: “outbound”,
“DATAFMT”: “{RESEND_DEST <thread_name>} {RESEND_DEST <thread_name>}”,
“SEPCHARS”: “”,
“FLAGS”: “33286”,
“TIMEQCUR”: “0”,
“TYPE”: “DATA”,
“SRCMID”: “<cloverleaf_mid_value>”,
“RETRIES”: “0”,
“DESTCONN”: “<thread_name>”,
“ORIGDESTCONN”: “<thread_name>”,
“GROUPID”: “0”,
“TIMESTOR”: “0”,
“XLTTHREAD”: “”,
“TIMEQTOT”: “0”,
“DBTABLE”: “”,
“SOURCECONN”: “<thread_name>”,
“ORIGSOURCECONN”: “<thread_name>”,
“TIMEREC”: “1608657356534”,
“TIMEOUT”: “1608657356534”,
“DRIVERCTL”: “{CONNID 0} {IPVERSION 4} {CLIENTIP <client_ip_address>} {CLIENTPORT 54568} {_TRXID_ ORM_O01}”,
“GROUPMID”: “”,
“USERDATA”: “”,
“TIMEARC”: “0”
},
“contentBase64String”: “<base64_message>”
}
],
“processName”: “<process_name”,
“threadContext”: “ob_post_tps”
}Thanks Rob. Posting the results in a separate comment.
I opened a support ticket for this which has now been escalated to R&D as a defect. I’ll document the results here if/when I determine the solution.
Update:
I figured out most of the keys and can get response data now… but I still don’t know what string values to pass to the Criteria object. Any assistance is appreciated.
Yes – but unfortunately I can’t decipher what parameters I need to supply to the following JSON object for the call to be successful, even from the Swagger UI.
Any way you can clarify what the needed string values are for the criteria, encodes, Files, etc. keys?
{
“criteria”: [
{
“itemName”: “string”,
“operator”: “string”,
“required”: true,
“val1”: “string”,
“val2”: “string”
}
],
“encodes”: {},
“filePasswordMap”: {},
“files”: [
“string”
],
“msgNumPerPage”: 0,
“pageNum”: 0,
“sort”: {
“ascending”: true,
“metaName”: “string”
},
“visiableMetaNames”: [
“string”
]
}Rob:
Should I open a case on the following issues?
For Javascript, I’m not sure how to debug – I’ve tried console.log(<variable>), but it errors out my scripts in testing so I can’t read any of my variables from the log file.
For testing tool, I try to pass arguments (JS and PY) the same way I do in the NetConfig, but I never get any output to the screen.
I’ll open a case if necessary, but thought I’d ask if that was worth my time first.
Thanks.
Appreciate that, Rob!
You can do that like so (just an example):
NetConfig
Java Class: ScriptTPS
Args: {LANG python} {FILE Tps_py_template.py} {FUNC __MODULE_NAME__} {userArgs TESTING}
Python Script
def __MODULE_NAME__(cloverEnv, context, mode, msg, userArgs, dl):# mode can be “run”, “start”, “shutdown”, or “time”#hciConnName = cloverEnv.getThreadName()import hl7lang = userArgs.get(‘LANG’)file = userArgs.get(‘FILE’)func – userArgs.get(‘FUNC’)uargs = userArgs.get(‘userArgs’)print(lang)print(uargs)Log Output[prod:prod:INFO/0: python_in:05/08/2020 13:34:22] Applying EO config: ”pythonTps_py_template.py__MODULE_NAME__TESTING[cmd :cmd :INFO/0: python_cmd:05/08/2020 13:34:26] Receiving a command[cmd :cmd :INFO/0: python_cmd:05/08/2020 13:34:26] Received command: ‘python_xlate xrel_post’[cmd :cmd :INFO/0: python_xlate:05/08/2020 13:34:26] Doing ‘xrel_post’ command with args ‘<none>’Awesome! There are some template outlines in $HCIROOT/scripts/templates that give you some general starting places on the different types of functions you might use. The one for TPS includes some function parameters, one of which is ‘userArgs’ which you can then call print(userArgs), or however you plan to use them, within your function. Below is my general understanding of ways to use (most of) the parameters:
def __MODULE_NAME__(cloverEnv, context, mode, msg, userArgs, dl):if mode == ‘run’:# Obtain thread namehciConnName = cloverEnv.getThreadName()# Print user argumentsuargs = userArgs# Obtain content of message handledata = msg.getContent())# Commit any changes you’ve made to your message contentmsg.setContent(str(data))# Add message to disposition listdl.add(CONTINUE, msg)- This reply was modified 4 years, 7 months ago by Jonathan Souders.
- This reply was modified 4 years, 7 months ago by Jonathan Souders.
- This reply was modified 4 years, 7 months ago by Jonathan Souders.
This is how I have my TPS set up with my .py files in$HCIROOT/scripts – which I’m currently just running against some sample files with success (still need to get the team on board with using Python since no one else is familiar):
Java Class: ScriptTPS
Args: {LANG python} {FILE Tps_py_template.py} {FUNC __MODULE_NAME__}
ScriptTPS being the Java class Infor allows these to run through, {LANG python} being the language I want to use (as opposed to JavaScript), {FILE Tps_py_template.py} being the file containing my relevant functions, and {FUNC __MODULE_NAME__} being the Python function I am calling from my .py file. Think of this like your Tcl procs, where you have a file that can contain many procs, and your Tcl_index contains a list of your procs which you can then select from the TPS properties window – with Tcl it’s inherently in the application, but for Python/JavaScript you have to specify the arguments for those parameters since they are not built in like the Tcl components.
TL;DR – LANG tells Cloverleaf what language to use, FILE specifies the file in which to look for functions, FUNC specifies which function in the FILE to use.
Clever!
I never followed up on this since there didn’t seem to be any interest, but I eventually did find a way to install libraries from pip.
It required downloading an updated version of the Jython Standalone .jar file that is in $HCIROOT/lib/java – the version that already exists in that directory wouldn’t allow the ensurepip command to work for whatever reason, but installing the libraries in the updated version is backwards compatible for the older version – and running the following commands:
$ java -jar jython-standalone-2.7.1.jar -m ensurepip
$ java -jar jython-standalone-2.7.1.jar -m pip install –upgrade pip
$ java -jar jython-standalone-2.7.1.jar -m pip install hl7
$ java -jar jython-standalone-2.7.1.jar -m pip install zxJDBCAfter doing this, I could write my scripts with any libraries I had installed from pip and set the threads to run with the Script TPS module.
- This reply was modified 4 years, 7 months ago by Jonathan Souders.
-
AuthorReplies