Check hierarchy · check_hierarchy

🟢 40 of 40 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc3 (9e1c81a6) · pandas 2.3.3 · DuckDB 1.5.5
🟢 all ok🟡 partially implemented🛡️ refused with an error🔴 not implemented or crash🔵 engines differ ✅ match · ❌ wrong result · 🛡 guarded error (code) · 💥 crash · 📌 team decision
        ---
config:
  flowchart:
    useMaxWidth: false

---
flowchart LR
    classDef ok fill:#d4edda,stroke:#28a745,color:#000
    classDef partial fill:#fff3cd,stroke:#ffc107,color:#000
    classDef refused fill:#d4edda,stroke:#28a745,stroke-width:3px,stroke-dasharray: 2 2,color:#000
    classDef missing fill:#f8d7da,stroke:#dc3545,color:#000
    classDef diverge fill:#cce5ff,stroke:#007bff,color:#000
    classDef block fill:#2b3a4a,stroke:#2b3a4a,color:#fff,font-weight:bold
    classDef ext fill:#fff,stroke:#666,color:#000,stroke-dasharray: 5 5
    O["Check hierarchy · check_hierarchy<br/>🟢40"]:::ok
    v_non_null_dataset_invalid["check_hierarchy(DS, HR non_null dataset invalid)"]:::ok
    v_non_null_dataset_all["check_hierarchy(DS, HR non_null dataset all)"]:::ok
    v_non_null_dataset_all_measures["check_hierarchy(DS, HR non_null dataset all_measures)"]:::ok
    v_non_null_dataset_priority_invalid["check_hierarchy(DS, HR non_null dataset_priority invalid)"]:::ok
    v_non_null_dataset_priority_all["check_hierarchy(DS, HR non_null dataset_priority all)"]:::ok
    v_non_null_dataset_priority_all_measures["check_hierarchy(DS, HR non_null dataset_priority all_measures)"]:::ok
    v_non_zero_dataset_invalid["check_hierarchy(DS, HR non_zero dataset invalid)"]:::ok
    v_non_zero_dataset_all["check_hierarchy(DS, HR non_zero dataset all)"]:::ok
    v_non_zero_dataset_all_measures["check_hierarchy(DS, HR non_zero dataset all_measures)"]:::ok
    v_non_zero_dataset_priority_invalid["check_hierarchy(DS, HR non_zero dataset_priority invalid)"]:::ok
    v_non_zero_dataset_priority_all["check_hierarchy(DS, HR non_zero dataset_priority all)"]:::ok
    v_non_zero_dataset_priority_all_measures["check_hierarchy(DS, HR non_zero dataset_priority all_measures)"]:::ok
    v_partial_null_dataset_invalid["check_hierarchy(DS, HR partial_null dataset invalid)"]:::ok
    v_partial_null_dataset_all["check_hierarchy(DS, HR partial_null dataset all)"]:::ok
    v_partial_null_dataset_all_measures["check_hierarchy(DS, HR partial_null dataset all_measures)"]:::ok
    v_partial_null_dataset_priority_invalid["check_hierarchy(DS, HR partial_null dataset_priority invalid)"]:::ok
    v_partial_null_dataset_priority_all["check_hierarchy(DS, HR partial_null dataset_priority all)"]:::ok
    v_partial_null_dataset_priority_all_measures["check_hierarchy(DS, HR partial_null dataset_priority all_measures)"]:::ok
    v_partial_zero_dataset_invalid["check_hierarchy(DS, HR partial_zero dataset invalid)"]:::ok
    v_partial_zero_dataset_all["check_hierarchy(DS, HR partial_zero dataset all)"]:::ok
    v_partial_zero_dataset_all_measures["check_hierarchy(DS, HR partial_zero dataset all_measures)"]:::ok
    v_partial_zero_dataset_priority_invalid["check_hierarchy(DS, HR partial_zero dataset_priority invalid)"]:::ok
    v_partial_zero_dataset_priority_all["check_hierarchy(DS, HR partial_zero dataset_priority all)"]:::ok
    v_partial_zero_dataset_priority_all_measures["check_hierarchy(DS, HR partial_zero dataset_priority all_measures)"]:::ok
    v_always_null_dataset_invalid["check_hierarchy(DS, HR always_null dataset invalid)"]:::ok
    v_always_null_dataset_all["check_hierarchy(DS, HR always_null dataset all)"]:::ok
    v_always_null_dataset_all_measures["check_hierarchy(DS, HR always_null dataset all_measures)"]:::ok
    v_always_null_dataset_priority_invalid["check_hierarchy(DS, HR always_null dataset_priority invalid)"]:::ok
    v_always_null_dataset_priority_all["check_hierarchy(DS, HR always_null dataset_priority all)"]:::ok
    v_always_null_dataset_priority_all_measures["check_hierarchy(DS, HR always_null dataset_priority all_measures)"]:::ok
    v_always_zero_dataset_invalid["check_hierarchy(DS, HR always_zero dataset invalid)"]:::ok
    v_always_zero_dataset_all["check_hierarchy(DS, HR always_zero dataset all)"]:::ok
    v_always_zero_dataset_all_measures["check_hierarchy(DS, HR always_zero dataset all_measures)"]:::ok
    v_always_zero_dataset_priority_invalid["check_hierarchy(DS, HR always_zero dataset_priority invalid)"]:::ok
    v_always_zero_dataset_priority_all["check_hierarchy(DS, HR always_zero dataset_priority all)"]:::ok
    v_always_zero_dataset_priority_all_measures["check_hierarchy(DS, HR always_zero dataset_priority all_measures)"]:::ok
    v_condition["check_hierarchy(DS, HR condition C)"]:::ok
    v_rule["check_hierarchy(DS, HR rule C)"]:::ok
    v_errorcode["check_hierarchy(DS, HR partial_zero dataset all), rules with errorcode"]:::ok
    v_errorlevel["check_hierarchy(DS, HR partial_zero dataset all), rules with errorlevel"]:::ok
    v_non_null_dataset_invalid --- O
    v_non_null_dataset_all --- O
    v_non_null_dataset_all_measures --- O
    v_non_null_dataset_priority_invalid --- O
    v_non_null_dataset_priority_all --- O
    v_non_null_dataset_priority_all_measures --- O
    v_non_zero_dataset_invalid --- O
    v_non_zero_dataset_all --- O
    v_non_zero_dataset_all_measures --- O
    v_non_zero_dataset_priority_invalid --- O
    v_non_zero_dataset_priority_all --- O
    v_non_zero_dataset_priority_all_measures --- O
    v_partial_null_dataset_invalid --- O
    v_partial_null_dataset_all --- O
    v_partial_null_dataset_all_measures --- O
    v_partial_null_dataset_priority_invalid --- O
    v_partial_null_dataset_priority_all --- O
    v_partial_null_dataset_priority_all_measures --- O
    v_partial_zero_dataset_invalid --- O
    v_partial_zero_dataset_all --- O
    O --- v_partial_zero_dataset_all_measures
    O --- v_partial_zero_dataset_priority_invalid
    O --- v_partial_zero_dataset_priority_all
    O --- v_partial_zero_dataset_priority_all_measures
    O --- v_always_null_dataset_invalid
    O --- v_always_null_dataset_all
    O --- v_always_null_dataset_all_measures
    O --- v_always_null_dataset_priority_invalid
    O --- v_always_null_dataset_priority_all
    O --- v_always_null_dataset_priority_all_measures
    O --- v_always_zero_dataset_invalid
    O --- v_always_zero_dataset_all
    O --- v_always_zero_dataset_all_measures
    O --- v_always_zero_dataset_priority_invalid
    O --- v_always_zero_dataset_priority_all
    O --- v_always_zero_dataset_priority_all_measures
    O --- v_condition
    O --- v_rule
    O --- v_errorcode
    O --- v_errorlevel
    click v_non_null_dataset_invalid href "#form-non-null-dataset-invalid"
    click v_non_null_dataset_all href "#form-non-null-dataset-all"
    click v_non_null_dataset_all_measures href "#form-non-null-dataset-all-measures"
    click v_non_null_dataset_priority_invalid href "#form-non-null-dataset-priority-invalid"
    click v_non_null_dataset_priority_all href "#form-non-null-dataset-priority-all"
    click v_non_null_dataset_priority_all_measures href "#form-non-null-dataset-priority-all-measures"
    click v_non_zero_dataset_invalid href "#form-non-zero-dataset-invalid"
    click v_non_zero_dataset_all href "#form-non-zero-dataset-all"
    click v_non_zero_dataset_all_measures href "#form-non-zero-dataset-all-measures"
    click v_non_zero_dataset_priority_invalid href "#form-non-zero-dataset-priority-invalid"
    click v_non_zero_dataset_priority_all href "#form-non-zero-dataset-priority-all"
    click v_non_zero_dataset_priority_all_measures href "#form-non-zero-dataset-priority-all-measures"
    click v_partial_null_dataset_invalid href "#form-partial-null-dataset-invalid"
    click v_partial_null_dataset_all href "#form-partial-null-dataset-all"
    click v_partial_null_dataset_all_measures href "#form-partial-null-dataset-all-measures"
    click v_partial_null_dataset_priority_invalid href "#form-partial-null-dataset-priority-invalid"
    click v_partial_null_dataset_priority_all href "#form-partial-null-dataset-priority-all"
    click v_partial_null_dataset_priority_all_measures href "#form-partial-null-dataset-priority-all-measures"
    click v_partial_zero_dataset_invalid href "#form-partial-zero-dataset-invalid"
    click v_partial_zero_dataset_all href "#form-partial-zero-dataset-all"
    click v_partial_zero_dataset_all_measures href "#form-partial-zero-dataset-all-measures"
    click v_partial_zero_dataset_priority_invalid href "#form-partial-zero-dataset-priority-invalid"
    click v_partial_zero_dataset_priority_all href "#form-partial-zero-dataset-priority-all"
    click v_partial_zero_dataset_priority_all_measures href "#form-partial-zero-dataset-priority-all-measures"
    click v_always_null_dataset_invalid href "#form-always-null-dataset-invalid"
    click v_always_null_dataset_all href "#form-always-null-dataset-all"
    click v_always_null_dataset_all_measures href "#form-always-null-dataset-all-measures"
    click v_always_null_dataset_priority_invalid href "#form-always-null-dataset-priority-invalid"
    click v_always_null_dataset_priority_all href "#form-always-null-dataset-priority-all"
    click v_always_null_dataset_priority_all_measures href "#form-always-null-dataset-priority-all-measures"
    click v_always_zero_dataset_invalid href "#form-always-zero-dataset-invalid"
    click v_always_zero_dataset_all href "#form-always-zero-dataset-all"
    click v_always_zero_dataset_all_measures href "#form-always-zero-dataset-all-measures"
    click v_always_zero_dataset_priority_invalid href "#form-always-zero-dataset-priority-invalid"
    click v_always_zero_dataset_priority_all href "#form-always-zero-dataset-priority-all"
    click v_always_zero_dataset_priority_all_measures href "#form-always-zero-dataset-priority-all-measures"
    click v_condition href "#form-condition"
    click v_rule href "#form-rule"
    click v_errorcode href "#form-errorcode"
    click v_errorlevel href "#form-errorlevel"
    

