Using the parameters

Fundamentals

As you can read in the Hyperon Concepts, parameters:

  • are the most fundamental concept in Hyperon,
  • are conceptually similar to decision tables - the term used in rules engines,
  • allow to make business logic dependent on their values,
  • are unlimited in size,
  • are fast and give result in constant time, in most cases.

Each parameter consists of 4 elements:

  • definition of input columns (conditions),
  • definition of output columns (result values),
  • matrix built on input and output columns
  • meta configuration (caching, sorting, etc.)

Input columns

Each input column (IN) have to be bound to some source. We distinguish 2 types of source:

  1. Context source which points to some valid data in the context model - for example policy.insurer.age is valid path to the number which is the age of person insured on the insurance policy we are processing now.
  2. Formula source which defines some cascade expression that needs to be executed to obtain source value - for example if we do not have age property in the context model, we can use function that calculates age using policy.insurer.dateOfBirth property from context.

Output columns

Each output column (OUT) holds potential parameter's value. This potential value will become the result if IN columns in the same row matches the context data (or source in general). Values stored in IN columns are called patterns.

Both IN and OUT columns have:

  • unique code (unique within parameter)
  • data type (text, numeric, boolean, etc.)

Matrix

The heart of the parameter is matrix. Let's say the matrix has N rows and M columns. First on the left are IN columns (conditions) and OUT columns (result) stands behind them. M is the sum of IN and OUT columns.

Specifics of the matrix contains:

  • Each matrix cell has value consistent with column's data type.
  • Each IN cell holds pattern that can match or not source value.
  • Each OUT cell can hold literal value (result) or cascade expression that needs to be evaluated.

Meta configuration

In addition to the matrix and columns, each parameter has meta configuration which includes:

  • parameter's code (unique in the whole Hyperon installation),
  • match required flag,
  • in-memory index flag,
  • result sorting expression,
  • version indicating version of the region, to which the parameter is assigned,
  • tags for organizational purposes - grouping, filtering, etc.

In-memory index flag is one of the most important configuration aspects. If in-memory index is enabled the whole matrix will be held in memory in the form of compact index. This index structure guarantees O(1) search time if all columns use the default matchers. If some column uses the non-default matcher it may be a bit slower but still fast as no network traffic is needed.

As a rule of thumb we suggest that parameters:

  • with matrix up to 100000 (100k) rows should use the in-memory index,
  • with matrix up to 500k rows - it depends on the values' selectivity and number of columns (M),
  • with matrix larger than 1 million rows usually should not use the in-memory index.

Example

Consider 2 sample parameters:

Parameter demo.product.discount:

IN (product)
Source: policy.product.code
matcher: default
IN (client_age)
Source: policy.insured.age
matcher: between
OUT (discount)
A
0 - 30
3.95
A
31 - 50
2.60
A
*
2.25
B
*
1.50
*
*
0.00

Parameter demo.product.fee:

IN (product)
Source: policy.product.code
matcher: default
IN (cover_code)
Source: cover.code
matcher: in
OUT (min_fee)
OUT (max_fee)
A
COV1, COV2
1.00
2.00
A
COV3
2.00
5.00
A
*
0.00
1.00
B
COV1
1.50
6.00
B
*
2.00
3.00

As you can see:

  • parameter demo.product.discount defines 2 IN columns (conditions) and 1 OUT column (result),
  • parameter demo.product.fee defines 2 IN columns and 2 OUT columns.

Following table describe columns' definition for demo.product.discount:

Column type
Column code
Column data type
In matcher
IN
product
string
default
IN
client_age
integer
between
OUT
discount
number

Following table describe columns' definition for demo.product.fee:

Column type
Column code
Column data type
In matcher
IN
product
string
default
IN
cover_code
string
in
OUT
min_fee
number
OUT
max_fee
number

Following image shows sample parameter defined in Hyperon Studio.

If you prefer step by step presentation of the parameter concept within Hyperon Studio, see our video tutorial:

Video overview: 

  • what are parameters,
  • parameter's levels definition,
  • how to create a simple parameter,
  • uploading values to the matrix,
  • testing the parameter.