← check operator page · validation/check/imbalance/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

check ( DS_1 >= DS_2 imbalance DS_1 - DS_2 ) with no output, on two data sets of 12 data points.

Manual:

Check, Example 1, output verbatim: the result has "the Measure imbalance that contains the specified imbalance", and "If not specified then output is all".

Expected:

all 12 data points, bool_var being DS_1 >= DS_2 and imbalance DS_1 - DS_2: false with -8, -3, -25 and -15 on 2010 I, 2013 I, 2010 D and 2014 D, true with 5 on 2012 D, and true with 0 where the two are equal. errorcode and errorlevel are null, as none is given.

script.vtl ⇩

DS_r := check ( DS_1 >= DS_2 imbalance DS_1 - DS_2 );

input/DS_1.csv ⇩

Id_1Id_2Me_1
2010I1
2011I2
2012I10
2013I4
2014I5
2015I6
2010D25
2011D35
2012D45
2013D55
2014D50
2015D75

input/DS_1.json ⇩

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

input/DS_2.csv ⇩

Id_1Id_2Me_1
2010I9
2011I2
2012I10
2013I7
2014I5
2015I6
2010D50
2011D35
2012D40
2013D55
2014D65
2015D75

input/DS_2.json ⇩

{
  "datasets": [
    {
      "name": "DS_2",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "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_2bool_varimbalanceerrorcodeerrorlevel
2010Ifalse-8
2011Itrue0
2012Itrue0
2013Ifalse-3
2014Itrue0
2015Itrue0
2010Dfalse-25
2011Dtrue0
2012Dtrue5
2013Dtrue0
2014Dfalse-15
2015Dtrue0

expected/DS_r.json ⇩

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