Creating the test data mockup process
Creating the test data mockup process
Test data mock-up process[edit]
It is important to quickly generate sample data and test an application after setting up the implementation layer for Pega Customer Decision Hub™ to ensure that the configurations are made correctly. This article will show you how to populate mock-up data in a sample multi-level (customer and account) structure and cover a few methods for testing service and strategies using the generated mockup data.
Note: This is not a guide for creating a Monte Carlo data set but to represent a process for creating sample data.
Pre-requisites[edit]
- An implementation layer for Customer Decision Hub is setup.
- Customer and Account classes are setup.
- An association between Customer and Account is created.
- Context Dictionary setup is completed.
- Next Best Action Designer has at least one action and treatment, and an active real-time container.
- A framework is installed (optional but recommended).
Assumptions[edit]
- For this article, Customer class is named
UBank-Data-Customer
and Account class is namedUBank-Data-Account
. - One customer may have multiple accounts..
- Customer and Accounts classes are inheriting from the Customer and Account classes shipped in the Financial services accelerator component.
- The following screenshots were taken for the Financial Services industry.
- The channel invoking
NextBestAction
container is U+ Bank website, with a Tile as placement - Real Time Container is named
NextBestAction
and is active
Creating mock-up data[edit]
Creating mock-up data from scratch[edit]
As a best practice, Pega recommends that industry frameworks should be leveraged during the initial setup of an application. These accelerator components can jump start application development from day one as it includes various artifacts that can be reused. If possible, please skip this section and reuse the SampleCustomerDataRecord
Monte Carlo data set provided with the accelerator. Otherwise, continue by creating everything from the beginning.
(For help creating Monte Carlo data sets, consider completing the Pega Academy challenge: Creating Monte Carlo Data sets)
- Create a new Monte Carlo data set in your implementation customer class (
UBank-Data-Customer
). - Start by entering the sample size of the dataset (number of customers that will be generated as a result).
- Add all properties that will be populated in customer and account classes, by selecting them from various methods. (For more information about each function and usage, see Monte Carlo Data set on Pega Documentation). Consider adding Account pages into the Monte Carlo data set.
- Some common methods are :
- For generating consecutive IDs, use →
ConsecutiveIds.nextRowID(Text,Text)
- For personal information, use →
Name.prefix, Name.firstName, Name.lastName, Address.streetAddress, Address.city, Address.country
- Random decimal →
Number.randomGaussian(Double,Double)
- Random integer →
Number.digits(Integer)
- Random text →
Options.options(Text,Text,Text,Text)
- Random true or false →
Bool.bool
- Date-time difference →
@DateTimeDifference(------A DATE PROPERTY------,@(Pega-RULES:DateTime).CurrentDateTime(),D)
- For generating consecutive IDs, use →
- Some common methods are :
- After completing all fields, click Actions > Run.
- Choose Browse operation to review the data.
- Skip next section and move to section on “Inserting the Data”
Creating mock-up data by leveraging the accelerator[edit]
As a best practice, Pega recommends that industry frameworks should be leveraged during the initial setup of an application. These accelerator components can start application development from day one, as it includes various artifacts that can be reused.
Use the SampleCustomerDataRecord
Monte Carlo data set to get started.
- Download the accelerator component for the industry from marketplace.
- In the application definition, install the accelerator component by clicking Manage Components.(For more information about the installation, see Implementation Guide.)
- After installing the component successfully, search for the
SampleCustomerDataRecord
Monte Carlo data set and save it into your implementation customer class. - Tailor it appropriately with the sample size and property values.
- Click Actions > Run.
- Choose Browse operation to review the data.
Inserting the Data[edit]
Create a new data flow to insert the sample data into corresponding database tables.
To begin with, create a new data flow in the customer class and name it CreateCustomerAndAccounts
.
- Choose the Monte Carlo data set that was created in the initial step.
- Choose the provided Customer data set to insert into customer class. When saving, select Insert new and overwrite existing records.
- Click Add branch to define the Account destination.
- In the data flow, add a Convert shape.
- In the convert shape, choose Embedded and select the
.Accounts
page list property. - Choose the out-of-the-box Account data set to insert into account class. When saving, select Insert new and overwrite existing records.
- Click Actions > Run.
- Click Submit.
- Start the data flow run.
- Verify that the data is generated in the Customer and Account classes by running the
Customer
andAccount
data sets.
Manipulating the sample data[edit]
It is possible to make changes to the customer or account data directly from Pega Customer Decision Hub or by exporting the data to a CSV file and update or import the CSV back. This helps users to manipulate the data as necessary.
- Make sure that your access group has the your implementation application name:DataAdmin role.
- Launch Pega Customer Decision Hub, and go to Data > Profile Data Sources.
- Select Customer data set.
- Click on the Records tab.
- Click on any record to customize.
- Alternately click on the Export button to export the records, make necessary changes then Import it back using the wizard.
Testing the Container Service[edit]
The first test functionality that can be leveraged within Pega Customer Decision Hub can be done from the Container service itself.
- Select
CustomerID
from the customer table for testing. (Simply run the Customer data set to preview records or review the customer data source in the Profile Data Sources landing page in Pega Customer Decision Hub.) - Search for the Container service. (Container V3 after 8.5+ ) (If using V2 Container then please update the following JSON with the sample shared in the user guide.)
- Click Action > Run and select POST HTTP method. Enter following JSON into the Message buffer, and Execute the service:
{ "SubjectID":"CUST1", "ContextName":"Customer", "ContainerName": "NextBestAction", "Channel": "Web", "Direction": "Inbound", "Placements":"Tile", "Contexts": [{ "Type":"", "Value":"", "Key":"" }] }
- If the engagement policies for the actions match the customer’s data, and corresponding treatment is present for the placement in the request (Tile in the above request), then the service response will display the action that was prioritized as the top action.
Testing the Strategies by a Dataflow[edit]
When debugging strategies and conveying more granular testing, decision architects may require testing strategies. A common difficulty faced is caused by the fact that Next Best Action Strategies in Pega Customer Decision Hub run on the Decision-Data-Request-Customer
class and does not have direct access to the CustomerCSMS
data flow in the customer class. So when testing, you cannot directly choose the Customer you want to run the strategy with.
To be able to choose the customer, complete the following steps:
- Create a temporary Decision Data Store data set in the
Data-Decision-Request-Customer
class and name it SampleCustomers. - Choose
.CustomerID
as the key for the data set. - Create a data flow in the Customer class and name it
LoadCustomersToSampleCustomers
.- Use out-of-the-box Customer data set as the source,
- Convert it to a top level page in
Data-Decision-Request-Customer
, map the.CustomerID
to.CustomerID
. - For destination choose the SampleCustomers data set created in the first step.
- Run the data flow to create the same customer records in the Cassandra data set in Data-Decision-Request-Customer class. (Optional: Add a filter shape to the data flow to reduce the number of records getting uploaded to the data set if necessary.)
- Create a new data flow in the Data-Decision-Request-Customer class and name it
TestCustomer
.- For the source, select the SampleCustomers data set.
- Add a Compose shape to join the out-of-the-box CustomerDataCSMS data flow, which includes additional data such as Action Insights.
- Compose the
.Customer
page by adding the conditionCustomerID is equal to .CustomerID
. - Add a convert shape to add any channel specific attributes that would be passed in the container call.For example:
.ContainerPayload.Channel
→ Web.ContainerPayload.Direction
→ Inbound.ContainerPayload.TreatmentPlacementList(1).pyName
→ Tile.SubjectType
→ “UBank-Data-Customer”
- Now select the TestCustomer data flow in any Strategy to be able to execute it for a given CustomerID.
References[edit]
- Pega Marketplace
- Pega Documentation article on Monte Carlo Data Set
- Pega Academy challenge on Creating Monte Carlo data set