[Econ] Add partial budget breakdown output - #3252
Merged
Merged
Conversation
Exports econ_pba_breakdown from the economics framework: one entry per line item and scenario with the biophysical module, cost/revenue flow type, item name, biophysical aggregate, price aggregate, and line item value, so the partial budget totals can be audited line by line from a single CSV or JSON output (issue #3211). PartialBudget shares the line item iteration and value coercion between the totals and the breakdown, so the two reconcile by construction. Verified on the 7-year freestall example: 54 rows whose cost and revenue sums match econ_pba_cost_total and econ_pba_revenue_total, unchanged from the base branch.
JoeWaddell
approved these changes
Sep 11, 2026
JoeWaddell
left a comment
Collaborator
There was a problem hiding this comment.
This looks to be working well! The only thing I got hung up on was the baseline notation: want to confirm that having alternative scenarios is waiting to be implemented in another PR, correct?
Collaborator
Author
Yes, I think whoever takes on #3212 and takes a deeper look into it can decide whether it's worth creating a separate issue to track it. I do think this PR should be kept within scope as it is. |
allisterakun
approved these changes
Sep 15, 2026
Comment on lines
+15
to
+17
| # Units for each field of the ``econ_pba_breakdown`` rows exported by | ||
| # ``PartialBudget.export_line_item_breakdown``. Biophysical quantities and prices mix units | ||
| # across line items (kg, head, hours, ...), so they are reported as unitless. |
Collaborator
There was a problem hiding this comment.
Suggested change
| # Units for each field of the ``econ_pba_breakdown`` rows exported by | |
| # ``PartialBudget.export_line_item_breakdown``. Biophysical quantities and prices mix units | |
| # across line items (kg, head, hours, ...), so they are reported as unitless. |
Comment on lines
+110
to
+114
| # Supporting multi-year scenarios will require accumulating results across | ||
| # scenarios as outlined in `Documentation of Economic Data and Analytical | ||
| # Methods (2).pdf`. | ||
|
|
||
| def _calculate_from_preprocessed( |
Collaborator
There was a problem hiding this comment.
Suggested change
| # Supporting multi-year scenarios will require accumulating results across | |
| # scenarios as outlined in `Documentation of Economic Data and Analytical | |
| # Methods (2).pdf`. | |
| def _calculate_from_preprocessed( | |
| def _calculate_from_preprocessed( |
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.
Adds a flat partial budget line item breakdown so each economics cost and revenue can be audited from one CSV or JSON output.
Context
Issue(s) closed by this pull request: closes #3211
What
econ_pba_breakdownoutput with one entry per line item and scenario:module,flow_type,item,scenario,biophysical_aggregate,price_aggregate,line_item_value.PartialBudget.export_line_item_breakdown, called fromEconomicFramework.run_economic_analysis, so it is produced whenever economics runs.line_item_valuebyflow_typereproducesecon_pba_cost_totalandecon_pba_revenue_total.Test plan
econ_pba_cost_total/econ_pba_revenue_total(unchanged from the base branch).biophysical_aggregate x price_aggregatereproduces every line item value, and the JSON-vs-CSV comparison script attached to [Econ] Add partial budget analysis breakdown to ouput manager #3211 reports zero difference.Input Changes
Output Changes
partial_budget.export_line_item_breakdown.econ_pba_breakdown: partial budget line item table described above.Filter
Save as
output/output_filters/csv_econ_partial_budget.txtto get the breakdown and the PBA totals in one CSV: