Example: Mapping HIPAA X12 to XML
This example illustrates how to map a file which contains an "837-Q2 Health Care Claim: Dental" transaction to an XML target file. It is accompanied by a mapping available at the following path: <Documents>\Altova\MapForce2023\MapForceExamples\HIPAA_837D.mfd.
The mapping can be created as shown in the steps below.
Step 1: Add the source HIPAA X12 file to the mapping
1.On the Insert menu, click EDI.
2.Select the collection "HIPAA.X12", and the message type "837-Q2 Health Care Claim: Dental".
3.When prompted to supply an instance file, open the source file available at the following path: <Documents>\Altova\MapForce2023\MapForceExamples\837-Q2.x12.
4.When prompted, adjust the settings of the newly added HIPAA X12 component if necessary (for more information, see EDI Component Settings).
Step 2: Add the target schema to the mapping
1.On the Insert menu, click the XML Schema/File, and open the 837-Q2.xsd file from the <Documents>\Altova\MapForce2023\MapForceExamples\ directory.
2.When prompted to supply a sample XML file, click Skip and select DentalClaim as the root of the target document.
Step 3: Add a function to format the date and draw the mapping connections
In the source HIPAA file, the DMG segment includes a date, in the format 19490501. To convert this date to a format suitable for the target XML file 1949-05-01, we will add a date conversion function, as follows:
2.On the Insert menu, click Constant, and enter [Y,4-4][M,2-2][D,2-2] as constant value.
3.Draw the following connections:
format input item of the parse-date function
Supplies to the function the format according to which the date should be parsed.
value input item of the parse-date function
Supplies to the function the actual value to be formatted.
result output item of the parse-date function
DateOfBirth input item of the XML target
Supplies the value returned by the function to the DateOfBirth XML node.
4.Draw the remaining mapping connections as shown in the example mapping (these are too many to be listed here; essentially, each connection copies values from the source HIPAA file to the target XML file. For basic information about mapping connections, see Working with Connections.)