Forum Replies Created
-
AuthorReplies
-
Yep it worked, sorry for the brain fart forgot I could just use the show command button in the recovery database. Don’t normally have to delete messages so wanted to make sure I was doing it right.
Thanks I will practice this on the test box and see how it goes and I believe you are right that it is the number from the MSH. Thanks that is what I thought but just wanted to be sure.
Thanks and now I see the reasoning for your question with your trim statement, I was trying to squeeze the values in between the repeating separators. I did not think to use trim and just append it. I’ll have some more test supplements ordered and see how it goes.
Worse case I go back to my method, which is not as elegant and I have your code to help me out in the future; but I believe your strategy will work fine.
Thanks once again.
Thanks Charlie and your ODS was a lot shorter than my ods_new and did the same thing. Sorry I was not more clear on the orc part but yes this is correct
ODS|S||83282^DTY: DIET SUPPLEMENT^DTY~Glucerna~orc7-1~orc_7_2
but instead of the tilde in between the two orc values it would be a carat
ODS|S||83282^DTY: DIET SUPPLEMENT^DTY~Glucerna~orc7-1^orc_7_2~~
I was off Friday so I going to try and see if I can get the message to combine like it should. I’m sure I’m just not rejoining the message correctly because of the repeating segment.
Thanks to your help I went from what I had to this new code which looks a lot better and works doing what was originally asked but alas they want more. If it is a supplement identified by the code 83282 (as before) they want me to copy the duration and frequency from the ORC segment section 7. I have them labeled orc_7_1 and orc_7_2. They would like these added to the end of the supplement name after the tilde. So in the example below it would be after the Glucerna~
ODS|S||83282^DTY: DIET SUPPLEMENT^DTY~Glucerna~~~
I’ll keep at it but while I’m getting close I have not gotten the values to go where I needed them. I can place them anywhere in the message other than the repeating area in which they need to go. I was hoping someone has done something similar and could chime in.
Thanks again for any help you can offer.
proc changeHL7_ORC { args } {
[code]
proc changeHL7_ORC { args } {Thank you both for these examples, will dissect them.
Thanks for the information Charlie. Do you happen to have a script using the lsearch that searches for a particular message segment? I would just like to see how it works. I’ll google the lsearch command to gather more information.
Thanks for the info
I finally figured out my problem it seems my system does not like [cequal $segtype “ODS”] I used {$segtype == “ODS”} instead and it worked better. I had one or two other similar changes to make.
I assume handling it in a xlate would be more efficient though so I’ll work on that next.
Well I tried my hand at creating a proc, I pilfered some of the code from other procs we have. The issue seems to be that the proc is not looping through each message type. Below is my code, ignore the puts commands those where for trouble shooting. I hope it is ok to post code in this forum
Code:
######################################################################
# Name: chg_ods_1_to_S_basedon_ods3
# Author: Chris Plummer
# Purpose: Translate ODS segment 2 from D to S based on segment 3
# Date: July 13, 2016proc chg_ods_1_to_S_basedon_ods3 { args } {
keylget args MODE mode ;# Fetch modeset dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set msg [msgget $mh]
set outbuf “”
set field_sep [csubstr $msg 3 1] ;# HL7 field separator
set sub_sep [csubstr $msg 4 1] ;# HL7 subfield separator
set rep_sep [csubstr $msg 5 1]
set segmentList [split $msg r] ;# Get segments
puts “This is before the for each loop”
foreach segment $segmentList {
puts “This is in the first loop $segmentList”
if [cequal $segment “”] { continue }
puts “This is after the first if $segment”
set fieldsList [split $segment $field_sep] ;# Just in case
set segtype [csubstr $segment 0 3] ;# Get segment name
puts “This is the field sep $field_sep”
puts “this is the segtype $segtype”
if [cequal $segtype “ODS”] {
puts “This is after the second if segtype $segtype”
set fieldsList [split $segment $field_sep]
set ods_3 [split [lindex $fieldsList 3] $sub_sep]
set ods_1 [split [lindex $fieldsList 1] $sub_sep]
puts “The Patient Account is: $sub_sep”
if {[cequal $ods_3 “83282”]} {
set new_ods_1 “S”# might not need this
set new_ods_1 [join $new_ods_1 $sub_sep]set fieldsList [lreplace $fieldsList 1 1 $new_ods_1]
set segment [join $fieldsList $field_sep]
}
}
puts “This is the end of msg compare before the append”
append outbuf ${segment}r
} ;# end of ‘foreach’# Put modified message ($newmsg) in message handle
msgset $mh $outbuf
lappend dispList “CONTINUE $mh”
}time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}
# end switch mode
puts “end of switch mode”
return $dispList
} -
AuthorReplies