aeat.domain.transactions._classification_rule module¶
Domain model for a ledger classification rule.
A rule binds a regex description-pattern to a target
BusinessClassification.
Rule IDs are content-addressed (SHA-256 of the rule’s key fields) so
creation is idempotent: adding the same pattern + classification pair
twice produces the same rule_id and the repository overwrites the prior
entry rather than duplicating it.
- class LedgerClassificationRule(**data)[source]¶
Bases:
BaseModelA persisted ledger classification rule.
rule_idis content-addressed so that persisting the same pattern twice is idempotent. Priority resolution: lowerpriorityinteger wins; ties broken bycreated_atascending (earliest rule wins).- Parameters:
- rule_id: str¶
- description_pattern: str¶
- classification: BusinessClassification¶
- category_id: str | None¶
- priority: int¶
- created_at: datetime¶
- actor: str¶
- classmethod create(*, description_pattern, classification, category_id=None, priority=100, actor, created_at=None)[source]¶
Construct a
LedgerClassificationRulewith the content-addressedrule_id.- Return type:
- Parameters: