Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Constraints

The constraints module implements Kasuari-based data plausibility validation.

flowchart LR
    subgraph Input["Transaction"]
        A["amount"]
        D["date"]
        C["category"]
    end
    
    subgraph Validate["Kasuari Constraint Solver"]
        RA["AmountRange"]
        RD["DateWindow"]
        RC["CategoryPattern"]
    end
    
    subgraph Output["Result"]
        OK["✓ Valid"]
        WARN["⚠ Warning"]
        FAIL["✗ Invalid"]
    end
    
    Input --> Validate
    RA --> OK
    RD --> WARN
    RC --> FAIL

VendorConstraintSet

#![allow(unused)]
fn main() {
pub struct VendorConstraintSet {
    pub vendor: String,
    pub constraints: Vec<Constraint>,
}
}

Constraint Types

  • AmountRange: Valid transaction amount bounds
  • DateWindow: Expected date range for statements
  • DescriptionPattern: Regex pattern for valid descriptions
  • AccountFormat: Valid account number format

Kasuari Integration

The module uses Kasuari strengths for constraint evaluation:

  • Strong: Must pass for validation to succeed
  • Medium: Warning if violated
  • Weak: Advisory if violated

InvoiceConstraintSolver

#![allow(unused)]
fn main() {
pub struct InvoiceConstraintSolver {
    // ...
}
}

Solves constraints for invoice data with multi-pass validation.