Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › changine case
- This topic has 15 replies, 8 voices, and was last updated 14 years, 11 months ago by Max Drown (Infor).
-
CreatorTopic
-
August 26, 2009 at 6:07 pm #51146Kevin CristParticipant
Our HIS system sends out all caps for name, address and other things. We are integrating now with a system from our facility and they have 2 years worth of data that they have first letter capitalized the lower for the rest. When we send over a transaction with all caps it makes a new patient. has anyone come across this before. Will it take one big tclproc or possible in an xlate? thanks for your thoughts and comments
-
CreatorTopic
-
AuthorReplies
-
-
August 26, 2009 at 6:33 pm #68934Vince AnguloParticipant
If it was just a few fields the following tcl fragment would work in the xlate:
set xlateOutVals [string toupper $xlateInVals]
But, if you’re doing wholesale replacement across entire segments or messages applying the string toupper command would be more efficient in a pre-processing UPoC.
Hope this helps.
-
August 26, 2009 at 6:41 pm #68935Kevin CristParticipant
yeah, its kind of a wholesale thing from what i gather…ie
we are sending DOE^SMITH^Z and need it changed to Doe^Smith^Z.
Address being sent is 210 OAK STREET^CRAZYTOWN^IN and they need 210 Oak Street^Crazytown^IN. Plus insurance names, and any next of kin names.
-
August 26, 2009 at 6:43 pm #68936James CobaneParticipant
Kevin,
Do you need to convert the data to all UPPER or convert it from all UPPER to mixed-case (i.e. Smith vs. SMITH)? If you need to convert to all UPPER then the command Vince shows will do the trick. If you need to convert to mixed case, there is a similar ‘string’ command:
string totitle $LastName
But, you would need to perform this on each name element individually (i.e. First, Last, etc.).
Hope this helps.
Jim Cobane
Henry Ford Health
-
August 26, 2009 at 7:10 pm #68937Kevin CristParticipant
yes i am going from all UPPER to mixed case. In many fields. thanks for the comments
-
August 26, 2009 at 9:53 pm #68938Charlie BursellParticipant
If you use string totitle don’t forget to check names with more than one word.
For example what would you do with a last name like “Van Horn”
It is never easy, that’s why you get the big bucks 😉
-
August 27, 2009 at 1:49 pm #68939Tom RiouxParticipant
Here is one possible solution:
For names:
hcitcl>set name “VAN HORN”
hcitcl>foreach nn [split $name] { lappend newname [string totitle $nn] }
hcitcl>echo $newname
Van Horn
or for addresses:
hcitcl>set address “1234 WHISPERING WIND DRIVE”
hcitcl>foreach addy [split $address] { lappend naddy [string totitle $addy] }
hcitcl>echo $naddy
1234 Whispering Wind Drive
Surely it can’t be that simple. I must be missing something or left out some possibilities.
Tom
-
August 27, 2009 at 2:15 pm #68940Jim KosloskeyParticipant
Hyphenated names, names like McKinley… 🙁
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
August 27, 2009 at 2:18 pm #68941Kevin CristParticipant
Thank you all for your comments. This should be a fun one to do.
-
August 27, 2009 at 2:30 pm #68942Tom RiouxParticipant
I guess here it would be best to go with percentages. There is no way to account for EVERY possibility and you will have to realize that there may be some manual cleanup that has to be done on the back end of this whole process.
The hyphenated can probably easily be accounted for with an extra command or two in the loop. However, the “McKinley” or something like it is a whole different story. There could be many variations like “McKinley” or “MacGyver”. Is there a sure fire way to account for every variation and know which letter needs to be capitalized and which ones doesnt? (Charlie?? 🙂 ) Then again, what if you get someone who spells their name like “e. e. white” who never used capitilization in their name. (Ok, Ok, I’m going a little overboard with that one but you get my point… 😀 )
Guess it is safe to go with what will work for the majority of the names or words and not run the risk of creating further errors. I don’t know about you but I’ve been having fun with this one!!!
Tom
-
August 27, 2009 at 2:58 pm #68943Jim KosloskeyParticipant
This is just me musing out loud but,
Aren’t you at all concerned that the system is using the Patient Name for Identification?
I mean, after all, that field is subject many errors in a normal situation.
Maybe suggest they modify their matching routine to internally change both to the samecase (upper or lower), do the compare and only add a new patient if that mismatches.
Even then, I bet there will be pletny of mis-matches on the same patient because the two systems do not match regardless of case considerations.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
August 27, 2009 at 3:31 pm #68944Kevin CristParticipant
yes. this is an ancillary application that they have been using for a couple of years and they have always handtyped the name in like that, we are now interfacing with them so they dont have to use that , but they do match on name because they have never recieved our medical record number to match on. thats how we found this big mess. We are hoping the vendor can do some type of conversion for us but i am exploring the possibilities just in case, because if they do that i am sure it wont be cheap.
-
August 27, 2009 at 4:01 pm #68945Tom RiouxParticipant
One possible solution to the hyphen. I think this would cover it…correct me if I’m wrong Jim and Charlie. It may not be the most elegant of solutions……
hcitcl>set full “KEITH VAN-HORN”
#Initialize your “newfull” variable
hcitcl>set newfull “”
# Now run the foreach
hcitcl>foreach name [split $full] {
foreach part [split $name -] {
lappend tmp [string totitle $part]
}
set newname [join $tmp -]
lappend newfull $newname
set tmp “”
}
hcitcl>echo $newfull
Keith Van-Horn
-
September 24, 2009 at 3:23 pm #68946Kevin CristParticipant
Finally got some time to work on this. I seem to be getting the totitle to work kinda, it will lowercase everything except first letter of name, but it doesnt capitalize the first letter of the first name. I thought i was on the right track with this but need some more guidance, also am i returning the changed name correctly to the message? Thanks very much for any ideas.
###############################################################################
###############################################################################
###############################################################################
# Name: tpsAlls_Formatting
# Purpose: This tclproc formats the case of the names, addresses, Insurances
# for Allscripts. Example…DOE,JOHN ->Doe,John.
# The patient/relative fields are listed below:
# PID-5: Patient Name
# PID-9: Patient Alias
# NK1-2: Name
# GT1-3: Guarantor Name
# GT1-4: Guarantor Spouse Name
# IN1-16: Name of Insured
#
#
#
#
#
#
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
# Continues the modified messages
# OR
# Continues un-modified message if the segment is missing
#
# Created: Kevin Crist
#
proc FormatAllsName { NameFldList subSep } {
set i 0
foreach Name $NameFldList {
set subfldList [split $Name $subSep]
lset subfldList [string totitle $Name ]
lset NameFldList [join $subfldList $subSep]
incr i
echo Name:$Name
echo subfldList:$subfldList
echo NameFldList:$NameFldList
}
return $NameFldList
}
proc tpsAlls_Formatting { args } {
###############################################################################
###############################################################################
# #
# Get the Connection/Proc Name for the Error/Debug Messages #
###############################################################################
###############################################################################
global HciConnName
set myname “$HciConnName/[lindex [info level 1] 0]”
set nowis [clock format [clock scan now] -format “%D – %T”]
###############################################################################
###############################################################################
# #
# Initialize variables used #
###############################################################################
###############################################################################
set dispList {} ;# Disposition List Returned to Engine
set fldSep “” ;# Field Seperator – get from MSH
set subSep “” ;# SubField Seperator – get from MSH
set repSep “” ;# Repeating Field Seperator – get
;# from the MSH
set segList
- ;# Message Segments in a list
set fldList
- ;# Fields of a segment in list
set repList
- ;# The Repitions of the Field in list
set subfldList
- ;# Sub-Fields of a Field in list
set PIDpos -1 ;# Position of PID segment in msg
set NK1pos -1 ;# Position of NK1 segment in msg
set GT1pos -1 ;# Position of GT1 segment in msg
set IN1pos -1 ;# Position of IN1 segment in msg
set PatName 5 ;# Position of Patient Name
set PatAlias 9 ;# Position of Patinet Alias
set NOKName 2 ;# Position of Next of Kin Name
set GT1Name 3 ;# Guarantor Name
set GT1SpName 4 ;# Guarantor Spouse Name
set IN1Name 16 ;# Name of Insured
set PosList
- ;# List of Position of Segments in msg
###############################################################################
###############################################################################
# #
# Load in the arguments we need that were passed from the caller #
###############################################################################
###############################################################################
keylget args MODE mode ;# The mode the engine was called from
###############################################################################
###############################################################################
# #
# Switch based on what mode the engine was in when it called the procedure #
###############################################################################
###############################################################################
switch -exact — $mode {
start { }
run {
set mh [keylget args MSGID] ;# Get message handle from args
set dispList
-
;# Initialize to good message
set msg [msgget $mh] ;# Get a copy of the message
set fldSep [string index $msg 3] ;# Field Seperator
set subSep [string index $msg 4] ;# Sub-Field Seperator
set repSep [string index $msg 5] ;# Field Seperator
set segList [split $msg r] ;# Split message into segList
###############################################################################
###############################################################################
# #
# Find Position of Segments that contain Name Positions #
###############################################################################
###############################################################################
lappend PosList [lsearch -regexp $segList {^PID}]
lappend PosList [lsearch -regexp $segList {^NK1}]
lappend PosList [lsearch -regexp $segList {^GT1}]
lappend PosList [lsearch -regexp $segList {^IN1}]
###############################################################################
###############################################################################
# #
# Process each segment that might contain a Dr ID Numbers #
###############################################################################
###############################################################################
foreach segPos $PosList {
if { $segPos > 0} {
set fldList [split [lindex $segList $segPos] $fldSep]
###############################################################################
###############################################################################
# #
# For each of the possible Name fields do the same thing #
# 1) Any of the fields can have repetitions #
# Split the field into a list of each repition. #
# 2) Call the subroutine that changes the first letter of each #
# name to a captial and lowercase the rest #
# 3) Rebuild the segList with the newly formatted names #
###############################################################################
###############################################################################
switch -exact [lindex $fldList 0] {
PID {
if { [llength $fldList] >= [expr $PatName + 1] } {
set repList [split [lindex $fldList $PatName] $repSep]
set repList [FormatAllsName $repList $subSep]
}
lset fldList $PatName [join $fldList $fldSep]
}
}
}
}
# 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
}
}
return $dispList
}
- ;# Message Segments in a list
-
September 24, 2009 at 8:00 pm #68947Bob RichardsonParticipant
Greetings,
Not familiar with the ins and outs of the “lset” command but it looks like the lset is only modifying the first element in your names list. Here is an alternate coding strategy to consider: for example:
tcl>set name “BOB^RICHARDSON”
BOB^RICHARDSON
tcl>set names [split $name ^]
BOB RICHARDSON
tcl>foreach name $names {
lappend newnames [string totitle $name]
}
tcl>echo $newnames
Bob Richardson
tcl>
tcl>set newnames [join $newnames ^]
Bob^Richardson
tcl>echo $newnames
Bob^Richardson
Good hunting !
-
September 24, 2009 at 9:26 pm #68948Max Drown (Infor)Keymaster
I would suggest working with the database team of the receiving application to try to do one of two things:
1) Do not match on patient name, but instead match on a unique number such as MRN or a combination of unique numbers such as MRN and DOB or some such. Or at the very least, make the patient name matching case insensitive.
2) Convert all of the names in the database to uppercase. There’s just so many things that go wrong with the camel back case conversion you are attempting.
-- Max Drown (Infor)
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.