Python SDK
Rule & Finding Models
SDK Reference: rule engine output objects
fs.analyze() runs the Profiling Engine and then the Rule Engine, returning a single frozen RuleResult. Rules are deterministic, isolated, and never fail the whole run: a rule that crashes is recorded in failed_rules instead.
RuleResult
@dataclass(frozen=True, slots=True)class RuleResult: profile: ProfileResult findings: Sequence[RuleFinding] executed_rules: Sequence[str] execution_time_ms: float failed_rules: Mapping[str, str] # rule ID -> error traceback def to_dict(self) -> dict[str, Any]: ...RuleFinding
A single issue identified by one rule. column_name is None for dataset-wide findings (for example duplicate rows).
@dataclass(frozen=True, slots=True)class RuleFinding: rule_id: str rule_name: str category: str # "quality" | "statistical" | "leakage" | "diff" severity: str # "info" | "warning" | "critical" column_name: str | None title: str description: str evidence: Mapping[str, Any] confidence: float = 1.0 id: str = ... # auto-generated UUID metadata: Mapping[str, Any] = ...category uses lowercase strings. The "diff" category is used by findings derived from a DatasetDiffResult via findings_from_diff().
Built-in Rules
All eight rules are enabled by default. Their defaults can be overridden per rule through the rule_config argument of fs.analyze():
| Rule ID | Name | Severity | Config Keys (defaults) |
|---|---|---|---|
| quality.missing_value_threshold | Missing Value Threshold | warning (escalates to critical above 50%) | threshold=20.0 |
| quality.duplicate_rows | Duplicate Rows | warning | threshold=10.0 |
| quality.constant_columns | Constant Columns | warning | — |
| quality.fully_empty_columns | Fully Empty Columns | critical | — |
| statistical.high_cardinality | High Cardinality | warning | threshold=0.50, min_cardinality=20 |
| statistical.outliers | Outlier Detection | warning | factor=1.5 (IQR multiplier) |
| statistical.high_correlation | High Correlation | warning | threshold=0.90 |
| leakage.potential_leakage | Potential Target Leakage | critical | target_column=None, threshold=0.99 |
The missing-value rule flags every column whose missing_percentage exceeds threshold. The high-cardinality rule flags categorical columns whose unique-ratio cardinality / non-missing exceeds threshold while cardinality is at least min_cardinality. The outlier rule flags numeric columns with values beyond [Q1 - factor*IQR, Q3 + factor*IQR].
Configuring Rules
import featuresmith as fsresult = fs.analyze( "train.csv", target_column="churn", enabled_rules=[ "quality.missing_value_threshold", "statistical.high_correlation", ], rule_config={ "quality.missing_value_threshold": {"threshold": 15.0}, "statistical.high_correlation": {"threshold": 0.85}, },)for finding in result.findings: print(f"[{finding.severity}] {finding.title}")