Contracts
A contract is a set of validation rules (logic blocks) that run against extracted document data. Contracts define what “correct” looks like — checking totals, verifying dates, ensuring required fields are populated, and more.
Creating a Contract
Section titled “Creating a Contract”- Navigate to Configure > Contracts and click New Contract.
- Enter a name and optional description.
- Click Save to create the contract, then add logic blocks.
Adding Logic Blocks
Section titled “Adding Logic Blocks”Each logic block is a single validation rule. You can add them in two ways:
- Inline — Create a new rule directly within the contract. Give it a name, build the expression, and set a severity.
- From template — Import an existing Logic Block that was created in the Data section. This copies the rule into the contract.
Severity Levels
Section titled “Severity Levels”Each logic block has a severity that determines how failures are presented:
| Severity | Behavior |
|---|---|
| Error | Marks the document as failed. Displayed with a red badge in review. |
| Warning | Highlights a potential issue but does not fail the document. Displayed with a yellow badge. |
| Info | Informational only. Displayed with a blue badge. |
A document passes overall only if all error-severity logic blocks evaluate to true.
Logic Block Expressions
Section titled “Logic Block Expressions”Expressions are built using a token-based editor. Each token is color-coded by type (field, operator, number, function, etc.). For full syntax details, see the Expression Syntax reference.
Common patterns:
$total_amount > 0$vendor_name != ""abs($expected - $actual) < 0.01rsum($line_item_amount) = $total_amountReference Documents
Section titled “Reference Documents”Contracts can include a reference PDF that provides context for the rules:
- Click Upload Reference Document on the contract editor.
- Upload a PDF (e.g. a rate schedule or policy document).
- For each logic block, draw a selection on the reference PDF to indicate which section the rule validates against.
Reference selections are shown to reviewers for context when a rule fails.
AI-Assisted Rule Generation
Section titled “AI-Assisted Rule Generation”When the Logic Block Generation AI setting is enabled (see AI Settings):
- Upload a reference PDF to the contract.
- Draw a selection on the PDF highlighting relevant content.
- termco automatically generates suggested logic block expressions from the selected text.
- Review and adjust the generated rules before saving.
Reordering Logic Blocks
Section titled “Reordering Logic Blocks”Drag and drop logic blocks within a contract to change their display order. The order affects how results are presented during review but does not change evaluation behavior — all rules are evaluated independently.