Thu Feb 28 20:12:17 EST 2019

Transaction matching

Link transactions between accounts, but allow for a little slack in date.

How to express this problem precisely?

Say M is the main account, and S is a sub account that needs to be
fully explained.  There will be a set of solutions to this.

- If the set is empty, something is wrong with the data.
- If there are multiple such sets, pick one based on:
  - Metadata distance?  This might be hard
  - Date distance
  - Random association
  - Combination

Expressed as a join, how can the uniqueness characteristic be
expressed?  It is a global property, so I don't really see how.

A sequential greedy algoritm:

- for each transaction in S, find a transaction in M that has the same
  amount by sequentially searching pre/post time and removing the
  corresponding transaction from M

This seems to be easy enough to implement.  Imperative in-place update
is easiest.  The main ledger should be ordered to make searching easy.

More general problems: