Testing Formulas
This functionality allows the user to test premium calculation and underwriting formulas. The user must select an existing product, go to the Test Calculations tab, press the Insert button available on the grid, and add a test scenario. Depending on the scenario, the user also chooses which type of formulas are called for testing - either tariff or underwriting formulas, and picks the formula from a list. The test results are displayed right away and the user has the option to log them into the test grid.
Test calculations are performed according to the Tariff Type and Underwriting Type, set for the specified per product, or product item (coverage).
User Journey
General description: This form driven flow is based on the FTOS_IP_TestScenario entity. The form is used to configure a certain scenario type and see the output of the selected formula. The flow covers the following two situations:
-
When the test scenario type is set on Premium Amount, automatically the system triggers the tariff type and the corresponding field is shown. If the tariff type is
perProduct
, the form displays the Insurance Product Formula field. If the tariff type isperCoverage
, the form displays the Insurance Product Item Formula field. -
When the test scenario type is set on Verify Underwriting, the form displays the underwriting context type dropdown. Once a value for the context type is chosen, the system automatically triggers the underwriting type and the corresponding field is shown. If the underwriting type is
perProduct
, the form displays the Insurance Product Formula UW field. If the underwriting type isperCoverage
, the form displays the Insurance Product Item field.
After completing the values from the formula and saving it, the Calculate button is displayed. On click, the output of the formula is displayed in a grid.
View Default This view is used to see the list of all the test scenarios that were performed for an insurance product. From this view, the user can:
-
add a new test scenario by pressing the Insert button.
-
see the details of each test scenario by double-clicking the test record.
-
export the list of test scenarios - by clicking the Export button.
-
delete a record - by clicking the Delete button.
Default Form Functions
The default form driven flow uses the following functions:
This function gets the product configuration - namely, the tariff type and underwriting type (using ebs.callActionByNameAsync
method from FintechOS Client Side SDK) calling FTOS_IP_GetInsuranceProductType endpoint asynchronous.
Input parameters: N/A.
Output parameters: N/A.
This function changes some form fields to read-only if formData.mode
is in edit mode and formula output was calculated and saved in FTOS_IP_TestScenarioOutputid.
Input parameters: N/A.
Output parameters: N/A.
If formData.mode
is in insert mode, this function produces the name of the test scenario by concatenating the insurance product name and the current date. After that, it calls on the TestScenarioTypeChange
function with a test scenario type value.
Input parameters: N/A
Output parameters: N/A
Based on scenario type, underwriting type and product type, a set of rules and validations are set to show or hide some of the fields and views according to the requirements of the test scenario. (See the description in the user journey, above.)
Input parameters: data
- The object provided by ebs.addFormChangeEvent
method
Output parameters: N/A.
This function is triggered after changing a value (using ebs.addFormChangeEvent
method from FintechOS Client Side SDK) either for the Insurance Product Item Formula field, or for the Insurance Product Formula field. Once triggered, the function calls the getCalculationDetails
function with the currently selected value. Also, a set of rules and validations is set in this function, in order to show or hide some of the fields and views.
Input parameters: data
- The object provided by ebs.addFormChangeEvent
method
Output parameters: N/A.
This function is triggered after changing a value (using ebs.addFormChangeEvent
method from FintechOS Client Side SDK), either for the Insurance Product Item Underwriting field, or for the Insurance Product Underwriting field. Once triggered, the function calls the getCalculationDetails
function with the currently selected value. Also, a set of rules and validations is set in this function, in order to show or hide some of the fields and views.
Input parameters: data
- The object provided by ebs.addFormChangeEvent
method
Output parameters: N/A.
This function is triggered after changing the value (using ebs.addFormChangeEvent
method from FintechOS Client Side SDK) from the Underwriting Context Type field. Also, a set of rules and validations is set in this function, in order to show or hide some of the fields and views.
Input parameters: data
- The object provided by ebs.addFormChangeEvent
method
Output parameters: N/A.
Based on the selected items from the testing scenario form and from the tariff configuration from the insurance product form, this function fetches the necessary data from the formula to be tested, using ebs.callActionByNameAsync
method from FintechOS Client Side SDK, calling FTOS_IP_GetInsuranceProductCalculationDetails endpoint asynchronous. The functions populates the dataContainer grid with the values returned from the formula.
Input parameters: insuranceProductItemFormulaId
- The Id provided by addFormChangeEvent
.
Output parameters: N/A.
Based on the formula masterType
, ArgumentType
and objectProperties
, this function sets a default value type for each formula key, displayed in the formula grid.
Input parameters:
-
masterType
- The formulamasterType
display name. -
subType
- The formulaArgumentType
display name. -
objProps
- The object properties.
Output parameters: depending on the formula key type, this function can return different types of data: Boolean, string, array, etc.
This is an on click function.
The function calculates the output of the formula and displays it in a grid, based on the provided data. Using ebs.callActionByNameAsync
method from FintechOS Client Side SDK, this function calls either the FTOS_IP_CALC_TestVerifyUnderwriting, or the FTOS_IP_CALC_TestPremiumAmount endpoint asynchronous (depending on what is selected on the scenario type), with parameters provided by constructEndPointParams
function. Next, the function calculates the output of the formula and displays it in a grid.
Input parameters: N/A.
Output parameters: N/A.
This is an on click function(). When clicking Batch File Template button, an Excel file gets exported with a name in the following format: batchFileTemplate + the current date and time. This file contains the formula input keys as headers and a single row with some dummy data that helps the user to fill in values in the right format and type. Besides these input keys, the generated file contains two more columns for adding an index to each row, and also an expected result for the test values.
Input Parameters: N/A.
Output Parameters: N/A.
This is an on click function(). When the user clicks the Run button, the date inside the uploaded file gets processed by a function that builds an object with some form data and sends it to the FTOS_IP_ProcessTestBatchFile endpoint. If the endpoint result is positive and the data is successfully processed, the function continues by saving the form asynchronously. It also displays an info message.
Input Parameters: N/A.
Output Parameters: N/A.
This is an on click function(). The function calls the getTestOutputs()
function when the Download results button gets clicked.
Input Parameters: N/A.
Output Parameters: N/A.
Depending on the selected value of the Testing type field, this function hides or shows parts of the form.
Input Parameters: N/A.
Output Parameters: N/A.
Based on different combinations of scenario type and underwriting type values, this function calls the onInsuranceFormulaUndChange()
or the onInsuranceFormulaChange()
methods with different value objects as parameters.
Input Parameters: N/A.
Output Parameters: N/A.
This function executes the following:
-
Checks the value of the
filename
parameter. -
Based on the results, builds up the array that populates the file.
-
Processes the obtained array into the desired format.
-
Generates the required Excel file.
-
Attaches the file path to a newly added anchor tag, used for the download part.
Input Parameters:
-
filename
- This parameter is used to determine the type of file that needs to be created. -
rows
- The rows of data that will be added inside the file.
Output Parameters: N/A.
This function gets the data rows to be added inside the results file and returns an array with a converted version of the values.
Input Parameters: arr
- The rows of data.
Output Parameters: csvArr
- The list with the converted version of the rows values.
This function gets the data rows to be added inside the template file. Next, it returns an array with two items, one for populating the headers and one for the dummy values.
Input Parameters: arr
- The rows of data.
Output Parameters: csvArr
- The list with all the key/ value pairs.
This function is used for converting the format of items (on a list) into the right format - needed for generating the headers of the formula results file.
Input Parameters: arrVal
- The list of the original format of the keys.
Output Parameters: returnArr
- The list of the converted format of the keys.
This function goes through a list and, if it detects an object , it converts it to a string.
Input Parameters: arrVal
- The list of values.
Output Parameters: returnArr
- The list with the converted objects.
This function determines if a given value is null or empty and returns a boolean result.
Input Parameters: value
- The value that needs to be checked.
Output Parameters: true/false
The job of this function is to call the FTOS_IP_GetTestBatchFile endpoint in order to obtain the list with the existing test scenario outputs for a test scenario, if any. Also, depending on the value of the parameter the function gets called with, a test results file will be generated.
Input Parameters: downloadBatchFilesResults
- boolean
Output Parameters: N/A.
Based on the scenarioType
, underwritingType
and productType
values, this function constructs the endpoint parameters, necessary to call the async function.
Input parameters: obj
- The scenarioType
, underwritingType
and productType
values.
Output parameters: result
- The object with the necessary parameters to call the async function.
Based on the scenarioType
, underwritingType
and productType
values, this function builds and returns the endpoint parameters, necessary to call the async function.
Input parameters:
-
inputParam
- The input parameter object. -
obj
- ThescenarioType
,underwritingType
andproductType
values.
Output parameters: result
- The object with necessary parameters to call the async function.
This function prepares the display grid for the results of the formula that was previously calculated.
Input parameters: gridData
- The array of object elements (key/ value).
Output parameters: N/A.
Endpoints
Endpoint used to run the FTOS_IP_GetInsuranceProductType server automation script.
Endpoint used to run the FTOS_IP_GetInsuranceProductCalculationDetails server automation script.
Endpoint used to run the FTOS_IP_CALC_TestPremiumAmount server automation script.
Endpoint used to run the FTOS_IP_CALC_TestVerifyUnderwriting server automation script.
Endpoint used to run the FTOS_IP_ProcessTestBatchFile server automation script.
Endpoint used to run the FTOS_IP_GetTestBatchFile server automation script.
On Demand Scripts
Based on the provided product Id, this script calls the getInsuranceProductType
function, to fetch the insurance product type and underwriting type, and return the results.
Input parameters: insuranceProductId
- The insurance product Id.
Output parameters: fetchProductType
- The collection of records.
This script is called with a data object. The object calls the getInsuranceProductCalculationDetails
function in order to return the formula (attached to the product, or coverage), based on the chosen values from test scenario form. The function includes four fetches, but only executes the fetch specified by the values provided in the object.
Input parameters: obj
- An object containing the following keys:
-
scenarioType
, -
productType
, -
underwritingType
, -
insuranceProductItemFormulaId
, -
insuranceProductId
, -
insuranceProductItemId
, -
underwrittingContextTypeId
.
Output parameters: fetchCalculationDetails
- The collection of records.
This script is called with a data object.
Based on the configured tariff type, the object calls either the testProdPremiumAmount
, or the testPremiumAmount
function - from the FTOS.IP_CALC.FormulaEngineHelper server automation script library.
Next, it receives the calculation results of the corresponding formula and saves the response in the FTOS_IP_TestScenarioOutput entity - if the Save Output Data option is selected.
Input parameters: object
- An object containing the following keys:
-
type
, -
inputParams
, -
insuranceProductId
, -
contextType
, -
shouldSaveOutput
.
Output parameters: result
- The formula output result.
This script is called with a data object.
Based on the configured context type and underwriting type, this function calls either the testUnderwritting
or the testUnderwrittingProductCover
function - from the FTOS.IP_CALC.FormulaEngineHelper server automation script library.
Next, it receives the calculation results of the corresponding formula and saves the response in the FTOS_IP_TestScenarioOutput entity - if the Save Output Data option is selected.
Input parameters: object
- An object containing the following keys:
-
type
, -
inputParams
, -
insuranceProductId
, -
contextType
, -
shouldSaveOutput
.
Output parameters: result
- The formula output result.
This on demand script gets called whenever a batch testing file has to be processed. It receives an object as a parameter containing the values of some of the form fields, necessary to determine which type of formula has to run and what the inputs are. With the result obtained from the formula test, the function goes ahead and creates a new object used for inserting a new record in the FTOS_IP_TestScenarioOutput entity.
Input parameters: object
- An object containing the following: file
, contextType
, insuranceProductId
, insuranceProductItemFormulaId
, insuranceProductFormulaId
, insuranceProductItemId
, scenarioType
, underwritingType
, and productType
.
Output parameters: N/A.
This script checks if there are any existing outputs for the specified test scenario. Next, it sends the query results list to the client side with the setData()
method.
Input parameters: object
- An object that contains one key with a boolean value.
Output parameters: N/A.
Server Side Script Library
FTOS.IP_CALC.FormulaEngineHelper
This library is used to create test scenarios and test premium calculation and underwriting formulas. From this library, the following functions are used:
This function runs the formula based on the following input parameters:
Input parameters:
-
insuranceProductId
- The insurance product Id. -
insuranceProductFormulaId
- The insurance product formula Id. -
formulaInput
- The formula input.
Output parameters: formulaResult.Input
- The result after running the formula.
This function is meant to run the formula based on the following input parameters:
Input parameters:
-
insuranceProductId
- The insurance product Id. -
insuranceProductItemFormulaId
- The insurance product item (coverage) formula Id. -
formulaInput
- The formula input.
Output parameters: formulaResult.Input
- The result after running the formula.
This function is meant to run the formula based on the following input parameters:
Input parameters:
-
insuranceProductId
- The insurance product Id. -
contextType
- The context type. -
formulaInput
- The formula input.
Output parameters: formulaResult.Input
- the result after running the formula.
This function is meant to run the formula based on the following input parameters:
Input parameters:
-
insuranceProductId
- The insurance product item (coverage) Id. -
contextType
- The context type. -
formulaInput
- The formula input.
Output parameters: formulaResult.Input
- The result after running the formula.