You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/get-started/thresholds.qmd
+32-22
Original file line number
Diff line number
Diff line change
@@ -5,34 +5,39 @@ html-table-processing: none
5
5
---
6
6
7
7
::::: {.callout}
8
-
This is a work in progress. It's just an outline for now.
8
+
This is a work in progress. And some of this article is just an outline for now.
9
9
:::
10
10
11
-
Thresholds enable you to signal failure at different severity levels. In the near future, thresholds will be able to trigger custom actions. For example, when testing a column for NULLs with `col_vals_not_null()` you might want to warn on any NULLs and stop where there are 10% NULLs in the column.
11
+
Thresholds enable you to signal failure at different severity levels. In the near future, thresholds
12
+
will be able to trigger custom actions. For example, when testing a column for Null/missing values
13
+
with `col_vals_not_null()` you might want to warn on any missing values and stop where there are
The code uses `thresholds=(1, 0.1)` to set a `WARN` threshold of 1 and a `STOP` threshold of 10% failing test units. Notice these pieces in the validation table:
28
+
The code uses `thresholds=(1, 0.1)` to set a `warn` threshold of `1` and a `stop` threshold of `0.1`
29
+
(which is 10%) failing test units. Notice these pieces in the validation table:
26
30
27
-
- The `FAIL` column shows that x tests units have failed
28
-
- The `W` column (short for `WARN`) shows a filled yellow circle indicating it's reached threshold
29
-
- The `S` column (short for `STOP`) shows an open red circle indicating it's below threshold
31
+
- The `FAIL` column shows that 2 tests units have failed
32
+
- The `W` column (short for `warn`) shows a filled yellow circle indicating it's reached threshold
33
+
- The `S` column (`stop`) shows an open red circle indicating it's below threshold
30
34
31
-
The one final threshold, `N` (`NOTIFY`), wasn't set so appears on the validation table as a dash.
35
+
The one final threshold, `N` (`notify`), wasn't set so appears on the validation table as a dash.
32
36
33
-
## Using the `Validation(threshold=)`argument
37
+
## Using the `Validation(threshold=)`Argument
34
38
35
-
We can also define thresholds globally. This means that every validation step will re-use the same set of threshold values.
39
+
We can also define thresholds globally. This means that every validation step will re-use the same
40
+
set of threshold values.
36
41
37
42
```python
38
43
import pointblank as pb
@@ -47,16 +52,21 @@ validation_2 = (
47
52
validation_2
48
53
```
49
54
50
-
In this, both the `col_vals_not_null()` and `col_vals_gt()` steps will use the `thresholds=` value set in the `Validate()` call. Now, if you want to override these global threshold values for a given validation step, you can always use `threshold=` argument when calling a validation method.
55
+
In this, both the `col_vals_not_null()` and `col_vals_gt()` steps will use the `thresholds=` value
56
+
set in the `Validate()` call. Now, if you want to override these global threshold values for a given
57
+
validation step, you can always use the `threshold=` argument when calling a validation method (the
58
+
argument is present in every validation method).
51
59
52
-
## Defining Thresholds
60
+
## Ways to Define Thresholds
53
61
54
-
### Threshold shorthands
55
62
56
-
The fastest way to define a threshold is to use a tuple with entries for `warn`, `stop`, and `nofify` levels.
63
+
### Using a Tuple
64
+
65
+
The fastest way to define a threshold is to use a tuple with entries for `warn`, `stop`, and
66
+
`nofify` levels.
57
67
58
68
```python
59
-
#[WARN, STOP, NOTIFY]
69
+
#(warn, stop, notify)
60
70
threshold = (1, 2, 3)
61
71
62
72
Validate(data=..., threshold=threshold)
@@ -67,17 +77,19 @@ Note that a shorter tuple or even single values are also allowed:
67
77
-`(1, 2)`: `warn` state at 1 failing test unit, `stop` state at 2 failing test units
68
78
-`1` or `(1, )`: `warn` state at 1 failing test unit
69
79
70
-
### Threshold cutoff values
80
+
### The `Threshold` Class
81
+
82
+
83
+
## Threshold Cutoff Values
71
84
72
85
Threshold values can be specified in two ways:
73
86
74
87
- percentage: a decimal value like 0.1 to mean 10% test units failed
75
88
- number: a fixed number of test units failed
76
89
77
-
Threshold cutoffs are inclusive so any value of failing test units greater than or equal to the cutoff will result in triggering the threshold. So if a threshold is defined with a cutoff value of `5`, then 5 failing test units will result in threshold.
78
-
79
-
### The `Threshold` class
80
-
90
+
Threshold cutoffs are inclusive so any value of failing test units greater than or equal to the
91
+
cutoff will result in triggering the threshold. So if a threshold is defined with a cutoff value of
92
+
`5`, then 5 failing test units will result in threshold.
81
93
82
94
## Triggering Actions
83
95
@@ -90,5 +102,3 @@ This is not currently implemented.
0 commit comments