Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2f5880d
add codecov coverage
juaristi22 Jul 15, 2025
8ef324b
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
juaristi22 Jul 15, 2025
069e93a
rename all variables and functions with lowercase
juaristi22 Jul 15, 2025
b5b2912
changelog_entry
juaristi22 Jul 15, 2025
53a0976
bring back BenUnit
juaristi22 Jul 15, 2025
65f4410
renaming files to follow snake case
juaristi22 Jul 15, 2025
eb6fc29
make p widely used in variale formulas
juaristi22 Jul 16, 2025
7c6ca9f
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
juaristi22 Jul 16, 2025
7b9d17f
lowercase lha test
juaristi22 Jul 16, 2025
fddfc4f
cleaned cached files to avoid import errors
juaristi22 Jul 16, 2025
6434250
switch off case insenstivity in git so it will record file name changes
juaristi22 Jul 16, 2025
1fb6426
removing leftover uppercase directories
juaristi22 Jul 16, 2025
244bd76
manually removing cached directories with uppercase in them
juaristi22 Jul 16, 2025
c2e5a5a
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
juaristi22 Jul 17, 2025
5eaf0fa
Merge origin/master into maria/minor_repo_fixes
PolicyEngine-Bot Dec 8, 2025
69201bc
Fix lowercase parameter reference and add backwards-compatible variab…
PolicyEngine-Bot Dec 8, 2025
315ac2a
Add backwards compatibility for parameter name lookups
PolicyEngine-Bot Dec 8, 2025
fba0325
Fix remaining mixed-case variable references in test YAML files
PolicyEngine-Bot Dec 9, 2025
da01ea5
Fix circular reference in rent variable formula
PolicyEngine-Bot Dec 9, 2025
68dc0eb
Fix circular reference in rent formula by checking known_periods
PolicyEngine-Bot Dec 9, 2025
5b57b1b
Fix rent circular reference by using holder.get_array() instead of re…
PolicyEngine-Bot Dec 9, 2025
da6c3b2
Fix TypeError in rent.py by converting data_year to int
PolicyEngine-Bot Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
added:
- Renaming variables to lowercase.
4 changes: 2 additions & 2 deletions policyengine_uk/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
containing_entities=["state"],
)

