项目作者: andrewscwei

项目描述 :
Handy Python script to parse RBC Visa statements
高级语言: Python
项目地址: git://github.com/andrewscwei/rbc-statement-parser.git
创建时间: 2018-07-09T23:23:30Z
项目社区:https://github.com/andrewscwei/rbc-statement-parser

开源协议:MIT License

下载


RBC Statement Parser

Python script for parsing RBC PDF statements, compatible with both VISA and personal banking accounts (i.e. chequing, savings, etc). The output is a list of formatted transactions printed on console or output to a file.

Setup

Set up environment:

  1. $ pre-commit install
  2. $ pipenv install -d
  3. $ pipenv shell

Usage

Download PDF statements from RBC and save them in a directory.

  1. # Parse PDF(s) and output to console
  2. $ python main.py <pdf_file_or_dir_of_pdf_files>
  3. # Parse PDF(s) and output to console and out.txt
  4. $ python main.py <pdf_file_or_dir_of_pdf_files> -o out.txt

Linting

  1. $ pylint **/*.py

Config

Create a .rc file in project root. You can also provide another file name and pass it to --config or -c option flag when executing main.py. See below example to understand what this config does:

  1. {
  2. // String format of each transaction in the output, the following is the
  3. // default.
  4. "format": "{date}\t{method}\t{code}\t{description}\t{category}\t{amount}",
  5. // Each key is a category name to be assigned to a parsed transaction, and
  6. // each array element is a regex pattern where if the transaction description
  7. // matches any of the patterns, the category association will be made.
  8. "categories": {
  9. "<category_1_name>": [
  10. "<pattern_1>",
  11. "<pattern_2>",
  12. "<pattern_3>",
  13. ...
  14. ],
  15. "<category_2_name>": [
  16. "<pattern_1>",
  17. "<pattern_2>",
  18. "<pattern_3>",
  19. ...
  20. ],
  21. ...
  22. },
  23. // Each array element is a regex pattern where if the transaction description
  24. // matches any of the patterns, it will be excluded from the output.
  25. "excludes": [
  26. "<pattern_1>",
  27. "<pattern_2>",
  28. "<pattern_3>",
  29. ...
  30. ]
  31. }