◷ Reading Time: 14 minutes
This is a sample for the car insurance industry that calculates the premium of a car based on Auto and Base premium components. The business rules are for risk classification and calculation of the premium of a car.
Decision Model
The decision graph automatically resolves the dependencies between different logic implementations (i.e. decision table, natural language, etc.)

Decision Flow
If a Flow is preferred, then the decision requirement diagram above can be presented as a Decision Flow, as shown below:

Business Rules
This is a sample for the car insurance industry that calculates the premium of a car based on Auto and Base premium components. The following business rules are for risk classification and calculation of the premium of a car.
Potential Theft Category definition
- If the car is a convertible, then the car’s potential theft rating is high.
- If the car’s price is greater than $45,000, then the car’s potential theft rating is high.
- If the car model is on the list of “High Theft Probability Auto”, then the car’s potential theft rating is high.
- If all of the following are true, then the car’s potential theft rating is moderate.
- car’s price is between $20,000 and $45,000,
- the car model is not on the list of “High Theft Probability Auto”
- If all of the following are true, then the car’s potential theft rating is low:
- car’s price is less than $20,000
- the car model is not on the list of “High Theft Probability Auto”
(The “High Theft Probability Auto” list is maintained by Risk Management and provided as input to the eligibility rating process. This list to be retrieved from Database e.g. MS SQL SERVER)
Potential Occupant Injury Category
- If the car has no airbags, then the car’s potential occupant injury rating is extremely high.
- If the car only has driver’s side airbags, then the car’s potential occupant injury rating is high.
- If the car has driver’s side and front passenger airbags, then the car’s potential occupant injury rating is moderate.
- If the car has a driver’s front passenger and side panel airbags, then the car’s potential occupant injury is low.
- If the car is a convertible and has no roll bar, then the potential occupant injury is extremely high.
Auto Premiums calculation
- If a compact car, then the base premium is $250.
- If sedan, then the base premium is $400.
- If a luxury car, then the base premium is $500.
- If the car is new, then increase the premium by $400.
- If the model year is the same as the current year, then this is a new car.
- If the model year is the same as next year, then the car is new.
- If the car is less than 5 years old, then increase the premium by $300.
- If the car is between 5 and 10 years old, then increase the premium by $250.
- If uninsured motorist coverage is included, then increase the premium by $300
- If medical coverage is included, then increase the premium by $600.
- If Potential Occupant Injury is Extremely High, then increase the premium by $1,000.
- If Potential Occupant Injury is High, then increase the premium by $500.
- If Potential Theft is High, then increase the premium by $500.
Decision Tables
The above business rules in each decision are formalized as shown in the Decision Tables below:
Potential Theft Rating Decision Table
Car is listed in “High Theft Probability Auto” | Car is Convertible | Price | Theft Rating |
FALSE | < 20000 | Low | |
FALSE | [20000; 45000] | Moderate | |
TRUE | High | ||
TRUE | High | ||
>= 45000 | High |
Potential Occupancy Injury Rating Decision Table
Driver’s Airbag | Front Passenger’s Airbag | Side Panel Airbag | Roll bar | Convertible | Occupant Injury Rating |
TRUE | FALSE | FALSE | High | ||
TRUE | TRUE | FALSE | Moderate | ||
TRUE | TRUE | Low | |||
FALSE | TRUE | ExtremelyHigh | |||
ExtremelyHigh |
Calculate Premiums Decision Table
Auto Premium
Is Car New? | Car Age | Uninsured Motorist coverage is included | Medical coverage is included | Potential Occupant Injury Rate | Potential Theft Rating | Rule Number | Auto Premium |
R1 | = 0 | ||||||
R2 | += 250 | ||||||
R3 | += 400 | ||||||
R4 | += 500 | ||||||
TRUE | R5 | += 400 | |||||
FALSE | < 5 | R6 | += 300 | ||||
FALSE | [5; 10] | R7 | += 250 | ||||
TRUE | R8 | += 300 | |||||
TRUE | R9 | += 600 | |||||
ExtremelyHigh | R10 | += 1000 | |||||
High | R11 | += 500 | |||||
High | R12 | += 500 |
Base Premium
Car Type | Rule Number | Auto Premium |
R1 | = 0 | |
Compact | R2 | += 250 |
Sedan | R3 | += 400 |
Luxury | R4 | += 500 |
Open sample project
On the Home screen, under Sample Gallery, search for “Car Insurance”. Then click on Download & Install.

Open the downloaded project.
“Car Flow.xml” is the main model that connects all the sub-models.

Video Description
Database Setup
Install MS SQL and MS SQL Server Management Studio.
- MS SQL (Express edition)
- MS SQL Server Management Studio
and then, create the database and tables as below.
HighRiskCars
The Potential Theft Category decision needs to access a list of “High Theft Probability Auto” which is maintained in our sample database. You can follow the instructions below to create your own sample database.
Create Table
Create a Database called Car-Insurance and then run the following script against it to create a table called HighRiskCars
USE [Car-Insurance]
GO
CREATE TABLE [dbo].[HighRiskCars](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Made] [nvarchar](50) NULL,
[Model] [nvarchar](50) NULL,
CONSTRAINT [PK_HighRiskCars] PRIMARY KEY CLUSTERED
( [Id] ASC ) ON [PRIMARY]
)
GO
Prepare Data
Once you create the database called Car-Insurance Run the script below to create the required data records:
USE [Car-Insurance]
GO
INSERT INTO [dbo].[HighRiskCars] VALUES ('Hyundai','IX35')
INSERT INTO [dbo].[HighRiskCars] VALUES ('BMW','E63')
GO
Thefts
In the newer version of the sample, an IRD is used to build up the HighTheftAutoList rather than reading it directly from the database.
Create Table
Create a Database called Car-Insurance and then run the following script against it to create a table called Thefts
USE [Car-Insurance]
GO
CREATE TABLE [dbo].[Thefts](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Made] [nvarchar](50) NOT NULL,
[Model] [nvarchar](50) NOT NULL,
[Year] [int] NOT NULL,
[Type] [nvarchar](50) NOT NULL,
[Location] [nvarchar](50) NOT NULL,
[Use] [nvarchar](50) NULL
)
GO
Prepare Data
Once you create the database called Car-Insurance Run the script below to create the required data records:
USE [Car-Insurance]
GO
INSERT INTO [dbo].[Thefts] VALUES ('Honda','CR-Z',2014,'Sedan','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Hyundai','IX35',2012,'SUV','VIC','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Honda','Passport',1995,'Van','NSW','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('BMW','E63',2016,'Sedan','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Pickup',2010,'Van','NT','City')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Ranger',1920,'Wagon','VIC','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Taurus',2000,'Sedan','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Austin','Mini',2000,'Mini','NSW','City')
INSERT INTO [dbo].[Thefts] VALUES ('Hyundai','Santa Fe',2010,'SUV','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Hyundai','Tucson',2010,'SUV','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Pickup',2010,'Van','NSW','City')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Ranger',1920,'Wagon','NSW','City')
INSERT INTO [dbo].[Thefts] VALUES ('Ford','Taurus',2000,'Sedan','NSW','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Hyundai','Santa Fe',2010,'SUV','NSW','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Honda','CRF250l',2014,'Motorcycle','VIC','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Aprila','RS250',2010,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Kawasaki','KR1',2014,'Motorcycle','VIC','Off-road')
INSERT INTO [dbo].[Thefts] VALUES ('Suzuki','RGV250',2015,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Yamaha','TZR250',2015,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Thefts] VALUES ('Suzuki','RMX450Z',2015,'Motorcycle','NSW','Off-road')
GO
Cars
Create Table
Create a Database called Car-Insurance and then run the following script against it to create a table called Cars
USE [Car-Insurance]
GO
CREATE TABLE [dbo].[Cars](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Made] [nvarchar](50) NOT NULL,
[Model] [nvarchar](50) NOT NULL,
[Year] [int] NOT NULL,
[Type] [nvarchar](50) NOT NULL,
[Location] [nvarchar](50) NOT NULL,
[Use] [nvarchar](50) NULL
)
GO
Prepare Data
Once you create the database called Car-Insurance Run the script below to create the required data records:
USE [Car-Insurance]
GO
INSERT INTO [dbo].[Cars] VALUES ('Honda','CR-Z',2014,'Sedan','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Hyundai','IX35',2012,'SUV','VIC','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Honda','Passport',1995,'Van','NSW','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('BMW','E63',2016,'Sedan','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Pickup',2010,'Van','NT','City')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Ranger',1920,'Wagon','VIC','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Taurus',2000,'Sedan','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Austin','Mini',2000,'Mini','NSW','City')
INSERT INTO [dbo].[Cars] VALUES ('Hyundai','Santa Fe',2010,'SUV','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Hyundai','Tucson',2010,'SUV','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Pickup',2010,'Van','NSW','City')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Ranger',1920,'Wagon','NSW','City')
INSERT INTO [dbo].[Cars] VALUES ('Ford','Taurus',2000,'Sedan','NSW','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Hyundai','Santa Fe',2010,'SUV','NSW','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Honda','CRF250l',2014,'Motorcycle','VIC','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Aprila','RS250',2010,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Kawasaki','KR1',2014,'Motorcycle','VIC','Off-road')
INSERT INTO [dbo].[Cars] VALUES ('Suzuki','RGV250',2015,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Yamaha','TZR250',2015,'Motorcycle','VIC','City')
INSERT INTO [dbo].[Cars] VALUES ('Suzuki','RMX450Z',2015,'Motorcycle','NSW','Off-road')
GO
Project Steps
1. Create the database following the steps above
2. Add a general flow
Once you create a project add a Generic flow to the project. This is the main file.

3. Validate the car
Validate the car using an Input Validation Logic file.

4. Once the car is valid, connect the database and get the required data to calculate the premium value
5. Build High Thefts Probability List
Using an IRD, define the high theft probability depending on the model, city and the country in which the car is being used.

6. Calculate the premium of the insurance
Using a DRD, calculate the car insurance premium

Decision tables were used to define the rules.

Natural Language files were also used when defining the rules.

7. Finally, show the insurance premium and validity of the car

How to run the project
1. Open the file Car Flow.xml
2. Click on Logic Run Template.

3. Select a template.

4. Click Debug.

5. Click Next Step to go to each step of the flow.

If you want to stop debugging and see the output, click Stop Debugging.

7. When your model is linked to other models and you are trying to navigate into the child model, FlexRule Designer will ask you to confirm that you wish to open and navigate to the child model in detail or just execute it (in which case it does not go to child model details).

8. Once the execution is successful, you will see a message.

9. You can see the output in the Parameters window.

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