Types

Takes number, hierarchical ruleset · Gives number, integer, string, boolean

Viral attributes: combined with the propagation rules → Viral propagation

Comes from · number — 44 operators in 6 blocks 🟢44
General purpose operators (2) 🟢2
String operators (3) 🟢3
Numeric operators (18) 🟢18
Time operators (9) 🟢9
Aggregate and Analytic operators (10) 🟢10
Data validation operators (2) 🟢2
Comes from · operators that return any type (their input's) — 37 operators in 8 blocks 🟢37
General purpose operators (5) 🟢5
Join operators (4) 🟢4
Time operators (3) 🟢3
Set operators (4) 🟢4
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (8) 🟢8
Conditional operators (3) 🟢3
Clause operators (9) 🟢9
Comes from · hierarchical ruleset — 1 operator in 1 block 🟢1
Definitions (VTL-DL) (1) 🟢1
Goes to · number, integer, string, boolean — 68 operators in 13 blocks 🟢68
General purpose operators (1) 🟢1
Join operators (4) 🟢4
String operators (11) 🟢11
Numeric operators (18) 🟢18
Comparison operators (1) 🟢1
Boolean operators (4) 🟢4
Time operators (6) 🟢6
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (13) 🟢13
Data validation operators (1) 🟢1
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (4) 🟢4
Goes to · operators that take any scalar — 35 operators in 7 blocks 🟢35
General purpose operators (6) 🟢6
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (5) 🟢5
Data validation operators (1) 🟢1
Conditional operators (1) 🟢1
Clause operators (7) 🟢7

Forms

check_hierarchy(DS, HR non_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_null a data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3) only; R7 F > B is true, and the other rules have a null or missing item. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_null a data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 B >= D false (imbalance -3) and R7 F > B true (2) only, as the other rules have a null or missing item. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1BR3false-3
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_null a data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 B >= D false (imbalance -3) and R7 F > B true (2) only, as the other rules have a null or missing item. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1BR3false3-3
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_null produces a data point “when all the items involved in the comparison exist and have not null Measure value”.

Expected:

as for the form non_null_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_null produces a data point “when all the items involved in the comparison exist and have not null Measure value”.

Expected:

as for the form non_null_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1BR3false-3
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_null produces a data point “when all the items involved in the comparison exist and have not null Measure value”.

Expected:

as for the form non_null_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1BR3false3-3
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_zero a data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3) and R6 D <= X (6, 6), X counting as 0; R7 is true, R1 and R2 null, as C stays null, and R4, with E 0 and X missing, and R5, with no item, give none. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_zero a data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 false (imbalance -3), R6 D <= X false (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R4, with E 0 and X missing, and R5, with no item. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in non_zero a data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 false (imbalance -3), R6 D <= X false (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R4, with E 0 and X missing, and R5, with no item. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR110
1CR2
1BR3false3-3
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_zero produces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.

Expected:

as for the form non_zero_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_zero produces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.

Expected:

as for the form non_zero_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1CR2
1BR3false-3
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR non_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; non_zero produces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.

Expected:

as for the form non_zero_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1CR2
1BR3false3-3
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Missing items count as null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_null a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3) only; R7 is true, R1, R2, R4 and R6 null, with C null or X missing, and R5, with no item found, gives none. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Missing items count as null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_null a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 false (imbalance -3), R7 true (2), R1, R2, R4 and R6 null, with C null or X missing, and none for R5, with no item found. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3
1ER4
1DR6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Missing items count as null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_null a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 false (imbalance -3), R7 true (2), R1, R2, R4 and R6 null, with C null or X missing, and none for R5, with no item found. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR110
1CR2
1BR3false3-3
1ER40
1DR66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_null produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_null_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_null produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_null_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1CR2
1BR3false-3
1ER4
1DR6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_null produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_null_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1CR2
1BR3false3-3
1ER40
1DR66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_zero a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3), R4 E > X (0, 0) and R6 D <= X (6, 6), X counting as 0; R7 is true, R1 and R2 null, as C stays null, and R5, with no item found, gives none. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3
1ER400
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_zero a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 false (imbalance -3), R4 E > X false (0) and R6 D <= X false (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R5, with no item found. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3
1ER4false0
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in partial_zero a data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 false (imbalance -3), R4 E > X false (0) and R6 D <= X false (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R5, with no item found. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR110
1CR2
1BR3false3-3
1ER4false00
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_zero produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_zero_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3
1ER400
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_zero produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_zero_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1CR2
1BR3false-3
1ER4false0
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; partial_zero produces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.

Expected:

as for the form partial_zero_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1CR2
1BR3false3-3
1ER4false00
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_null a data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3) only; R7 is true, and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_null a data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 false (imbalance -3), R7 true (2), and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3
1ER4
1YR5
1DR6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_null a data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 false (imbalance -3), R7 true (2), and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR110
1CR2
1BR3false3-3
1ER40
1YR5
1DR66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_null produces a data point “in any case”.

Expected:

as for the form always_null_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_null produces a data point “in any case”.

Expected:

as for the form always_null_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1CR2
1BR3false-3
1ER4
1YR5
1DR6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_null produces a data point “in any case”.

Expected:

as for the form always_null_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1CR2
1BR3false3-3
1ER40
1YR5
1DR66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_zero a data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

the false results only, keyed by the left item and the rule, with Me_1, the value of the left item, and no bool_var: R3 B >= D (Me_1 3, imbalance -3), R4 E > X (0, 0), R5 Y < Z (0, 0) and R6 D <= X (6, 6), X, Y and Z counting as 0; R7 is true, and R1 and R2 null, as C stays null; R5’s Me_1 is 0, its missing left item counted as 0, a reading of the manual. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1BR33-3
1ER400
1YR500
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_zero a data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and no Me_1: R3 false (imbalance -3), R4 E > X, R5 Y < Z and R6 D <= X false (0, 0 and 6), X, Y and Z counting as 0, R7 true (2), and R1 and R2 null, as C stays null. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3
1ER4false0
1YR5false0
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken from DS_1.

Manual:

Check hierarchy: in always_zero a data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.

Expected:

every result, keyed by the left item and the rule, with bool_var and Me_1, the value of the left item: R3 false (imbalance -3), R4 E > X, R5 Y < Z and R6 D <= X false (0, 0 and 6), X, Y and Z counting as 0, R7 true (2), and R1 and R2 null, as C stays null; R5’s Me_1 is 0, its missing left item counted as 0, a reading of the manual. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR110
1CR2
1BR3false3-3
1ER4false00
1YR5false00
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_zero produces a data point “in any case”.

Expected:

as for the form always_zero_dataset_invalid, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy; R5’s Me_1 is 0, its missing left item counted as 0, a reading of the manual. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority invalid );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101
1BR33-3
1ER400
1YR500
1DR666

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_zero produces a data point “in any case”.

Expected:

as for the form always_zero_dataset_all, but R1 10 = 3 + 6 is false (imbalance 1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1false1
1CR2
1BR3false-3
1ER4false0
1YR5false0
1DR6false6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR always_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 on A 10, B 3, C null, D 6, E 0 and F 5, where the = rules define only A, in R1 A = B + C, and the null C, in R2 C = D + E: every other item comes from DS_1.

Manual:

Check hierarchy: with dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”; always_zero produces a data point “in any case”.

Expected:

as for the form always_zero_dataset_all_measures, but R1 10 = 3 + 6 is false (imbalance 1, Me_1 10): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as in hierarchy; R5’s Me_1 is 0, its missing left item counted as 0, a reading of the manual. The types are those of that form.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C
    ; R2 : C = D + E
    ; R3 : B >= D
    ; R4 : E > X
    ; R5 : Y < Z
    ; R6 : D <= X
    ; R7 : F > B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority all_measures );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varMe_1imbalanceerrorcodeerrorlevel
1AR1false101
1CR2
1BR3false3-3
1ER4false00
1YR5false00
1DR6false66
1FR7true52

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR condition C) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Conditioning variable named 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_2 on Id_2 conditioned by the variable Id_1, R1 : when Id_1 = 2 then A = B, called with condition Id_1 and the default non_null, dataset and invalid.

Manual:

Check hierarchy: on Variables, condComp “can be specified all the same if it is desired to show explicitly in the invocation which are the involved Components”; the leftCondition “defines the pre-condition for evaluating the left member Code Item (i.e., it is evaluated only when the leftCondition is true)” (define hierarchical ruleset).

Expected:

(2, A, R1) only, 7 = 4 being false, with Me_1 7 and imbalance 3: for Id_1 1 the rule is not evaluated, though 5 = 2 would be false, and invalid leaves such a rule out whatever it returns. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_2 ( variable condition Id_1 rule Id_2 ) is
    R1 : when Id_1 = 2 then A = B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_2 condition Id_1 );
Input DS_1
Id_1Id_2Me_1
1A5
1B2
2A7
2B4
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
2AR173

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

Conditioning value domain bound 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_3, the rule of HR_2 on the value domains VD_C and VD_1, R1 : when VD_C = 2 then A = B, bound with condition Id_1 rule Id_2, with the default mode, input and output.

Manual:

Check hierarchy: “If hr is defined on Value Domains then it is mandatory to specify the condition (if any in the ruleset hr) and the rule parameters”, whose Components “must take values on the Value Domains corresponding, in positional order, to the ones specified in the condition and rule parameter of hr”.

Expected:

the output of Conditioning variable named: (2, A, R1), 7 = 4 being false, with Me_1 7 and imbalance 3, as Id_1 1 fails the condition. VD_1 holds the 26 uppercase letters of the manual’s Example 1 and VD_C the values 1 and 2 of Id_1; imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_3 ( valuedomain condition VD_C rule VD_1 ) is
    R1 : when VD_C = 2 then A = B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_3 condition Id_1 rule Id_2 );
