Skip to content

API Reference parrot_tools.hooba.rules.engine

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.hooba.rules.engine

View source

Data-driven deductibility rules for Spanish autónomos (FEAT-602 M9). Pure after load.

Class AeatRule

One versioned AEAT-inspired deductibility rule.

Fields:

Field Type Default Description
rule_id str
matcher RuleMatcher
priority int 100
deductible_pct Decimal
vat_deductible_pct Decimal
annual_cap Optional[Decimal] None
daily_cap Optional[Decimal] None
requires_exclusive_use bool False
invoice_required bool True
review_required bool True
skip bool False
legal_basis str
hooba HoobaMapping

Attribute BUNDLED

Alias BankExpenseRow

Re-exported from parrot_tools.hooba.models.BankExpenseRow.

Alias DeductibilityVerdict

Re-exported from parrot_tools.hooba.models.DeductibilityVerdict.

Alias HoobaMapping

Re-exported from parrot_tools.hooba.models.HoobaMapping.

Class RuleEngine

Classify bank rows into deductibility verdicts.

Parameter Type Default Description
table RuleTable

Method RuleEngine.load

Load and validate a rule table (bundled autonomo_es_v1.yaml by default).

load(path: Optional[Union[str, Path]] = None) -> 'RuleEngine'

Parameter Type Default Description
path Optional[Union[str, Path]] None

Returns: 'RuleEngine'

Method RuleEngine.match

Lowest-priority-number match; ties or no match → fallback (never guess, S12).

match(row: BankExpenseRow) -> AeatRule

Parameter Type Default Description
row BankExpenseRow

Returns: AeatRule

Method RuleEngine.assess

Return a draft verdict, or None when the matched rule is skip.

assess(row: BankExpenseRow, *, period: str) -> Optional[DeductibilityVerdict]

Parameter Type Default Description
row BankExpenseRow
period str

Returns: Optional[DeductibilityVerdict]

Class RuleMatcher

Conditions that identify a deductibility rule.

Fields:

Field Type Default Description
concept_regex Optional[str] None
amount_min Optional[Decimal] None
amount_max Optional[Decimal] None
category str

Class RuleTable

A versioned collection of deductibility rules.

Fields:

Field Type Default Description
version str
simplified_invoice_limit_eur Decimal
rules list[AeatRule]
fallback_rule_id str

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally