adept/full-fledged-hledger

Example for multi-source import setup

kiteloopdesign opened this issue · 3 comments

I tried setting up for a folder structure in which I have an extra source for CSVs (an extra bank alongside "lloyds" in your examples), and updating the export.hs accordingly but I can't get it to work (extra source is ignored). Listing what I have done in case you spot what is missing or can provide an example maybe? Thanks

I used example 02 as base. I created a new dummy folder alongside lloyds

02-getting-data-in
.
├── dummy
│   ├── csv
│   ├── csv2journal
│   ├── dummy.rules
│   ├── in
│   ├── in2csv
│   └── journal
└── lloyds
    ├── csv
    ├── csv2journal
    ├── in
    ├── in2csv
    ├── journal
    └── lloyds.rules

content in dummy is like so:

dummy
.
├── csv
│   └── test.csv
├── csv2journal
├── dummy.rules
├── in
│   └── test.csv
├── in2csv
└── journal
    └── test.journal

updated 2017 journal like so:

cat 2017.journal 
;; This journal is for the current year

;; Opening balances
2017/01/01 opening balances
  assets:Lloyds:current    = £100.00
  equity:opening balances
  
include ./import/lloyds/journal/99966633_20171223_1844.journal
include ./import/dummy/journal/test.journal

on export.hs updated these lines:


extraDeps file
  | "//lloyds//*.journal" ?== file   = ["lloyds.rules"]
  | "//dummy//*.journal" ?== file   = ["dummy.rules"]
  | otherwise = []


  -- Enumerate directories with auto-generated cleaned csv files
  [ "//import/lloyds/csv/*.csv", "//import/dummy/csv/*.csv"] |%> in2csv

  -- Enumerate directories with auto-generated journals
  [ "//import/lloyds/journal/*.journal", "//import/dummy/csv/*.csv"] |%> csv2journal

In this line:

[ "//import/lloyds/journal/*.journal", "//import/dummy/csv/*.csv"] |%> csv2journal

you need to talk about journals, not csv files, like so:

[ "//import/lloyds/journal/*.journal", "//import/dummy/journal/*.journal"] |%> csv2journal

Let me know if this helps

true, that was a typo on my side
Changing it makes it work. Getting a balance assertion error now though as I guess the balances b/w accounts do not match, but that's a different story...
Thanks!

Let me know if it works out for you ... or does not :)