Skip to content

Commit e40e231

Browse files
committed
fix: sync pointblank materials with tutorial scripts
Align the quickstart and atom scripts and the atom YAML with the published tutorial examples, and refresh the generated HTML report.
1 parent 2f79a3f commit e40e231

4 files changed

Lines changed: 110 additions & 30 deletions

File tree

python-pointblank/pointblank_atoms.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,23 @@ def main() -> None:
1717
validation = (
1818
pb.Validate(
1919
data=atoms,
20-
tbl_name="atoms_from_parser",
21-
label="Round-trip validation before re-export",
20+
tbl_name="atoms",
21+
label="Atom data validation",
2222
thresholds=pb.Thresholds(warning=0.02, error=0.05, critical=0.07),
2323
)
2424
.col_vals_in_set(columns="symbol", set=VALID_ELEMENTS)
2525
.col_vals_not_null(columns=["x", "y", "z"])
2626
.col_vals_between(columns=["x", "y", "z"], left=0, right=20)
27-
.col_vals_between(columns="fx", left=-1000, right=1000)
27+
.col_vals_between(columns=["fx", "fy", "fz"], left=-1000, right=1000)
2828
.interrogate()
2929
)
3030

3131
clean = validation.get_sundered_data(type="pass")
3232
dirty = validation.get_sundered_data(type="fail")
3333

34-
print(f"Safe to re-export: {len(clean)} rows")
35-
print(f"Needs review: {len(dirty)} rows")
36-
print("\nClean rows")
34+
print(f"Clean rows: {len(clean)}")
3735
print(clean.select(["atom_id", "symbol", "x", "fx"]))
38-
print("\nDirty rows")
36+
print(f"\nDirty rows: {len(dirty)}")
3937
print(dirty.select(["atom_id", "symbol", "x", "fx"]))
4038

4139

python-pointblank/pointblank_atoms.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
tbl: pointblank_atoms.csv
22
df_library: polars
3-
tbl_name: "Atom Validation"
4-
label: "Tutorial YAML validation"
3+
tbl_name: "atoms"
4+
label: "Atom data validation"
55
thresholds:
66
warning: 0.02
77
error: 0.05
@@ -17,6 +17,6 @@ steps:
1717
left: 0
1818
right: 20
1919
- col_vals_between:
20-
columns: fx
20+
columns: [fx, fy, fz]
2121
left: -1000
2222
right: 1000

python-pointblank/pointblank_quickstart.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# ]
66
# ///
77

8+
import json
9+
810
import pointblank as pb
911

1012

@@ -21,17 +23,14 @@ def main() -> None:
2123
.interrogate()
2224
)
2325

24-
report = validation.get_dataframe_report()
25-
summary = report.select(
26-
["step_description", "pass_n", "failed_n"]
27-
).iter_rows(named=True)
26+
report = json.loads(validation.get_json_report())
2827

2928
print("Validation summary:\n")
30-
for step in summary:
29+
for step in report:
3130
print(
32-
f"{step['step_description']:20}"
33-
f"passed={step['pass_n']:<4}"
34-
f"failed={step['failed_n']}"
31+
f"{step['assertion_type']:20}"
32+
f"passed={step['n_passed']:<4}"
33+
f"failed={step['n_failed']}"
3534
)
3635

3736

0 commit comments

Comments
 (0)