Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/PolicyEngine/openfisca-uk
Browse files Browse the repository at this point in the history
…into pr/Weishan-Lu/764
  • Loading branch information
nikhilwoodruff committed Oct 12, 2023
2 parents 16e2f68 + 97a4d24 commit e762f5d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.56.3] - 2023-10-09 19:01:07

## [0.56.2] - 2023-09-14 16:06:31

### Fixed
Expand Down Expand Up @@ -1037,6 +1039,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[0.56.3]: https://github.com/PolicyEngine/openfisca-uk/compare/0.56.2...0.56.3
[0.56.2]: https://github.com/PolicyEngine/openfisca-uk/compare/0.56.1...0.56.2
[0.56.1]: https://github.com/PolicyEngine/openfisca-uk/compare/0.56.0...0.56.1
[0.56.0]: https://github.com/PolicyEngine/openfisca-uk/compare/0.55.4...0.56.0
Expand Down
5 changes: 5 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -861,3 +861,8 @@
fixed:
- Small issues on the NI page.
date: 2023-09-14 16:06:31
- bump: patch
changes:
removed:
- numpy pin.
date: 2023-10-09 19:01:07
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/tax_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def formula(benunit, period, parameters):
"property_income",
]
income = add(benunit, period, STEP_1_COMPONENTS)
income = amount_over(income, TC.means_test.non_earned_disregard)
income = max_(income - TC.means_test.non_earned_disregard, 0)
STEP_2_COMPONENTS = [
"employment_income",
"self_employment_income",
Expand Down
9 changes: 2 additions & 7 deletions policyengine_uk/variables/gov/dwp/universal_credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,8 @@ def formula(benunit, period, parameters):
rent = benunit("benunit_rent", period)
max_housing_costs = select(
[
np.isin(
tenure_type,
[
TenureType.RENT_FROM_COUNCIL,
tenure_type == TenureType.RENT_FROM_HA,
],
),
(tenure_type == TenureType.RENT_FROM_COUNCIL)
| (tenure_type == TenureType.RENT_FROM_HA),
tenure_type == TenureType.RENT_PRIVATELY,
],
[rent, min_(benunit("LHA_cap", period), rent)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ def formula(person, period, parameters):
CB_received = person.benunit("child_benefit", period)
CB_HITC = parameters(period).gov.hmrc.income_tax.charges.CB_HITC
percentage = (
amount_over(
person("adjusted_net_income", period),
CB_HITC.phase_out_start,
max_(
person("adjusted_net_income", period)
- CB_HITC.phase_out_start,
0,
)
# HITC is specified as a percent of Child Benefit recollected for
# every £1,000 over the phase-out threshold.
Expand Down
13 changes: 7 additions & 6 deletions policyengine_uk/variables/gov/hmrc/national_insurance/class_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def formula(person, period, parameters):
* WEEKS_IN_YEAR
/ MONTHS_IN_YEAR,
)
add_earnings = amount_over(
earnings,
class_1.thresholds.upper_earnings_limit
add_earnings = max_(
earnings
- class_1.thresholds.upper_earnings_limit
* WEEKS_IN_YEAR
/ MONTHS_IN_YEAR,
0,
)
main_charge = class_1.rates.employee.main * main_earnings
add_charge = class_1.rates.employee.additional * add_earnings
Expand Down Expand Up @@ -71,9 +72,9 @@ class employer_NI_class_1(Variable):
def formula(person, period, parameters):
class_1 = parameters(period).gov.hmrc.national_insurance.class_1
earnings = person("employment_income", period)
main_earnings = amount_over(
earnings,
class_1.thresholds.secondary_threshold * WEEKS_IN_YEAR,
main_earnings = max_(
earnings - class_1.thresholds.secondary_threshold * WEEKS_IN_YEAR,
0,
)
return class_1.rates.employer * main_earnings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def formula(person, period, parameters):
class_4.thresholds.lower_profits_limit,
class_4.thresholds.upper_profits_limit,
)
add_amount = amount_over(
profits, class_4.thresholds.upper_profits_limit
)
add_amount = max_(profits - class_4.thresholds.upper_profits_limit, 0)
main_charge = main_amount * class_4.rates.main
add_charge = add_amount * class_4.rates.additional
return main_charge + add_charge
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="PolicyEngine-UK",
version="0.56.2",
version="0.56.3",
author="PolicyEngine",
author_email="nikhil@policyengine.org",
classifiers=[
Expand All @@ -31,10 +31,9 @@
"gif[plotly]>=3.0.0",
"inquirer>=2.7.0",
"microdf_python>=0.3.0",
"numpy<1.22",
"pandas",
"plotly>=4.14.3",
"PolicyEngine-Core>=2.1,<3",
"PolicyEngine-Core>=2.8.1,<3",
"pyyaml>=5.3.1",
"pytest",
"requests>=2.25.1",
Expand Down

0 comments on commit e762f5d

Please sign in to comment.