Exercise 7.1 – Mapping From EDI
Purpose:
To practice transforming EDI X12 files to an XML Format.
Create a Route
- From the eiConsole File Management screen, select the Add Route button.
- In the dialog that appears, enter the name EDI to People XML and select OK.
- The Route should now appear in the table on the screen. Double-click it to open it.
Document Source System
- Select the Source System stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Change the System Name to EDI File.
- Select the Choose Source Icon button, and scroll down to select one of the EDI icons.
Configure the Listener
- Select the Listener stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Select Directory/File from the Listener Type selection box. Optionally, click the … button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
- Assign a polling directory, using the … button to open the file selector. The polling directory should NOT be the directory with all the sample files, since files will be moved/deleted by the Listening process.
Add Source Format for EDI Transformation
- Select the Source Transform stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Click the Add Format button. In the dialog that appears, name the format EDI to People, and click OK. The transformation configuration panel will appear below.
- On the left-hand side, in the Transformation Module Configuration panel, select the EDI transformer. Its configuration panel will appear below.
- Check the box, Use X12 Table Data for Enhanced Functionally.
- Add the 837-Q1 directory.
- Set the Version to 5010.On the Enhancements tab, under Friendly Naming, select Add to element name from the drop-down.
- On the right-hand side, in the XSLT To XML configuration panel, uncheck the Use Direct Relay button. The options in that panel will now be enabled.
- Click the New button beneath the checkbox to open the Data Mapper.
Load Source and Target Formats
- Use the Open Source Format button above the Source Format panel to open the Select Format dialog. Choose XML from the Format Reader selection box.
- In the select format dialog, browse and select 837_5010.xml, then click Read Format.
- Click on the icon to expand it so you can see the sub-elements.
- Use the Open Target Format button above the Target Format panel to open the Select Format dialog. Choose XML from the Format Reader selection box again.
- Remove the existing sample file and add People.xml, then click Read Format.
- Check the box Show Friendly Names in all Mapper Trees Where Available.
- The Source and Target format panels should now be populated.
Map the Root Nodes and Add Iteration
- Select the XCSData Node that is the root of the tree in the Source panel to the left. Drag it onto the center panel and drop it on the stylesheet node that’s already there.
- Select the People node that is the root of the tree in the Target panel to the right. Drag it onto the center panel and drop it on the XCSData node that was just dropped there.
- Above the center mapping panel is the Extensions panel. The currently displayed tab, Filter by Pattern, has a text field called Pattern. Type for-each into that field.
- A single item should be present in the panel. This item should also be called for-each. Select and drag it onto the People node in the center mapping panel.
- In the Source tree, expand the node called Interchange/Group/Transaction/Loop_2000B_SubscriberHierarchicalLevel/Loop_2010BA_SubscriberName. This element represents a loop with a named entity, which can be used to identify a subscriber(patient) according to the NM1_SubscriberName field.
- Drag the found Interchange/Group/Transaction/Loop_2000B_SubscriberHierarchicalLevel/Loop_2010BA_SubscriberName element onto the @select node beneath the for-each node in the center mapping panel.
- Next, we’ll need to modify this mapping to conditionally select Interchange/Group/Transaction/Loop_2000B_SubscriberHierarchicalLevel/Loop_2010BA_SubscriberName elements with a child NM1_SubscriberName/NM101_EntityIdentifierCode having a value of IL subscriber (patient).
- Double-click on the @select element you mapped the for each onto; this will enable you to edit the XPath expression.
- You should have: Interchange/Group/Transaction/Loop_2000B_SubscriberHierarchicalLevel/Loop_2010BA_SubscriberName.
- We’ll modify this by adding this to the end of the expression: [NM1_SubscriberName/NM101_EntityIdentifierCode = ‘IL’] the line should look like this Interchange/Group/Transaction/Loop_2000B/Loop_2010BA [NM1_SubscriberName/NM101_EntityIdentifierCode = ‘IL’] when completed.
- This is a predicate; it’s effectively saying, “find the Interchange/Group/Transaction/Loop_2000B/Loop_2010BA with a child element, NM1_SubscriberName/NM101_EntityIdentifierCode, with a value of ′IL′ “.
- In the Target tree, select the Person node that is a child of the People node and drag it onto the for-each node in the center mapping panel.
Finish the Mapping
- Select all of the nodes that are children of the Person node in the Target format panel and drag them onto the center panel dropping them onto the Person node.
- Click the + button next to the Name and Address Nodes in the Target format panel to expand them to show their child nodes and drag them onto the center mapping panel as well.
- Now that the whole Target format has been configured in the center panel, it’s time to map the Source format to it. Map the nodes in the following way (all source nodes are children of the Interchange/Group/Transaction/Loop_2000B_SubscriberHierarchicalLevel/Loop_2010BA_SubscriberName Source node):
- Source: NM1_SubscriberName/NM104_SubscriberFirstName -> Target: Name/First
- Source: NM1_SubscriberName/NM103_SubscriberLastName -> Target: Name/Last
- Source: NM1_SubscriberName/NM109_SubscriberPrimaryIdentifier -> Target: SSN
- Source: DMG_SubscriberDemographicInformation/DMG03_SubscriberGenderCode -> Target: Gender
- Source: DMG_SubscriberDemographicInformation/DMG02_SubscriberBirthDate -> Target: BirthDate
- Source: N3_SubscriberAddress/N301_SubscriberAddressLine -> Target: Address/Line1
- Source: N3_SubscriberAddress/N302_SubscriberAddressLine -> Target: Address/Line2
- Source: N4_SubscriberCityStateZIPCode/N401_SubscriberCityName -> Target: City
- Source: N4_SubscriberCityStateZIPCode/N402_SubscriberStateCode -> Target: Address/State
- Source: N4_SubscriberCityStateZIPCode/N403_SubscriberPostalZoneOrZIPCode -> Target: Address/Zip
- Now that the mapping is complete click the Save icon in the toolbar above the tree. When prompted for a name, use the default, transform.
- Click the X button in the top right corner to close the Data Mapper and return to the Route Editing Grid.
Configure the Transport
- Select the Transport stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Select Directory/File from the Transport Type selection box. Optionally, click the … button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
- Select the Target Directory, using the … button to open the file selector.
- Set edi-people-output as the Target File Name.
- Set xml as the Target File Extension.
Document the Target System
- Select the Target System stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Change the System Name to People XML File.
- Select the Choose Target Icon button and scroll down to select one of the XML icons.
Prepare to Test
- In the menu bar at the top, select Mode -> Testing Mode. Make sure the changes to the Route are saved.
- Copy the file named 837_5010.edi from the Samples directory provided into the directory chosen as the polling directory.
Perform the Test
- At the top of the Testing Mode screen, select the Execute Test button.
- If the Route was configured successfully, all the Stages should light up with green checkmarks.
- In the OS File Explorer, open the directory selected as the Target Directory. The file edi-people-output.xml should be there, with the transformed contents produced by the XSLT.
Output Files
- Compare the results from the exercise with the following example output files to see if they are correct.