Skip to content

[Econ] Update ROI calculations - #3187

Draft
ew3361zh wants to merge 4 commits into
economicsfrom
roi-check
Draft

[Econ] Update ROI calculations#3187
ew3361zh wants to merge 4 commits into
economicsfrom
roi-check

Conversation

@ew3361zh

@ew3361zh ew3361zh commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Context

Issue(s) closed by this pull request: closes #3068

What

  • Updates calculations for ROI in the economics module
  • Removes previous ROI calculation based on cash flow in DCFROR class.
  • The _load_data_from_csv() method from InputManager was made public so it could be referenced to load previous simulation ROI data.

Why

Ensures ROI is functioning and available for future iterative expansion and extension.

How

  • Adds compare_roi boolean and roi_comparison_paths dictionary for locating previous roi-calculation data.
  • Within the PartialBudget module, where a partial budget calculation is requested, the economic outputs are logged as before but now there is a check on the new inputs listed above.
  • If the user has selected compare_roi to be true (default is false), then the current simulation ROI will be calculated based on the roi formula in the EconomicMetrics module. Once calculated, the pathways the user provided in the inputs will be looked up for comparison.
  • With each pathway provided, the previous simulation outputs for ROI (costs/revenue) will be used to calculate the ROI for each previous simulation (with the user being allowed to name that simulation as they choose) and then the delta between the current simulation ROI and each previous simulation referenced by the user will be logged.
  • Further unit testing coverage will be added once the approach here is agreed upon and approved.

Test plan

Step by step process:

  1. Run a simulation with the following filter to collect the ROI-inputs from that simulation:
{
            "name": "ROI INPUTS",
            "filters": [
                ".*econ_pba_summary.*"
            ]
        }

This will capture a set of economic outputs that looks like this:
Screenshot 2026-08-05 at 3 41 11 PM

  1. Adjust whatever economic inputs you want to get different values for RevenueTotal and CostTotal. I went to the economic_inputs.json file (input > data > EEE > economic_inputs.json) and upped the numbers for each of the Animal inputs like this:
Screenshot 2026-08-05 at 3 43 00 PM
  1. While in economic_inputs.json, go to the end of the file and:
  • change compare_roi from false -> true
  • update the roi_comparison_paths section accordingly. The name is whatever you want to call the outputs from the first simulation run. I just named it base_freestall_costs_and_revenue but it can be whatever you want.
  • the address section needs to be updated to be a relative path to the output file generated from the filter in the first simulation you ran. The address in there currently is specific to my output file so please be sure to update it to your output file.
  1. Add a second output filter to capture the ROI delta:
{
            "name": "Net ROI",
            "filters": [
                ".*roi_delta_for_.*"
            ],
            "use_verbose_report_name": true
        }
  1. Run your second simulation (the comparison simulation). This will generate a second report that will look something like this:
Screenshot 2026-08-05 at 3 49 57 PM

Input Changes

economic_outputs.json

Added:

"roi": {
    "compare_roi": false,
    "roi_comparison_paths": [
       {
        "name": "",
        "address": ""
       }
    ]
  }

Output Changes

  • N/A

Filter

@ew3361zh
ew3361zh changed the base branch from dev to economics August 4, 2026 20:20
@ew3361zh
ew3361zh requested a review from bradenlimb August 5, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Econ] Make sure ROI works

1 participant