Check
Source code in cuallee/__init__.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 |
|
empty
property
True when no rules are added in the check
keys
property
Returns blake2s unique identifiers of rules
rules
property
Returns all rules defined for check
sum
property
Total number of rules in Check
__init__(level=0, name='cuallee.check', *, execution_date=datetime.now(timezone.utc), table_name=None, session=None)
A container of data quality rules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
CheckLevel
|
[0-1] value to describe if its a WARNING or ERROR check |
0
|
name
|
str
|
Normally the name of the dataset being verified, or a name for this check |
'cuallee.check'
|
execution_date
|
date
|
An automatically generated timestamp of the check in UTC |
now(utc)
|
table_name
|
str
|
When using databases matches the table name of the source |
None
|
session
|
Session
|
When operating in Session enabled environments like Databricks or Snowflake |
None
|
Source code in cuallee/__init__.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
add_rule(method, *arg, **kwargs)
Add a new rule to the Check class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
str
|
Check name |
required |
arg
|
list
|
Parameters of the Rule |
()
|
kwars
|
dict
|
Dictionary of options for the Rule |
required |
Source code in cuallee/__init__.py
267 268 269 270 271 272 273 274 275 276 |
|
adjust_rule_coverage(rule_index, rule_coverage)
Adjust the ratio predicate/rows for a rule. It is intended to lower or increase tolerance without having to rewrite the entire check
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_index
|
int
|
The position of the rule in the check list |
required |
rule_coverage
|
float
|
New value between [0..1] for tolerance |
required |
Source code in cuallee/__init__.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
are_complete(column, pct=1.0)
Validation for non-null values in a group of columns
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
List[str]
|
A tuple or list of column names in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
355 356 357 358 359 360 361 362 363 364 |
|
are_unique(column, pct=1.0)
Validation for unique values in a group of columns
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
List[str]
|
A tuple or list of column names in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
416 417 418 419 420 421 422 423 424 425 |
|
delete_rule_by_attribute(rule_attribute, values)
Delete rule based on method(s) or column name(s) or coverage value(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_attribute
|
str
|
Finds a rule with by: method, column or coverage |
required |
values
|
List[str]
|
Deletes a rule that matches the rule_attribute equal to the value in this parameter |
required |
Source code in cuallee/__init__.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
delete_rule_by_key(keys)
Delete rules from check based on keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
List[str]
|
a single or list of keys to remove from the check |
required |
Source code in cuallee/__init__.py
278 279 280 281 282 283 284 285 286 287 288 289 |
|
has_cardinality(column, value)
Validates the number of distinct values in a column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
value
|
int
|
The number of expected distinct values on a column |
required |
Source code in cuallee/__init__.py
953 954 955 956 957 958 959 960 961 962 |
|
has_correlation(column_left, column_right, value)
Validates the correlation in a range of [0..1] between 2 columns
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_left
|
str
|
Column name in dataframe |
required |
column_right
|
str
|
Column name in dataframe |
required |
value
|
float
|
Value to match the correlation |
required |
Source code in cuallee/__init__.py
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 |
|
has_entropy(column, value, tolerance=0.01)
Validation for entropy calculation on continuous variables/features on log2
.
Useful in Machine Learning classifications to test imbalanced datasets with low entropy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
value
|
float
|
The expected entropy value |
required |
tolerance
|
float
|
The tolerance/precision used when comparing the actual and expected value |
0.01
|
Examples:
Source code in cuallee/__init__.py
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
|
has_infogain(column, pct=1.0)
Validate cardinality > 1. Particularly useful when validating categorical data for Machine Learning
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
|
has_max(column, value)
Validation of a column's maximum value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
Source code in cuallee/__init__.py
611 612 613 614 615 616 617 618 619 620 |
|
has_max_by(column_source, column_target, value)
Validation the correspondance of a column value based on another column maximum
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_source
|
str
|
Column used to obtain the row with the max value |
required |
column_target
|
str
|
Column used to verify the matching value |
required |
value
|
(str, number)
|
The value to match against |
required |
Source code in cuallee/__init__.py
861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 |
|
has_mean(column, value)
Validation of a column's average/mean
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
Source code in cuallee/__init__.py
633 634 635 636 637 638 639 640 641 642 |
|
has_min(column, value)
Validation of a column's minimum value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
Source code in cuallee/__init__.py
600 601 602 603 604 605 606 607 608 609 |
|
has_min_by(column_source, column_target, value)
Validation the correspondence of a column value based on another column minimum
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_source
|
str
|
Column used to obtain the row with the min value |
required |
column_target
|
str
|
Column used to verify the matching value |
required |
value
|
(str, number)
|
The value to match against |
required |
Source code in cuallee/__init__.py
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 |
|
has_pattern(column, value, pct=1.0, options={})
Validation for string type column matching regex expression
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
regex
|
A regular expression used to match values in the |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|
has_percentile(column, value, percentile, precision=10000)
Validation of a column percentile value using approximation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
percentile
|
float
|
Value between [0,1] i.e. |
required |
precision
|
float
|
The precision to calculate percentiles |
10000
|
Source code in cuallee/__init__.py
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 |
|
has_std(column, value)
Validation of a column's standard deviation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
Source code in cuallee/__init__.py
622 623 624 625 626 627 628 629 630 631 |
|
has_sum(column, value)
Validation of a sum of all values of a column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
Source code in cuallee/__init__.py
644 645 646 647 648 649 650 651 652 653 |
|
has_workflow(column_group, column_event, column_order, edges, pct=1.0)
Validates events in a group clause with order, followed a specific sequence. Similar to adjacency matrix validation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_group
|
str
|
The dataframe column used to group events |
required |
column_event
|
str
|
The state of the event within the group |
required |
column_order
|
List[date, number, str]
|
The order within the group, should be deterministic and without collisions. |
required |
edges
|
List[Tuple[str, str]]
|
The combinations of events expected in the data frame i.e |
required |
Example
Given the following fictitious dataset example:
date | ticket | status |
---|---|---|
2024-01-01 | CASE-001 | New |
2024-01-02 | CASE-001 | In Progress |
2024-01-03 | CASE-001 | Closed |
You can validate that events for each ticket follow certain sequence by using:
from cuallee import Check, CheckLevel
df = spark.createDataFrame(
[
["2024-01-01", "CASE-001", "New"],
["2024-01-02", "CASE-001", "In Progress"],
["2024-01-03", "CASE-001", "Closed"],
],
["date", "ticket", "status"],
)
check = Check(CheckLevel.WARNING, "WorkflowValidation")
check.has_workflow(
column_group="ticket",
column_event="status",
column_order="date",
edges=[(None, "New"),("New", "In Progress"),("In Progress","Closed"), ("Closed", None)]
)
# Validate
check.validate(df).show(truncate=False)
# Result
+---+-------------------+------------------+-------+----------------------------+------------+------------------------------------------------------------------------------------+----+----------+---------+--------------+------+
|id |timestamp |check |level |column |rule |value |rows|violations|pass_rate|pass_threshold|status|
+---+-------------------+------------------+-------+----------------------------+------------+------------------------------------------------------------------------------------+----+----------+---------+--------------+------+
|1 |2024-05-11 11:24:00|WorkflowValidation|WARNING|('ticket', 'status', 'date')|has_workflow|((None, 'New'), ('New', 'In Progress'), ('In Progress', 'Closed'), ('Closed', None))|3 |0 |1.0 |1.0 |PASS |
+---+-------------------+------------------+-------+----------------------------+------------+------------------------------------------------------------------------------------+----+----------+---------+--------------+------+
The check validates that:
- Nothing preceeds a
New
state In Progress
follows theNew
eventClosed
follows theIn Progress
event- Nothing follows after
Closed
state
Source code in cuallee/__init__.py
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 |
|
is_between(column, value, pct=1.0)
Validation of a column between a range
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
655 656 657 658 659 660 661 662 663 664 665 |
|
is_complete(column, pct=1.0)
Validation for non-null values in column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
331 332 333 334 335 336 337 338 339 340 341 |
|
is_composite_key(column, pct=1.0)
Validation for unique values in a group of columns
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|
is_contained_in(column, value, pct=1.0, options={})
Validation of column value in set of given values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
|
is_custom(column, fn=None, pct=1.0, options={})
Uses a user-defined function that receives the to-be-validated dataframe and uses the last column of the transformed dataframe to summarize the check
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column(s) required for custom function |
required |
fn
|
Callable
|
A function that receives a dataframe as input and returns a dataframe with at least 1 column as result |
None
|
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 |
|
is_daily(column, value=None, pct=1.0)
Validates that there is no missing dates using only week days in the date/timestamp column.
An alternative day combination can be provided given that a user wants to validate only certain dates.
For example in PySpark to validate that time series are every Wednesday consecutively on a year
without any missing values, the value input should contain [4]
as it represent the numeric
equivalence of the day of week Wednesday.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
value
|
List[int]
|
A list of numbers describing the days of the week to consider. i.e. Pyspark uses [2, 3, 4, 5, 6] for Mon-Fri |
None
|
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 |
|
is_empty(column, pct=1.0)
Validation for null values in column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
343 344 345 346 347 348 349 350 351 352 353 |
|
is_equal_than(column, value, pct=1.0)
Validation for numeric column equal than value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
544 545 546 547 548 549 550 551 552 553 554 |
|
is_greater_or_equal_than(column, value, pct=1.0)
Validation for numeric greater or equal than value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
|
is_greater_than(column, value, pct=1.0)
Validation for numeric greater than value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
450 451 452 453 454 455 456 457 458 459 460 |
|
is_in(column, value, pct=1.0)
Vaildation of column value in set of given values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
729 730 731 732 733 734 735 736 737 738 |
|
is_in_billions(column, pct=1.0)
Validates that a column has values greater than 1B (1e9)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
497 498 499 500 501 502 503 504 505 |
|
is_in_millions(column, pct=1.0)
Validates that a column has values greater than 1M (1e6)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
487 488 489 490 491 492 493 494 495 |
|
is_inside_interquartile_range(column, value=[0.25, 0.75], pct=1.0)
Validates a number resides inside the quartile(1) and quartile(3) of the range of values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[number]
|
A number between 0 and 1 demarking the quartile |
[0.25, 0.75]
|
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
|
is_legit(column, pct=1.0)
Validation for string columns giving wrong signal about completeness due to empty strings.
Useful for reading CSV files and preventing empty strings being reported as valid records.
This is an alias
implementation of the has_pattern
rule using not black space
as the pattern
Which validates the presence of non-empty characters between the begining and end of a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
|
is_less_or_equal_than(column, value, pct=1.0)
Validation for numeric less or equal than value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
|
is_less_than(column, value, pct=1.0)
Validation for numeric less than value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
number
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
507 508 509 510 511 512 513 514 515 516 517 |
|
is_negative(column, pct=1.0)
Validation for numeric less than zero
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
519 520 521 522 523 524 525 526 527 |
|
is_on_friday(column, pct=1.0)
Validates a datetime column is on Friday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 |
|
is_on_monday(column, pct=1.0)
Validates a datetime column is on Monday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 |
|
is_on_saturday(column, pct=1.0)
Validates a datetime column is on Saturday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 |
|
is_on_schedule(column, value, pct=1.0)
Validation of a datetime column between an hour interval
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
value
|
Tuple[int, int]
|
A tuple indicating a 24hr day interval. i.e. (9,17) for 9am to 5pm |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 |
|
is_on_sunday(column, pct=1.0)
Validates a datetime column is on Sunday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
|
is_on_thursday(column, pct=1.0)
Validates a datetime column is on Thursday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 |
|
is_on_tuesday(column, pct=1.0)
Validates a datetime column is on Tuesday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
|
is_on_wednesday(column, pct=1.0)
Validates a datetime column is on Wednesday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 |
|
is_on_weekday(column, pct=1.0)
Validates a datetime column is in a Mon-Fri time range
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
|
is_on_weekend(column, pct=1.0)
Validates a datetime column is in a Sat-Sun time range
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 |
|
is_positive(column, pct=1.0)
Validation for numeric greater than zero
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
462 463 464 465 466 467 468 469 470 |
|
is_primary_key(column, pct=1.0)
Validation for unique values in column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
is_t_minus_1(column, pct=1.0)
Validate that date is yesterday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
760 761 762 763 764 765 766 767 768 |
|
is_t_minus_2(column, pct=1.0)
Validate that date is 2 days ago
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
770 771 772 773 774 775 776 777 778 |
|
is_t_minus_3(column, pct=1.0)
Validate that date is 3 days ago
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
780 781 782 783 784 785 786 787 788 |
|
is_t_minus_n(column, value, pct=1.0, options={'name': 'is_t_minus_n'})
Validate that date is n
days before the current date
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The number of days before the current date |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
is_today(column, pct=1.0)
Validate that date is today
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
800 801 802 803 804 805 806 807 808 |
|
is_unique(column, pct=1.0, approximate=False, ignore_nulls=False)
Validation for unique values in column
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
approximate
|
bool
|
A flag to speed up computation using an approximation through maximum relative std. dev. |
False
|
ignore_nulls
|
bool
|
Run drop nulls before counting |
False
|
Source code in cuallee/__init__.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|
is_yesterday(column, pct=1.0)
Validate that date is yesterday
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
790 791 792 793 794 795 796 797 798 |
|
not_contained_in(column, value, pct=1.0)
Validation of column value not in set of given values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
|
not_in(column, value, pct=1.0)
Validation of column value not in set of given values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in dataframe |
required |
value
|
List[str, number, date]
|
The condition for the column to match |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
688 689 690 691 692 693 694 695 696 697 |
|
ok(dataframe)
True when all checks passed
Source code in cuallee/__init__.py
1303 1304 1305 |
|
satisfies(column, predicate, pct=1.0, options={})
Validation of a column satisfying a SQL-like predicate
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
Column name in the dataframe |
required |
predicate
|
str
|
A predicate written in SQL-like syntax |
required |
pct
|
float
|
The threshold percentage required to pass |
1.0
|
Source code in cuallee/__init__.py
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
|
validate(dataframe, ok=False)
Compute all rules in this check for specific data frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataframe
|
Union[pyspark, snowpark, pandas, polars, duckdb, bigquery]
|
A dataframe object |
required |
Source code in cuallee/__init__.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
|