BenUnit = build_entity(
ben_unit = build_entity(
key="benunit",
plural="benunits",
label="Benefit unit",
Expand All @@ -43,4 +43,4 @@
is_person=True,
)

entities = [Household, BenUnit, Person]
entities = [Household, ben_unit, Person]
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand All @@ -29,13 +29,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand All @@ -54,13 +54,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand All @@ -79,13 +79,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand All @@ -104,13 +104,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand All @@ -129,13 +129,13 @@
input:
people:
person1:
is_SP_age: false
is_sp_age: false
person2:
is_SP_age: false
is_sp_age: false
person3:
is_SP_age: false
is_sp_age: false
person4:
is_SP_age: false
is_sp_age: false
benunits:
benunit:
members: [person1, person2, person3, person4]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
input:
age: 14
output:
is_CTC_child_limit_exempt: true
is_ctc_child_limit_exempt: true
- name: CTC two-child limit non-exemption
period: 2020
absolute_error_margin: 0
input:
age: 0
output:
is_CTC_child_limit_exempt: false
is_ctc_child_limit_exempt: false
- name: CTC children
period: 2020
absolute_error_margin: 0
Expand All @@ -31,7 +31,7 @@
child3:
age: 1
output:
is_child_for_CTC: [true, true, true]
is_child_for_ctc: [true, true, true]
- name: WTC eligibility for worker
period: 2020
absolute_error_margin: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
input:
people:
person:
is_SP_age: false
is_sp_age: false
output:
is_pension_credit_eligible: false

Expand All @@ -12,9 +12,9 @@
input:
people:
person:
is_SP_age: false
is_sp_age: false
spouse:
is_SP_age: true
is_sp_age: true
benunits:
benunit:
members: [person, spouse]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class bi_maximum(Variable):
def formula(person, period, parameters):
bi = parameters(period).gov.contrib.ubi_center.basic_income
weekly_flat_amount = bi.amount.flat
is_senior_for_bi = person("is_SP_age", period)
is_senior_for_bi = person("is_sp_age", period)
age = person("age", period)
is_child_for_bi = (age < bi.amount.adult_age) * (
age >= bi.amount.child_min_age
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

class would_claim_care_to_learn(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "would claim Care to Learn"
documentation = (
"Whether this BenUnit would claim Care to Learn if eligible"
"Whether this ben_unit would claim Care to Learn if eligible"
)
definition_period = YEAR
default_value = True
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class extended_childcare_entitlement(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "annual extended childcare entitlement expenses"
definition_period = YEAR
unit = GBP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class extended_childcare_entitlement_eligible(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "eligibility for extended childcare entitlement"
definition_period = YEAR
defined_for = "would_claim_extended_childcare"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class maximum_extended_childcare_hours_usage(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "maximum extended childcare hours used"
documentation = "The maximum number of weekly extended childcare hours that this family uses"
definition_period = YEAR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class would_claim_extended_childcare(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "would claim extended childcare entitlement"
documentation = "Whether this family would claim extended childcare entitlement if eligible"
definition_period = YEAR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class meets_tax_credit_criteria_for_targeted_childcare_entitlement(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "meets Tax Credit criteria for targeted childcare entitlement"
definition_period = YEAR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class meets_universal_credit_criteria_for_targeted_childcare_entitlement(
Variable
):
value_type = bool
entity = BenUnit
entity = ben_unit
label = (
"meets Universal Credit criteria for targeted childcare entitlement"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class targeted_childcare_entitlement_eligible(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "eligibility for targeted childcare entitlement"
definition_period = YEAR
defined_for = "would_claim_targeted_childcare"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class would_claim_targeted_childcare(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "would claim targeted childcare entitlement"
documentation = "Whether this family would claim targeted childcare entitlement if eligible"
definition_period = YEAR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

class would_claim_universal_childcare(Variable):
value_type = bool
entity = BenUnit
entity = ben_unit
label = "would claim universal childcare entitlement"
documentation = "Whether this BenUnit would claim universal childcare entitlement if eligible"
documentation = "Whether this ben_unit would claim universal childcare entitlement if eligible"
definition_period = YEAR
default_value = True
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/BRMA_LHA_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class BRMA_LHA_rate(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "LHA rate"
documentation = "Local Housing Allowance rate"
definition_period = YEAR
Expand Down
10 changes: 5 additions & 5 deletions policyengine_uk/variables/gov/dwp/CTC_child_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CTC_child_element(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "Child Tax Credit child element"
definition_period = YEAR
reference = "Tax Credits Act 2002 s. 9"
Expand All @@ -12,14 +12,14 @@ class CTC_child_element(Variable):
def formula(benunit, period, parameters):
person = benunit.members
CTC = parameters(period).gov.dwp.tax_credits.child_tax_credit
is_child_for_CTC = person("is_child_for_CTC", period)
is_CTC_child_limit_exempt = person("is_CTC_child_limit_exempt", period)
exempt_child = is_child_for_CTC & is_CTC_child_limit_exempt
is_child_for_ctc = person("is_child_for_ctc", period)
is_ctc_child_limit_exempt = person("is_ctc_child_limit_exempt", period)
exempt_child = is_child_for_ctc & is_ctc_child_limit_exempt
exempt_children = benunit.sum(exempt_child)
child_limit = CTC.limit.child_count
spaces_left = max_(0, child_limit - exempt_children)
non_exempt_children = min_(
spaces_left, benunit.sum(is_child_for_CTC) - exempt_children
spaces_left, benunit.sum(is_child_for_ctc) - exempt_children
)
children = exempt_children + non_exempt_children
return CTC.elements.child_element * children
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

class CTC_disabled_child_element(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "CTC entitlement from disabled child elements"
definition_period = YEAR
reference = "Tax Credits Act 2002 s. 9"
unit = GBP

def formula(benunit, period, parameters):
person = benunit.members
is_child_for_CTC = person("is_child_for_CTC", period)
is_child_for_ctc = person("is_child_for_ctc", period)
is_disabled_for_benefits = person("is_disabled_for_benefits", period)
is_disabled_child = is_child_for_CTC & is_disabled_for_benefits
is_disabled_child = is_child_for_ctc & is_disabled_for_benefits
disabled_children = benunit.sum(is_disabled_child)
CTC = parameters(period).gov.dwp.tax_credits.child_tax_credit
amount = CTC.elements.dis_child_element * disabled_children
Expand Down
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/CTC_family_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CTC_family_element(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "CTC entitlement in the Family Element"
definition_period = YEAR
reference = "Tax Credits Act 2002 s. 9"
Expand Down
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/CTC_maximum_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CTC_maximum_rate(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "Maximum Child Tax Credit"
definition_period = YEAR
reference = "Tax Credits Act 2002 s. 9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CTC_severely_disabled_child_element(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "CTC entitlement from severely disabled child elements"
definition_period = YEAR
reference = "Tax Credits Act 2002 s. 9"
Expand All @@ -12,12 +12,12 @@ class CTC_severely_disabled_child_element(Variable):

def formula(benunit, period, parameters):
person = benunit.members
is_child_for_CTC = person("is_child_for_CTC", period)
is_child_for_ctc = person("is_child_for_ctc", period)
is_severely_disabled_for_benefits = person(
"is_severely_disabled_for_benefits", period
)
is_severely_disabled_child = (
is_child_for_CTC & is_severely_disabled_for_benefits
is_child_for_ctc & is_severely_disabled_for_benefits
)
severely_disabled_children = benunit.sum(is_severely_disabled_child)
CTC = parameters(period).gov.dwp.tax_credits.child_tax_credit
Expand Down
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/LHA_allowed_bedrooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class LHA_allowed_bedrooms(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "The number of bedrooms covered by LHA for the benefit unit"
definition_period = YEAR
reference = "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/10/2021-04-06"
Expand Down
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/LHA_cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class LHA_cap(Variable):
value_type = float
entity = BenUnit
entity = ben_unit
label = "Applicable amount for LHA"
documentation = "Applicable amount for Local Housing Allowance"
definition_period = YEAR
Expand Down
Loading
Loading