import pointblank as pb
import polars as pl
def orders_on(night, n_missing, n_negative):
orders = pl.DataFrame(
{
"id": range(1000),
"email": [None] * n_missing + ["a@example.com"] * (1000 - n_missing),
"amount": [-1.0] * n_negative + [20.0] * (1000 - n_negative),
}
)
return (
pb.Validate(data=orders, tbl_name="orders", label=f"Night {night}")
.col_vals_not_null(columns="email")
.col_vals_gt(columns="amount", value=0)
.rows_distinct()
.interrogate()
)
missing = [10, 12, 9, 11, 10, 13, 12]
negative = [2, 1, 3, 2, 2, 1, 59]
multi = pb.MultiValidate(
*[orders_on(night, m, n) for night, (m, n) in enumerate(zip(missing, negative), start=1)]
)MultiValidate.get_scorecard()
Get a scorecard of the data quality dimensions, with how each one changed over the runs.
Usage
MultiValidate.get_scorecard(
title=":default:",
lang=None,
)The scorecard has a row for each data quality dimension of the runs (like completeness or validity), with the score of the latest run, a small chart of the score over all the runs, and the change from the run before. It answers the questions a single run’s scorecard (see Validate.get_scorecard()) can’t: is this score normal for the table, and did it just change?
Each row has:
- dimension: the dimension, as a badge in its color
- score: the dimension’s score in the latest run (the share of its test units that passed), as a bar and a percentage, or an em dash if the latest run has no steps in the dimension
- trend: the score in each run that has the dimension, from the first run to the latest; the chart goes from 100% at the top down to the lowest score rounded down to a multiple of 10% (90% at the highest), so that a drop of a few points stands out
- change: the change in the score from the run before (of those with the dimension) to the latest run, in percentage points, in green for a rise and red for a drop (with both scores and their run numbers in the tooltip)
- units: the numbers of passing and of all test units of the dimension in the latest run
The runs are grouped by table (tbl_name= of Validate), and the latest run of a table is its last in the order of the MultiValidate object (as in the summary report of get_tabular_report()). With one table, the header has the health score of its latest run. With several, each table has a group of rows, and its label has that health score.
Parameters
title: str | None = ":default:"-
The title of the scorecard. The default,
":default:", gives a title in the language of the scorecard, with the name of the table if all runs have the same one. Use":tbl_name:"for just the name of the table,":none:"(orNone) for no title, or provide your own text (which can have Markdown). lang: str | None = None-
The language of the scorecard, as a two-letter code (e.g.,
"fr"). By default, it’s the language of the first run.
Returns
GT- A GT table (from the Great Tables package), which can be styled further or saved like any other.
Raises
ValueError-
If there are no runs, or if
lang=isn’t a supported language.
Examples
Here’s a week of nightly runs of a validation of an orders table, with a check for missing emails (completeness), a check that the amounts are positive (validity), and a check for duplicate rows (uniqueness). On the last night, some of the amounts are negative:
Its scorecard has a row for each of the three dimensions:
multi.get_scorecard()Dimension Scores — orders |
||||
Health Score: 97.63%2026-11-23 02:00:00 UTC – 2026-11-29 02:00:00 UTC |
||||
| DIMENSION | SCORE | TREND | CHANGE | UNITS |
|---|---|---|---|---|
| Completeness | 98.8% |
▲ 0.1 | 988 / 1000 | |
| Validity | 94.1% |
▼ 5.8 | 941 / 1000 | |
| Uniqueness | 100% |
= | 1000 / 1000 | |
Validity was about 99.8% every night, and fell by 5.8 points on the last one, which the trend and the change show at a glance. Completeness moved by a fraction of a point, as it does from night to night. The same scores are in get_dimension_scores(by="run") and in get_dataframe(shape="dimensions"), for a chart or a dashboard of your own.
See Also
- get_dimension_scores()
-
Get the scores of the dimensions, by run or table.
- get_scorecard()
-
Get a scorecard of the dimensions of a single run.