Expand the Order entity

Decision Insight supports a very broad range of interfaces, methods, and configurations. Nearly every task you perform with DI could be done another way. In this section, you will create a standard route to process three different types of events that correspond to the steps of the Step entity.

The route will invoke a different mapping for each event type, as shown in the schema below.


There are other options that would work just as well. This is simply what you will be doing as part of the tutorial.

One of the most important steps in any Decision Insight project is to understand the data you will receive. In many cases the data you will access is less than, or different from, what you expected. 

1. Explore data and adapt the Order entity

Overview of the sample data

 You've been provided with sample order test data in the file Part-4-10.Orders.txt.

Let's look at this file more closely. If you open the file in a file editor, you can see that the file:

  • Contains the same 10 orders you've worked with in Parts 1-3.
  • Includes additional information about Order Valid and Payment Received events. 

The file contains these new following fields:

  • process step

  • total amount of the order

  • the number of line items in the order

  • the freight carrier used for the shipment

  • invoice number

  • credit card number

This file only shows a partial set of events regarding the 10 orders. That's okay. You can work with these events and then add other data as they become available.

Adapt the Order entity


Step

Action

1

Click the Configuration icon > Entities.

2 Edit the Order entity.
3

In the Attributes tab, add the observed attributes that are missing to import your sample data:

  • carrier String type

  • cC Number String type

  • invoice Number String type

  • line Items Integer type

  • total Amount Decimal type

4

Add an observed relation to Step:

  • Name: Current Step
  • Reverse name: Orders
  • Make sure Multiple tail is checked.
5

Click Done and Save until you are back at the list of entities.

6

Check your model diagram. See if it looks like the one in the figure below.

Model Diagram with Step Entity


Background: missing data

If you look carefully at the data sample, you will see that there are ten data fields – but there is no event (or step) where all fields are present. Within this limited set of data, there is one field – Carrier – that does not appear at all.

New event types will bring with them new data attributes. Here is a table that shows all the available attributes once you receive all event types.

Attributes and Event Types

Gaps in the data are often the result of using different data sources for different events. All information may not (and usually does not) flow forward through the process.

For example, in the image above, when an order is received, it arrives as a block of data. The information known at that time is origin (customer name) and identity (customer reference). Other information (like amount and line item count) cannot be seen until the file is cracked open for validation.

This type of missing data is not a problem. You do not need to pass all the data types to a mapping for each event. Take Customer name for example. Once you have an instance of Order with that attribute set, it will persist until you unbind the event. If a process included a change of customer name during processing, you could update it to the new value. That new value would persist until changed.

From an overall view, the six changes needed to adapt your solution are:

  1. Incorporate the Step name as a relation from Order to Step. 

  2. Populate the total Amount value. 

  3. Populate the line Items count. 

  4. Populate the invoice Number field. 

  5. Populate the credit Card Number field. 

  6. Create a placeholder for the carrier field (you will use that when the data arrives).

When working with Decision Insight one of the important skills to learn is to leave a pathway back to undo actions. 

Your next step is a perfect example of a situation where it makes sense to avoid blocking your return. You have new data to load, and the new data has new attributes.

You could make changes to the existing mapping and route for Order – to manage the same data (the New Order event) you only need to add the required configurations to add the relation from Order to Step. Seems like an easy change.

However, if you make changes to your existing mapping and route, you will be incompatible with the data resources you used to bring the original 10 orders into the solution. Sooner or later you may need to delete all the data for Orders. Making incompatible changes to data integration for Order would make reloading that information difficult.

The safe course is to save what currently exists and make modifications to a copy. You will see how that is easily done in the next task.

2. Clean up your existing data

The data you used to create your first orders – and to unbind all but one of them – are still part of the solution's memory. The first nine are already completed – you won't see them unless you intentionally move back in time to when they were active. The other one, though is still active. The completed status from earlier tests – which you created – are out of sequence with the actual data sample from the client. There are two ways to approach the clean-up.

  1. One method is to "hide" the old events – you can tell Decision Insight to not show any of the existing transactional information. For information about which function to use to hide your data, see How to hide data. This is not the cleanest process but it is the quickest.

  2. Another method is to start with a clean slate – create a backup, reset the solution data, then restore your backup. The configuration, your integration definitions, and instances of configuration entities will all be restored, but none of the transaction data will exist. This was the reset method described during Part 1 of the tutorial. This is the more complete of the two methods and is the recommended way to have a clean start for your new data.

Whichever method you use, once the old data is gone, you can move to the next task.

Related Links