Homepage › Clovertech Forums › Cloverleaf › OBX From Data Extract
- This topic has 17 replies, 5 voices, and was last updated 2 years, 11 months ago by
Jonathan Souders.
-
CreatorTopic
-
September 4, 2019 at 12:32 pm #112110
Jonathan Souders
ParticipantThis may be a repeat of old information, but I can’t quite find what I need in searching the forums.
I have a file extract from a database which has data elements belonging in the OBX segments for vitals, progress notes, etc. Many of these elements are coming out as multiple lines which I need to combine into a single HL7 message. What is the best way to accomplish this? The data is currently mapped from the file via VRL through a translation to the HL7 which is fine, but I’ve toyed with an iteration in a translation and a little bit of Tcl, but I’m sort of stuck and hoping someone here can help me on the direction I need to take to get the multiple OBX segments in the message that I need – seems like I have the right pieces but can’t seem to fit them together appropriately.
-
CreatorTopic
-
AuthorReplies
-
-
September 4, 2019 at 1:26 pm #112112
Matthew Brophy
Participantdo you have an example of what your source file looks like?
If the issue is just creating a single HL7 message with multiple OBX segments populated with the values of your source file, wouldn’t you just iterate through OBX segment with a MATH (add +1) at the beginning of the loop so everytime it has a variable to populate, it populates the OBX 1 field in sequence and fills OBX5 with that variable?
**disregard the attachment : I incorrectly read your post initially **
-
This reply was modified 5 years ago by
Matthew Brophy.
Attachments:
You must be logged in to view attached files.-
September 4, 2019 at 1:44 pm #112117
Jonathan Souders
ParticipantYes. Attached a sample.
Attachments:
You must be logged in to view attached files.
-
This reply was modified 5 years ago by
-
September 4, 2019 at 1:43 pm #112116
Dustin Sayes
Participantis your source file per message -one message per file? if so, is your thread set to read to the end of file? if this is the scenario, then concat the multiple fields, in the xlate, and copy to the obx segment.
-
September 4, 2019 at 1:46 pm #112119
Jonathan Souders
ParticipantIt is a single file with multiple lines of data from a SQL extract (can be multiple lines for one patient as well) which I need to convert to HL7.
-
-
September 4, 2019 at 1:50 pm #112120
Dustin Sayes
ParticipantI see your sample file. should each line be a new message, or should this entire file create a single HL7 message? Its hard to tell from the example b/c mrn and acct numbers are the same for each line. However, your original post states that multiple lines may be required to create a single message. Can you clarify that? will the multiple lines also contain the same values in filler orderID and procedure ID? if not, you’ll need to create repeating obr,obx groups to keep the procedure data together.
-
This reply was modified 5 years ago by
Dustin Sayes.
-
September 4, 2019 at 1:56 pm #112121
Jonathan Souders
ParticipantEach line is initially a separate message, but several (not all) will need to combine the observation result items toward the end of the file into single messages – I don’t know if this is even realistic, given the data extracted in the format I have.
To clarify: say I have message 1 from line 1 – line 2 is a result for the same patient which I need to put into OBX for message one instead of creating it’s own message.
-
September 4, 2019 at 2:06 pm #112124
Dustin Sayes
Participantso sometimes each line will be a new message and sometimes not? that is going to tricky. And i dont think you can reliable do that in an xlate. you’d wanted to be very clear on what is the trigger for creating a new message or appending the next line to the same message. it could be best to first re-create the source file, so that it contains all the data you need for a single outbound hl7 message.
-
This reply was modified 5 years ago by
Dustin Sayes.
-
This reply was modified 5 years ago by
-
September 4, 2019 at 2:08 pm #112125
Jonathan Souders
ParticipantFair point – appreciate your input!
-
This reply was modified 5 years ago by
-
September 4, 2019 at 3:25 pm #112129
Jim Kosloskey
ParticipantDo you have the ability to control the structure of the IB file?
The file needs more architecture to it.
The first issue is the VRL definition does not have any repetition capability so having multiple ‘OBX’ sets of data in the same line will not necessarily improve your lot.
However, if the file had an architecture to it such that there are multiple lines per record where the first field is a type field then an HRL could be used.
So for example, the main line had the value ‘pat’ and each ‘OBX’ set of data were on its own line with a type of ‘obx’.
I would get rid of the Header line unless you have some other need for it.
pat|H000000|…<cr>
obx|<obx type data fields for above pat first rep> <cr>
obx|<obx type data fields for above pat second rep><cr>
etc. until next ‘pat’. – last obx line terminating with <crnl>
Each record set should then be terminated with something definable in the Fileset protocol style (like nl) – each line could have something like cr.
You would define 3 VRLs – one for ‘hdr’, one for ‘pat’, and one for ‘obx’.
In the HRL you would include all three VRLs in order with the OBX VRL having a repetition as long as the ‘type’ field has the value ‘obx’.
You then could ITERATE over the obx types in the Xlate.
With the style set properly you would Get each pat with all of its obx type lines in one ‘message’ (from the Fileset Protocol, and the Xlate would work the fields including the repetitions (each obx type line).
If you would like to discuss in more detail, email me.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
September 5, 2019 at 9:43 am #112153
Jonathan Souders
ParticipantI think I get what you are saying here – someone else is writing the SQL extracts, but I have the query to execute at my discretion. Perhaps once the query is completed I could work some magic to reformat based on the account number – moving the OBX bits to their own separate lines and condensing the duplicate patient info to a single line above all of the stripped out OBX data. Great – this gives me some ideas to play with.
Thanks for your input!
-
-
September 4, 2019 at 6:41 pm #112147
Jim Kosloskey
ParticipantSorry original reply had:
You would define 3 VRLs – one for ‘hdr’, one for ‘pat’, and one for ‘obx’.
In the HRL you would include all three VRLs in order with the OBX VRL having a repetition as long as the ‘type’ field has the value ‘obx’.
Should read:
You would define 2 VRLs – one for ‘pat’, and one for ‘obx’.
In the HRL you would include both VRLs in order with the OBX VRL having a repetition as long as the ‘type’ field has the value ‘obx’.
Sorry for any confusion.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-
September 4, 2019 at 11:57 pm #112148
Charlie Bursell
ParticipantTricky
The first thing I would do is use an lassign command rather than a bunch of lindex commands. This is easily done since you have a fixed number of fields.
I would then step through the file and create an array of lists with the MRN as the array index. Store each record for the same patient to the array as a list.
Once the array is finished it should be a simple mater to step through each element and build a proper HL7 message.
This is from a very high level but the nuts and bolts are not that difficult
-
September 5, 2019 at 9:40 am #112152
Jonathan Souders
ParticipantThis all makes a lot of sense – I’ll give it a shot and see what I can manages. Thanks for the ideas!
-
-
September 4, 2019 at 11:59 pm #112149
Charlie Bursell
ParticipantI should have stated that my response assumes you read the entire file in and then step through each record one at a time to build the array.
-
September 12, 2019 at 11:02 am #112379
Jonathan Souders
ParticipantI did end up coming to a solution on this – I will post once I format it a little better.
Thanks to everyone that replied for their help.
-
September 16, 2021 at 11:47 am #119177
Matthew Brophy
Participantjonathan – what did you come up with on this multiple lines/single message solution?
I assume this was for a Cerner export, correct?
-
September 16, 2021 at 1:05 pm #119178
Jonathan Souders
ParticipantIt 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 $fileIDif {$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>
-
This reply was modified 2 years, 11 months ago by
Jonathan Souders.
-
This reply was modified 2 years, 11 months ago by
Jonathan Souders.
-
This reply was modified 2 years, 11 months ago by
Jonathan Souders.
-
This reply was modified 2 years, 11 months ago by
-
-
-
AuthorReplies
- You must be logged in to reply to this topic.