161 Commits

Author SHA1 Message Date
85c0819a44
Adds --category index option
Category argument added to allow the parsing of already categorized
transaction files. The new option takes an integer to indicate the
category index in a transaction row.
2021-07-07 17:07:35 +01:00
ba608093d3
Fix parsing for files w/o bank_cc naming
Fixes code flow for transactions' files with undescriptive filenames.
Adds default indexing to support banks not described in parsers.yaml.
Adds creditcard optional argument.
Command line options now passed as `dict` instead of `Namespace` to
`parse_data`. This will allow for an easier addition of future command
line options.
2021-07-07 17:05:25 +01:00
66262d8dc2
Moves period parser outside of Graph section
`period` ArgumentParser was inside of the Graph section of the
`argparser` function, resulting in confusing logical sequence.
Moved around to the beginning of the function to clarify code.
2021-07-07 16:46:50 +01:00
f9ecd15a7e
Updates README.md with ToDo section and info 2021-07-07 16:33:32 +01:00
5af505f962
Catch invalid category options
If there are invalid options in the category.yaml, the program will not
abort and will instead use an empty dictionary.
2021-07-06 19:14:29 +01:00
5f0fe38ba8
Accept a Null category
Null categories can have regex and additional options defined in the
configuration yaml.
2021-07-05 23:38:42 +01:00
c0cc8d5563
Removes obsolete code
Removes `PFState` class and surrounding code.
Removes load/save transactions methods, that were not used since
database introduction.
Removes status command from runnable.py.
2021-07-05 23:07:56 +01:00
37c97453a9
Refactored report module
Bring report up-to-date with sqlite3 database and yaml configuration
files.
Updates report command in runnable.py. Moves date arg parsing to utils
module
Report and graph now share an ArgumentParser with shared date options.
2021-07-05 22:53:03 +01:00
f811b5c711
Name unnamed category groups
Categories without group will now be assigned a No group category
instead of staying blank.
2021-07-05 22:34:51 +01:00
42ab10fd90
Refactored graph module
Bring graph up-to-date with sqlite3 database and yaml files.
Fix sorted transaction query. Removes date as passed parameters.
Updates graph command in runnable.py.
2021-07-04 00:53:07 +01:00
206a828b4a
[Fix] SELECT * now returns list of Transactions 2021-07-04 00:38:29 +01:00
dc6d1d0b02
Add groups to categories in YAML
Groups will later be used to aggregate categories into related groups to
present graphs and reports by type of categories.
2021-07-04 00:36:27 +01:00
9ba7f87a37
[Fix] Add Null to the possible list of categories
The Null category was missing from the available categories when
manually categorizing.
2021-07-03 18:21:12 +01:00
d8c9f3f9b9
[Fix] categorize_data now works w/ Transaction
Updates `categorize_data` to work with the `Transaction` class, which is now
used by the database.
Vacation categorizing will no longer replace previous category assigned.
`DBManager` gained new method to retrieve transactions between two dates
without any category.
Add method to `Transaction` to prepare for category update in database.
Transaction's returns from database queries are checked and assigned in
`if`s with the walrus (`:=`) operator.
2021-07-03 17:47:40 +01:00
1139dff249
Add long --database arg option 2021-07-03 00:51:55 +01:00
fb93f9d4fd
Replaces one-liner function with lambda 2021-07-03 00:23:27 +01:00
703acadaa9
Adds ArgumentParser to contain general arguments
Fix parser func arguments. The database should be passed as an argument,
not used before parsing.
Reordered and added logging to `DBManager` for better recording.
2021-06-30 21:18:06 +01:00
c51d31db47
Fix Postponed Evaluation of Annotations
Adds missing __future__ import.
Moves transaction parser method into Parser class.
2021-06-30 21:12:44 +01:00
3e20ae97db
parser command now writes do DB
`parse_data` from parser.py now takes a `DBManager` and runs
`insert_transactions` after parsing.
`DBManager` now takes `Transaction` type and returns the same on select
queries.
`DBManager` refactored with extensive type hinting.
`Transaction` updated to reflect use in `DBManager`.
2021-06-21 23:49:23 +01:00
fe2b347a53
Adds flake8-type-checking
flake8 now checks for proper type hinting.
Required when commiting new code.
2021-06-21 23:31:46 +01:00
393e3310a4
Removes unused commands
Removes obsolete vacation and restart argument parser.
Also updates some docstrings.
2021-06-12 22:30:04 +01:00
a7ea3affe6
__init__.py now contains module public methods
main.py updated.
2021-06-11 23:31:46 +01:00
deaa71ead4
Categorizing refactored with SQLite DB and YAML
`categorize_data` is the new entry for data categorization and receives
a DBManager. Contains the categorizing logic.
Categorizer configuration now done solely from categories.yaml file.

Ancilliary database methods added to DBManager required for categorizing
transactions.

Adds categorize to command line options.
Removes obsolete restart options and method from runnable.py.
Fixes parse and categorize method, now take cmd line arguments and
`DBManager`.

Removes obsolete tools.py, all functions already rewritten in relevant
modules.

