Check datapoint · check_datapoint
---
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 datapoint · check_datapoint<br/>🟢7"]:::ok
v_output_default["check_datapoint(DS, DPR)"]:::ok
v_invalid["check_datapoint(DS, DPR invalid)"]:::ok
v_all["check_datapoint(DS, DPR all)"]:::ok
v_all_measures["check_datapoint(DS, DPR all_measures)"]:::ok
v_components["check_datapoint(DS, DPR components C1, C2)"]:::ok
v_errorcode["check_datapoint(DS, DPR all), rules with errorcode"]:::ok
v_errorlevel["check_datapoint(DS, DPR all), rules with errorlevel"]:::ok
v_output_default --- O
v_invalid --- O
v_all --- O
v_all_measures --- O
O --- v_components
O --- v_errorcode
O --- v_errorlevel
click v_output_default href "#form-output-default"
click v_invalid href "#form-invalid"
click v_all href "#form-all"
click v_all_measures href "#form-all-measures"
click v_components href "#form-components"
click v_errorcode href "#form-errorcode"
click v_errorlevel href "#form-errorlevel"
Types
Takes datapoint ruleset, any scalar · Gives integer, string, boolean, any type
Comes from: any operator that returns a value
Comes from · datapoint ruleset — 1 operator in 1 block 🟢1
Definitions (VTL-DL) (1) 🟢1
Goes to: whatever takes its input's type
Goes to · integer, string, boolean — 69 operators in 13 blocks 🟢69
General purpose operators (1) 🟢1
Join operators (4) 🟢4
String operators (11) 🟢11
||Whitespace removal trimLeading whitespace removal ltrimTrailing whitespace removal rtrimUpper case conversion upperLower case conversion lowerSub-string extraction substrString pattern replacement replaceString pattern location instrString length lengthString distances string_distanceNumeric 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 (2) 🟢2
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (4) 🟢4
Goes to · operators that take any scalar — 34 operators in 6 blocks 🟢34
General purpose operators (6) 🟢6
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (5) 🟢5
Conditional operators (1) 🟢1
Forms
check_datapoint(DS, DPR) 🟢 · any scalar, datapoint ruleset → any type, string, integer
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
check_datapoint ( DS_1, dpr1 )with no output, in the manual’s script, which callsdpr1before its definition.- Manual:
Check datapoint, Example 1, output verbatim: “If not specified then output is assumed to be invalid”; the User Manual: “The order in which the user defines the Transformations … cannot override the order of execution”.
- Expected:
(2011, l, DEBIT) only: rule 2,
when Id_3 = "DEBIT" then Me_1 >= 0, is false on -2, witherrorcodeBad debit, and rule 1 holds everywhere, on the DEBIT data points by its false antecedent.ruleidis 2, “the progressive order number of the Rule in the Ruleset” (define datapoint ruleset), as the rules have no names, and the nullerrorlevelInteger, as the manual types it.
DS_r := check_datapoint ( DS_1, dpr1 );define datapoint ruleset dpr1 ( variable Id_3, Me_1 ) is
when Id_3 = "CREDIT" then Me_1 >= 0 errorcode "Bad credit"
; when Id_3 = "DEBIT" then Me_1 >= 0 errorcode "Bad debit"
end datapoint ruleset;
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| 2011 | l | CREDIT | 10 |
| 2011 | l | DEBIT | -2 |
| 2012 | l | CREDIT | 10 |
| 2012 | l | DEBIT | 2 |
| Id_1 | Id_2 | Id_3 | Me_1 | ruleid | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 2011 | l | DEBIT | -2 | 2 | Bad debit |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_datapoint(DS, DPR invalid) 🟢 · any scalar, datapoint ruleset → any type, string, integer
False results with the measures 🟢 pandas ✅ · DuckDB ✅
- Tests:
DPR_1,R1 : when Id_2 = "A" then Me_1 > 0andR2 : Me_1 < 100, on (1, A, 10), (2, A, -5), (3, B, 200) and (4, A, null), with outputinvalid.- Manual:
Check datapoint: invalid “contains a Data Point for each Data Point of op and each Rule in dpr that evaluates to false on that Data Point. The resulting Data Set has the Measures of op”; on a false antecedent “the result is considered as valid (true)” (define datapoint ruleset).
- Expected:
(2, A, R1) and (3, B, R2),
ruleidthe rule name, withMe_1-5 and 200 and nobool_var: (3, B) passes R1 by its false antecedent, and (4, A) is null on both rules.errorcodeanderrorlevelare null,errorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define datapoint ruleset DPR_1 ( variable Id_2, Me_1 ) is
R1 : when Id_2 = "A" then Me_1 > 0
; R2 : Me_1 < 100
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_1 invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | Me_1 | errorcode | errorlevel |
|---|---|---|---|---|---|
| 2 | A | R1 | -5 | ||
| 3 | B | R2 | 200 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_datapoint(DS, DPR all) 🟢 · any scalar, datapoint ruleset → boolean, string, integer
Manual example 2 🟢 pandas ✅ · DuckDB ✅
- Tests:
check_datapoint ( DS_1, dpr1 all ), in the manual’s script, which callsdpr1before its definition.- Manual:
Check datapoint, Example 2, output verbatim: all “contains a data point for each Data Point of op and each Rule in dpr. The resulting Data Set has the boolean Measure bool_var”; the User Manual: “The order in which the user defines the Transformations … cannot override the order of execution”.
- Expected:
8 data points, one per data point and rule: rule 1 true on all four, the DEBIT ones by its false antecedent, and rule 2 false only on (2011, l, DEBIT), -2, with
errorcodeBad debit, null on the valid results.ruleidis 1 or 2, “the progressive order number of the Rule in the Ruleset” (define datapoint ruleset), as the rules have no names, and the nullerrorlevelInteger, as the manual types it.
DS_r := check_datapoint ( DS_1, dpr1 all );define datapoint ruleset dpr1 ( variable Id_3, Me_1 ) is
when Id_3 = "CREDIT" then Me_1 >= 0 errorcode "Bad credit"
; when Id_3 = "DEBIT" then Me_1 >= 0 errorcode "Bad debit"
end datapoint ruleset;
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| 2011 | l | CREDIT | 10 |
| 2011 | l | DEBIT | -2 |
| 2012 | l | CREDIT | 10 |
| 2012 | l | DEBIT | 2 |
| Id_1 | Id_2 | Id_3 | bool_var | ruleid | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 2011 | l | CREDIT | true | 1 | ||
| 2011 | l | DEBIT | true | 1 | ||
| 2012 | l | CREDIT | true | 1 | ||
| 2012 | l | DEBIT | true | 1 | ||
| 2011 | l | CREDIT | true | 2 | ||
| 2011 | l | DEBIT | false | 2 | Bad debit | |
| 2012 | l | CREDIT | true | 2 | ||
| 2012 | l | DEBIT | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_datapoint(DS, DPR all_measures) 🟢 · any scalar, datapoint ruleset → any type, boolean, string, integer
Every result with the measures 🟢 pandas ✅ · DuckDB ✅
- Tests:
DPR_1,R1 : when Id_2 = "A" then Me_1 > 0andR2 : Me_1 < 100, on (1, A, 10), (2, A, -5), (3, B, 200) and (4, A, null), with outputall_measures.- Manual:
Check datapoint: all_measures “contains a Data Point for each Data Point of op and each Rule in dpr. The resulting dataset has the Measures of op and the boolean Measure bool_var”, which is “true, false or null”; on a false antecedent “the result is considered as valid (true)” (define datapoint ruleset).
- Expected:
8 data points, one per data point and rule,
ruleidthe rule name, withMe_1andbool_var: false on (2, A, R1) and (3, B, R2), null on both rules of (4, A), and true elsewhere, (3, B, R1) by its false antecedent.errorcodeanderrorlevelare null,errorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define datapoint ruleset DPR_1 ( variable Id_2, Me_1 ) is
R1 : when Id_2 = "A" then Me_1 > 0
; R2 : Me_1 < 100
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_1 all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | Me_1 | bool_var | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | true | ||
| 1 | A | R2 | 10 | true | ||
| 2 | A | R1 | -5 | false | ||
| 2 | A | R2 | -5 | true | ||
| 3 | B | R1 | 200 | true | ||
| 3 | B | R2 | 200 | false | ||
| 4 | A | R1 | ||||
| 4 | A | R2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_datapoint(DS, DPR components C1, C2) 🟢 · any scalar, datapoint ruleset → any type, boolean, string, integer
Listed variables change nothing 🟢 pandas ✅ · DuckDB ✅
- Tests:
DPR_1on the variablesId_2andMe_1,R1 : when Id_2 = "A" then Me_1 > 0andR2 : Me_1 < 100, called withcomponents Id_2, Me_1, in their order, and no output, on (1, A, 10), (2, A, -5), (3, B, 200) and (4, A, null).- Manual:
Check datapoint: “If dpr is defined on Variables then listComp is the list of Components of op to be associated (in positional order) to the conditioning Variables defined in dpr (for documentation purposes)”, and “If not specified then output is assumed to be invalid”.
- Expected:
the output of False results with the measures, form
invalid: (2, A, R1) and (3, B, R2),ruleidthe rule name, withMe_1-5 and 200, as (3, B) passes R1 by its false antecedent.errorcodeanderrorlevelare null,errorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define datapoint ruleset DPR_1 ( variable Id_2, Me_1 ) is
R1 : when Id_2 = "A" then Me_1 > 0
; R2 : Me_1 < 100
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_1 components Id_2, Me_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | Me_1 | errorcode | errorlevel |
|---|---|---|---|---|---|
| 2 | A | R1 | -5 | ||
| 3 | B | R2 | 200 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Value domains bound to components 🛡️ pandas 🛡 1-2-8 · DuckDB 🛡 1-2-8
SemanticError 1-2-8: Missing value domain 'VD_M' definition, please provide an structure. Please check transformation with output Dataset DS_r
- Tests:
DPR_2, the rules ofDPR_1written on the value domainsVD_2andVD_M, bound toId_2andMe_1bycomponents Id_2, Me_1, with no output.- Manual:
Check datapoint: “If dpr is defined on Value Domains then it is mandatory to specify listComp”, the Components of op “to be associated (in positional order) to the conditioning Value Domains defined in dpr”.
- Expected:
the output of Listed variables change nothing: (2, A, R1) and (3, B, R2), with
Me_1-5 and 200, nullerrorcodeand the nullerrorlevelInteger.VD_2holds A and B, the values ofId_2, andVD_M, the numbers ofMe_1, has no file: a value domain file lists values, and no rule tests membership ofVD_M.
define datapoint ruleset DPR_2 ( valuedomain VD_2, VD_M ) is
R1 : when VD_2 = "A" then VD_M > 0
; R2 : VD_M < 100
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_2 components Id_2, Me_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | Me_1 | errorcode | errorlevel |
|---|---|---|---|---|---|
| 2 | A | R1 | -5 | ||
| 3 | B | R2 | 200 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/VD_2.json · example page ↗
check_datapoint(DS, DPR all), rules with errorcode 🟢 · any scalar, datapoint ruleset → boolean, string, integer
Code only on false results 🟢 pandas ✅ · DuckDB ✅
- Tests:
DPR_1,R1 : when Id_2 = "A" then Me_1 > 0andR2 : Me_1 < 100, witherrorcode "E1"on R1 and"E2"on R2, on (1, A, 10), (2, A, -5), (3, B, 200) and (4, A, null), with outputall.- Manual:
Check datapoint: “the Measure errorcode that contains the errorcode specified in the rule; if the Measure bool_var is true or null then errorcode is null”; on a false antecedent “the result is considered as valid (true)” (define datapoint ruleset).
- Expected:
8 data points,
ruleidthe rule name:errorcodeE1on (2, A, R1) andE2on (3, B, R2), the false results, and null on the true ones, (3, B, R1) by its false antecedent, and on the null ones of (4, A). The nullerrorlevelis Integer, the manual’s default without errorlevel_vd (#1256).
define datapoint ruleset DPR_1 ( variable Id_2, Me_1 ) is
R1 : when Id_2 = "A" then Me_1 > 0 errorcode "E1"
; R2 : Me_1 < 100 errorcode "E2"
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_1 all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | bool_var | errorcode | errorlevel |
|---|---|---|---|---|---|
| 1 | A | R1 | true | ||
| 1 | A | R2 | true | ||
| 2 | A | R1 | false | E1 | |
| 2 | A | R2 | true | ||
| 3 | B | R1 | true | ||
| 3 | B | R2 | false | E2 | |
| 4 | A | R1 | |||
| 4 | A | R2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_datapoint(DS, DPR all), rules with errorlevel 🟢 · any scalar, datapoint ruleset → boolean, string, integer
Integer level on false results 🟢 pandas ✅ · DuckDB ✅
- Tests:
DPR_1,R1 : when Id_2 = "A" then Me_1 > 0andR2 : Me_1 < 100, witherrorlevel 1on R1 and2on R2, on (1, A, 10), (2, A, -5), (3, B, 200) and (4, A, null), with outputall.- Manual:
Check datapoint: “the Measure errorlevel that contains the errorlevel specified in the rule; if the Measure bool_var is true or null then errorlevel is null”.
- Expected:
errorlevel1 on (2, A, R1) and 2 on (3, B, R2), the false results, and null elsewhere, typed Integer as in the manual’s example structures, Check datapoint Examples 1 and 2 and Check hierarchy Example 1, and the manual’s default without errorlevel_vd (#1256).
define datapoint ruleset DPR_1 ( variable Id_2, Me_1 ) is
R1 : when Id_2 = "A" then Me_1 > 0 errorlevel 1
; R2 : Me_1 < 100 errorlevel 2
end datapoint ruleset;
DS_r := check_datapoint ( DS_1, DPR_1 all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 2 | A | -5 |
| 3 | B | 200 |
| 4 | A |
| Id_1 | Id_2 | ruleid | bool_var | errorcode | errorlevel |
|---|---|---|---|---|---|
| 1 | A | R1 | true | ||
| 1 | A | R2 | true | ||
| 2 | A | R1 | false | 1 | |
| 2 | A | R2 | true | ||
| 3 | B | R1 | true | ||
| 3 | B | R2 | false | 2 | |
| 4 | A | R1 | |||
| 4 | A | R2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