fix(#131,#132): CC amount CR-suffix rerouting + yearless date sorting#135
Merged
fix(#131,#132): CC amount CR-suffix rerouting + yearless date sorting#135
Conversation
AIB CC statements encode payments/refunds as amounts suffixed with 'CR' (e.g. '300.00CR') in a single Amount column, aliased to Debit. - currency.reroute_cr_suffix(): strips CR suffix, moves value to Credit, clears Debit - RowPostProcessor._reroute_cr_amounts(): calls reroute_cr_suffix after alias mapping - page_header_analyser: extend _PAYMENT_DUE_PATTERNS to match ordinal suffixes (e.g. '17th April, 2026') to improve year extraction robustness - Re-baseline integration snapshot: pdf_count 4→5, pdfs_extracted 3→4, pages_read 24→26 (reflects CC PDF added to fixture set in earlier branch work) Closes #131
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
Fixes two AIB Credit Card statement bugs:
300.00CRin the Amount column (aliased to Debit) were written to the Debit column as-is. They should strip theCRsuffix and route to the Credit column.3 Feb) failed to parse, causing incorrect sort order. Year is now inferred from thePayment Dueheader line on page 1.Changes
currency.py—reroute_cr_suffix(row): detectsCRsuffix on Debit, strips it, moves value to Credit, clears Debitrow_post_processor.py—_reroute_cr_amounts(): callsreroute_cr_suffiximmediately after column alias mapping, before row classificationpage_header_analyser.py— extend_PAYMENT_DUE_PATTERNSto match ordinal date suffixes (17th April, 2026) for more robust year extractiontest_currency.py— 5 unit tests forreroute_cr_suffixtest_row_post_processor.py— 2 end-to-end tests throughprocess()for CR reroutingpdf_count4→5,pdfs_extracted3→4,pages_read24→26 (CC PDF added to fixture set)Type
Testing
make docker-integrationpassed locally (required when touchingDockerfile,entrypoint.sh,docker-compose.yml, orpackages/parser-core/)Checklist
Downstream impact
bankstatements_core(exported class, function, or exception)