OBX From Data Extract

Homepage Clovertech Forums Cloverleaf OBX From Data Extract

Tagged: , , ,

  • Creator
    Topic
  • #112110
    Jonathan Souders
    Participant

    This 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.

Viewing 8 reply threads
  • Author
    Replies
    • #112112
      Matthew Brophy
      Participant

      do 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 **

      Attachments:
      You must be logged in to view attached files.
    • #112116
      Dustin Sayes
      Participant

      is 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.

      • #112119
        Jonathan Souders
        Participant

        It 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.

    • #112120
      Dustin Sayes
      Participant

      I 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 4 years, 3 months ago by Dustin Sayes.
      • #112121
        Jonathan Souders
        Participant

        Each 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.

      • #112124
        Dustin Sayes
        Participant

        so 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 4 years, 3 months ago by Dustin Sayes.
      • #112125
        Jonathan Souders
        Participant

        Fair point – appreciate your input!

    • #112129
      Jim Kosloskey
      Participant

      Do 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

      • #112153
        Jonathan Souders
        Participant

        I 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!

    • #112147
      Jim Kosloskey
      Participant

      Sorry 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

    • #112148
      Charlie Bursell
      Participant

      Tricky

      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

      • #112152
        Jonathan Souders
        Participant

        This all makes a lot of sense – I’ll give it a shot and see what I can manages. Thanks for the ideas!

    • #112149
      Charlie Bursell
      Participant

      I 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.

    • #112379
      Jonathan Souders
      Participant

      I 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.

    • #119177
      Matthew Brophy
      Participant

      jonathan – what did you come up with on this multiple lines/single message solution?

      I assume this was for a Cerner export, correct?

      • #119178
        Jonathan Souders
        Participant

        It 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 $fileID

         

        if {$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>

         

Viewing 8 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,044
Forums
28
Topics
9,200
Replies
34,021
Topic Tags
267