Merging duplicate data entities
Merging duplicate data entities
PGP Merge Entities[edit]
The PGP Merge Entities is a feature for merging 2 or more entities into a single entity which acts as a master.
Architecture[edit]
Merge entities consists of two parts:
- Configuring Scalar and List merge attributes (Properties) in the design time.
- Executing the merge for the selected entities at run time.
Merge attributes can be configured from App Studio by navigating to the PGP > Merge entities landing page.
Scalar attributes can be configured by providing the following details:
- Name of the property
- Property supported for merge and
- Data type of the property
List attributes can be configured by providing the following details:
- Name of the attribute
- Data page that fetches the list items and
- Properties to be shown to the user
Merge Entities[edit]
In the Merge entities case type, User can select only one of the values for scalar attributes from of the selected entities to be the value of the master entity record.
For list attributes, Users can select any record to be part of the master entity without any restriction.
Technical details for merging entities[edit]
To support merging of an entity, 2 properties are added to the entity data model and corresponding columns are also added to the respective entity database table.
- MergeStatus (Possible values: Active/Inactive)
- MergedTo
For example, let’s assume below are the entities before merge
Entity ID | Merge Status | Merged To |
PERSON-1 | -- | -- |
PERSON-2 | -- | -- |
Now user selects PERSON-1 as a master entity and wants to merge PERSON-2 into PERSON-1, up on completion, the entities will have the following data to the above mentioned 2 properties.
Entity ID | Merge Status | Merged To |
PERSON-1 | Active | -- |
PERSON-2 | Inactive | PERSON-1 |
Along with the above values to support the unmerge functionality, the Master entity would have the details that it possesses before the merge in the Snapshot (PegaPS-Data-Snapshot) embedded page of the entity.
Technical details for merging list items[edit]
The design of merging the list items like Address has a different way of handling the merge compared to merging of entities.
For handling the merge of list items 2 properties are introduced to the data model.
- MergeStatus (Possible values: MasterInactive/Inactive/Active)
- MasterInactive: Used to inactivate the master list items (only if not selected), these are omitted and not shown in master profile.
- Inactive: Used to inactivate the duplicate list items (irrespective of selection is made or not.)
- Active: Used to activate the list items that are selected from the master items.
- RefID
For example, let us assume below are the addresses of the entities in the system.
Address ID | Entity ID | Merge Status | RefID | User selection |
Address-1 | PERSON-1 (Master) | -- | -- | Selected by user |
Address-2 | PERSON-1 (Master) | -- | -- | Not selected |
Address-3 | PERSON-2 (Duplicate) | -- | -- | Selected by user |
Address-4 | PERSON-2 (Duplicate) | -- | -- | Not selected |
In the above scenario, 1 address from each entity is selected by the user and below are the address details after the merge.
Address ID | Entity ID | Merge Status | RefID |
Address-1 | PERSON-1 (Master) | Active | -- |
Address-2 | PERSON-1 (Master) | MasterInactive | -- |
Address-3 | PERSON-2 (Duplicate) | Inactive | -- |
Address-4 | PERSON-2 (Duplicate) | Inactive | -- |
Address-5 | PERSON-1 (Master) | Active | Address-3 |
Below is the explanation for each address how its handled in the above scenario.
- Address-1: This originally belongs to master entity and it has been selected by the user, so the status is set to Active.
- Address-2: This originally belongs to master entity and it has not been selected by the user, so the status is set to MasterInactive (this is not shown in master profile going forward)
- Address-3: This originally belongs to duplicate entity, so the status is set to Inactive.
- Address-4: This originally belongs to duplicate entity, so the status is set to Inactive.
- Address-5: This is a new address added to master by cloning the Address-3 which is a selected address from the duplicate entity and the status is set to Active. The RefID property is set to the value Address-3 to indicate that it is cloned from Address-3.
The key concept is all the selected list items from the duplicate are cloned with new ID’s and added to the master.