The structured output of ExReconcile.reconcile/3.
Fields
:matched- list of{left, right}pairs that were successfully reconciled with no field differences outside configured tolerances.:discrepancies- list of{left, right, [field_diff]}tuples where the pair was matched (same key) but one or more fields differ beyond tolerance. Eachfield_diffis a map describing the field and the delta; seefield_diff/0.:splits- list ofsplit_match/0tuples representing many-to-one matches found whenallow_splits: true. Either one left transaction matched against multiple right transactions ({left, [right1, right2, ...]}), or multiple left transactions matched against one right transaction ({[left1, left2, ...], right}).:unmatched_left- transactions from the left list with no counterpart in the right.:unmatched_right- transactions from the right list with no counterpart in the left.
field_diff shape
# Amount discrepancy
%{field: :amount, left: 1050, right: 1000, delta: -50}
# Date discrepancy
%{field: :date, left: ~D[2024-01-15], right: ~D[2024-01-16], delta: 1}
# Description discrepancy
%{field: :description, left: "Coffee Shop", right: "COFFESHOP LTD"}
Summary
Types
A many-to-one split match. Either a single left transaction whose amount equals the sum of multiple right transactions, or multiple left transactions that sum to a single right.
Functions
Returns true when the reconciliation is clean: no discrepancies and no unmatched
transactions on either side.
Returns a summary map with counts for each category.
Types
@type discrepancy() :: {ExReconcile.Transaction.t(), ExReconcile.Transaction.t(), [field_diff()]}
@type pair() :: {ExReconcile.Transaction.t(), ExReconcile.Transaction.t()}
@type split_match() :: {ExReconcile.Transaction.t(), [ExReconcile.Transaction.t()]} | {[ExReconcile.Transaction.t()], ExReconcile.Transaction.t()}
A many-to-one split match. Either a single left transaction whose amount equals the sum of multiple right transactions, or multiple left transactions that sum to a single right.
@type t() :: %ExReconcile.Result{ discrepancies: [discrepancy()], matched: [pair()], splits: [split_match()], unmatched_left: [ExReconcile.Transaction.t()], unmatched_right: [ExReconcile.Transaction.t()] }
Functions
Returns true when the reconciliation is clean: no discrepancies and no unmatched
transactions on either side.
Examples
iex> ExReconcile.Result.clean?(%ExReconcile.Result{})
true
iex> ExReconcile.Result.clean?(%ExReconcile.Result{unmatched_left: [%ExReconcile.Transaction{amount: 1}]})
false
Returns a summary map with counts for each category.
The splits count is the number of split groups (not the total number of transactions
involved). The total_left and total_right counts include all transactions covered
by split groups.
Examples
iex> result = %ExReconcile.Result{matched: [{"a", "b"}], unmatched_left: ["c"]}
iex> ExReconcile.Result.summary(result)
%{matched: 1, discrepancies: 0, splits: 0, unmatched_left: 1, unmatched_right: 0, total_left: 2, total_right: 1}