π Field Rules (Rules Engine)¶
Field Rules validate, normalize, and protect the values that a Service extracts from documents. After extraction, the AIForged Rules Engine evaluates each configured field against its Rule Type to ensure the value is correct and ready for downstream use.
What Field Rules help you do:
- Validate: enforce formats, ranges, and required patterns (dates, emails, phone numbers, codes).
- Normalize: auto-correct common OCR mistakes (e.g., O β 0, l β 1) and standardize formats.
- Escalate: route to HumanβinβtheβLoop (HITL) review when conditions arenβt met or confidence is low.
- Protect: mark sensitive fields (e.g., passwords) and control visibility/handling.
Opening Field Configuration¶
Configure rules for any field using either path:
1) From the document overlay (supported services)¶
- Click the field directly on the document (bounding box).
- Click the gear icon βOpen field configurationβ.
- Configure the rule in the panel that opens.
2) From the Fields panel (right sidebar)¶
- In the Fields list, select the field.
- Click the gear icon βOpen field configurationβ.
- Configure the rule in the panel that opens.
Where to find these options
The overlay actions appear only for services that support the interactive document view. If you donβt see the overlay, use the Fields panel on the right.
Configuring a Rule¶
-
Choose Rule Type
Select the Rule Type that best matches the expected value (e.g., DateTime, Number, Email Address). -
Set validation conditions
- Required vs. optional
- Allowed patterns (presets or regex, where supported)
- Ranges, lengths, masks (e.g., min/max, decimal places, country formats)
-
Enable normalization (optional)
- Auto-correct common OCR substitutions (Oβ0, Iβ1)
- Trim whitespace, standardize casing
- Unify formats (e.g., YYYYβMMβDD for dates; consistent decimal/thousand separators)
-
Define HITL behavior
- Trigger review when validation fails or confidence is below a threshold
-
Save and test
- Re-run validation on the current document
- Confirm the status (e.g., Passed checks, Suspicious, Required) and adjust as needed
Available Rule Types¶
Assign one of the following Rule Types to a field. Each type includes targeted validation and optional normalization:
- Address
- Boolean
- Code
- Country
- Currency
- DateTime
- Email Address
- Enum
- GPS Coordinates
- ID Number
- Number
- Password
- Picture
- Secure String
- String
- Telephone Number
- Timespan
Examples¶
-
DateTime
Enforce YYYYβMMβDD and auto-normalize separators (/, -) to your standard. -
Number / Currency
Require a fixed number of decimal places; normalize comma/dot usage; reject alphabetic characters. -
Email Address
Must contain β@β and a valid domain; trim whitespace; lower-case domain part. -
Telephone Number
Normalize to a consistent format (e.g., E.164); ensure valid country code and digit length. -
Code / String
Use a regex such as^INV-[0-9]{6}$
to enforce business identifiers.
Best Practices¶
- Match the Rule Type to the business meaning of the field (not just the current value).
- Be strict on critical fields (amounts, dates, IDs) to reduce downstream corrections.
- Prefer normalization before escalation to fix common issues automatically.
- Pilot rules with a small, varied batch before broad rollout.
Troubleshooting¶
-
Donβt see the overlay action?
Use the Fields panel; overlay is available only in services that support the interactive document view. -
Rule didnβt trigger?
Check the assigned Rule Type, thresholds, and conditions; confirm the field value actually violates the rule. -
Unexpected corrections?
Review normalization settings; disable specific substitutions that conflict with your data patterns. -
Permission issues?
Ensure your role includes rights to edit field configurations within the current agent/service.