ParametricInsuranceEngine

Parametric insurance evaluation engine.

Evaluates conditions for parametric insurance contracts based on external data triggers (e.g., flood depth, temperature, rainfall).

Supports condition types:

  • THRESHOLD: Value exceeds or falls below a threshold

  • RANGE: Value within a specified range

  • COMPARISON: Compare two values

Expression format examples:

  • Threshold: "$.floodDepthCm >= 50"

  • Range: "

    $.temperature >= 20 && $

    .temperature <= 30"

  • Comparison: "

    $.value1 > $

    .value2"

Example Usage:

val engines = EvaluationEngines()
engines += ParametricInsuranceEngine()

val contract = createContract(
executionModel = ExecutionModel.Parametric(
triggerType = TriggerType.EarthObservation,
evaluationEngine = "parametric-insurance"
)
)

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val engineId: String

Unique identifier for this evaluation engine. Must match the evaluationEngine value in ExecutionModel. Examples: "parametric-insurance", "rule-engine", "smart-contract-vm"

Link copied to clipboard

Lazy initialization of hash to avoid computation during object construction.

Link copied to clipboard

Supported condition types for this engine.

Link copied to clipboard
open override val version: String

Version of the engine implementation. Used for tamper detection and compatibility checks.

Functions

Link copied to clipboard
open suspend override fun evaluateCondition(condition: ContractCondition, inputData: JsonElement, context: EvaluationContext): Boolean

Evaluate a single contract condition.

Link copied to clipboard
open suspend override fun evaluateConditions(conditions: List<ContractCondition>, inputData: JsonElement, context: EvaluationContext): Map<String, Boolean>

Default implementation of evaluateConditions that evaluates each condition individually. Override if you need custom batch evaluation logic.