Transform XML element with a delimiter in to multiple HL7 Segments
Hi all! 2nd time poster and still kind of a newbie. I Googled and searched the posts but did not find anything quite like my question. I have an XML to HL7 2.6 MFN_M16 translation. I created an XML schema and I am using it inside a DTL to translate data to HL7. The XML is rather simple EXCEPT one element as data separated by pipes. This only happens when one item has multiple PAR Locations. To make a valid HL7 message these multiple PAR Locations each need their own IVT segment.
XML Par Location is equal to HL7 IVT:InventoryLocationIdentifier OR (IVT-2)
The Business process is of class: EnsLib.MsgRouter.RoutingEngine
Thus the source looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<wd:Report_Data xmlns:wd="urn:com.workday.report/CR_INT084_Epic_Item_Master_Outbound">
<wd:Report_Entry>
<wd:Item_Name>PLATE 5.4MM LWR 814100003</wd:Item_Name>
<wd:Active>Y</wd:Active>
<wd:Item_numbers>10190</wd:Item_numbers>
<wd:Description>PLATE 5.4MM LWR 814100003</wd:Description>
<wd:Type_of_item>42321505</wd:Type_of_item>
<wd:Implant_type>42321505</wd:Implant_type>
<wd:GTIN>00085412071060</wd:GTIN>
<wd:Latex_product>Yes</wd:Latex_product>
<wd:Chargeable>N</wd:Chargeable>
<wd:Charge_code>IM010190</wd:Charge_code>
<wd:Cost_per_unit>88.2</wd:Cost_per_unit>
<wd:HCPCS_code>C1713</wd:HCPCS_code>
<wd:Supplier_id>S-00000139</wd:Supplier_id>
<wd:Supplier>BIOMET INC</wd:Supplier>
<wd:Catalog_Number>814100003</wd:Catalog_Number>
<wd:Package_Type>Each</wd:Package_Type>
<wd:Ratio>1</wd:Ratio>
<wd:Manufacturer>DEPUY ORTHOPAEDICS INC</wd:Manufacturer>
<wd:Manufacturer_Catalog_Number>814100003</wd:Manufacturer_Catalog_Number>
<wd:Location>MCVH CCH Operating Room Inventory</wd:Location>
<wd:Par_Location>M071|M074|</wd:Par_Location>
<wd:ID>10190</wd:ID>
<wd:Shelf_Code>01A02B</wd:Shelf_Code>
</wd:Report_Entry>
</wd:Report_Data>
The output should look like this output below (I manually added the second IVT segment)
I understand how to use piece and count occurrence etc... but I can not figure out how to create 1 IVT segment for each value in Par Location.
I hope I have included enough information in the post- I know that can be the frustrating part of being in a forum and helping to answer questions.
Thank you for your assistance in pointing me to a solution!!!!
|
Hi Blakely,
I assume you already have code that goes over your XML and extracts data into the HL7 fields.
So then you get to the Par_Location element, do something like this:
Set tPar_Location_Text = M071|M074|...
For i=1:1:$LENGTH(tPar_Location_Text) {
Set word = $PIECE(tPar_Location_Text, "|", i)
Do createSegment("IVT", i, word, field3, ...)
}
Note I assume you have a routine that creates the segments...
I hope this helps
Vitaly
Thank you for your answer. We are using a class for the xml and a schema to do the mapping. Your code is logical and looks quite correct to me. I will find where this processing is occurring and modify. I will mark Correct when it gets there. Thank you again
You could use Piece to separate the values in Par_Locations.
Perfect thank you