Skip to content

Add option to skip duplicates when exploring entries on import extract - #1663

Closed
zenitraM wants to merge 4 commits into
beancount:mainfrom
zenitraM:skip-duplicates-on-import-extract
Closed

zenitraM wants to merge 4 commits into
beancount:mainfrom
zenitraM:skip-duplicates-on-import-extract

Conversation

@zenitraM

Copy link
Copy Markdown

Hi! I use the Importer UI with some API-driven importers, for which the downloaded files are really only config files yet they read the full history from the origin bank APIs (like https://tariochbctools.readthedocs.io/en/latest/importers.html#nordigen).

Those output a big chunk of past entries, sometimes from multiple banks and not necessarily in chronological order. And, most of the time, a big percentage of those entries will be duplicated - in some importers the de-duplication is done by the importer against the bank's entry ID so I'm almost completely sure they are not false positives.

So I'm only interested (most of the time) on checking the non-duplicate entries, however in some cases (like combining multiple banks into a same importer, or reconciling a long tail of history) they will be 4-5 new/non-duplicate entries out of a list of >400 entries, in the middle of the list.

Browsing them and finding them with the next/back buttons is a bit awkward, so to make this easier, I've added a checkbox that will only make the prev/next buttons in the Extract window move only across the non-duplicate entries, which is enabled by default - which I think may be a more desired standard behavior?

It looks like this on the UI:

image
The checkbox make the buttons go to the next and previous non-duplicate items - and if there's none left, they will just go to the first/last entry (to finalize the import, in the latter case).

I found this quite useful for my workflow but it may not fit everyone's usage or the project's alikes - happy to address any feedback or tweaks. 😊

@yagebu

yagebu commented Sep 6, 2023

Copy link
Copy Markdown
Member

Hi, thanks for the PR!

It might be confusing to have both "ignore duplicate" and "skip duplicates", those sound quite similar to me. Would maybe having this behaviour triggered when Ctrl-Clicking on the button also be an option instead of having the checkbox?

@zenitraM
zenitraM force-pushed the skip-duplicates-on-import-extract branch from a858e21 to f612de1 Compare September 8, 2023 17:24
@zenitraM

zenitraM commented Sep 8, 2023

Copy link
Copy Markdown
Author

Agree, I found it a bit confusing too but couldn't think how to express it better.
What about something like this? With > used for the next entry, >> to jump to the next non-duplicate.

image

@zenitraM

zenitraM commented Oct 5, 2024

Copy link
Copy Markdown
Author

I finally built some scripts to do imports automatically (now I need time to opensource them...), so I no longer depend on Fava to import - if someone is willing to take on this work, feel free to take the changes in my branch!

@zenitraM zenitraM closed this Oct 5, 2024
robcohen added a commit to rustledger/rustfava that referenced this pull request Jul 1, 2026
- test_failing_balance_assertion_is_surfaced: flip from xfail to a positive
  assertion — v0.18.0 (rustledger 3.1.0 / beancount#1663) reports balance failures on
  load and carries a non-zero diff, closing the C1 gap end to end.
- test_passing_balance_assertion_is_green: guard the zero-diff mapping (a
  passing balance must stay diff_amount=None, not render as failed).
- test_clamped_totals_match_beancount_balance_at_cutoff: the time-filter (engine
  clamp) opening balances must reconstruct the correct closing totals — the path
  rustledger#1656 broke. Clamp long-example to 2014 and assert each account's
  total (opening + in-window) equals beancount's balance as of the cutoff, per
  (currency, cost) lot. Excludes the clamp-specific Equity:Opening-Balances.
robcohen added a commit to rustledger/rustfava that referenced this pull request Jul 1, 2026
STAGED — v0.18.0 is not yet released (rustledger#1665 open); finalize by
downloading the wasm, running the suite, and flipping the C1 xfail in the
differential test once it ships.

rustledger 3.1.0 (beancount#1663/beancount#1664) is a minor WIT bump (3.0.0 -> 3.1.0) with no
function-signature changes:
- Bump the interface-ID constant `_WIT_VERSION` 3.0.0 -> 3.1.0 (a mismatch makes
  get_export_index return None and every call fail). SUPPORTED_API_MAJOR stays 3.
- `load`/`load-file` now report balance-assertion failures (previously only
  validate did — the C1 gap, rustfava-side beancount#1663). No loader change needed: the
  errors flow through the existing errors list.
- `balance-dir` gains `diff` (computed - asserted): present on every *checked*
  assertion, zero = passed. RLBalance.from_json reads it, but only carries a
  NON-ZERO diff as `diff_amount` — the journal/red-green contract treats a
  present diff_amount as "failed", so mapping the zero-diff through verbatim
  would render every passing balance red. Verified the mapping (passed->None,
  failed->carried, legacy key->carried).
- Bump RUSTLEDGER_VERSION -> v0.18.0.
robcohen added a commit to rustledger/rustfava that referenced this pull request Jul 1, 2026
- test_failing_balance_assertion_is_surfaced: flip from xfail to a positive
  assertion — v0.18.0 (rustledger 3.1.0 / beancount#1663) reports balance failures on
  load and carries a non-zero diff, closing the C1 gap end to end.
- test_passing_balance_assertion_is_green: guard the zero-diff mapping (a
  passing balance must stay diff_amount=None, not render as failed).
- test_clamped_totals_match_beancount_balance_at_cutoff: the time-filter (engine
  clamp) opening balances must reconstruct the correct closing totals — the path
  rustledger#1656 broke. Clamp long-example to 2014 and assert each account's
  total (opening + in-window) equals beancount's balance as of the cutoff, per
  (currency, cost) lot. Excludes the clamp-specific Equity:Opening-Balances.
robcohen added a commit to rustledger/rustfava that referenced this pull request Jul 1, 2026
#210)

* test(differential): validate booking against beancount as ground-truth oracle

Snapshot tests only prove output didn't change, not that it's correct — a
booking bug gets frozen into the snapshot (as the pre-beancount#1656 trial_balance
snapshot did). This adds Layer 1 of the correctness plan: load each fixture
through both rustfava (rustledger engine) and beancount and assert the booked
per-account inventories agree to the cent.

- test_booked_inventories_match_beancount over example/long-example/
  query-example/off-by-one — all currently match (long-example alone has ~193
  cost lots), so this locks in booking correctness going forward.
- test_failing_balance_assertion_is_surfaced — xfail(rustledger#1663): the
  load() path emits no error for a failing `balance` (only validate() does), so
  a wrong assertion is silently shown as passed. Documents the defect as an
  executable check; flips to passing when the engine surfaces balance errors.

beancount is already a test dependency (beancount-compat extra).

* test(differential): C1 now passes on v0.18.0; add clamped-total oracle

- test_failing_balance_assertion_is_surfaced: flip from xfail to a positive
  assertion — v0.18.0 (rustledger 3.1.0 / beancount#1663) reports balance failures on
  load and carries a non-zero diff, closing the C1 gap end to end.
- test_passing_balance_assertion_is_green: guard the zero-diff mapping (a
  passing balance must stay diff_amount=None, not render as failed).
- test_clamped_totals_match_beancount_balance_at_cutoff: the time-filter (engine
  clamp) opening balances must reconstruct the correct closing totals — the path
  rustledger#1656 broke. Clamp long-example to 2014 and assert each account's
  total (opening + in-window) equals beancount's balance as of the cutoff, per
  (currency, cost) lot. Excludes the clamp-specific Equity:Opening-Balances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants