beansoup package¶
Submodules¶
beansoup.transactions module¶
Utilities to work with beancount.core.data.Transaction objects.
-
class
beansoup.transactions.
TransactionCompleter
(existing_entries, account, min_score=0.5, max_age=None, interpolated=False)[source]¶ Bases:
object
A class capable of completing partial transactions.
Importers typically generate incomplete transactions with a single posting to the main account related to the imported data. This class attempts to complete those transaction by adding a second posting to an account chosen based on the existing transaction history for the main account.
It looks for existing transactions that have exactly two postings and where one of the two postings is to the main account. It scores each of these transactions based on the similarity of its payee and narration fields to the narration field of the incomplete transaction and selects the one with the highest score as a model to fill in the missing posting of the incomplete transaction. Equal scores are broken by selecting the most recent transaction.
-
complete_entries
(entries)[source]¶ Complete the given entries.
Only transactions with a single posting to the account bound to the completer may be modified.
Parameters: entries – The entries to be completed. Returns: A list of completed entries
-
complete_entry
(entry)[source]¶ Complete the given entry.
This method attempts to complete the entry only if it is a transaction with a single posting to the account bound to the completer. The entry will be completed only if a suitable model transaction can be found. If multiple model transactions are found that balance the transaction against different account, the missing posting will be flagged for review.
Parameters: entry – The entry to be completed. Returns: True is the entry was completed; False, otherwise.
-
find_best_model
(txn)[source]¶ Return the best model for the given incomplete transaction.
Parameters: txn – A beancount.core.data.Transaction object; an incomplete transaction with a single posting. Returns: A pair of a beancount.core.data.Transaction object and a set of account strings; the first part is the model transaction or None, if no suitable model could be found; the second part is a set of the different accounts used by top-scoring transaction to balance the posting to the target account.
-
beansoup.version module¶
Project version.