Riddy21 / Riddy21/Friday_Budgeting_Pro

feat: deduplicate joint/shared accounts across bank connections

Open
#269 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Problem

When a user has joint accounts that appear in multiple bank connections (e.g. a shared chequing account visible from both a personal BMO connection and a joint RBC connection), Friday currently:

  • Shows the same account twice on the accounts page
  • Pulls and stores transactions from both connections, double-counting everything
  • Doubles the displayed balance

Solution

Detect duplicate accounts across connections and designate one as primary. Only the primary account syncs transactions and appears in the UI.

Deduplication key

Two bank_accounts rows are duplicates when they share the same:

  • mask (last 4 digits, when available)
  • name (account name)
  • type + subtype (e.g. depository/checking)

Implementation

DB
ALTER TABLE bank_accounts ADD COLUMN is_duplicate INTEGER NOT NULL DEFAULT 0;
ALTER TABLE bank_accounts ADD COLUMN primary_account_id TEXT REFERENCES bank_accounts(id);
Sync (server/main.py)

After upserting account rows in sync(), run a deduplication pass:

  • Group bank_accounts by (mask, name, type, subtype) where mask IS NOT NULL
  • For groups with >1 row: keep the row with the earliest id (or most recent sync) as primary, mark others is_duplicate=1, primary_account_id=<primary>
  • Skip transaction sync for is_duplicate=1 accounts
UI (ui/server.py + accounts.html)
  • Filter out is_duplicate=1 accounts from the accounts page display
  • Show a small note on the primary account if duplicates were detected: "Also connected via [institution]"
MCP list()
  • Exclude duplicate accounts from transaction queries by default
  • Add optional include_duplicates=True param for power users

Acceptance criteria

  • Same account connected via two banks → only shown once in UI
  • Transactions only pulled from primary account
  • Balance shown once, not doubled
  • Unit tests for deduplication logic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the sync() flow in server/main.py and inspect how bank_accounts schema changes are handled. Then follow account queries in ui/server.py, accounts.html, and MCP list(), including existing tests around synchronization. Done means duplicate accounts are consolidated across sync, UI, transaction queries, balances, and the requested deduplication tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
backend, database, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.