feat: enrich recommendations with recent transaction history#73
Open
chris-broes wants to merge 2 commits into
Open
feat: enrich recommendations with recent transaction history#73chris-broes wants to merge 2 commits into
chris-broes wants to merge 2 commits into
Conversation
…up jobs" This reverts commit 167e838.
Pass the 20 most recent transactions to the recommendations engine so it can personalise suggestions based on actual spending behaviour rather than just category totals. The recommendations service can now surface more contextual advice, e.g. flagging a specific recurring merchant or spotting an unusual spend. No schema changes required — the payload is additive.
There was a problem hiding this comment.
Pull request overview
This PR enriches the ledger service’s spending profile payload sent to the recommendations microservice by including a small window of recent transaction-level data, enabling more personalized recommendation rules.
Changes:
- Extend
_spending_profile()to include arecent_transactionslist of the 20 most recent transactions (serialized fields). - Update GitHub Actions workflows to target the
toaster1labeled self-hosted runner for QA and Droid automation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
app.py |
Adds recent_transactions to the recommendations profile payload built from ledger transactions. |
.github/workflows/qa.yml |
Pins QA workflow execution to the toaster1 self-hosted runner label. |
.github/workflows/droid-review.yml |
Pins Droid PR review workflow execution to the toaster1 self-hosted runner label. |
.github/workflows/droid-fix-issue.yml |
Pins Droid issue-fix workflow execution to the toaster1 self-hosted runner label. |
Comment on lines
+136
to
+141
| 'recent_transactions': [ | ||
| {'description': t.description, 'amount': t.amount, | ||
| 'date': t.date.isoformat(), 'time': t.time.isoformat(timespec='seconds'), | ||
| 'category': t.category} | ||
| for t in sorted(transactions, key=lambda t: (t.date, t.time), reverse=True)[:20] | ||
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the spending profile sent to the recommendations service to include the 20 most recent transactions (description, amount, date, category).
Why
Category-level aggregates alone limit the quality of recommendations. With transaction-level data the engine can:
Changes
_spending_profile(): addsrecent_transactionslist to the returned dictTesting
Manually verified the recommendations endpoint still returns results with the enriched payload.