Repository navigation
Support single-use matches during import deduplication - #219
Open
ryanduguid wants to merge 1 commit into
Open
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
Add optional single-use matching for importers whose otherwise identical source records represent separate occurrences. This lets an importer retain an extra bank record when only one matching occurrence exists in the journal. Related to #179.
The default remains many-to-one. The option allocates each eligible existing object once per call, excludes already-commented targets from overlapping files, and preserves target provenance. Matching uses the existing date window and greedy input order, selecting the last available match. The importer docstring shows how to opt in.
Evidence
After: the opt-in mode retains the extra occurrence. A CLI regression with two overlapping files retains two live imports, comments three duplicates with exact provenance, and reconciles the closing AUD bank balance.
python -m pytest beangulppasses 174 tests; configured Ruff 0.12.12 passes. All 18 focused tests pass on Windows. Ten example unit tests and the CSV, OFX and investment importer examples pass on the final files.Risk
This is a policy proposal for importers that know their source preserves occurrence counts. Repeated representations with the same unique source ID usually need the default. Greedy allocation may leave an ambiguous duplicate live. Premarked inputs retain and reserve their directive target; truthy boolean markers raise
ValueErrorin the opt-in mode.Unverified
The full Windows suite has the same 16 failing tests before and after this change.
make test/test-all, the full Python and platform matrix, the example importer workflows, hosted CI and performance on large inputs were not run. Whether real bank exports preserve occurrence identity was not checked.