On Wed, Aug 26, 2009 at 03:05:35PM -0700, linuxcaffe wrote: > > > > > > When you say "setting up a rule".. is there an existing mechanism for > > > > that ? Maybe I'll try to have a local perl-monger make me a post-post > > > > processor to do this, that and the other. (If I succeed, I will > > > > > share) > > > > > Setting up a rule in AccountMatching.yaml, use "ToBeEdited" instead of > > > a real account name (ie: Expenses). > > > > I can't say that I understand that.. > > OK, now I do; basically substitute a FIXME flag, cool ! > > The more you explain and the more I pour over the code and yaml, the > more it all makes sense. > What order are these yaml files processed in ? > djp >
That's a good question! The real answer is that they are "dispatch tables" saved in YAML and all loaded back into Perl data structures prior to any data processing. A dispatch table is a way for me to replace a large switch statement with logic represented in data (ie: an array). You don't have to know perl to write your own rules this way, though you do need to know some basic perl regular expressions. As to how they are handled realistically: - FileMatches.yaml sets all the command line options based on matching the input filename. You can test using CLI options instead, and write a record here later. - Preprocess.yaml is exactly that. Each CSV line is sent through this dispatch table, and when it encounters a matching regexp it then executes the associated search/replace on the input CSV line. - AccountMatching.yaml uses a regexp to match a payee name, and set the accounts for the Ledger txn. The payee name is the one AFTER the preprocessor ran, so it may have changed or been cleaned up. You'll want to match that name, not the original. Regarding the MD5SUM question, it is an md5 of the original CSV line without any modifications, the same CSV line that is saved as a comment for comparison. A very exciting option you may not have looked into yet is the external file matching. When properly configured, my ledger reads in CSV for my credit card, and matches the date and amount of the transaction to a directory of scanned receipt images, and provided there is a match it adds a URL in the payee name. This means I can click on the URL in emacs to view the receipt for that txn without my having to link the image to the txn manually. I also have reports I run later that generate PDF expense reports with inline receipt images using that information. Obviously I have to scan in the receipts and place them in a directory with a specific filename, that is scripted separately. Enjoy. ------------------------------------------------------------------ Russell Adams [email protected] PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
