Create Repeating Group statements to process the details for patients that each doctor submits claims for. Create a Group statement to process a single set of patient details for a specific patient.
In the
XMap
view, add a Repeating Group statement to the
Patient_Claim
XMap. To add a Repeating Group statement, in the XMap editor grid, right-click and select
New
Repeating Group
.
To define the Repeating Group, perform the following steps:
To name the statement, double-click the
Name
field and type the name
PatientDetails
.
Drag the input schema node
Patient
into the Input field of the
PatientDetails
statement.
Each time the transformation iterates a Repeating Group statement, the transformation processes a set of patient details.
The following image shows the final
PatientDetails
Repeating Group:
To create a claim for each appointment, compare the appointment details to the doctor specialization. Drag the
Patient
input schema node to the
Claims
output schema node.
The editor creates a Repeating Group that provides the context for the patient data. We want to change the Repeating Group to a Group that contains a set of statement to perform for each claim in the output.
To define the Repeating Group, perform the following steps:
To change the statement to be a Group statement, click the arrow to the right of the
Statement Type
field and select
Group
.
When the transformation processes the Group statement, the transformation processes the set of statements nested in the Group statement.
To name the statement, double-click the
Name
field and type the name
ContactDetails
.
Use the XPath Expression editor to edit the expression in the
Output
field for the
ContactDetails
Group statement. To open the XPath Expression editor, click the arrow to the right of the
Output
field.
In the
Expressions
pane, add brackets to the right of the expression to create the following expression:
out:Claims[]
We use brackets to create an XPath predicate that acts as a filter. We want to associate patient information with the doctor with whom the patient had an appointment. This is also the doctor who makes the insurance claim. In the next steps, we see how to do this.
To filter according to the doctor specialization, use the specialization element as the filter condition for the doctor appointments. To position the cursor in the expression, in the
Expressions
pane, click between the brackets in the expression
out:Claims[]
. In the
Output Schema
tab, double-click to select the
Specialization
node.
The action creates the following expression:
out:Claims[@Specialization]
To the right of the
Specialization
node in the expression, add an equals sign to create the following expression:
out:Claims[@Specialization=]
To use the filter to match the output
Specialization
element to the input appointment
Speciality
element, add the
Speciality
element to the expression. Open the
Input Schema
tab and double-click the
Speciality
node that is under the
Appointment
node.
There is a
Specialty
input node under the
Doctor
input node, and a
Speciality
input node under the
Patient
input node. We refer to the second node in this lesson.
function to refer to an input node from the output statement. The expression returns nodes that match
Specialization
to
Speciality
.
To ensure that the claim data is matched or added for the relevant doctor, change the
Mode
to
Match or Add
.
The following image shows the final
ContactDetails
Repeating Group statement:
To transform a set of details for a specific patient, create a Group statement. Drag and drop from the
PersonDetails
input node to the
Patient
output node. In the grid, right-click the
PersonDetails to Patient
Group, and select
Demote
to nest the Group statement under the
ContactDetails
Repeating Group.
The XMap editor creates a Group statement in the grid. This statement passes a single set of patient details to the output XML. When the Group statement is indented, this signifies that it is performed for every patient whose doctor appointment details match the speciality for that iteration. This means that the set of patient details are associated in the output with the doctor that makes the claim.
To find every patient for the Group statement according to the patient ID, use the XPath Expression editor to edit the expression in the
Output
field. To define the
Output
field, perform the following steps:
To open the XPath Expression editor, click the arrow to the right of the
Output
field.
In the Expressions pane, add brackets to the right of the expression to create the following expression:
out:Patient[]
We want to find input patient contact information according to the patient ID. We also assign the input patient ID data to the ID output element. In the next steps, we see how to do this.
To identify the patient according to the patient ID number, filter the patient according to the
ID
node as part of the output expression. Open the
Output Schema
tab and double-click the
ID
node.
The action creates the following expression:
out:Patient[out:ID]
To the right of the expression, add an equals sign to create the following expression:
out:Patient[out:ID=]
To use the filter to match the output
ID
element to the input
id
element, add the
id
element to the expression. Open the
Input Schema
tab and double-click the
id
node.
The action creates the following expression:
out:Patient[out:ID=../dp:input()/@id]
. The statement filters patients according to ID and passes the ID to the output.
The following image shows the final Group statement:
Drag the mouse from the
Last
input schema node to the
Name
output schema node.
The XMap editor creates a Map statement named
Last to Name
in the grid.
To demote the
Last to Name
statement to be within the context of the
PersonDetails to Patient
Group statement, select the statement and click
Alt-Right
as needed.
The statement is nested within the Repeating Group and Group statements that select patients according to the filters that you defined. The patients are filtered according to the doctor that makes the claim and according to the patient ID. For each iteration of the Group statement, the statement passes the last name of the filtered patient to the output XML.
To combine the first and last name in the
Name
output schema node, use the XPath Expression editor to edit the expression. To get data from both the first name and last name nodes in the input, edit the
Input
field. To edit the
Input
field, perform the following steps:
To open the XPath Expression editor, click the arrow to the right of the
Input
field.
To select a function, open the
XPath
tab and select
Functions
String
.
To combine the first and last names, use the
concat()
function. Scroll down and double-click
concat()
.
The action creates the following expression:
concat()in:Name/in:Last
.
To correctly position the last name, delete the close parenthesis character, then add it to the end of the expression.
The function operates on parameters that are within the parenthesis, so we must position the name within the parenthesis. The action creates the following expression:
concat(in:Name/in:Last)
.
To add the first name, open the
Input Schema
tab and double-click the
First
node.
We want to append the first name after the last name. The action creates the following expression:
concat(in:Name/in:Lastin:Name/in:First)
To add a comma and space between the last and first name, add commas and quotation marks between the last name node and the first name node. Edit the expression to create the following expression:
concat(in:Name/in:Last,', ',in:Name/in:First)
We use commas to separate parameters within the concat function. The expression we created adds a space and comma between the last and first names.
To test the expression, click
Test Expression
. Then, to enter the expression into the statement, click
OK
.
When you test the expression, the
Results
panel displays all the nodes that result from the expression. With this method, you can check that the results are correct before you add the statement to the XMap. You can adjust the expression if needed.
To ensure that the claim data is matched or added for the relevant doctor, change the
Mode
field to
Match or Add
.
To ensure that if there is an error, the statement fails, change the
On Fail
field to
Propagate
.
The following image shows the final statement:
Drag from the
InsuranceID
input schema node to the
InsuranceID
output schema node. To demote the statement to be within the context of the
PersonDetails to Patient
Group statement, select the statement and click
Alt-Right
as needed.
The XMap editor creates a Map statement named
InsuranceID to InsuranceID
in the grid. This statement passes a single insurance identification number to the output XML.
The following image shows the final statement:
To pass the date of the appointment to the output, drag from the
Date
input schema node to the
AppointmentDate
output schema node. To demote the statement to be within the context of the