Skip to content

API Reference parrot_tools.hooba.reconcile

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

parrot_tools.hooba.reconcile

View source

Match Hooba purchase invoices to the bank charges that paid them (pure functions, no I/O).

A purchase invoice pays out as one bank debit, but the amount registered in Hooba is not always the amount charged: only the deductible share of a mixed-use supply may be registered, or the invoice may be in a foreign currency. Such drafts carry the charged amount in their notes as a [bank:<amount>] marker; every other draft is expected to be charged its totalAmount.

Attribute BANK_MARKER_RE

Alias BankExpenseRow

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

Class ChargeMatch

One purchase invoice paired with the bank debit that paid it.

Fields:

Field Type Default Description
purchase_invoice_id int
number Optional[str]
supplier str
invoice_date dt.date
registered_amount Decimal
expected_charge Decimal
charge_date dt.date
charge_amount Decimal
concept str
movement Optional[str]
row_id str

Function bank_marker

Notes marker recording the amount the bank will charge for an invoice.

bank_marker(amount: Decimal) -> str

Parameter Type Default Description
amount Decimal

Returns: str

Function expected_charge

Amount the bank should have charged for a purchase-invoice record (marker, else its total).

expected_charge(record: dict) -> Decimal

Parameter Type Default Description
record dict

Returns: Decimal

Function match_charges

Pair each purchase invoice with at most one debit: same supplier, amount and a nearby value date.

Candidates are assigned greedily by date distance across all invoices, so a monthly subscription never takes the charge that belongs to the next month's invoice.

match_charges(records: Iterable[dict], contacts: dict[int, dict], rows: Iterable[BankExpenseRow], *, days_before: int = 2, days_after: int = 12, tolerance: Decimal = Decimal('0.01')) -> tuple[list[ChargeMatch], list[dict]]

Parameter Type Default Description
records Iterable[dict]
contacts dict[int, dict]
rows Iterable[BankExpenseRow]
days_before int 2
days_after int 12
tolerance Decimal Decimal('0.01')

Returns: tuple[list[ChargeMatch], list[dict]] — (matches, unmatched_records).

Function payment_method_urn

Hooba payment-method URN for the kind of bank movement that paid the invoice.

payment_method_urn(match: ChargeMatch) -> str

Parameter Type Default Description
match ChargeMatch

Returns: str

Function supplier_tokens

Words of a contact's legal and trade names that can identify it on a bank statement line.

supplier_tokens(contact: dict) -> set[str]

Parameter Type Default Description
contact dict

Returns: set[str]

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