1. Home
  2. Sample Projects
  3. Health Insurance Premium Calculation

Health Insurance Premium Calculation

◷ Reading Time: 7 minutes

This example is about calculating the health insurance price for a given individual. We have used the AutoML capability of FlexRule as a part of this project.

Therefore, this example uses the Analytics Extension.

Running the Sample

1. Open the file MainFlow.xml

2. Click on Logic Run Template.

3. Click on one of the given templates.

4. Click Debug.

5. Click Next Step to go step by step.

6. You will see the output under the Parameters window.

Video Tutorial

Process Steps

These are the process steps.

  1. Predict the charges based on age, sex, BMI, number of children, smoking preference, and region
  2. Calculate the extra charges
  3. Calculate situational charges
  4. Calculate the premium

Project Description

The project contains several components that can be easily added or removed as necessary.

Main Flow

  • MainFlow.xml: This is the main flow, which is the orchestration layer that combines the validation and decisioning parts of the project.


  • Health Premium Calculation.xml: The main decision requirement diagram that connects different components of the project such as the prediction, extra charges calculation, and finally calculates the health insurance premium.

Glossaries and Concepts

  • BoxedExpressions.xml: The list of formulas used in the project.
  • Concept.xml: The context of the project.

Predict Charges

These files were created automatically by the AutoML Builder.

  • Predict Insurance Charges.DRD.xml: The decision requirement diagram that predicts the charges based on the model created using AutoML.
  • insurance.InputOutput.Concept.xml: The concept file that defined the inputs and outputs of the predictive model.
  • insurance.frml: The report for the model.

Extra Charges

We used decision tables and a natural language document to calculate extra charges.

  • Cover Type.xml: The decision table that calculates the charges depending on the cover type.
  • Income.xml: The natural language document that calculates the charges depending on the customer’s income.
  • Residency Status.xml: The decision table that calculates the charges depending on the residency status.

Situational Charges

The models that calculate situational charges such as discounts and time-related charges (e.g. COVID)

  • COVID.xml: The decision table that calculates the charges depending on the covid vaccination status and covid positive status.
  • Discount
    • Discount.xml: The decision table that calculates the discounts.
    • Embedded Model Expressions.xml: The boxed expression document that contains the expression to connect to the flow with the REST API to get the discounted customer list.
    • GetDiscountedCustomers.xml: The flow that connects to the REST API to get the discounted customer list.

The Project Design

  • The main flow connects the validation and the decisioning parts of the project.
  • The DRD connects all the decision components according to their hierarchy.
  1. First, it calculates the extra charges (from the decision tables, Residency Status, Cover Type, and Income), temporary charges, and predicts the insurance charges.
  2. Finally, adds all the charges together to determine the health premium.

The expressions used in this file are stored separately in BoxedExpressions.xml.

  • Decision tables and the Natural Language Document in extra charges are used to add charges based on different criteria such as cover type, income, and residency status.
NL for health insurance
Business terms for health insurance
  • The concept file maps the business context.
Fact for health insurance
  • Under Predict Charges, you can see the automatically created decision requirement diagram, concept, and ML build report.

The dataset (CSV file) used to build the model contains data of 1338 customers.

  • Under Temporary Charges, you can add if there are any discounts or temporary charges.
  • Under Discount, you can see the discount-related documents.

Download the project

Use the attachment at the end of the page to download the sample project.

Updated on February 21, 2023

Article Attachments

Was this article helpful?

Related Articles