← define_datapoint_ruleset operator page · definitions/define_datapoint_ruleset/unconditioned_rule/consequent_alone

Consequent alone 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a rule with no antecedent, Me_1 >= 0.

Manual:

define datapoint ruleset: "In case the antecedentCondition is absent then it is assumed to be always true, therefore the consequentCondition is expected to evaluate to true for all the Data Points".

Expected:

ruleid 1, the order number of the unnamed rule, and bool_var true for 10 and false for -5. errorcode and errorlevel are null, ruleid and errorcode Strings as in the manual's examples, and errorlevel Integer, the manual's default without errorlevel_vd (#1256).

script.vtl ⇩

define datapoint ruleset DPR_1 (variable Me_1) is
    Me_1 >= 0
end datapoint ruleset;

DS_r := check_datapoint(DS_1, DPR_1 all);

input/DS_1.csv ⇩

Id_1Id_2Me_1
1CREDIT10
2DEBIT-5

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {
          "name": "Id_1",
          "type": "Integer",
          "role": "Identifier",
          "nullable": false
        },
        {
          "name": "Id_2",
          "type": "String",
          "role": "Identifier",
          "nullable": false
        },
        {
          "name": "Me_1",
          "type": "Integer",
          "role": "Measure",
          "nullable": true
        }
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2ruleidbool_varerrorcodeerrorlevel
1CREDIT1true
2DEBIT1false

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {
          "name": "Id_1",
          "type": "Integer",
          "role": "Identifier"
        },
        {
          "name": "Id_2",
          "type": "String",
          "role": "Identifier"
        },
        {
          "name": "ruleid",
          "type": "String",
          "role": "Identifier"
        },
        {
          "name": "bool_var",
          "type": "Boolean",
          "role": "Measure"
        },
        {
          "name": "errorcode",
          "type": "String",
          "role": "Measure"
        },
        {
          "name": "errorlevel",
          "type": "Integer",
          "role": "Measure"
        }
      ]
    }
  ]
}