Ledger Filtering¶
All data (including loss events and all other events) flowing through the business model defined in the Data API can be filtered. Filtering can be done at links or at nodes using the Node and Link structures.
Data API Filter nodes¶
The following example structure defines an intermediary Node
that filters records before they arrive at the QuotaShare
Node
for application of financial terms.
Refer to the below Filter Expressions for examples of the operations supported.
Data API Filter links¶
As a convenience method for filtering without having to define additional Nodes
in a business model, filtering can be applied to Links
by defining the attributes on a Link
as in the following example:
In the example, there are three attributes specified in LinkFilter_2.0
template: expression
, include_record_types
, scale_value
. They correspond to
three types of operations supported in a LinkFilter_2.0
: filter expressions, record types filtering and scaling.
Note
The attributes in the LinkFilter_2.0
are all optional.
The filter expressions operations are identical to those supported at the Node
level. Refer to the below Filter Expressions for examples.
The record types filtering operation filters records with certain record type(s). A user can specify a list of record types under the attribute include_record_types
to allow records that matches with any specified record types output from the Link
. Internally, each record type in the include_record_types
will be transformed to a Node
that uses RecordTypeFilter with EQUAL
as op
.
The scaling operation applies a scaling factor specified by scale_value
to the value of each record in the ledger, which uses Scale.
Note
Unlike defining a filter on a Node
, this invokes a special template that replaces the Link
with one or more intermediate Node(s)
,
since internally, all operations in the financial model are performed at Nodes
.
Filter Expressions¶
Filter Expression can use the valid field names and their corresponding values found in the ledger parquet files.
The query expressions provided in Node and Link structures are based on the SQLite expression syntax
The syntax for these expressions is not to be confused with the syntax used to define Data API Queries, although they are similar.
Matching and direct comparison¶
Expression example |
Meaning |
---|---|
|
The |
|
The |
|
The |
|
The |
|
The |
Matching multiple possible values¶
Expression example |
Meaning |
---|---|
|
The |
|
The |
|
The |
Null comparison¶
Expression example |
Meaning |
---|---|
|
The |
|
The |
|
The |
Logical expression combinations¶
Expression example |
Meaning |
---|---|
|
The |
|
The |
|
The record matches when the |