Input DS_1
Id_1Id_2Me_1
1A5
1B2
2A7
2B4
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
2AR173

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/VD_1.json · value_domains/VD_C.json · example page ↗

check_hierarchy(DS, HR rule C) 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

the manual’s HR_1, eleven rules on VD_1, “the 26 uppercase letters of the English language”, with rule Id_2 partial_null all.

Manual:

Check hierarchy, Example 1, with the erratum below: partial_null produces a data point “if at least one Data Point … of the rule is found (whichever is its Measure value)”; R080, with H found but null, follows this, not the mode table’s “If at least the involved Data Points is not null”.

Expected:

the error 1-3-2-3, “At op {op}: Vtl Script contains Cycles, no DAG established. Nodes involved: {nodes}”: R020 B = M + N + O, R070 G = B + C and R110 M <= G form a cycle, as a rule with <= or >= links its items as = does (team decision). The manual’s example is to be fixed.

script.vtl
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
    R010 : A = J + K + L errorlevel 5
    ; R020 : B = M + N + O errorlevel 5
    ; R030 : C = P + Q errorcode "XX" errorlevel 5
    ; R040 : D = R + S errorlevel 1
    ; R050 : E = T + U + V errorlevel 0
    ; R060 : F = Y + W + Z errorlevel 7
    ; R070 : G = B + C
    ; R080 : H = D + E errorlevel 0
    ; R090 : I = D + G errorcode "YY" errorlevel 0
    ; R100 : M >= N errorlevel 5
    ; R110 : M <= G errorlevel 5
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 rule Id_2 partial_null all );
Input DS_1
Id_1Id_2Me_1
2010A5
2010B11
2010C0
2010G19
2010H
2010I14
2010M2
2010N5
2010O4
2010P7
2010Q-7
2010S3
2010T9
2010U
2010V6

