Restore idtl=5 full-text output in cli#936
Merged
Merged
Conversation
Closes #933 (idtl=5 part). The legacy exe.py PyInstaller entry point produced TAXSIM's labeled-section human-readable output for idtl=5. After exe.py was removed in PR #855, the modern Microsim-based cli.py always emitted CSV, ignoring idtl. Daniel flagged the regression in #933. Add `core/text_formatter.py` that renders one result-DataFrame row in TAXSIM-35 format using the existing variable_mappings.yaml metadata (full_text_group, text_description, group_order). No fresh Simulation needed — values come straight from the Microsim output. Wire `_emit_results` into the cli stdin/stdout flow: pure-CSV when no row has idtl=5 (existing behavior), per-row labeled-section output for idtl=5 rows, interleaved with CSV for mixed input. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The prior implementation went through set_index('taxsimid') and
.to_dict(), which appended taxsimid as the last column when
serialized back to CSV. Use direct row lookup instead so the CSV
emission preserves the standard `taxsimid,year,state,...` header
order downstream parsers expect.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Bring back TAXSIM-35's labeled-section human-readable output format (idtl=5) to the cli stdin/stdout flow. Previously only the legacy
exe.pyPyInstaller entry point handled idtl=5; the modern Microsim-based cli.py always emitted CSV regardless of input idtl.Context
Closes #933 (idtl=5 portion — the cli-vs-exe pension-allocation portion was already addressed by PR #935). Daniel flagged that
cli.pywas ignoring idtl=5; the legacy exe.py was removed in PR #855 (April 2026), and the idtl=5 path was lost in the transition.Mechanism
core/text_formatter.pyrenders one result-DataFrame row in TAXSIM-35's labeled format using existingvariable_mappings.yamlmetadata (full_text_group,text_description,group_order). No fresh Simulation needed — values come straight from the Microsim output._emit_resultshelper incli.pyroutes per-row based on idtl: CSV for idtl=0/2, labeled-section text for idtl=5. Mixed-idtl inputs interleave outputs in original input order.Test plan
tests/test_cli_idtl5.py(idtl=5 emits sections; idtl=5 doesn't emit CSV header; idtl=2 still emits CSV; idtl=5 shows federal tax)