Skip to content

Skip unwanted transactions

After setting up rules for DoorDash, Netflix, and Comcast in the previous steps, you might still see some transactions in the Open transactions section when you run the import command. Looking at our example CSV file, there are two remaining transactions:

  • CREDIT BALANCE REFUND -- a credit card balance refund
  • SP CORSAIR GAMING INC. -- a one-off electronics purchase

Some of these transactions are simply not interesting to us. For example, the CREDIT BALANCE REFUND is an internal credit card balance transfer. We don't want to import it into our Beancount books at all. However, if we don't handle it somehow, it will keep showing up in the Open transactions section every time we run the import command. This makes it hard to spot genuinely new transactions that need attention.

The ignore action

To solve this problem, beanhub-import provides an ignore action type. When a transaction matches a rule with the ignore action, the import engine marks it as processed and moves on. No Beancount transaction is generated, but it won't appear in the Open transactions section anymore.

Let's add a rule to ignore the credit balance refund transactions:

inputs:
  - match: "import-data/connect/chase/*.csv"
    config:
      default_file: "main.bean"
      prepend_postings:
        - account: Liabilities:ChaseCreditCard
          amount:
            number: "{{ -amount }}"
            currency: "{{ currency | default('USD', true) }}"

imports:
  - name: Routines
    common_cond:
      extractor:
        equals: "plaid"
    match:
      - cond:
          desc:
            prefix: "DD *DOORDASH"
        vars:
          narration: DoorDash food delivery
          account: Expenses:FoodDelivery:DoorDash
      - cond:
          desc: "Netflix"
        vars:
          narration: Netflix subscription
          account: Expenses:Entertainment:StreamingService
      - cond:
          desc: "Comcast"
        vars:
          account: Expenses:Internet
    actions:
      - txn:
          flag: "{{ '!' if pending else '*' }}"
          payee: "{{ payee | default(omit, true) }}"
          narration: "{{ narration | default(desc, true) }}"
          postings:
            - account: "{{ account }}"
              amount:
                number: "{{ amount }}"
                currency: "{{ currency | default('USD', true) }}"

  - name: Ignore credit balance refunds
    match:
      extractor:
        equals: "plaid"
      desc: "CREDIT BALANCE REFUND"
    actions:
      - type: ignore

Notice that the key difference is the type: ignore in the action. There is no file or txn field needed because we're not generating any transaction. We simply tell the import engine to skip this transaction.

After running the import command, the CREDIT BALANCE REFUND transaction will no longer appear in the Open transactions section.

Ignoring multiple transactions at once

You can match multiple transaction descriptions in a single rule using the one_of match condition. This is handy when you have several types of transactions you want to skip.

For example, say you also want to ignore autopay confirmation entries and payment thank you entries:

  - name: Ignore unneeded entries
    match:
      extractor:
        equals: "plaid"
      desc:
        one_of:
          - "CREDIT BALANCE REFUND"
          - "AUTOPAY PAYMENT"
          - "PAYMENT THANK YOU"
    actions:
      - type: ignore

This single rule will ignore any transaction whose desc matches one of those values.

Ignoring is not deleting

It's worth noting that the ignore action only tells the import engine to treat the transaction as handled. It does not delete anything from your Beancount files. If you have previously imported a transaction and later decide you want to remove it, you need the del_txn action instead, which we will cover in the next section.

The ignore action is purely about keeping your Open transactions report clean so you can focus on the transactions that still need your attention.