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.

digraph G { graph [ fontname="Courier", fontsize=12, size="7,5"]; node [ shape=rect, fontname="Courier", fontcolor=blue, fontsize=10, margin=0.1]; edge [ fontname="Courier", fontcolor=blue, fontsize=10]; ledger_node [label="{\l \"_schema\": \"LossSet_1.0\"\l \"path\": \"s3://bucket/path/file1.parquet\"\l \"type\": \"stochastic\"\l}\l"]; filter_node [label="{\l \"_schema\": \"MetadataFilter_1.0\"\l \"expression\": \"Peril = 'HU'\"\l}\l"]; quota_share [label="{\l \"_schema\": \"QuotaShare_1.0\"\l \"policy_id\": \"abc123\"\l \"inception_date\": 1546300800\l \"expiration_date\": 1577836800\l \"limit_value\": 30000.0\l \"premium_value\": 3000.0\l \"brokerage\": 0.1\l \"share\": 0.2\l}\l"] ledger_node -> filter_node; filter_node -> quota_share; }

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

Region='SC'

The Region attribute matches SC exactly

EventId=6

The EventId attribute is 6

Region<>'SC'

The Region attribute is not SC

Intensity<6.5

The Intensity attribute is less than 6.5

Intensity>=4.0

The Intensity attribute is greater than or equal to 4.0

Matching multiple possible values

Expression example

Meaning

Peril in ('HU', 'FFEQ')

The Peril attribute matches either HU or FFEQ

Peril not in ('HU', 'FFEQ')

The Peril attribute does not match either of HU or FFEQ

EventId in (1,3,5,7)

The EventId attribute does not match either of HU or FFEQ

Null comparison

Expression example

Meaning

Peril is null

The Peril attribute is _null_

Peril is not null

The Peril attribute is not _null_

EventId in (1,3,5,7)

The EventId attribute does not match either of HU or FFEQ

Logical expression combinations

Expression example

Meaning

Region='FL' and Peril in ('HU', 'FFEQ')

The Region attribute matches FL and the Peril attribute also matches HU or FFEQ

(not Region='FL') or Peril='HU'

The Region attribute does not match FL or the Peril attribute matches HU

not (Region='FL' and Peril='HU')

The record matches when the Region is not FL or the Peril is not HU