Jonathan Souders

Forum Replies Created

Viewing 15 replies – 1 through 15 (of 22 total)
  • Author
    Replies
  • in reply to: Cloverleaf API – SMATDB #121538
    Jonathan Souders
    Participant

      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.

      in reply to: Cloverleaf API – SMATDB #121537
      Jonathan Souders
      Participant

        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.

        in reply to: SMATDB File Permissions #119182
        Jonathan Souders
        Participant

          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!

          in reply to: OBX From Data Extract #119178
          Jonathan Souders
          Participant

            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 $fileID

             

            if {$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>

             

            in reply to: Cloverleaf API – SMATDB #118301
            Jonathan Souders
            Participant

              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”
              }

              in reply to: Cloverleaf API – SMATDB #118275
              Jonathan Souders
              Participant

                Thanks Rob. Posting the results in a separate comment.

                in reply to: Cloverleaf API – SMATDB #118263
                Jonathan Souders
                Participant

                  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.

                  in reply to: Cloverleaf API – SMATDB #118248
                  Jonathan Souders
                  Participant

                    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.

                    in reply to: Cloverleaf API – SMATDB #118247
                    Jonathan Souders
                    Participant

                      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”
                      ]
                      }

                      in reply to: Python Libraries #116786
                      Jonathan Souders
                      Participant

                        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.

                        in reply to: Python Libraries #116732
                        Jonathan Souders
                        Participant

                          Appreciate that, Rob!

                          in reply to: Python Libraries #116731
                          Jonathan Souders
                          Participant

                            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 hl7
                                lang = 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: ”
                            python
                            Tps_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>’
                            in reply to: Python Libraries #116720
                            Jonathan Souders
                            Participant

                              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 name
                                      hciConnName = cloverEnv.getThreadName()
                                      # Print user arguments
                                      uargs = userArgs
                                      # Obtain content of message handle
                                      data = msg.getContent())
                                      # Commit any changes you’ve made to your message content
                                      msg.setContent(str(data))
                                      # Add message to disposition list
                                      dl.add(CONTINUE, msg)
                              in reply to: Python Libraries #116716
                              Jonathan Souders
                              Participant

                                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.

                                in reply to: Python Libraries #116699
                                Jonathan Souders
                                Participant

                                  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 zxJDBC

                                   

                                  After 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.

                                Viewing 15 replies – 1 through 15 (of 22 total)