Skip to content

Commit

Permalink
Change UK revenue metric
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Oct 21, 2024
1 parent 1f6e04b commit a38fcf2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: minor
changes:
changed:
- PolicyEngine UK bumped to 2.7.0.
- Government revenue in the UK switch to include employer NI.
10 changes: 8 additions & 2 deletions policyengine_api/endpoints/economy/single_economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def compute_general_economy(
simulation: Microsimulation, country_id: str = None
) -> dict:
total_tax = simulation.calculate("household_tax").sum()
total_spending = simulation.calculate("household_benefits").sum()

if country_id == "uk":
total_tax = simulation.calculate("gov_tax").sum()
total_spending = simulation.calculate("gov_spending").sum()
personal_hh_equiv_income = simulation.calculate(
"equiv_household_net_income"
)
Expand Down Expand Up @@ -132,7 +137,7 @@ def compute_general_economy(
.tolist(),
"total_tax": total_tax,
"total_state_tax": total_state_tax,
"total_benefits": simulation.calculate("household_benefits").sum(),
"total_benefits": total_spending,
"household_net_income": simulation.calculate("household_net_income")
.astype(float)
.tolist(),
Expand Down Expand Up @@ -206,8 +211,9 @@ def compute_general_economy(
"child_benefit",
"state_pension",
"pension_credit",
"ni_employer",
]
IS_POSITIVE = [True] * 5 + [False] * 5
IS_POSITIVE = [True] * 5 + [False] * 5 + [True]
for program in PROGRAMS:
result["programs"][program] = simulation.calculate(
program, map_to="household"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"policyengine_canada==0.96.1",
"policyengine-ng==0.5.1",
"policyengine-il==0.1.0",
"policyengine_uk==2.6.0",
"policyengine_uk==2.7.0",
"policyengine_us==1.127.0",
"pymysql",
"redis",
Expand Down

0 comments on commit a38fcf2

Please sign in to comment.