Skip to main content

Library to parse & update memo and/or payee information in YNAB transactions

Project description

ynab-memo-parser

GitHub Release Github Release

This library helps you to use original memo and payee information from your bank transactions to either show additional details or substitute/change the current one in YNAB. It can be helpful for cases in which YNAB import does not handle the information coming from the bank well (e.g. not showing the actual bank memo or populating a wrong payee name).

"Buy Me A Coffee"

Preparations

  1. Create a personal access token for YNAB as described here
  2. Get the IDs of your budget and account which records are faulty. You can find both IDs if you go to https://app.ynab.com/ and open the target account by clicking on the name on the left hand side menu. The URL does now contain both IDs https://app.ynab.com/<budget_id>/accounts/<account_id>

Basic Usage

1. Install library from PyPI

pip install ynab-memo-parser

2. Check your original memo and payee values for potential things to use

All records in YNAB come with their original memo and payee information attached. You can see both values if you use the `fetch records' function of this library and look at a couple sample records.

from ynabmemoparser import YnabMemoParser

ynab_memo_parser = YnabMemoParser(token='<token>', budget='<budget>', account='<account>')
ynab_memo_parser.fetch_record_dicts()

You will get back a dictionary with all data stored for the transaction. The library uses the following keys with the stated labels

  • import_payee_name_original as original_memo
  • import_payee_name as original_payee
  • payee as current_payee
  • memo as current_memo

3. Create a Parser child class which implements your logic

The class needs to implement a logic for parse_payee() and parse_memo() based on the values coming from the four fields above. If you don't want to change anything in the field you e.g. just return current_payee inside the parse_payee() function.

from ynabmemoparser import Parser

class MyParser(Parser):

    def parse_payee(self, original_payee: str, current_payee: str, original_memo: str, current_memo: str) -> str:
        # your implementation

    def parse_memo(self, original_payee: str, current_payee: str, original_memo: str, current_memo: str) -> str:
        # your implementation

3. Test your parser on some records

from ynabmemoparser import YnabMemoParser

ynab_memo_parser = YnabMemoParser(token='<token>', budget='<budget>', account='<account>')
record_dicts = ynab_memo_parser.fetch_record_dicts()
parsed_records = ynab_memo_parser.parse_records(records_dicts=record_dicts, parser=MyParser())

You will get back a list of YnabRecord objects. Check the payee and memo fields in these objects to see the result of your parser.

4. Update your records in YNAB

If you are satisfied with your parsing results you can pass the list of YnabRecord to the update_records()function. It will update the payeeand memo values in YNAB with the values in the YnabRecord object

ynab_memo_parser.update_records(parsed_records)

If the insert is successful you get back an integer with the number of records which have been updated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ynab_memo_parser-0.1.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ynab_memo_parser-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file ynab_memo_parser-0.1.0.tar.gz.

File metadata

  • Download URL: ynab_memo_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.12.2 Linux/6.2.0-1019-azure

File hashes

Hashes for ynab_memo_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe29fb986430362ff8e48af0f69e275573f93bc79043b16610e6e3b18529bc35
MD5 b73fb2f33753f75536939a71db5465dd
BLAKE2b-256 e9c31f66008f91bdbfb4220bf64e71756813c7d4f851df17dbf81189ffb22207

See more details on using hashes here.

File details

Details for the file ynab_memo_parser-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ynab_memo_parser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.12.2 Linux/6.2.0-1019-azure

File hashes

Hashes for ynab_memo_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9e1a8e24a6cd57b76c3c21c01811aef919a5876bf9bd323d1431c7c80b03c01
MD5 464f61325641135a80233a73800b71e6
BLAKE2b-256 b322639828b2096e300dcfc14484935d383c833dae58cb5c1accb552ac115435

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page