When doing complex maps that can’t be resolved using the map designer and you need to do a custom map with xsl, sometimes you may have to store and update variable values. This is not possible using only xslt notation, but can be achieved using C# scripting in the xsl file and static variables and methods.
I.E. you need to generate a flat file from an HL7 file. On each flat file row you have to put info for the PID, OBR, OBX and OCR segments.
Your HL7 file will have a structure similar to this:
MSH|….
PID|…….
PV1|……..
ORC|……..
OBR|……..
OBX|……….
OBX|……….
OBX|………
OBX|……….
OBX|……….
OBX|……….
ORC|……..
OBR|……..
OBX|………
OBX|……….
OBX|……….
OBX|……….
File Segments and C# methods
The segments in an HL7 file don’t have any relational field. They are related based on the position of the row, so when you apply a map to transform the HL7 file to a flat file format, you will lose the relationships and your flat file will be incorrect.
The solution in this case, is to load the information about how many children has each segment (how many OBX are on each OBR, etc…)
To do this, you must construct a C# method that will iterate the nodes and store this information in a static structure. And then you will be able to get the values based on this.
This file contains the structure and methods to iterate on an HL7 file:
HL7NodeStructure.cs
The xsl file should start iterating the segments in a bottom-up approach. That means that you will iterate on the deepest segment you want to map, in this case the OBX segment. For each OBX you are mapping you can get the corresponding OBR based on the static structure.
What our Clients have to say about Art2link
“Art2link was always there to answer questions and provide excellent service. I’m sure we wouldn’t have finished this project without their expertise. We had a great experience and can’t wait to work with them again” Management – IT – Practice Velocity.