fix(#134): append statement_year to yearless CC dates in output#137
Merged
fix(#134): append statement_year to yearless CC dates in output#137
Conversation
…tput Add Transaction._enrich_date() which detects yearless date strings (e.g. '3 Feb') and appends statement_year from additional_fields. Called from to_dict() so all output paths (CSV, JSON, Excel, monthly_summary, expense_analysis) automatically receive the enriched date. Nine new tests cover unit behaviour of _enrich_date and integration through to_dict().
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
CC statement transactions use yearless date strings (e.g.
3 Feb). Thestatement_yearwas already extracted and stored inadditional_fieldsfor sorting, but was never written back into theDatecolumn in output. This fix enriches the date at serialisation time so all output formats (CSV, JSON, Excel, monthly_summary, expense_analysis) show3 Feb 2025instead of3 Feb.Closes #134
Changes
Transaction._enrich_date(date_str, additional_fields)— detects yearless dates via regex and appendsstatement_yearwhen presentTransaction.to_dict()— calls_enrich_datefor theDatefieldTestTransactionEnrichDatecovering unit and integration pathsType
Testing
Checklist
Downstream impact
bankstatements_core(exported class, function, or exception)