Git Product home page Git Product logo

fireflayer's Introduction

Build

FireFlayer

A python app to clean (or flay if you will) firefly-iii transactions as they are imported or in bulk.

Usage

Can be started in either webook or process mode, where the former is probably what you would want most of the time, while the latter is useful to process all existing transactions.

FireFlayer expects a configuration file in Yaml format fireflayer_config.yaml which should contain flays which are actions to perform on any given transaction processed.

As an example:

---
flay:
  - name: Extract Payment services as tags
    function: extract_tag
    arguments:
      source_field: description
      pattern: '^(.+)\ ?\*'
      group: 1
  - name: Remove Payment services from description and destination_name
    function: replace
    arguments:
      source_fields:
        - description
        - destination_name
      pattern: '^(.+)\ ?\*'
      value: ''
  - name: Override destination_name for cryptic payment providers
    function: destination_by_tags
    arguments:
      tag_names: ['Microsoft', 'AMZN Mktp US', 'GOOGLE',]
  - name: Set groceries as category
    function: category_by_filter
    arguments:
      source_fields:
        - destination_name
      category_name: Groceries
      includes:
        - Obs
        - Extra
        - Prix
      excludes:
        - Obs Bygg
      case_sensitive: false

With the configuration above and a transaction with the description "PayPal *Ice Cream Shop" "PayPal" would be extracted as a tag in the first stage. In the second stage we remove "PayPal *" from the description and destination_name fields.

Sometimes though these payment providers create weird contents for destination_name like "AMZN Mktp US * HTNS456HTNS", which ends up as "HTNS456HTNS" after the first 2 stages. So the third stage sets the destination_name to the extracted payment provider tag instead.

The last stage is used to add a category based on "destination_name". In this case if there are transactions going to both Obs and Obs Bygg where one is a supermarket and the other a hardware store, only Obs will get the category groceries.

Configuration

FireFlayer expects the following environment variables

FIREFLAYER_AUTH_TOKEN # https://docs.firefly-iii.org/firefly-iii/api/
FIREFLAYER_API_URL # The url to the api https://firefly.yourdomain.com
FIREFLAYER_CONFIG_PATH # The path to the yaml config file

Command line invocation:

usage: fireflayer.app [-h] [--dry-run] [--log-level {WARN,INFO,DEBUG}] [--port PORT] {webhook,process}

positional arguments:
  {webhook,process}     Which action to execute

options:
  -h, --help            show this help message and exit
  --dry-run             Dry run (No side effects)
  --log-level {WARN,INFO,DEBUG}
                        Change log level (default: INFO)
  --port PORT           Set the port for the webserver to listen on

fireflayer's People

Contributors

brujoand avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.