Updated categories.yaml with new keys.
2021-06-11 22:11:07 +01:00
569469eac4
[Fix] Category SELECT can now get Null values 2021-06-07 20:33:34 +01:00
60a25b1f91
Adds category configuration as YAML file 2021-06-05 23:28:31 +01:00
b7b7e6041d
Updates .gitignore
Removes obsolete raw and data dirs and adds export one for exporting
.csv files.
Adds database files.
2021-06-04 23:44:45 +01:00
189ad42b3d
Removes helper Transaction functions
better accomplished by SQL queries.
2021-06-04 23:15:37 +01:00
4d6c865bb5
Parsers configuration now on parsers.yaml
parsers.py redid with single default parser that takes configurating
parameters from a yaml file.
Additional parsing configuration can be achieved with the additional_parser
attribute on yaml and rewriting the func and parser method on child
classes of Parser.
func will be called after each transaction is created and the parser
should call the parent parser method or rewrite the entire parser
process.
The parse_data function is now called from the runnable and the parsing
process is now called from there. The parse command can take an optional
bank before is tries to extract it from the filename and multiple paths,
either files or directories.
The Transaction __init__ was fixed to take inputs from previously
initiated Transaction.
Also adds utils.py with helper functions.
2021-06-03 23:30:32 +01:00
4d9e8edec8
Changed run logic to adjust to SQLite db
Removed init and restart functions and writes to state file.
Moved create tables to init method of DBManager and launch from init
command.
Restart removed.
Rearranged order in runnable.py according to sections.

Only init command working since rest of runnable function not updated
at the moment.
2021-06-03 23:11:52 +01:00
1c2c64f9fe
Implemented open connection at each transaction
Also adds vacation and backups table.
2021-05-27 22:37:50 +01:00
0898143f68
Helper function for database access 2021-05-27 21:14:57 +01:00
9513016d42
Adds SQLite interface and logging.conf
Begins process of porting transaction data from csv to SQLite.
Improves logging and introduces logging.conf.
2021-05-16 00:42:35 +01:00
466c884b1c
Adds README.md 2021-04-25 22:13:57 +01:00
84e5d68a6b
Removes unused imports and adds setuf.cfg
with flake8 setup.
2021-04-24 01:03:52 +01:00
c692a01f72
Graph now saves the images and increases its width 2021-04-24 00:27:37 +01:00
88c1d9d5ca
Refactor argparser and PFState classes
Moves argparser functions to runnable.py and PFState to state.py

Main function will now only call run from runnable.py. Should make it
easier to run additional functions. Program can now be run from main.py,
or imported from pfbudget.
2021-03-07 03:14:25 +00:00
2007f2bb9c
Adds better docstrings
and prints helpful messages to user.
2021-02-05 00:51:20 +00:00
51b16c7977
Fixes several FileNotFound at initialization
Added multiple Path.mkdir() when .pfstate, backup, raw and data
directories weren't created.
Adds try-except clause around functions called in init, so that errors
in the early stages are catched to remove already initialized state
files.
Moves filename definitions to tools using global vars.
Removed state.filename = p from main.py introduced when the state
filename was changed.
`self._save()` removed from `PFState` `__init__` as it's not needed. All
setattr already call it.
2021-02-04 23:45:24 +00:00
647af8be5b
Adds graph date options and report option
Also checks for transactions before loop incase of months without
transactions.
2021-02-03 21:57:57 +00:00
ff324ca0a6
Removes unnecessary Transactions class 2021-02-02 22:07:17 +00:00
311c5358f1
Removes duplicated sort_by_bank method 2021-02-02 22:03:55 +00:00
fe26bf8a6a
Adds two new plot methods and health expenses
Two new graphs created, discrete, where all discretionary expenses are
plotted, and average, for the yearly average. This later one will be
moved to report form.
Health expenses separated from required. Commute moved from fixed to
required expenses.
New by_month_and_category functions added to transactions.py.
2021-02-02 21:57:07 +00:00
9cdf626bdd
Adds requirements.txt 2021-01-29 22:54:34 +00:00
fe840b622c
Adds graph subcommand
Moves all graph and matplotlib dependencies to graph.py.
Moves Transactions and Categories methods outside the class for better
visibility.
Variable expenses renamed to required.
transactions.py now has by_year, by_month, by_categories in global scope
and slightly improved perfomance.
2021-01-29 22:48:55 +00:00
9971e6214f
Major refactor
Add new tools.py to handle subcommands.
Most workflow moved to subcommands handlers, which in turn calls
tools.py functions.
Moves internal state (dict which gets parsed into PFState) to folder
.pfstate (sort of like git) and renamed to state.
New PFState class and factory pfstate function added.
*.pickle changed to .pfstate on .gitignore. Everything local stored in
.pfstate.

Adds vacation, status and backup commands. Modifies init, restart and
parse to receive PFState and call tools functions.
Vacation can add, list or remove vacations date intervals.
Backup saves either a full transaction list or the entire data folder
into .pfstate/backup folder.

Categorization functions moves to tools, deleted old one on
categories.py.
Moves parse_data and load_transactions/save_trasactions outside of
respective class to global scope.
Travel category class moved to the end of file, since it uses others in
its search method.
Removes unused initializer.py file.
2021-01-29 21:46:25 +00:00
909065eca6
Restructures project tree
Moves *.py except main and initializer.py to pfbudget folder
2020-12-18 19:11:50 +00:00
69b44fecae
Adds argparse lib to handle different run modes 2020-12-18 18:55:48 +00:00
fd1059ffb3
Moves initializer function to its own file 2020-12-18 00:14:25 +00:00
d165f566de
Bump month to last November 2020-12-04 22:52:57 +00:00
8ae1ecb2a4
Updates Bank2 parser for different locales 2020-12-04 22:49:44 +00:00