Summary
Create a strongly typed TransactionModel using Pydantic to validate and standardize normalized transaction records after ETL processing. This model will serve as the single source of truth for downstream logic, including validation, serialization, and optional export.
Design Requirements
- Field validation: Ensure type enforcement and domain-level constraints (e.g. non-negative amounts, ISO8601 timestamps).
- Field coverage:
date: datetime.date or ISO 8601 string
amount: Decimal
vendor: str
category: str
subcategory: Optional[str]
account_name: str
account_id: UUID | str
person_tag: Optional[str]
budget_category: Optional[str]
comment: Optional[str]
Implementation Tasks
Acceptance Criteria
- The model validates all normalized transaction records against the schema
- Invalid fields raise detailed Pydantic
ValidationError exceptions
- Model is unit tested for correct parsing, coercion, and failure cases
- Field types align with
pyproject.toml-defined linters and type checkers
Dependencies
Milestone
Milestone: v0.3.0 – ETL Enhancements and Data Integrity
This model is foundational for enforcing transaction schema consistency as the system scales to multi-institution support and category tagging logic.
Summary
Create a strongly typed
TransactionModelusing Pydantic to validate and standardize normalized transaction records after ETL processing. This model will serve as the single source of truth for downstream logic, including validation, serialization, and optional export.Design Requirements
date:datetime.dateor ISO 8601 stringamount:Decimalvendor:strcategory:strsubcategory:Optional[str]account_name:straccount_id:UUID | strperson_tag:Optional[str]budget_category:Optional[str]comment:Optional[str]Implementation Tasks
ledgerbase/models/transaction.pyAcceptance Criteria
ValidationErrorexceptionspyproject.toml-defined linters and type checkersDependencies
Milestone
Milestone: v0.3.0 – ETL Enhancements and Data Integrity
This model is foundational for enforcing transaction schema consistency as the system scales to multi-institution support and category tagging logic.