ledgerconv

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 1 Imported by: 0

README

Ledgerconv

Ledgerconv is a command line tool that converts multiple bank CSV statement files into a single JSON statement file.

How to use

Ledgerconv expects the input statement files to be arranged in the following directory structure.

my-input-directory
|___ name-of-your-account
|       |___ statement-file-1.csv
|       |___ statement-file-2.csv
|       |___ statement-file-3.csv
|___ for-example-hdfc-savings
|       |___ statement-file-1.csv
|       |___ statement-file-2.csv
|___ for-example-icici-credit-card
        |___ statement-file-1.csv
        |___ statement-file-2.csv

Once you have your statements in the correct structure, simply execute:

ledgerconv <input-dir> -o <output-dir>

An example can be:

ledgerconv ./statements/original -o ./statements/converted

The output JSON statement file contains an array of bank-agnostic transaction documents. The schema of a transaction document is as follows:

{
  "account_name": "string",
  "amount": "float64",
  "timestamp": "string",
  "bank_ref_num": "string",
  "payment_mode": "string",
  "remarks": "string"
}

Supported banks

Currently, Ledgerconv can understand the CSV statement schemas of the following bank accounts:

  1. ICICI savings account statements
  2. ICICI credit card statements
  3. HDFC savings account statements

Note that Ledgerconv uses the name of the directory (the account name) to determine the kind of parser to be used for its statements.

See the accountTypeInferRules map in the src/core/banks/mappings.go file for more information on how account names are parsed.

Add support for a bank

This section describes the changes needed in the codebase to add support for a new bank account.

  • Write a ConverterFunc for your bank account in the src/core/banks package. For guidance, take reference from already written ConverterFunc(s).
  • Go into the src/core/banks/mappings.go file and add your new BankAccountType in the list of constants.
  • In the same file, update the accountTypeInferRules map, so that the BankAccountType for your new bank account can be inferred from an informal directory name.
  • In the same file, update the ConverterMap map to add your new BankAccountType to ConverterFunc mapping.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL