@@ -708,8 +708,9 @@ FinalActions(*args)
708708 In this example, the `send_alert()` function is defined to check the validation summary for
709709 critical failures. If any are found, an alert message is printed to the console. The function is
710710 passed to the `FinalActions` class, which ensures it will be executed after all validation steps
711- are complete. Note that we used the `get_validation_summary()` function to retrieve the summary
712- of the validation results to help craft the alert message.
711+ are complete. Note that we used the
712+ [`get_validation_summary()`](`pointblank.get_validation_summary`) function to retrieve the
713+ summary of the validation results to help craft the alert message.
713714
714715 Multiple final actions can be provided in a sequence. They will be executed in the order they
715716 are specified after all validation steps have completed:
@@ -5208,13 +5209,11 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
52085209 ----------
52095210 expr
52105211 A callable function that defines the specialized validation logic. This function should:
5211-
5212- - accept the target data table as its single argument (though it may ignore it), or
5213- - take no parameters at all (for environment validations)
5214-
5215- The function must ultimately return boolean values representing validation results.
5216- Design your function to incorporate any custom parameters directly within the function
5217- itself using closure variables or default parameters.
5212+ (1) accept the target data table as its single argument (though it may ignore it), or
5213+ (2) take no parameters at all (for environment validations). The function must
5214+ ultimately return boolean values representing validation results. Design your function
5215+ to incorporate any custom parameters directly within the function itself using closure
5216+ variables or default parameters.
52185217 pre
52195218 An optional preprocessing function or lambda to apply to the data table during
52205219 interrogation. This function should take a table as input and return a modified table.
@@ -5302,7 +5301,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
53025301 import pointblank as pb
53035302 import polars as pl
53045303
5305- tbl = pl.DataFrame({
5304+ simple_tbl = pl.DataFrame({
53065305 "a": [5, 7, 1, 3, 9, 4],
53075306 "b": [6, 3, 0, 5, 8, 2]
53085307 })
@@ -5312,7 +5311,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
53125311 return data.select(pl.col("a") + pl.col("b") > 0)
53135312
53145313 (
5315- pb.Validate(data=tbl )
5314+ pb.Validate(data=simple_tbl )
53165315 .specially(expr=validate_sum_positive)
53175316 .interrogate()
53185317 )
@@ -5336,7 +5335,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
53365335 return validate_column_ratio
53375336
53385337 (
5339- pb.Validate(data=tbl )
5338+ pb.Validate(data=simple_tbl )
53405339 .specially(
53415340 expr=make_column_ratio_validator(col1="a", col2="b", min_ratio=0.5)
53425341 )
@@ -5358,7 +5357,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
53585357 import random
53595358
53605359 # Create sample data
5361- tbl = pl.DataFrame({
5360+ transaction_tbl = pl.DataFrame({
53625361 "transaction_id": [f"TX{i:04d}" for i in range(1, 11)],
53635362 "amount": [120.50, 85.25, 50.00, 240.75, 35.20, 150.00, 85.25, 65.00, 210.75, 90.50],
53645363 "category": ["food", "shopping", "entertainment", "travel", "utilities",
@@ -5390,7 +5389,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
53905389 return test_results
53915390
53925391 (
5393- pb.Validate(data=tbl )
5392+ pb.Validate(data=transaction_tbl )
53945393 .specially(
53955394 expr=validate_transaction_rules,
53965395 brief="Validate transaction IDs and amounts by category."
@@ -5401,13 +5400,12 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
54015400
54025401 This example shows how to create a validation function that applies multiple business rules
54035402 to each row and returns a list of boolean results. Each boolean in the list represents a
5404- separate test unit (one per row), and the validation passes only if all rules are satisfied
5405- for a given row.
5403+ separate test unit, and a test unit passes only if all rules are satisfied for a given row.
54065404
54075405 The function iterates through each row in the data table, checking:
54085406
5409- 1. If transaction IDs follow the required format
5410- 2. If transaction amounts are appropriate for their respective categories
5407+ 1. if transaction IDs follow the required format
5408+ 2. if transaction amounts are appropriate for their respective categories
54115409
54125410 This approach is powerful when you need to apply complex, conditional logic that can't be
54135411 easily expressed using the built-in validation functions.
@@ -5429,7 +5427,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
54295427 return has_large_values and has_positive_mean
54305428
54315429 (
5432- pb.Validate(data=tbl )
5430+ pb.Validate(data=simple_tbl )
54335431 .specially(expr=validate_table_properties)
54345432 .interrogate()
54355433 )
@@ -5440,8 +5438,8 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
54405438
54415439 ### Environment validation that doesn't use the data table
54425440
5443- The `specially()` method can even be used to validate aspects of your environment that are
5444- completely independent of the data:
5441+ The `specially()` validation method can even be used to validate aspects of your environment
5442+ that are completely independent of the data:
54455443
54465444 ```python
54475445 def validate_pointblank_version():
@@ -5463,7 +5461,7 @@ specially(self, expr: 'Callable', pre: 'Callable | None' = None, thresholds: 'in
54635461 return False
54645462
54655463 (
5466- pb.Validate(data=tbl )
5464+ pb.Validate(data=simple_tbl )
54675465 .specially(
54685466 expr=validate_pointblank_version,
54695467 brief="Check Pointblank version `>=0.9.0`."
@@ -9463,7 +9461,7 @@ send_slack_notification(webhook_url: 'str | None' = None, step_msg: 'str | None'
94639461 validation
94649462 ```
94659463
9466- By placing the `notify_slack` function in the `Validate(actions=Actions(critical=))` argument,
9464+ By placing the `notify_slack() ` function in the `Validate(actions=Actions(critical=))` argument,
94679465 you can ensure that the notification is sent whenever the 'critical' threshold is reached (as
94689466 set here, when 15% or more of the test units fail). The notification will include information
94699467 about the validation step that triggered the alert.
@@ -9493,7 +9491,7 @@ send_slack_notification(webhook_url: 'str | None' = None, step_msg: 'str | None'
94939491 )
94949492 ```
94959493
9496- In this case, the same `notify_slack` function is used, but it is placed in
9494+ In this case, the same `notify_slack() ` function is used, but it is placed in
94979495 `Validate(final_actions=FinalActions())`. This results in the summary notification being sent
94989496 after all validation steps are completed, regardless of whether any steps failed or not.
94999497
0 commit comments