redstreet / beancount_reds_plugins

Miscellaneous plugins for Beancount double entry accounting
GNU General Public License v3.0
92 stars 18 forks source link

zerosum with multiple sub accounts of one bank in one bean file ans 100% CPU #24

Closed jpduyx closed 7 months ago

jpduyx commented 11 months ago

Hello I'm trying the zerosum plugin to handle duplicates

I have multiple bank accounts and in one of them i have multiple (lets say 10) sub accounts. I have imported all these accounts for this year so far into one single file

2023bank.bean
2023OtherBank.bean
2023YetAnotherBank.bean

I tried to use the plugin on some of the accounts to try and detect duplicates from transactions between all the accounts, like this:

plugin "beancount_reds_plugins.zerosum.zerosum"  "{
  'zerosum_accounts' : {
    'Assets:B:Bank1'              : ('', 1),
    'Assets:B:Bank2'              : ('', 1),
    'Assets:B:Bank3'              : ('', 1),
    'Assets:B:Bank4'              : ('', 1),
    'Assets:B:Bank5'               : ('', 1),
    'Assets:B:Bank6'               : ('', 1),
    'Assets:B:Bank7'               : ('', 1),
    'Assets:B:Bank8'               : ('', 1),
    'Assets:B:Bank9'               : ('', 1),
    'Assets:B:Bankj10'             : ('', 1),
    'Assets:B:OtherBank'             : ('', 1),
    'Assets:B:YetAnotherBank'             : ('', 1),
   'Assets:ZeroSum:Transfers'       : ('', 1),
  }, 
  'account_name_replace' : ('ZeroSum', 'ZS-Matched')
}"

First I go some errors, but later just nothing until I noticed that the cpu core goes to 100% use and my laptop runs warm until I think it is warm enough and I cancel the process after some minutes.

I tried reducing the time span to 1, because all transactions are between my accounts and usually arrive the same day in the target account anyways.

Any Idea where I should look to make this work? Or is this plugin not meant for a use-case like this?

redstreet commented 11 months ago

The plugin is meant to find matches within accounts. It's meant for the cases where all those bank accounts have transactions that have one posting into 'Assets:ZeroSum:Transfers'. And if so, your config should only include 'Assets:ZeroSum:Transfers', nothing else.

Does that help?

jpduyx commented 11 months ago

thanks this explains a lot

The last thing I tried was to remove all the accounts except for the 'Assets:ZeroSum:Transfers' ... but I didn't think about manually fixing one side of the transaction ... I give it another shot ...

I guess I was hoping that the plugin uses all the configured accounts and then "automagically" find all the duplicate transactions between them and then mak or proposes to fix. But I can now work with this.

An interesting journey I got into. Thank you kindly for your help.

redstreet commented 11 months ago

Glad it helped. The very first example in the README should give you a good idea of the reason why I took this approach, which is an alternative to de-duplication.

Also see https://reds-rants.netlify.app/personal-finance/deduping-with-zerosum/

Good luck!

jpduyx commented 11 months ago

It works way better now ... just one more thing ... any idea how come that "smart-importer" now sometimes uses the account:

Assets:ZS-Matched:Transfers

I grepped my repository to find any references to this Account (I played with it trying to figure out ZeroSum plugin) and cleaned up and made sure that this AccountName was nowhere in any of the files ... but still ... I thought smart-importer learns on the fly and doesn't have any "Memory"

It is like the zerosum plugin is also active during an import and then creates the matched account on the fly in memory and then smart-importer uses it for the training instead of learning 'Assets:ZeroSum:Transfers' ?

Is there a way to disable the plugin when running an import?

redstreet commented 11 months ago

That's exactly what happens.

Search for the source of

process_all_files.zsh

in this page, which shows you how to disable it.

https://reds-rants.netlify.app/personal-finance/putting-it-all-together-into-a-workflow/

redstreet commented 7 months ago

Closing this as there seem to be no more questions. Feel free to reopen.