Forum Replies Created
-
AuthorReplies
-
First thing I see is that the “return $dispList” is inside your switch, but not within one of the switch cases. I expect that would cause a Tcl error that would kill the script.
Are you wanting this script to email an alert and kill the message if it doesn’t have an MR in PID-3 and continue the message if you do find an MR?
Please confirm what you want it to do.
Jeff Dinsmore
Chesapeake Regional HealthcarePlus what Tim said…
If you only want to kill if there’s a missing MRN, you’ll need to put a condition in there to check the MRN – once you’ve found it – for validity.
You’ll also want to set mrn to “” prior to your loop so that the variable exists in case you don’t find a repeat that contains “MR”.
Once you have your variable, you can use it to choose whether or not to kill.
Something like
if { $mrn eq “” } {
puts “mrn is empty”
# kill message here
} else {puts “mrn is not empty”
}
Also – a style pointer…
Using two variables that are spelled the same, but have different capitalization is confusing. Distinguishing between errormsg and errorMsg is harder than it needs to be.
Make it easy on yourself and whoever will maintain this after you and use something like “errormsg” and “emailErrorMsg”.
Jeff Dinsmore
Chesapeake Regional HealthcareCheck what’s returned from your hl7::count command – [hl7::count hl7 PID.3.1]
I expect that’s counting the number of repeats in PID-3.1 and likely returning 1 rather than the number of repeats in all of PID-3.
If that’s the case, it would never get to the repeat with the “MR”
Try [hl7::count hl7 PID.3] instead
Jeff Dinsmore
Chesapeake Regional HealthcareTim
I think that passing the variable by name is correct since the command prior to the one generating the error would probably have barfed if it was sent a string (hl7) and it was expecting the value in that string.
Passing the name and then referencing it with upvar in the called procedure is fine – and the only way to do it if the passed variable is an array.
Jeff Dinsmore
Chesapeake Regional HealthcareWhat it’s complaining about is that the “level” variable is not set when running…
lindex { segment segrep field fieldrep component subcomponent } $level
… to select one of the six values from the list {segment segrep field fieldrep component subcomponent }. If level is zero, lindex returns “segment”. If level is 3, lindex returns “fieldrep”.
This is the command that’s generating the error:
set MSH_5 [hl7::get_field hl7 MSH.5.0]
Assuming it’s not a bug in the hl7 package code itself, the problem is most likely in how message element is specified – “MSH.5.0”. Perhaps the zero element is the issue.
Try “MSH.5.1” instead. If that doesn’t work, try eliminating the component altogether – using “MSH.5” to see if it retrieves the entire contents of MSH-5.
Good luck!
Jeff Dinsmore
Chesapeake Regional HealthcareHost Server Build Information:
Version: 19.1.0.1PLike the Bartles & James guys said – “Thank you for your continued support”
Jeff Dinsmore
Chesapeake Regional HealthcareYes, it’s using PDL, so that’s useful info.
Those that have failed recently have been the largest payloads – a couple MB or more. – so I considered that size might be an issue. But I wasn’t thinking they’re huge.
I switched my test inbound to use TCPIP with MLLP encapsulation, and now get a different error, but looks like the same problem.
[tcp :read:ERR /0:imageTrend_ib_tcp4:05/01/2024 15:54:26] Tcp encapsulated read timed out after start block, reseting to look for start block.
[tcp :read:WARN/0:imageTrend_ib_tcp4:05/01/2024 15:54:40] Nonmessage data received. Enable tcp/read/info/0 to see detailBut… it looks like CL actually eventually receives the whole message. It’s written to SMAT, but I don’t see an ACK back to the sender. The client sent the message five times total after timing out four times waiting for an ACK.
And, again, the TCPIP with MLLP encapsulation works fine if I remove most of the Base64-encoded payload.
Very strange…
Here’s the start/end of a hex dump of the message that’s being sent. It looks like it has proper MLLP start/stop characters.
HEX DUMP – 2582103 characters
0b 4d 53 48 7c 5e 7e 5c *MSH|^~\*
26 7c 49 6d 61 67 65 54 *&|ImageT*
72 65 6e 64 7c 34 34 39 *rend|449*
7c 45 4d 52 5f 56 65 6e *|EMR_Ven*
64 6f 72 7c 30 38 7c 32 *dor|08|2*
30 32 34 30 35 30 31 30 *02405010*
39 33 38 35 39 32 30 32 *93859202*
34 30 35 30 31 31 34 33 *40501143*
38 35 39 2d 30 35 30 30 *859-0500*
7c 7c 4f 52 55 5e 52 30 *||ORU^R0*
31 7c 34 37 31 36 31 35 *1|471615*
37 36 31 31 36 37 32 36 *76116726*
32 33 39 39 30 7c 50 7c *23990|P|*
32 2e 35 7c 7c 7c 41 4c *2.5|||AL*
7c 4e 45 7c 7c 7c 7c 7c *|NE|||||*
0d 50 49 44 7c 30 31 7c * PID|01|*…
7c 7c 7c 7c 7c 7c 46 7c *||||||F|*
7c 7c 32 30 32 34 30 34 *||202404*
31 36 30 35 31 31 31 36 *16051116*
7c 7c 7c 7c 0d 1c 0d *|||| *Jeff Dinsmore
Chesapeake Regional HealthcareMe too, but I’m trying establish whether or not SQLite SMATDBs are kept up-to-date – and whether it’s a viable tool for storing SMAT.
If it’s just a delay in the display of data, that’s one thing, but if it’s actually not storing messages in SMATDB real-time, that’s another thing entirely.
There’s certainly value to being able to query across multiple SMAT DBs directly in the GUI. If it can be done effectively without writing any code, that would be a good thing.
In the past, using SMAT files, we had no choice but to write code to search through multiple files.
We have a substantial amount of automation that does direct SMAT file lookup, so I want to be sure SMATDB is solid before I invest the time to convert our SMAT file code to handle SMATDB.
Jeff Dinsmore
Chesapeake Regional HealthcareYes.
Jeff Dinsmore
Chesapeake Regional HealthcareFebruary 22, 2024 at 4:46 pm in reply to: SQLite programming question – how to execute dot commands from Tcl #121192Cloverleaf will likely always be a bit behind on SQLite and Tcl, so we’ll probably never have the latest features – even if we’re running the most recent version of Cloverleaf. If we’re running an older CL version, the included SQLite and Tcl versions will be older as well.
I didn’t find documentation for non-current versions of SQLite, but did find a revision history that might be helpful https://www.sqlite.org/changes.html
I wasn’t really suggesting you code around anything – just suggesting an alternative approach that’s perhaps better/faster/more capable.
For my money, exec-ing a shell function from Tcl is not my preferred method. If I can use Tcl extension function to do SQLite stuff within the Tcl shell, that’s more desirable solution for me.
Jeff Dinsmore
Chesapeake Regional HealthcareFebruary 21, 2024 at 10:40 am in reply to: SQLite programming question – how to execute dot commands from Tcl #121176Jim,
You can use the SQLite Tcl extension/API commands directly from your Tcl script.
To check if a table exists:
if { ! [llength [$dbHandle eval “PRAGMA table_info(yourTableName)” ]] } { puts “table does not exist – do something.” }
To create a table:
if { [catch {$dbHandle eval “create table yourTableName(mrn INTEGER, personLastName TEXT, personFirstName TEXT, personMiddleName TEXT)”} catchErr] } { puts “Table creation failed (catchErr= $catchErr)” }
Then, you can open your file, skip any number of lines, then write the modified content to another file and use the copy command to write the file data to the DB.
Or, you could just open the DB, open the file, optionally skip the first N lines, then write the DB a row at a time.
Read a line of the file, write a row to the DB.
Jeff Dinsmore
Chesapeake Regional HealthcareIn our Redhat Linux, the max processes and max files are controlled by /etc/security/limits.conf
Jeff Dinsmore
Chesapeake Regional HealthcarePerhaps your production max files configuration is too small.
Jeff Dinsmore
Chesapeake Regional HealthcareWe have some tools to read some NetConfig content – the stuff we’ve needed for our automation.
But this looked like fun so I played around with adding routing/xlate info as well.
Attached is a fairly complete example proc that will read NetConfig for a specified site.
usage: readNetConfigExt <site> <arrayName>
>>> something like: readNetConfigExt lab netConfigArray
There is also a proc to print what was read.
usage: printNetConfigExt <arrayName>
>>> something like: printNetConfigExt netConfigArray
Attachments:
You must be logged in to view attached files.Jeff Dinsmore
Chesapeake Regional HealthcareYep, it’s definitely busted.
It’s also getting more apathetic as it gets older.
I’ll requisition a new one.
Jeff Dinsmore
Chesapeake Regional Healthcare -
AuthorReplies