Converting DFT^P03 HL7 to flat file

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Converting DFT^P03 HL7 to flat file

  • Creator
    Topic
  • #52019
    George Kulz
    Participant

    Hi all

    I’ve seen lots of talk about converting DFT^P03 HL7 types to flat files, but I’m still incredibly confused, and none of them seem to be exactly what I want anyway, even if I did understand what everyone is talking about.

    What I have is a batch file with a bunch of DFT^P03 type records in it. So it looks like this:

    FHS

    BHS

    MSH

    PID (1)

    FT1 (1)

    PID (2)

    FTI (2)

    .

    .

    .

    PID (n)

    FT1 (n)

    BTS

    FTS

    I want to flatten this into a file that contains one header line, which contains the info from the FHS or BHS segments, then one line for each PID/FT1 pair, then a trailer that contains info from the BTS/FTS segments.

    I’m still very new to all of this, so I don’t understand how to use any of the other formats other than HL7, and the examples I’ve seen are confusing when talking about CONTINUEs and SUPPRESSs in the middle of the xlates. I can’t follow what’s going on. Also, none of the examples ever addresses the header and trailer info that I need. Can someone please explain this so that I can understand this? Thanks.

Viewing 6 reply threads
  • Author
    Replies
    • #72736
      Tim Jipson
      Participant

      I had to do this same thing(or at least something similar) a while back and the only way I found to create a batch file was to do it outside of cloverleaf.

      First, I’ve got a thread that saves one message per file then I use crontab to kick off the script below once an hour


      #!/bin/bash
      #
      # Written by: Tim Jipson – Systems Integration Developer – NorDx Labs
      # Purpose: Cloverleaf outputs one hl7 record per .dat file. This script merges
      #
      [code]
      #!/bin/bash
      #
      # Written by: Tim Jipson – Systems Integration Developer – NorDx Labs
      # Purpose: Cloverleaf outputs one hl7 record per .dat file. This script merges
      #

    • #72737
      Robert Kersemakers
      Participant

      Hi George,

      You should be able to do this with an xlate, but you will need to build an HRL which consists of several FRLs/VRLs (depending on what you want).

      Steps to be taken:

      * define one FRL/VRL for the header line, one for the detail line and one for the trailer line

      * define the HRL, using the above FRLs/VRLs.

      * make an xlate from HL7 to HRL.

      This sounds pretty straightforward, but you will probably need to search the forum on building the HRL and using it in an xlate.

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #72738
      George Kulz
      Participant

      Hi all

      I did manage to get this accomplished with lots of help from Jim Kosloskey (thanks Jim!). I took the same approach as you recommended Robert. Tim, thanks for your  input as well, but I decided not to go that route, prefering to try keeping this within the engine as much as possible. I managed to do the entire translation using mostly Xlate functions, with one place where I had to use a proc (which I’m having trouble with at the moment, but I’ll post elsewhere if I can’t figure it out).

      Thanks again to all who offered to help.

      George Kulz

      Senior Java Programmer

      Memorial Hospital of Rhode Island

    • #72739
      James Cobane
      Participant

      All,

      I am in the process of configuring something very similar.

    • #72740
      Robert Kersemakers
      Participant

      Hi James,

      It looks like the definition of the HRL is not correct. Can you give more information on how you defined it?

      Your HRL should look something like this:

      * Header

      Name: Header

      File Name: header_record.frl

      No Repeat

      * Encounter

      Name: Encounter

      File Name: encounter_record.frl

      Repeat While Field: Encounter.

                         Value:

      * Trailer

      Name: Tralier

      File Name: Trailer

      No Repeat

      I have only used the ‘Repeat While’ option with HRL’s, so I’m not sure if you can use another repeat. There should be some kind of field/character that indicates what kind of record the current line is, so you should be able to use that.

      The Trailer is optional too. Not sure how to do that; make it repeat as well and the only fill it as required?

      Not a lot of information/examples on these HRL’s, so you will need to just try a lot. Hope this helps a bit.

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #72741
      George Kulz
      Participant

      James,

      It looks like what might be happening is that at the end of every FRL is a line feed but no carriage return. You might want to insert one at the end of every FRL in order to fix this. I recently posted a question regarding how to insert CR/LF characters at the end of every line in the flat file. Basically, the answer that I received involved creating placeholders for both the CR and the LF characters in each FRL, and then in the Xlate copying the CR character into the corresponding placeholder and coping the LF into the corresponding placeholder.

      There was also another solution offered to my question, and you might want to look at that answer as well. I’ll hunt down the question I wrote and post where you can find it here.

    • #72742
      George Kulz
      Participant

      James

      Sorry, I don’t know how to reference other messages within this one except by topic. The topic I posted under was this:

      CR/LF in FRL

      Let me know if you can’t find it and I’ll try to copy the text of the messages to this topic.

Viewing 6 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,105
Forums
28
Topics
9,278
Replies
34,382
Topic Tags
281