infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
General
HL7 Data Analysis Utility
System
Originally posted by Jay Yeiser
I need a breakdown for ADT messages of patient types by message type in a data file. For example, I want to know how any A03 messages were of patient type
Find more posts tagged with
Clovertech
Comments
Mike Grieger
You could just use the SMAT tool to achieve this. Load the file, then Add to View messages that include ADT^A03, and of these, remove from view all messages that do not include |OPM| (or, instead of the two steps, just Add to View messages that include ADT^A03.*|OPM|
System
Originally posted by Ryan Spires
Usage...
saved it as countMsgPatType.tcl (binary) in /home/hci
takes the filename as a parameter.
Quick and dirty... may be a better way to do it... but here it is.
#!/qdx/qdx5.3/integrator/bin/hcitcl
#
set fileName [lindex $argv 0]
# open file specified
if [catch { open $fileName r} inFile] {
puts stderr "Cannot open $fileName: $inFile"
} else {
# grab contents of file
set contents [split [read $inFile] n]
close $inFile
}
lappend reportData {"msgType" "count"}
#loop through the contents for each message.
foreach message $contents {
#initialize for each message
set evn_1 ""
set pv1_18 ""
set segments [split $message r]
foreach seg $segments {
set segId [string range $seg 0 2]
switch -exact -- $segId {
MSH {
set fieldDelim [string range $seg 3 3]
set compDelim [string range $seg 4 4]
}
EVN {
set evn_1 [lindex [split $seg $fieldDelim] 1]
}
PV1 {
set pv1_18 [lindex [split $seg $fieldDelim] 18]
}
default {}
}
}
set msgTypePatType "$evn_1_$pv1_18"
if {[lsearch [keylkeys reportData] $msgTypePatType] > 0} {
set counts [keylget reportData $msgTypePatType]
incr counts
keylset reportData $msgTypePatType $counts
} else {
if { $msgTypePatType != "_" } {
keylset reportData $msgTypePatType 1
}
}
}
set keyList [keylkeys reportData]
foreach key $keyList {
echo "$key: [keylget reportData $key]"
}
Russ Ross
For the AIX user, understanding how to use these commands
grep
perl
cut
wc
sort & sort -u
can be very useful for this sort of thing without having to resort to writing a program.
The "cut" command is especially useful since it can parse out a single field easily.
Here are the simple AIX commands to do what you want.
grep '|ADT^A03|' newline_file | perl -pi -e 's/r/rn/g' >f1
grep "^PV1" f1 | cut -d"|" -f 19 | grep OPM | wc -l
There are other ways to do the same thing but I wanted to illustrate using the cut command to parse out the contents of an individual field.