› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › FT1 multiple iterations to a flat file
Has anyone done this?
Gina,
If using an Xlate: put a SUPPRESS at the beginning of the Xlate; COPY all of the needed segment fields that are not included in the repetition; then ITERATE over the repetition (I think that is the FT1) and inside of the ITERATE after you have COPY’d or whatever all of the needed re[petition segments and fields, do a CONTINUE.
The SUPPRESS will make sure the Xlate does not produce an extra message, the CONTINUE cause the Xlate to place a message as built to that point on the next step in the engine. Each Iteration of the FT1 will cause a CONTINUE which will ‘cut’ a new message.
The fields that are produced prior to the iteration will be repeated for each message – no need to include jhandling inside the ITERATE for this ‘static’ data.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Whoo Hoo!!!!! Once again, Jim, you are my hero!!!!!
OK, I’m going to take this back to the person who started working on this, and make sure the output is what she’s looking for. I’ve never done a flat file before but she needed a fresh set of eyes.
I’ve at least gotten data into the proper elements of the flat file, which I didn’t have before.
Here is a sample Cloverleaf 5.2 xlate I did that has multiple FT1 segments per message and outputs one flat file charge record for each FT1 and illustrates what Jim Kosloskey (whom is my coworker) spoke about.
It is for our batch_020 integration and called bdm_rxtfc_DFT_P03_to_sms_charge.xlt
You can create a variant with the same name I used (rxtfc_020 DFT_P03) by saving the standard HL7 2.2 as rxtfc_020 DFT_P03 to your development site and copy the standard DFT message to make a DFT_P03.
Another approach would be to change what the xlate referece for the inbound HL7 2.2 variant, good luck.
I did include the FRL layout called global_sms_charge_rec.frl so you will be able to launch the xlate in the IDE and perhaps run a message thru the tester to get you started.
As I glanced over my post I notice some xlt TCL procs that get called so running it as is in the tester will not work without them and I’m not going to resolve all the called TCL procs and post any of them, but should be able to pull up in the IDE to reference visually.
prologue
xlt_infile: hl7 2.2 rxtfc_020 DFT_P03
who: RRoss
date: November 22, 2005 1:28:42 PM CST
xlt_outfile: fr global_sms_charge_rec.frl
type: xlt
version: 5.0
end_prologue
{ { OP COMMENT }
{ COMMENT {
Purpose: Translate HL7 2.2 DFT_P03 message from Pharmacy (BDM) RxTFC
to SMS charge system as an FRL} }
}
{ { OP COMMENT }
{ COMMENT {
Note: This tranlation will handle repeating FT1 segments,
by generating one outbound SMS charge detail record for each FT1 segment
} }
}
{ { OP SUPPRESS } }
{ { OP COMMENT }
{ COMMENT {
——————————
map the outbound fields that do not iterate
——————————
} }
}
{ { OP COMMENT }
{ COMMENT {
— hard coded batch_code to B001 to signify BDM (RxTFC)} }
}
{ { OP COPY }
{ ERR 0 }
{ IN =B001 }
{ OUT batch_code }
}
{ { OP COMMENT }
{ COMMENT {
— Patient ID (Internal ID)} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).PID(0).#3.[0]}} }
{ OUT medical_record_number }
}
{ { OP COMMENT }
{ COMMENT {
— Patient Account (Number)} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).PID(0).#18.[0]}} }
{ OUT case_number }
}
{ { OP COMMENT }
{ COMMENT {
— Patient Name (Last)} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).PID(0).#5.[0]}} }
{ OUT patient_name }
}
{ { OP COMMENT }
{ COMMENT {
— hard code detail_record_type to 9} }
}
{ { OP COPY }
{ ERR 0 }
{ IN =9 }
{ OUT detail_record_type }
}
{ { OP COMMENT }
{ COMMENT {
————————-
map the outbound fields that iterate
————————-
} }
}
{ { OP ITERATE }
{ BASIS 0(0).FT1 }
{ VAR %s1 }
{ TYPE segment }
{ BODY {
{ { OP COMMENT }
{ COMMENT {
— Transaction Posting Date} }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_ccyymmdd_mmddyy
}}
{ IN 0(0).FT1(%s1).#5 }
{ OUT batch_date }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Date} }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_ccyymmdd_mmddyy
}}
{ IN 0(0).FT1(%s1).#4 }
{ OUT date_of_service }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Code} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).FT1(%s1).#7.[0]}} }
{ OUT charge_service_code }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Amount – Unit} }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_remove_all_periods
}}
{ IN 0(0).FT1(%s1).#11 }
{ OUT charge_amount }
}
{ { OP IF }
{ ERR 2 }
{ COND { 0(0).PID.#18.[0] ne @null} }
{ THENBODY {
{ { OP COMMENT }
{ COMMENT {
— The SMS Charge Description for ACUTE charges is 32 characters max and will be a concatenation of the following separated by a space
— FT1-9.2 [all characters] = Net Doses
— FT1-8.1 [first 11 characters] = Generic Name
— FT1-8.2 [all characters] = Dosage Form
— FT1-8.3 [trim trailing zeros then trailing periods] = (Dose or Volume) from Order
— FT1-8.4 [all characters] = (Dose or Volume) Unit Abbreviation} }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Description for ACUTE charges is a text string of descrete fields separated by ^
— FT1-8.1 = Generic Name
— FT1-8.2 = Dosage Form
— FT1-8.3 = (Dose or Volume) from Order
— FT1-8.4 = (Dose or Volume) Unit Abbreviation} }
}
{ { OP COMMENT }
{ COMMENT {———————————————
— Temporary solution to allow testing to proceed
— truncate FT1-8.1 (Generic Name) down to 12 chars} }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_substring
}}
{ IN {=0 =11 =N {0(0).FT1(%s1).#8.[0]}} }
{ OUT @trunc_FT1_8_1 }
}
{ { OP COMMENT }
{ COMMENT {———————————————
— Get rid of insignificat trailing zeros then any insignificant decimal point from
— FT1-8.3 = (Dose or Volume) from Order} }
}
{ { OP COPY }
{ ERR 0 }
{ IN =N }
{ OUT @xlt_trim_chars_debug }
}
{ { OP COPY }
{ ERR 0 }
{ IN =right }
{ OUT @xlt_trim_chars_dir }
}
{ { OP COPY }
{ ERR 0 }
{ IN =0 }
{ OUT @xlt_trim_chars_char }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_trim_chars
}}
{ IN {@xlt_trim_chars_char @xlt_trim_chars_debug @xlt_trim_chars_dir {0(0).FT1(%s1).#8.[2]}} }
{ OUT @trim_FT1_8_3_pass_1 }
}
{ { OP COPY }
{ ERR 0 }
{ IN =. }
{ OUT @xlt_trim_chars_char }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_trim_chars
}}
{ IN {@xlt_trim_chars_char @xlt_trim_chars_debug @xlt_trim_chars_dir @trim_FT1_8_3_pass_1} }
{ OUT @trim_FT1_8_3_pass_2 }
}
{ { OP COMMENT }
{ COMMENT {———————————————
— Squeeze the following text strings into the SMS charge description field
— FT1-9.1 FT1-8.1 FT1-8.2 FT1-8.3 FT1-8.4} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).FT1(%s1).#9.[1]} {= } @trunc_FT1_8_1 {= } {0(0).FT1(%s1).#8.[1]} {= } @trim_FT1_8_3_pass_2 {= } {0(0).FT1(%s1).#8.[3]}} }
{ OUT charge_description }
{ COPYSEP {} }
}
}}
{ ELSEBODY {
{ { OP COMMENT }
{ COMMENT {
— The SMS Charge Description for AMBULATORY charges is 32 characters max and will be a concatenation of the following separated by a space
— FT1-10.1 = Tansaction Net Quantity
— FT1-9.1 = Rx Number
— FT1-8.1 = Item Description from the order} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).FT1(%s1).#10.[0]} {= } {0(0).FT1(%s1).#9.[0]} {= } {0(0).FT1(%s1).#8.[0]}} }
{ OUT charge_description }
{ COPYSEP {} }
}
}}
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Description – ALT is a text string of descrete fields separated by ^
— FT1-9.1 = Order Number
— FT1-9.2 = Net Doses
— FT1-9.3 = NDC #
— FT1-9.4 = Generic Indicator
— FT1-9.5 = Unit Multiplier from Order} }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).FT1(%s1).#9 }
{ OUT order_number }
}
{ { OP COMMENT }
{ COMMENT {
— Set over_ride_indictor to * if charge_amount is not NULL} }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
xlt_cp_f1_if_f2_ne_f3
}}
{ IN {=* ~charge_amount @null} }
{ OUT over_ride_indicator }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Type} }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).FT1(%s1).#6 }
{ OUT record_type }
}
{ { OP COMMENT }
{ COMMENT {
— Transaction Quantity} }
Here is the outbound FRL called global_sms_charge_rec.frl:
# Record Layout: global_sms_charge_rec.frl
#
prologue
who: RRoss
date: November 28, 2005 5:00:52 PM CST
type: frl
version: 3.0
end_prologue
#
# Include Files
#
#
# Mask declarations
#
#
# Group declarations
#
#
# Field declarations
#
{NAME batch_code} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 4 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 4 }
}}
{NAME batch_date} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 6 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 6 }
}}
{NAME date_of_service} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 6 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 6 }
}}
{NAME medical_record_number} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 6 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 6 }
}}
{NAME filler_1} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 2 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 2 }
}}
{NAME charge_service_code} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 7 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 7 }
}}
{NAME charge_amount} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 9 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 9 }
}}
{NAME continuation_code} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 1 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 1 }
}}
{NAME charge_description} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 32 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 32 }
}}
{NAME filler_2} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 1 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 1 }
}}
{NAME case_number} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 11 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 11 }
}}
{NAME patient_name} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 16 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 16 }
}}
{NAME order_number} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 10 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 10 }
}}
{NAME over_ride_indicator} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 1 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 1 }
}}
{NAME record_type} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 2 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 2 }
}}
{NAME charge_quantity} {TYPE fmt} { FMT {
{ FILL 0 }
{ JUST r }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL 0 }
{ IN_VERIFY 0 }
{ JUST r }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 5 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 5 }
}}
{NAME CPT_code} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 5 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 5 }
}}
{NAME detail_record_type} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 1 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 1 }
}}
{NAME procedure_code_modifier_1} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 2 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 2 }
}}
{NAME procedure_code_modifier_2} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 2 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 2 }
}}
{NAME procedure_code_modifier_3} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 2 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 2 }
}}
{NAME filler_3} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 30 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 30 }
}}
{NAME diagnosis_code} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 7 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 7 }
}}
{NAME filler_4} {TYPE fmt} { FMT {
{ FILL {x20} }
{ JUST l }
{ OFFSET {} }
{ SFDATA {
{
{ DATATYPE ch }
{ FILL {x20} }
{ IN_VERIFY 0 }
{ JUST l }
{ OUT_VERIFY 0 }
{ PREFIX {} }
{ WIDTH 7 }
}
} }
{ WHEN_VERIFY f }
{ WIDTH 7 }
}}
Russ Ross
RussRoss318@gmail.com
Gena – one word of caution when creating multiple messages through an Xlate iterate as has been suggested. It’s been several years since I worked on such a thing, so my memory may be a bit fuzzy, but here’s what I recall:
Within the iterate, you should ‘initialize’ all the FT1 fields that you will be copying in your iteration. Reason being, if a particular field is valued on one iteration, but not on the next, I believe that the first iteration’s data will carry over. (I believe that on a subsequent iteration, an empty field will not overwrite a value on the outbound field buffer).
Something to be mindful of.
Mike:
What you said about a null inbound field not getting copied was something I wasn’t aware of which would potentially be a big deal for randomly valued fields in repeating segments.
It just so happens I’m working on a project right now in our Cloverleaf 5.6 environment that uses my posted xlate.
I decided to test the problem you described by creating 2 FT1 segments and getting rid of the charge_service_code in the second FT1 segment in field FT1-7 and the xlate did correctly overwrite the outbound charge_service_code with a NULL as desired on the second occurance.
I don’t know if this is true for older versions of cloverleaf.
I might also note that my copies are done field by field which could also be causing my test to be giving me the desired outcome when compared to what you remember.
Russ Ross
RussRoss318@gmail.com
Russ – I don’t recall the specifics of the issue, but it could well have been on old 3.7 or 3.8 versions. I did a quick test as well, and the field by field copying that you use does look like it handles things properly; however, with PATHCOPY, I see the carry-over (so initialization would be advised). I’m pretty sure what I remember was with field by field and before PATHCOPY existed, so if I do recall correctly, I’d say that has been resolved in newer Cloverleaf versions.
So, I guess my caution may only be relevant any more if using PATHCOPY.
Bumping an old thread because I’m encountering something strange with iterating into a flat file.
I am splitting a message with repeating FT1 groups into individual messages. Within the iterate on the FT1 basis, I have an iterate on a FT1.19. FT1.19 is empty, most of the time. However, once it is populated, every subsequent message that is split off becomes populated with the values from the FT1 instance that was valued.
For example, here is one message generated from the xlate:
[code]
Hi John,
Yes, this is something to be aware of when using Suppress/Continue in an Xlate. After each Continue, the outbound fields will retain the value that they have at that moment. So when you start gathering information for the next message, the previous message is what you start out with. If the previous message has fields filled that are not ‘touched’ on the next iteration, then they will remain that way and will be send out at every next message.
So before you iterate on FT1.19, you should do an initialization of these fields:
COPY @null -> hospitalist_diag_0
COPY @null -> hospitalist_diag_1
COPY @null -> hospitalist_diag_2
COPY @null -> hospitalist_diag_3
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands