Reference data design pattern
Reference data is used to define and classify other data. In the Pega Common Data Model, data that is used to source a picklist is referred to as reference data. The Pega Common Data Model offers a large set of pre-defined reference data for objects like countries, states, currencies, account types, contact types and so on.
When identifying reference data that your application will use, first review the existing data. For example, for a picklist that displays a list of countries, you can use the pre-defined Countries data object. Using an existing reference data object gives you the data values and the underlying Pega rules and objects used to integrate the data with your application.
For example, the reference data object named PaymentMethod provides a list of payment methods that you can use in your application, and the associated Data Page and Data Transforms. The values include payment methods such as credit card, bank account, Apple Pay, Google Pay, and PayPal.
You create a new reference data object in the main reference data class, Common-LDM-Reference, from which each picklist reference data class inherits.
The Common Data Model includes two options for populating a picklist with reference data.
- A centralized approach that uses a consistent set of Data Pages, fields, and Data Transforms to supply a picklist's values. This approach is useful when there are only a few fields and filters. It includes options to use a shared database table that stores records for many picklists, or an independent database table that contains values for a single picklist only, which is helpful when there many records.
- A standalone approach in which you create a specific Data Page, fields, and Data Transforms to supply the values for a picklist. Use this approach when there is metadata associated to a record that is used in other rules, or if the record requires its own preview and maintenance.
The following diagram shows the reference data design pattern and how data connectors communicate with the service layer to get reference data.
The following sections describe the design patterns.
Design pattern for Generic reference data object (Single value picklist)
This approach includes a main reference data object from which all the generic reference data objects inherit. It is useful when your picklist contains a few properties and filters. The diagram shows an example of the Country data object, which provides a list of countries, and the Role object, which provides a list of employee role types. The design pattern has the following characteristics:
- All reference data inherits from the Common-LDM-Reference class
- Generic Data Pages retrieve the reference data picklist data: D_Reference_Data_List, D_Reference_Data
- Data Transforms map data from the source to the logical data model and provide CRUD operations, for example, RefData_Role_Request; RefData_Role_Response
- Reference data uses tags to represent the application that uses them, for example CDM-HC for a healthcare application, and CDM-CS for a customer service application. Tags enable data to be shared across applications and can also limit the data that is shared.
- Exclusion pattern to not-include specific instances.
Benefits of using the generic reference pattern:
- Consistent across all applications
- Faster to add new picklist data objects
- Central validation and logging – improvements are shared
- Easier to troubleshoot and correct issues
Design pattern for Standalone reference data object
This approach contains fields that are specific to a reference data object and is useful when there are many filters or fields that are particular to that picklist field, or if the data is from an external source. The diagram shows the example for the Specialty reference data object, which defines a picklist of specialties for a healthcare provider, for example, Allergist, Audiologist, Radiologist.
Reference data that needs to be standalone use the following design pattern:
- For a standalone reference data object, you create a new class within Common-LDM-Reference. For example, Common-LDM-Reference-Specialty.
- Does not use generic Data Pages. Instead, you create a new Data Page to retrieve the reference data picklist, for example D_ReferenceData_List_Specialty.
- Data Transforms map data from the source to the logical data model and provide CRUD operations: RefData_Specialty_Request, RefData_Specialty_Response
Using Reference data
For more information on using reference data, refer to Adding a generic reference data object and Adding a standalone reference data object in the Common Data Model documentation.