Context
policyengine-api-v2 needs to preserve the legacy single-year macro output shape when it eventually moves back to policyengine 4.x. The pre-1 Simulation.calculate_economy_comparison() result included detailed_budget, while the 4.x economic_impact_analysis() path exposes program_statistics.
Before the simulation API can safely adapt 4.x outputs back into the legacy response contract, we need to determine whether detailed_budget can be reconstructed from ProgramStatistics without semantic drift.
Questions to answer
- Does every pre-1
detailed_budget entry have a corresponding ProgramStatistics row for US and UK?
- Are signs, baseline/reform totals, changes, and recipient/count fields equivalent?
- Are labels/groupings in the old
detailed_budget public contract recoverable from 4.x metadata?
- Are any old
detailed_budget fields intentionally unsupported in 4.x?
Acceptance criteria
- Document the mapping from pre-1
detailed_budget to 4.x ProgramStatistics for US and UK.
- Identify any unmappable fields or sign convention differences.
- Add tests or fixtures that compare representative pre-1 and 4.x outputs if feasible.
- Recommend whether the sim API should reconstruct
detailed_budget from ProgramStatistics or expose a new dedicated .py output helper.
Context
policyengine-api-v2needs to preserve the legacy single-year macro output shape when it eventually moves back topolicyengine4.x. The pre-1Simulation.calculate_economy_comparison()result includeddetailed_budget, while the 4.xeconomic_impact_analysis()path exposesprogram_statistics.Before the simulation API can safely adapt 4.x outputs back into the legacy response contract, we need to determine whether
detailed_budgetcan be reconstructed fromProgramStatisticswithout semantic drift.Questions to answer
detailed_budgetentry have a correspondingProgramStatisticsrow for US and UK?detailed_budgetpublic contract recoverable from 4.x metadata?detailed_budgetfields intentionally unsupported in 4.x?Acceptance criteria
detailed_budgetto 4.xProgramStatisticsfor US and UK.detailed_budgetfromProgramStatisticsor expose a new dedicated.pyoutput helper.