Metakeys

Metakeys are special attributes that modify or enhance data points. They allow you to control how data points behave, how they’re displayed, and how they’re validated. The basic syntax for a metakey is:

// Basic syntax
my_datapoint has metakey value;

// Multiple metakeys can be combined in a block
my_datapoint has {
    metakey1 = value1,
    metakey2 = value2
};

Prompt

The prompt metakey defines how a field is labeled in the UI:

// Basic prompt
insured.name has {
    prompt = "Insured"
};

// Prompt with additional context
risk.inception_date has {
    prompt = "Inception Date (DD/MM/YYYY)"
};

// Prompt with currency symbol
premium has {
    prompt = "Premium",
    ui_prefix = "£"
};

Options

The options metakey restricts input to a predefined set of values:

// Simple options list
risk.currency has {
    prompt = "Policy Currency",
    options = #{"GBP", "USD", "EUR"}
};

// Options from reference data
insured.country has {
    prompt = "Country",
    options = column_set(countries, "name")
};

// Line of business options
coverage.type has {
    prompt = "Type of Coverage",
    options = #{"Property", "Liability", "Marine"}
};

Multi-options

Similar to options but allows multiple selections:

// Multiple coverages
risk.coverages has {
    prompt = "Coverage(s)",
    multi_options = #{
        "Property Damage",
        "Business Interruption",
        "Terrorism",
        "Natural Catastrophe"
    }
};

// Multiple territories
risk.territories has {
    prompt = "Covered Territories",
    multi_options = column_list(territories, "code")
};

Minimum and maximum

These metakeys set bounds for numbers, dates, or text length:

// Policy limits
risk.limit: Number;
risk.limit has {
    prompt = "Policy Limit",
    minimum = 1000000,
    maximum = 10000000,
    description = "Enter the total policy limit required"
};

// Age restrictions
insured.age: Int;
insured.age has {
    prompt = "Age",
    minimum = 18,
    maximum = 120,
    description = "Please note that this product only covers adults."
};

Description

The description metakey provides additional context or help text for a data point:

// Basic description
risk.limit has {
    prompt = "Policy Limit",
    description = "Enter the total policy limit required"
};

// Dynamic description using interpolation
policy.revenue_gbp has {
    description = "RoE from {{ policy.currency }} to {{ policy.currency_gbp }} is {{ policy.roe_to_gbp }}"
};

// Description with conditional help text
insured.age has {
    prompt = "Age",
    minimum = 18,
    maximum = 120,
    description = "Please note that this product only covers adults."
};

UI formatting

The ui_prefix adds text before the input field:

// Currency prefix
premium has {
    prompt = "Premium",
    ui_prefix = "£"
};

Multiline

The multiline metakey enables multi-line text input:

// Simple multiline text
risk.description has {
    prompt = "Risk Description",
    multiline = yes
};

Render

The render metakey controls how complex data structures are displayed.

The following example uses render for a table:

// 1. Define the collection of IDs that will be used to create table rows
claims.history.ids: #{Uuid};

// 2. Define the parameterized data point that will provide the data
claims.history.date(id: Uuid): Date;

// 3. Configure how the table should be displayed
claims.history.ids has {
    prompt = "Claims History",
    render = {
        // Specify that this will be rendered as a table
        type: "table",

        // Define the table columns
        columns: [
            {
                name: "date",           // Must match the definition use in cells:{} below
                label: "Date of Loss"   // What appears in the UI table header
            }
        ],

        // Create a row for each ID in claims.history.ids
        rows: [{
            id: id,                     // The UUID set to be used
            cells: {
                date: datapoint(claims.history.date(id))  // must use datapoint() to get the data
            }
        } | id <- claims.history.ids]   // List comprehension to create all rows
    }
};