[GH-ISSUE #196] [BUG] Auto categorization rule not created on new transaction or update of transaction #7064

Closed
opened 2026-04-10 16:43:52 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @winklevos on GitHub (Aug 21, 2022).
Original GitHub issue: https://github.com/actualbudget/actual/issues/196

When creating a new transaction and a new payee, adding a category does not auto-create a related rule

The same occurs when updating an existing transaction from uncategorised

Browser: Firefox and Chrome
Version: https://hub.docker.com/r/kippenhof/actual-server latest
Confirmed the same behaviour locally building from master

image

Originally created by @winklevos on GitHub (Aug 21, 2022). Original GitHub issue: https://github.com/actualbudget/actual/issues/196 When creating a new transaction and a new payee, adding a category does not auto-create a related rule The same occurs when updating an existing transaction from uncategorised Browser: Firefox and Chrome Version: https://hub.docker.com/r/kippenhof/actual-server latest Confirmed the same behaviour locally building from master ![image](https://user-images.githubusercontent.com/30995408/185774427-265e0640-9c92-4dff-87b1-123d8af30420.png)
Author
Owner

@rich-howell commented on GitHub (Aug 21, 2022):

Hey @winklevos

This looks to be by design, if you take a look at the documentation https://actualbudget.com/docs/other/rules/ it states the following;

Here's the best part: you might never need to touch rules. Actual will automatically create rules for you based on your behavior. >As you rename payees or categorize transactions, it will use rules as a mechanism for writing down what you've done so it will >automatically happen later. For example, if you categorize the payee "Kroger" as "Food" a couple times, it will create a rule to >automatically apply that category on import. As you use Actual more, your data will automatically get cleaned up for you based >on your previous behavior.

Actual will create a rule based on how you use it.

Hope this helps, if you need anything more please do reach out or @ me in discord and I will re-open this issue.

<!-- gh-comment-id:1221554974 --> @rich-howell commented on GitHub (Aug 21, 2022): Hey @winklevos This looks to be by design, if you take a look at the documentation https://actualbudget.com/docs/other/rules/ it states the following; >Here's the best part: you might never need to touch rules. Actual will automatically create rules for you based on your behavior. >As you rename payees or categorize transactions, it will use rules as a mechanism for writing down what you've done so it will >automatically happen later. For example, if you categorize the payee "Kroger" as "Food" a couple times, it will create a rule to >automatically apply that category on import. As you use Actual more, your data will automatically get cleaned up for you based >on your previous behavior. Actual will create a rule based on how you use it. Hope this helps, if you need anything more please do reach out or @ me in discord and I will re-open this issue.
Author
Owner

@winklevos commented on GitHub (Aug 21, 2022):

@rich-howell this bug is saying it isn't creating as per this documentation.

When categorising transactions rules are not created automatically.

I have a working fix in progress that adds the behaviour I expect

<!-- gh-comment-id:1221643773 --> @winklevos commented on GitHub (Aug 21, 2022): @rich-howell this bug is saying it isn't creating as per this documentation. When categorising transactions rules are not created automatically. I have a working fix in progress that adds the behaviour I expect
Author
Owner

@rich-howell commented on GitHub (Aug 22, 2022):

I am happy to re-open this for you, however this isn't a bug.

The rules engine will decide when a rule needs to be created based on the factors used within the transaction. If you just create one transaction for say Grocery and select the merchant and value a rule won't be created because you would end up with rules for every single thing.

I am not sure if you will get your PR merged into main if it create a rule for every single transaction added, but I will leave this open for James to review when the time comes.

<!-- gh-comment-id:1222580624 --> @rich-howell commented on GitHub (Aug 22, 2022): I am happy to re-open this for you, however this isn't a bug. The rules engine will decide when a rule needs to be created based on the factors used within the transaction. If you just create one transaction for say Grocery and select the merchant and value a rule won't be created because you would end up with rules for every single thing. I am not sure if you will get your PR merged into main if it create a rule for every single transaction added, but I will leave this open for James to review when the time comes.
Author
Owner

@winklevos commented on GitHub (Aug 22, 2022):

would end up with rules for every single thing.

This is the exact user experience I expect and is standard in budgeting apps. Ultimately a user should not have to manually categorise as much as possible.

If creating a rule for each payee is going to be a problem we might need to change some things.

I see the functionality like so

  1. Categorising a transaction should then categorise any future transactions with a matching payee
  2. You can optionally choose to only apply it to the single transaction
  3. You can apply it historically to all transactions, and future transactions.

I've imported 10,000 transactions into actual, the user experience currently will result in me not being able to use it.

I hope this feature can be considered beneficial for actual

<!-- gh-comment-id:1223305666 --> @winklevos commented on GitHub (Aug 22, 2022): > would end up with rules for every single thing. This is the exact user experience I expect and is standard in budgeting apps. Ultimately a user should not have to manually categorise as much as possible. If creating a rule for each payee is going to be a problem we might need to change some things. I see the functionality like so 1. Categorising a transaction should then categorise any future transactions with a matching payee 2. You can optionally choose to only apply it to the single transaction 3. You can apply it historically to all transactions, and future transactions. I've imported 10,000 transactions into actual, the user experience currently will result in me not being able to use it. I hope this feature can be considered beneficial for actual
Author
Owner

@winklevos commented on GitHub (Aug 23, 2022):

For note, the current logic is in https://github.com/winklevos/actual/blob/categorise-rules/packages/loot-core/src/server/accounts/transaction-rules.js#L614

Goes as follows

When the category is changed actual will look back 6 months, and forward 180 days. And get all related transactions for that payee.

It will only continue if you modified the latest transactions.

It will then count the number of occurrences of that category for the payee.

It selects the category with the majority (max). And only updates if it has > 3 occurrences.

Think

SELECT category, count(*) 
FROM transactions 
WHERE payee = 1 
GROUP BY 
category 
HAVING count(*) > 3 
ORDER BY count(*) desc 
LIMIT 1

This to me is a bit overbuilt, see my previous three points for UX

<!-- gh-comment-id:1223941497 --> @winklevos commented on GitHub (Aug 23, 2022): For note, the current logic is in https://github.com/winklevos/actual/blob/categorise-rules/packages/loot-core/src/server/accounts/transaction-rules.js#L614 Goes as follows When the category is changed actual will look back 6 months, and forward 180 days. And get all related transactions for that payee. It will only continue if you modified the latest transactions. It will then count the number of occurrences of that category for the payee. It selects the category with the majority (max). And only updates if it has > 3 occurrences. Think ``` SELECT category, count(*) FROM transactions WHERE payee = 1 GROUP BY category HAVING count(*) > 3 ORDER BY count(*) desc LIMIT 1 ``` This to me is a bit overbuilt, see my previous three points for UX
Author
Owner

@rich-howell commented on GitHub (Sep 7, 2022):

As this isn't a bug I am going to move it over to ideas for further discussion.

<!-- gh-comment-id:1238969446 --> @rich-howell commented on GitHub (Sep 7, 2022): As this isn't a bug I am going to move it over to ideas for further discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#7064