hooqu.constraints¶
Submodules¶
hooqu.constraints.analysis_based_constraint module¶
-
class
hooqu.constraints.analysis_based_constraint.AnalysisBasedConstraint(analyzer, assertion, value_picker=None, hint=None)[source]¶ Bases:
hooqu.constraints.constraint.Constraint,typing.GenericCommon functionality for all analysis based constraints that provides unified way to access AnalyzerContext and metrics stored in it.
Runs the analysis and get the value of the metric returned by the analysis, picks the numeric value that will be used in the assertion function with metric picker runs the assertion.
-
__init__(analyzer, assertion, value_picker=None, hint=None)[source]¶ - Parameters
analyzer (
Analyzer[~S,Metric[~M]]) – Analyzer to be run on the data frameassertion (Assertion callable) –
value_picker ((NOT IMPLEMENTED)) – Optional function to pick the interested part of the metric value that the assertion will be running on. Absence of such function means the metric value would be used in the assertion as it is.
hint (
Optional[str]) – A hint to provide additional context why a constraint could have failed
-
hooqu.constraints.constraint module¶
-
class
hooqu.constraints.constraint.ConstraintResult(constraint: hooqu.constraints.constraint.Constraint, status: hooqu.constraints.constraint.ConstraintStatus, message: Union[str, NoneType] = None, metric: Union[hooqu.metrics.Metric, NoneType] = None)[source]¶ Bases:
object
-
class
hooqu.constraints.constraint.ConstraintStatus(value)[source]¶ Bases:
enum.EnumAn enumeration.
hooqu.constraints.constraints module¶
-
hooqu.constraints.constraints.compliance_constraint(name, column, assertion, where=None, hint=None)[source]¶ Runs given the expression on the given column(s) and executes the assertion
- name:
A name that summarizes the check being made. This name is being used to name the metrics for the analysis being done.
- column:
The column expression to be evaluated.
- assertion:
Callable that receives a float input parameter and returns a boolean
- where:
Additional filter to apply before the analyzer is run.
Hint
A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.constraints.pattern_match_constraint(column, pattern, assertion, where=None, name=None, hint=None)[source]¶ Runs given regex compliance analysis on the given column(s) and executes the assertion.
- Parameters
column (
str) – The column to run the assertion onpattern (
Union[str,Pattern]) – The regex pattern to check compliance for (either string or pattern instance)where (
Optional[str]) – Additional filter to apply before the analyzer is run.name (
Optional[str]) – A name that summarizes the check being made. This name is being used to name the metrics for the analysis being done.hint (
Optional[str]) – A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.constraints.quantile_constraint(column, quantile, assertion, where=None, hint=None)[source]¶ Runs quantile analysis on the given column and executes the assertion
- column:
Column to run the assertion on
- quantile:
Which quantile to assert on
- assertion
Callable that receives a float input parameter (the computed quantile) and returns a boolean
Hint
A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.constraints.uniqueness_constraint(columns, assertion, where=None, hint=None)[source]¶ Runs Uniqueness analysis on the given columns and executes the assertion columns.
- columns:
Columns to run the assertion on.
- assertion:
Callable that receives a float input parameter and returns a boolean
- where:
Additional filter to apply before the analyzer is run.
Hint
A hint to provide additional context why a constraint could have failed
- Return type
Module contents¶
-
class
hooqu.constraints.AnalysisBasedConstraint(analyzer, assertion, value_picker=None, hint=None)[source]¶ Bases:
hooqu.constraints.constraint.Constraint,typing.GenericCommon functionality for all analysis based constraints that provides unified way to access AnalyzerContext and metrics stored in it.
Runs the analysis and get the value of the metric returned by the analysis, picks the numeric value that will be used in the assertion function with metric picker runs the assertion.
-
__init__(analyzer, assertion, value_picker=None, hint=None)[source]¶ - Parameters
analyzer (
Analyzer[~S,Metric[~M]]) – Analyzer to be run on the data frameassertion (Assertion callable) –
value_picker ((NOT IMPLEMENTED)) – Optional function to pick the interested part of the metric value that the assertion will be running on. Absence of such function means the metric value would be used in the assertion as it is.
hint (
Optional[str]) – A hint to provide additional context why a constraint could have failed
-
-
class
hooqu.constraints.ConstraintResult(constraint: hooqu.constraints.constraint.Constraint, status: hooqu.constraints.constraint.ConstraintStatus, message: Union[str, NoneType] = None, metric: Union[hooqu.metrics.Metric, NoneType] = None)[source]¶ Bases:
object
-
hooqu.constraints.compliance_constraint(name, column, assertion, where=None, hint=None)[source]¶ Runs given the expression on the given column(s) and executes the assertion
- name:
A name that summarizes the check being made. This name is being used to name the metrics for the analysis being done.
- column:
The column expression to be evaluated.
- assertion:
Callable that receives a float input parameter and returns a boolean
- where:
Additional filter to apply before the analyzer is run.
Hint
A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.pattern_match_constraint(column, pattern, assertion, where=None, name=None, hint=None)[source]¶ Runs given regex compliance analysis on the given column(s) and executes the assertion.
- Parameters
column (
str) – The column to run the assertion onpattern (
Union[str,Pattern]) – The regex pattern to check compliance for (either string or pattern instance)where (
Optional[str]) – Additional filter to apply before the analyzer is run.name (
Optional[str]) – A name that summarizes the check being made. This name is being used to name the metrics for the analysis being done.hint (
Optional[str]) – A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.quantile_constraint(column, quantile, assertion, where=None, hint=None)[source]¶ Runs quantile analysis on the given column and executes the assertion
- column:
Column to run the assertion on
- quantile:
Which quantile to assert on
- assertion
Callable that receives a float input parameter (the computed quantile) and returns a boolean
Hint
A hint to provide additional context why a constraint could have failed
- Return type
-
hooqu.constraints.uniqueness_constraint(columns, assertion, where=None, hint=None)[source]¶ Runs Uniqueness analysis on the given columns and executes the assertion columns.
- columns:
Columns to run the assertion on.
- assertion:
Callable that receives a float input parameter and returns a boolean
- where:
Additional filter to apply before the analyzer is run.
Hint
A hint to provide additional context why a constraint could have failed
- Return type