Expected error 1-3-2-3: At op {op}: Vtl Script contains Cycles, no DAG established. Nodes involved: {nodes}.

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/error.json · value_domains/VD_1.json · example page ↗

Value domain bound to identifier 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_2 on the value domain VD_1, R1 : A = B + C and R2 : C >= B, bound with rule Id_2 and the default non_null, dataset and invalid.

Manual:

Check hierarchy: ruleComp “is the Identifier Component of op to be associated to the rule Value Domain or Variable defined in hr”, and “If hr is defined on Value Domains then it is mandatory to specify the condition (if any in the ruleset hr) and the rule parameters”.

Expected:

(1, A, R1) only: 10 = 3 + 6 is false, with imbalance 1, while R2, 6 >= 3, holds. VD_1 holds the 26 uppercase letters of the manual’s Example 1; imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_2 ( valuedomain rule VD_1 ) is
    R1 : A = B + C
    ; R2 : C >= B
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_2 rule Id_2 );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C6
Expected DS_r
Id_1Id_2ruleidMe_1imbalanceerrorcodeerrorlevel
1AR1101

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/VD_1.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset all), rules with errorcode 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Code only on false results 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 and DS_1 of the <mode>_<input>_<output> forms (A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing), with errorcode "E<n>" on each rule R<n>, in partial_zero dataset all: three false results, a true one, two null ones, and none for R5, which has no item, so the question that separates always_* from partial_* stays in the grid.

Manual:

Check hierarchy: “the Measure errorcode, which contains the errorcode value specified in the Rule; if the Measure bool_var is true or null then errorcode is null”.

Expected:

E3, E4 and E6 on the false R3 3 >= 6, R4 0 > 0 and R6 6 <= 0, X counting as 0, and null on R1 and R2, null as C is null, and on R7, true. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual’s default without errorlevel_vd (#1256).

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C errorcode "E1"
    ; R2 : C = D + E errorcode "E2"
    ; R3 : B >= D errorcode "E3"
    ; R4 : E > X errorcode "E4"
    ; R5 : Y < Z errorcode "E5"
    ; R6 : D <= X errorcode "E6"
    ; R7 : F > B errorcode "E7"
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-3E3
1ER4false0E4
1DR6false6E6
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

check_hierarchy(DS, HR partial_zero dataset all), rules with errorlevel 🟢 · number, hierarchical ruleset → number, boolean, string, integer

Integer level on false results 🟢 pandas ✅ · DuckDB ✅
Tests:

HR_1 and DS_1 of the <mode>_<input>_<output> forms (A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing), with errorlevel <n> on each rule R<n>, in partial_zero dataset all, and Me_1 Integer, as in the manual’s Example 1.

Manual:

Check hierarchy: “the Measure errorlevel, which contains the errorlevel value specified in the Rule; if the Measure bool_var is true or null then errorlevel is null”; Subtraction: “If the type of both operands is integer then the result has type integer”.

Expected:

3, 4 and 6 on the false R3, R4 and R6, and null on R1, R2 and R7, typed Integer as in the manual’s example structures and the manual’s default without errorlevel_vd (#1256). imbalance, left minus right, is an Integer like Me_1.

script.vtl
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
    R1 : A = B + C errorlevel 1
    ; R2 : C = D + E errorlevel 2
    ; R3 : B >= D errorlevel 3
    ; R4 : E > X errorlevel 4
    ; R5 : Y < Z errorlevel 5
    ; R6 : D <= X errorlevel 6
    ; R7 : F > B errorlevel 7
end hierarchical ruleset;

DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
Input DS_1
Id_1Id_2Me_1
1A10
1B3
1C
1D6
1E0
1F5
Expected DS_r
Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
1AR1
1CR2
1BR3false-33
1ER4false04
1DR6false66
1FR7true2

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