Docs Menu
Docs Home
/ /

Refactor the Policy Domain

A policy can have both several insurable objects to cover and several parties' agreements involved. For instance, a policy may have many parties involved, and each party might be part of multiple policies. This results in a many-to-many relationship between roles and agreements.

Similar to the Party domain, you can embed this information under the MongoDB policy document by adding mappings for each table in the relational database.

The Policy domain includes the following key entities:

  • Insurable Object: An object insured by a policy agreement.

  • Insurable Object Party Role: An associative entitiy which links the following entities:

    • Party

    • Party Roles

    • Insurable Objects

  • Agreement Party Role: An associative entity which links the following entities:

    • Parties

    • Party Roles

    • Agreements (which are related to a product and policy)

The following image shows the Entity Relationship Diagram (ERD) for the Policy domain:

Entity Relationship Diagram (ERD) for the Policy domain

Refactoring the Policy domain is the third step of the insurance data model example tutorial. Before you refactor the Party domain, ensure that you connected to your PostgreSQL database in Relational Migrator and refactored the Party domain.

1

On the right side of the screen, the Mappings menu opens.

2

Next to Mappings from relational tables, click Add. Click Embedded array and select policy_party_role from the Source table drop-down menu.

Under the All fields checkbox, uncheck the policyIdentifier field and click Save and close.

3

Next to Mappings from relational tables, click Add and select Embedded documents. Choose agreement from the Source table drop-down menu.

Click Save and close.

4

Next to Mappings from relational tables, click Add and select Embedded array. Choose policy_coverage_part from the Source table drop-down menu.

Under the All fields checkbox, uncheck the policyIdentifier field and click Save and close.

5

Each coverage part has details included in the policy_coverage_detail table. To embed this information, click Add and select Embedded array. Choose policy_coverage_detail from the Source table drop-down menu and ensure that the Root path prefix is policyCoverageParts.

Under the All fields checkbox, uncheck the policyIdentifier and coveragePartCode fields, and click Save and close.

6

To include the coverage information from the insurable_object collection, click Add and select Embedded documents. Choose insurable_object from the Source table drop-down menu.

Click Save and close.

7

To include policy_limit information, click Add and select Embedded array. Choose policy_limit from the Source table drop-down menu and ensure that the Root path prefix is policyCoverageParts.

Under the All fields checkbox, uncheck the policyCoverageDetailIdentifier field and click Save and close.

Repeat the process for policy_deductible.

8

Insurable objects have additional relationships to specify the address and roles played by the different parties. To include this information, click Add and select Embedded array. Choose insurable_object_party_role from the Source table drop-down menu.

Under the All fields checkbox, uncheck the insurableObjectIdentifier field and click Save and close.

9

Now that you mapped all the necessary tables to the policy collection, you can delete the following collections from the MongoDB view of Relational Migrator:

  • agreement

  • policyPartyRole

  • policyCoveragePart

  • policyCoverageDetail

  • policyDeductible

  • policyLimit

After you map the Policy domain, refactor the Claim domain in a similar manner. See Refactor the Claim Domain.

Back

Refactor the Party Domain

On this page