From b7203b6ffdcea4fb67f25ec4355b0506da10e9b3 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 15 May 2023 23:15:25 +0000 Subject: [PATCH 01/11] pr creation --- .../gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml | 0 .../gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml | 0 .../gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml | 0 .../provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml | 0 .../gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml | 0 .../provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml new file mode 100644 index 000000000..e69de29bb From c6bbe972d179e46bcf47d7cc5612b4b6827fb7e7 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Sun, 21 May 2023 20:06:59 +0000 Subject: [PATCH 02/11] parameters, variables and test creation --- .../benefits/rebates/ygcpri/amount/child.yaml | 9 +++++++++ .../benefits/rebates/ygcpri/amount/self.yaml | 9 +++++++++ .../rebates/ygcpri/amount/spouse.yaml | 9 +++++++++ .../rebates/ygcpri/supplement/child.yaml | 9 +++++++++ .../rebates/ygcpri/supplement/self.yaml | 9 +++++++++ .../rebates/ygcpri/supplement/spouse.yaml | 9 +++++++++ .../income/benefits/yt_ygcpri_rebates.yaml | 19 +++++++++++++++++++ .../rebates/ygcpri/yt_ygcpri_rebates.py | 19 +++++++++++++++++++ .../rebates/ygcpri/yt_ygcpri_spouse.py | 12 ++++++++++++ .../rebates/ygcpri/yt_ygcpri_spouses.py | 11 +++++++++++ .../person/lived_outside_of_Whitehorse.py | 10 ++++++++++ .../person/yt_ygcpri_eligible_child.py | 12 ++++++++++++ .../person/yt_ygcpri_eligible_children.py | 11 +++++++++++ 13 files changed, 148 insertions(+) create mode 100644 policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py create mode 100644 policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py create mode 100644 policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py create mode 100644 policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml index e69de29bb..3d3fd052e 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this base amount for each child in Yukon Government carbon price rebate - Individuals (YGCPRI) +values: + 2023-01-01: 320 +metadata: + unit: currency-CAD + label: Yukon child YGCPRI base + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml index e69de29bb..6443aeca0 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this base amount for each individual in Yukon Government carbon price rebate - Individuals (YGCPRI) +values: + 2023-01-01: 320 +metadata: + unit: currency-CAD + label: Yukon individual YGCPRI base + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml index e69de29bb..17f68936f 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this base amount for each spouse in Yukon Government carbon price rebate - Individuals (YGCPRI) +values: + 2023-01-01: 320 +metadata: + unit: currency-CAD + label: Yukon spouse YGCPRI base + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml index e69de29bb..78c0e07f4 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this remote supplement amount for each child if individuals living outside of Whitehorse in YGCPRI +values: + 2023-01-01: 32 +metadata: + unit: currency-CAD + label: Yukon child YGCPRI supplement + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml index e69de29bb..789501c93 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this remote supplement amount for each individual if living outside of Whitehorse in YGCPRI +values: + 2023-01-01: 32 +metadata: + unit: currency-CAD + label: Yukon self YGCPRI supplement + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml index e69de29bb..8db3f684b 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this remote supplement amount for each spouse if individuals living outside of Whitehorse in YGCPRI +values: + 2023-01-01: 32 +metadata: + unit: currency-CAD + label: Yukon spouse YGCPRI supplement + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml new file mode 100644 index 000000000..b73b81e3c --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml @@ -0,0 +1,19 @@ +- name: No supplement # 4 * 320 = 1280 + period: 2023 + input: + province_code: YT + yt_ygcpri_eligible_children: 2 + yt_ygcpri_spouses: 1 + lived_outside_of_Whitehorse: False + output: + gycpri_rebates: 1280 + +- name: Have supplement # 4 * (320+32) = 1408 + period: 2023 + input: + province_code: YT + yt_ygcpri_eligible_children: 2 + yt_ygcpri_spouses: 1 + lived_outside_of_Whitehorse: True + output: + gycpri_rebates: 1408 diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py new file mode 100644 index 000000000..d132aad9a --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py @@ -0,0 +1,19 @@ +from policyengine_canada.model_api import * + + +class gycpri_rebates(Variable): + value_type = float + entity = Household + label = "Yukon ygcpri rebates" + unit = CAD + definition_period = YEAR + reference = "https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI" + defined_for = ProvinceCode.YT + + def formula(household, period, parameters): + children = household("yt_ygcpri_eligible_children", period) + spouses = household("yt_ygcpri_spouses", period) + remote = household("lived_outside_of_Whitehorse", period) + p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri + supplement = remote*(p.supplement.child*children + p.supplement.spouse*spouses + p.supplement.self) + return p.amount.child*children + p.amount.spouse*spouses + p.amount.self + supplement \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py new file mode 100644 index 000000000..0e7f6f473 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py @@ -0,0 +1,12 @@ +from policyengine_canada.model_api import * + + +class yt_ygcpri_spouse(Variable): + value_type = bool + entity = Person + label = "Yukon ygcpri eligible spouse" + definition_period = YEAR + defined_for = ProvinceCode.YT + + def formula(person, period, parameters): + return person("is_spouse", period) \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py new file mode 100644 index 000000000..cb98a95f7 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py @@ -0,0 +1,11 @@ +from policyengine_canada.model_api import * + + +class yt_ygcpri_spouses(Variable): + value_type = int + entity = Household + label = "Yukon YGCPRI eligible spouses" + definition_period = YEAR + defined_for = ProvinceCode.YT + + adds = ["yt_ygcpri_spouse"] \ No newline at end of file diff --git a/policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py b/policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py new file mode 100644 index 000000000..98118404c --- /dev/null +++ b/policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py @@ -0,0 +1,10 @@ +from policyengine_canada.model_api import * + + +class lived_outside_of_Whitehorse(Variable): + value_type = bool + entity = Household + label = "lived outside of Whitehorse" + unit = CAD + documentation = "A person who lived outside of Whitehorse" + definition_period = YEAR diff --git a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py b/policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py new file mode 100644 index 000000000..fb1721d97 --- /dev/null +++ b/policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py @@ -0,0 +1,12 @@ +from policyengine_canada.model_api import * + + +class yt_ygcpri_eligible_child(Variable): + value_type = bool + entity = Person + label = "Yukon ygcpri eligible child" + definition_period = YEAR + defined_for = ProvinceCode.YT + + def formula(person, period, parameters): + return person("age", period) < 19 \ No newline at end of file diff --git a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py b/policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py new file mode 100644 index 000000000..08a4c26e9 --- /dev/null +++ b/policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py @@ -0,0 +1,11 @@ +from policyengine_canada.model_api import * + + +class yt_ygcpri_eligible_children(Variable): + value_type = int + entity = Household + label = "Yukon YGCPRI eligible children" + definition_period = YEAR + defined_for = ProvinceCode.YT + + adds = ["yt_ygcpri_eligible_child"] \ No newline at end of file From 259084a84ad0f4c1b1f2d1bc74c0e832e8e4b38f Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 22 May 2023 22:50:40 +0000 Subject: [PATCH 03/11] changes and fixes --- changelog_entry.yaml | 4 ++++ .../benefits/rebates/ygcpri/amount/child.yaml | 4 ++-- .../benefits/rebates/ygcpri/amount/self.yaml | 4 ++-- .../rebates/ygcpri/amount/spouse.yaml | 4 ++-- .../rebates/ygcpri/child_eligible_age.yaml | 9 +++++++++ .../rebates/ygcpri/supplement/child.yaml | 5 ++--- .../rebates/ygcpri/supplement/self.yaml | 4 ++-- .../rebates/ygcpri/supplement/spouse.yaml | 4 ++-- .../ygcpri}/yt_ygcpri_eligible_child.py | 7 ++++++- .../ygcpri}/yt_ygcpri_eligible_children.py | 2 +- .../rebates/ygcpri/yt_ygcpri_rebates.py | 19 +++++++++++++++---- .../rebates/ygcpri/yt_ygcpri_spouse.py | 12 ------------ .../rebates/ygcpri/yt_ygcpri_spouses.py | 2 +- ...orse.py => lived_outside_of_whitehorse.py} | 4 ++-- 14 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml rename policyengine_canada/variables/{household/person => gov/provinces/yt/tax/income/benefits/rebates/ygcpri}/yt_ygcpri_eligible_child.py (60%) rename policyengine_canada/variables/{household/person => gov/provinces/yt/tax/income/benefits/rebates/ygcpri}/yt_ygcpri_eligible_children.py (85%) delete mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py rename policyengine_canada/variables/household/person/{lived_outside_of_Whitehorse.py => lived_outside_of_whitehorse.py} (65%) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..f6bab55d4 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Yukon Government carbon price rebate - Individuals (YGCPRI) diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml index 3d3fd052e..cf63cfc48 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml @@ -1,4 +1,4 @@ -description: Yukon provides this base amount for each child in Yukon Government carbon price rebate - Individuals (YGCPRI) +description: Yukon provides this base amount for each child under the Yukon Government carbon price rebate (YGCPRI). values: 2023-01-01: 320 metadata: @@ -6,4 +6,4 @@ metadata: label: Yukon child YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml index 6443aeca0..2c8444047 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml @@ -1,4 +1,4 @@ -description: Yukon provides this base amount for each individual in Yukon Government carbon price rebate - Individuals (YGCPRI) +description: Yukon provides this base amount for the individual filer under the Yukon Government carbon price rebate (YGCPRI). values: 2023-01-01: 320 metadata: @@ -6,4 +6,4 @@ metadata: label: Yukon individual YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml index 17f68936f..ed3538e48 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml @@ -1,4 +1,4 @@ -description: Yukon provides this base amount for each spouse in Yukon Government carbon price rebate - Individuals (YGCPRI) +description: Yukon provides this base amount for the spouse in Yukon Government carbon price rebate (YGCPRI). values: 2023-01-01: 320 metadata: @@ -6,4 +6,4 @@ metadata: label: Yukon spouse YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml new file mode 100644 index 000000000..e46646f05 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this eligible age for each child in Yukon Government carbon price rebate - Individuals (YGCPRI) +values: + 2023-01-01: 19 +metadata: + unit: year + label: Yukon YGCPRI child eligible age + reference: + - title: Yukon Government carbon price rebate - Individuals (YGCPRI) + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml index 78c0e07f4..2e9d69de2 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml @@ -1,9 +1,8 @@ -description: Yukon provides this remote supplement amount for each child if individuals living outside of Whitehorse in YGCPRI -values: +description: Yukon provides this remote supplement amount for each child if the household resides outside of Whitehorse under the YGCPRI. 2023-01-01: 32 metadata: unit: currency-CAD label: Yukon child YGCPRI supplement reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml index 789501c93..e4868f925 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml @@ -1,4 +1,4 @@ -description: Yukon provides this remote supplement amount for each individual if living outside of Whitehorse in YGCPRI +description: Yukon provides this remote supplement amount for the individual if living outside of Whitehorse in YGCPRI values: 2023-01-01: 32 metadata: @@ -6,4 +6,4 @@ metadata: label: Yukon self YGCPRI supplement reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml index 8db3f684b..607883733 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml @@ -1,4 +1,4 @@ -description: Yukon provides this remote supplement amount for each spouse if individuals living outside of Whitehorse in YGCPRI +description: Yukon provides this remote supplement amount for the spouse if the household resides outside of Whitehorse under the YGCPRI. values: 2023-01-01: 32 metadata: @@ -6,4 +6,4 @@ metadata: label: Yukon spouse YGCPRI supplement reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) - href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI \ No newline at end of file + href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py similarity index 60% rename from policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py rename to policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py index fb1721d97..ef3529526 100644 --- a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_child.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py @@ -9,4 +9,9 @@ class yt_ygcpri_eligible_child(Variable): defined_for = ProvinceCode.YT def formula(person, period, parameters): - return person("age", period) < 19 \ No newline at end of file + return ( + person("age", period) + < parameters( + period + ).gov.provinces.yt.benefits.rebates.ygcpri.child_eligible_age + ) diff --git a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py similarity index 85% rename from policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py rename to policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py index 08a4c26e9..37e96f2d6 100644 --- a/policyengine_canada/variables/household/person/yt_ygcpri_eligible_children.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py @@ -8,4 +8,4 @@ class yt_ygcpri_eligible_children(Variable): definition_period = YEAR defined_for = ProvinceCode.YT - adds = ["yt_ygcpri_eligible_child"] \ No newline at end of file + adds = ["yt_ygcpri_eligible_child"] diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py index d132aad9a..c699387db 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py @@ -12,8 +12,19 @@ class gycpri_rebates(Variable): def formula(household, period, parameters): children = household("yt_ygcpri_eligible_children", period) - spouses = household("yt_ygcpri_spouses", period) - remote = household("lived_outside_of_Whitehorse", period) + person = household.members + spouse = person("is_spouse", period) + spouses = household.sum(spouse) + remote = household("lived_outside_of_whitehorse", period) p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri - supplement = remote*(p.supplement.child*children + p.supplement.spouse*spouses + p.supplement.self) - return p.amount.child*children + p.amount.spouse*spouses + p.amount.self + supplement \ No newline at end of file + supplement = remote * ( + p.supplement.child * children + + p.supplement.spouse * spouses + + p.supplement.self + ) + return ( + p.amount.child * children + + p.amount.spouse * spouses + + p.amount.self + + supplement + ) diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py deleted file mode 100644 index 0e7f6f473..000000000 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouse.py +++ /dev/null @@ -1,12 +0,0 @@ -from policyengine_canada.model_api import * - - -class yt_ygcpri_spouse(Variable): - value_type = bool - entity = Person - label = "Yukon ygcpri eligible spouse" - definition_period = YEAR - defined_for = ProvinceCode.YT - - def formula(person, period, parameters): - return person("is_spouse", period) \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py index cb98a95f7..8ecd9e32f 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py @@ -8,4 +8,4 @@ class yt_ygcpri_spouses(Variable): definition_period = YEAR defined_for = ProvinceCode.YT - adds = ["yt_ygcpri_spouse"] \ No newline at end of file + adds = ["yt_ygcpri_spouse"] diff --git a/policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py b/policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py similarity index 65% rename from policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py rename to policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py index 98118404c..0670be2f5 100644 --- a/policyengine_canada/variables/household/person/lived_outside_of_Whitehorse.py +++ b/policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py @@ -1,10 +1,10 @@ from policyengine_canada.model_api import * -class lived_outside_of_Whitehorse(Variable): +class lived_outside_of_whitehorse(Variable): value_type = bool entity = Household - label = "lived outside of Whitehorse" + label = "Household that resides outside of Whitehorse" unit = CAD documentation = "A person who lived outside of Whitehorse" definition_period = YEAR From 991e354791daa285e982fadfc39722a0d1418e85 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 22 May 2023 23:16:30 +0000 Subject: [PATCH 04/11] fixed test --- .../rebates/ygcpri/supplement/child.yaml | 1 + .../income/benefits/yt_ygcpri_rebates.yaml | 19 ----- .../yt_government_carbon_price_rebate.yaml | 78 +++++++++++++++++++ ...y => yt_government_carbon_price_rebate.py} | 4 +- .../rebates/ygcpri/yt_ygcpri_spouses.py | 11 --- 5 files changed, 81 insertions(+), 32 deletions(-) delete mode 100644 policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml create mode 100644 policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml rename policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/{yt_ygcpri_rebates.py => yt_government_carbon_price_rebate.py} (90%) delete mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml index 2e9d69de2..77b45047c 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml @@ -1,4 +1,5 @@ description: Yukon provides this remote supplement amount for each child if the household resides outside of Whitehorse under the YGCPRI. +values: 2023-01-01: 32 metadata: unit: currency-CAD diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml deleted file mode 100644 index b73b81e3c..000000000 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/benefits/yt_ygcpri_rebates.yaml +++ /dev/null @@ -1,19 +0,0 @@ -- name: No supplement # 4 * 320 = 1280 - period: 2023 - input: - province_code: YT - yt_ygcpri_eligible_children: 2 - yt_ygcpri_spouses: 1 - lived_outside_of_Whitehorse: False - output: - gycpri_rebates: 1280 - -- name: Have supplement # 4 * (320+32) = 1408 - period: 2023 - input: - province_code: YT - yt_ygcpri_eligible_children: 2 - yt_ygcpri_spouses: 1 - lived_outside_of_Whitehorse: True - output: - gycpri_rebates: 1408 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml new file mode 100644 index 000000000..111610f4d --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml @@ -0,0 +1,78 @@ +- name: Have supplement # 4 * (320+32) = 1408 + period: 2023 + input: + people: + head: + is_spouse: false + spouse: + is_spouse: true + child: + is_spouse: false + child2: + is_spouse: false + household: + members: [head, spouse, child, child2] + province_code: YT + yt_ygcpri_eligible_children: 2 + lived_outside_of_whitehorse: true + output: + yt_government_carbon_price_rebate: 1_408 + +- name: No supplement # 4 * 320 = 1280 + period: 2023 + input: + people: + head: + is_spouse: false + spouse: + is_spouse: true + child: + is_spouse: false + child2: + is_spouse: false + household: + members: [head, spouse, child, child2] + province_code: YT + yt_ygcpri_eligible_children: 2 + lived_outside_of_whitehorse: false + output: + yt_government_carbon_price_rebate: 1_280 + +- name: No spouse + Have supplement # 3 * (320+32) = 1056 + period: 2023 + input: + people: + head: + is_spouse: false + child: + is_spouse: false + child2: + is_spouse: false + household: + members: [head, child, child2] + province_code: YT + yt_ygcpri_eligible_children: 2 + lived_outside_of_whitehorse: true + output: + yt_government_carbon_price_rebate: 1_056 + +- name: No spouse + No supplement # 4 * 320 = 1280 + period: 2023 + input: + people: + head: + is_spouse: false + child: + is_spouse: false + child2: + is_spouse: false + child3: + is_spouse: false + + household: + members: [head, child, child2] + province_code: YT + yt_ygcpri_eligible_children: 3 + lived_outside_of_whitehorse: false + output: + yt_government_carbon_price_rebate: 1_280 diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py similarity index 90% rename from policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py rename to policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py index c699387db..e0254cf73 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_rebates.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py @@ -1,10 +1,10 @@ from policyengine_canada.model_api import * -class gycpri_rebates(Variable): +class yt_government_carbon_price_rebate(Variable): value_type = float entity = Household - label = "Yukon ygcpri rebates" + label = "Yukon government carbon price rebate" unit = CAD definition_period = YEAR reference = "https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI" diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py deleted file mode 100644 index 8ecd9e32f..000000000 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_spouses.py +++ /dev/null @@ -1,11 +0,0 @@ -from policyengine_canada.model_api import * - - -class yt_ygcpri_spouses(Variable): - value_type = int - entity = Household - label = "Yukon YGCPRI eligible spouses" - definition_period = YEAR - defined_for = ProvinceCode.YT - - adds = ["yt_ygcpri_spouse"] From 6de580e5fee0cf38137fa90a8cd6b7395b562d28 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 22 May 2023 23:19:19 +0000 Subject: [PATCH 05/11] change test --- .../income/rebates/yt_government_carbon_price_rebate.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml index 111610f4d..ca4f86cac 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml @@ -1,4 +1,4 @@ -- name: Have supplement # 4 * (320+32) = 1408 +- name: 1 head + 1 spouse + 2 children + have supplement # 4 * (320+32) = 1408 period: 2023 input: people: @@ -18,7 +18,7 @@ output: yt_government_carbon_price_rebate: 1_408 -- name: No supplement # 4 * 320 = 1280 +- name: 1 head + 1 spouse + 2 children + no supplement # 4 * 320 = 1280 period: 2023 input: people: @@ -38,7 +38,7 @@ output: yt_government_carbon_price_rebate: 1_280 -- name: No spouse + Have supplement # 3 * (320+32) = 1056 +- name: 1 head + 0 spouse + 2 children + have supplement # 3 * (320+32) = 1056 period: 2023 input: people: @@ -56,7 +56,7 @@ output: yt_government_carbon_price_rebate: 1_056 -- name: No spouse + No supplement # 4 * 320 = 1280 +- name: 1 head + 0 spouse + 3 children + no supplement # 4 * 320 = 1280 period: 2023 input: people: From d0ba5a635855f9ef1e7887469e93d436425709c6 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:42:57 +0000 Subject: [PATCH 06/11] in_whitehorse --- .../ygcpri/yt_government_carbon_price_rebate.py | 4 ++-- .../household/demographic/geographic/in_whitehorse.py | 10 ++++++++++ .../household/person/lived_outside_of_whitehorse.py | 10 ---------- 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py delete mode 100644 policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py index e0254cf73..fb4c885fe 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py @@ -15,9 +15,9 @@ def formula(household, period, parameters): person = household.members spouse = person("is_spouse", period) spouses = household.sum(spouse) - remote = household("lived_outside_of_whitehorse", period) + not_remote = household("in_whitehorse", period) p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri - supplement = remote * ( + supplement = (-not_remote+1) * ( p.supplement.child * children + p.supplement.spouse * spouses + p.supplement.self diff --git a/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py new file mode 100644 index 000000000..c1f00693e --- /dev/null +++ b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py @@ -0,0 +1,10 @@ +from policyengine_canada.model_api import * + + +class in_whitehorse(Variable): + value_type = bool + entity = Household + label = "Household that resides in Whitehorse" + unit = CAD + documentation = "A person who lived in Whitehorse" + definition_period = YEAR diff --git a/policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py b/policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py deleted file mode 100644 index 0670be2f5..000000000 --- a/policyengine_canada/variables/household/person/lived_outside_of_whitehorse.py +++ /dev/null @@ -1,10 +0,0 @@ -from policyengine_canada.model_api import * - - -class lived_outside_of_whitehorse(Variable): - value_type = bool - entity = Household - label = "Household that resides outside of Whitehorse" - unit = CAD - documentation = "A person who lived outside of Whitehorse" - definition_period = YEAR From da0cb4ae5040dad31c0212589ea8f23233653736 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:54:51 +0000 Subject: [PATCH 07/11] test --- .../income/rebates/yt_government_carbon_price_rebate.yaml | 8 ++++---- .../rebates/ygcpri/yt_government_carbon_price_rebate.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml index ca4f86cac..33076334a 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml @@ -14,7 +14,7 @@ members: [head, spouse, child, child2] province_code: YT yt_ygcpri_eligible_children: 2 - lived_outside_of_whitehorse: true + in_whitehorse: false output: yt_government_carbon_price_rebate: 1_408 @@ -34,7 +34,7 @@ members: [head, spouse, child, child2] province_code: YT yt_ygcpri_eligible_children: 2 - lived_outside_of_whitehorse: false + in_whitehorse: true output: yt_government_carbon_price_rebate: 1_280 @@ -52,7 +52,7 @@ members: [head, child, child2] province_code: YT yt_ygcpri_eligible_children: 2 - lived_outside_of_whitehorse: true + in_whitehorse: false output: yt_government_carbon_price_rebate: 1_056 @@ -73,6 +73,6 @@ members: [head, child, child2] province_code: YT yt_ygcpri_eligible_children: 3 - lived_outside_of_whitehorse: false + in_whitehorse: true output: yt_government_carbon_price_rebate: 1_280 diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py index fb4c885fe..3afc724bf 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py @@ -17,7 +17,7 @@ def formula(household, period, parameters): spouses = household.sum(spouse) not_remote = household("in_whitehorse", period) p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri - supplement = (-not_remote+1) * ( + supplement = ~not_remote * ( p.supplement.child * children + p.supplement.spouse * spouses + p.supplement.self From cd736baddabac4d873e264ac94c35e0a8d288375 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 16:14:29 +0000 Subject: [PATCH 08/11] changes --- ...ble_age.yaml => child_ineligible_age.yaml} | 4 +-- .../child.yaml | 0 .../self.yaml | 0 .../spouse.yaml | 0 .../yt_government_carbon_price_rebate.yaml | 25 +++++++++++++------ .../yt_government_carbon_price_rebate.py | 23 ++++++++--------- .../ygcpri/yt_ygcpri_eligible_child.py | 17 ------------- .../ygcpri/yt_ygcpri_eligible_children.py | 11 -------- 8 files changed, 30 insertions(+), 50 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/{child_eligible_age.yaml => child_ineligible_age.yaml} (61%) rename policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/{supplement => non_whitehorse_supplement}/child.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/{supplement => non_whitehorse_supplement}/self.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/{supplement => non_whitehorse_supplement}/spouse.yaml (100%) delete mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py delete mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_ineligible_age.yaml similarity index 61% rename from policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml rename to policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_ineligible_age.yaml index e46646f05..82e6dc467 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_eligible_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/child_ineligible_age.yaml @@ -1,9 +1,9 @@ -description: Yukon provides this eligible age for each child in Yukon Government carbon price rebate - Individuals (YGCPRI) +description: Yukon provides the Yukon Government Carbon Price Rebate - Individuals child element to people below this age. values: 2023-01-01: 19 metadata: unit: year - label: Yukon YGCPRI child eligible age + label: Yukon YGCPRI child ineligible age reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/child.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/child.yaml rename to policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/child.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/self.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/self.yaml rename to policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/self.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/spouse.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/supplement/spouse.yaml rename to policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/non_whitehorse_supplement/spouse.yaml diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml index 33076334a..5925e3a87 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/rebates/yt_government_carbon_price_rebate.yaml @@ -4,16 +4,19 @@ people: head: is_spouse: false + age: 40 spouse: is_spouse: true + age: 40 child: is_spouse: false + age: 10 child2: is_spouse: false + age: 15 household: members: [head, spouse, child, child2] province_code: YT - yt_ygcpri_eligible_children: 2 in_whitehorse: false output: yt_government_carbon_price_rebate: 1_408 @@ -24,16 +27,19 @@ people: head: is_spouse: false + age: 40 spouse: is_spouse: true + age: 40 child: is_spouse: false + age: 5 child2: is_spouse: false + age: 10 household: members: [head, spouse, child, child2] province_code: YT - yt_ygcpri_eligible_children: 2 in_whitehorse: true output: yt_government_carbon_price_rebate: 1_280 @@ -44,35 +50,40 @@ people: head: is_spouse: false + age: 40 child: is_spouse: false + age: 13 child2: is_spouse: false + age: 18 household: members: [head, child, child2] province_code: YT - yt_ygcpri_eligible_children: 2 in_whitehorse: false output: yt_government_carbon_price_rebate: 1_056 -- name: 1 head + 0 spouse + 3 children + no supplement # 4 * 320 = 1280 +- name: 1 head + 0 spouse + 2 children + no supplement # 3 * 320 = 960 period: 2023 input: people: head: is_spouse: false + age: 40 child: is_spouse: false + age: 13 child2: is_spouse: false + age: 15 child3: is_spouse: false + age: 20 household: - members: [head, child, child2] + members: [head, child, child2, child3] province_code: YT - yt_ygcpri_eligible_children: 3 in_whitehorse: true output: - yt_government_carbon_price_rebate: 1_280 + yt_government_carbon_price_rebate: 960 diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py index 3afc724bf..c9f706b17 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py @@ -11,20 +11,17 @@ class yt_government_carbon_price_rebate(Variable): defined_for = ProvinceCode.YT def formula(household, period, parameters): - children = household("yt_ygcpri_eligible_children", period) + p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri person = household.members + child = person("age", period) < p.child_ineligible_age + children = household.sum(child) spouse = person("is_spouse", period) spouses = household.sum(spouse) - not_remote = household("in_whitehorse", period) - p = parameters(period).gov.provinces.yt.benefits.rebates.ygcpri - supplement = ~not_remote * ( - p.supplement.child * children - + p.supplement.spouse * spouses - + p.supplement.self - ) - return ( - p.amount.child * children - + p.amount.spouse * spouses - + p.amount.self - + supplement + in_whitehorse = household("in_whitehorse", period) + non_whitehorse_supplement = ~in_whitehorse * ( + p.non_whitehorse_supplement.child * children + + p.non_whitehorse_supplement.spouse * spouses + + p.non_whitehorse_supplement.self ) + base = (p.amount.child * children) + (p.amount.spouse * spouses) + p.amount.self + return base + non_whitehorse_supplement diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py deleted file mode 100644 index ef3529526..000000000 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_child.py +++ /dev/null @@ -1,17 +0,0 @@ -from policyengine_canada.model_api import * - - -class yt_ygcpri_eligible_child(Variable): - value_type = bool - entity = Person - label = "Yukon ygcpri eligible child" - definition_period = YEAR - defined_for = ProvinceCode.YT - - def formula(person, period, parameters): - return ( - person("age", period) - < parameters( - period - ).gov.provinces.yt.benefits.rebates.ygcpri.child_eligible_age - ) diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py deleted file mode 100644 index 37e96f2d6..000000000 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_ygcpri_eligible_children.py +++ /dev/null @@ -1,11 +0,0 @@ -from policyengine_canada.model_api import * - - -class yt_ygcpri_eligible_children(Variable): - value_type = int - entity = Household - label = "Yukon YGCPRI eligible children" - definition_period = YEAR - defined_for = ProvinceCode.YT - - adds = ["yt_ygcpri_eligible_child"] From 9813da6716dc4ca6b4406113367e7c5b878fc3dd Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 23:27:53 +0000 Subject: [PATCH 09/11] update historical value --- .../yt/benefits/rebates/ygcpri/amount/child.yaml | 8 +++++++- .../yt/benefits/rebates/ygcpri/amount/self.yaml | 8 +++++++- .../yt/benefits/rebates/ygcpri/amount/spouse.yaml | 8 +++++++- .../tax/income/credits/pension/ab_pension_credit.yaml | 2 +- .../ygcpri/yt_government_carbon_price_rebate.py | 10 +++++++--- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml index cf63cfc48..cb3b5fd0a 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/child.yaml @@ -1,9 +1,15 @@ description: Yukon provides this base amount for each child under the Yukon Government carbon price rebate (YGCPRI). values: - 2023-01-01: 320 + 2019-07-01: 86 + 2020-07-01: 192 + 2021-07-01: 176 + 2022-07-01: 320 + 2023-07-01: 372 metadata: unit: currency-CAD label: Yukon child YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI + - title: Rebates for Yukon individuals + href: https://yukon.ca/en/carbon-rebate#rebates-for-yukon-individuals diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml index 2c8444047..d761d1b3e 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/self.yaml @@ -1,9 +1,15 @@ description: Yukon provides this base amount for the individual filer under the Yukon Government carbon price rebate (YGCPRI). values: - 2023-01-01: 320 + 2019-07-01: 86 + 2020-07-01: 192 + 2021-07-01: 176 + 2022-07-01: 320 + 2023-07-01: 372 metadata: unit: currency-CAD label: Yukon individual YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI + - title: Rebates for Yukon individuals + href: https://yukon.ca/en/carbon-rebate#rebates-for-yukon-individuals diff --git a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml index ed3538e48..372bd5ec4 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/benefits/rebates/ygcpri/amount/spouse.yaml @@ -1,9 +1,15 @@ description: Yukon provides this base amount for the spouse in Yukon Government carbon price rebate (YGCPRI). values: - 2023-01-01: 320 + 2019-07-01: 86 + 2020-07-01: 192 + 2021-07-01: 176 + 2022-07-01: 320 + 2023-07-01: 372 metadata: unit: currency-CAD label: Yukon spouse YGCPRI base reference: - title: Yukon Government carbon price rebate - Individuals (YGCPRI) href: https://www.canada.ca/en/revenue-agency/services/child-family-benefits/provincial-territorial-programs/yukon.html#YGCPRI + - title: Rebates for Yukon individuals + href: https://yukon.ca/en/carbon-rebate#rebates-for-yukon-individuals diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml index e3c23fabd..a9faa8c92 100644 --- a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml @@ -20,4 +20,4 @@ pension_and_savings_plan_income: 0 province_code: AB output: - ab_pension_credit: 0 \ No newline at end of file + ab_pension_credit: 0 diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py index c9f706b17..fe2c51354 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/benefits/rebates/ygcpri/yt_government_carbon_price_rebate.py @@ -19,9 +19,13 @@ def formula(household, period, parameters): spouses = household.sum(spouse) in_whitehorse = household("in_whitehorse", period) non_whitehorse_supplement = ~in_whitehorse * ( - p.non_whitehorse_supplement.child * children - + p.non_whitehorse_supplement.spouse * spouses + (p.non_whitehorse_supplement.child * children) + + (p.non_whitehorse_supplement.spouse * spouses) + p.non_whitehorse_supplement.self ) - base = (p.amount.child * children) + (p.amount.spouse * spouses) + p.amount.self + base = ( + (p.amount.child * children) + + (p.amount.spouse * spouses) + + p.amount.self + ) return base + non_whitehorse_supplement From 6f1f0d2ea6f963c77b3923eb506c799780b64a3e Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:42:04 +0000 Subject: [PATCH 10/11] in_whitehorse --- .../variables/household/demographic/geographic/in_whitehorse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py index c1f00693e..1260e584b 100644 --- a/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py +++ b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py @@ -6,5 +6,5 @@ class in_whitehorse(Variable): entity = Household label = "Household that resides in Whitehorse" unit = CAD - documentation = "A person who lived in Whitehorse" definition_period = YEAR + defined_for = ProvinceCode.YT \ No newline at end of file From 1c28cecfed33df42f3557a8d67ea707d9dd2bd1f Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:44:16 +0000 Subject: [PATCH 11/11] make format --- .../variables/household/demographic/geographic/in_whitehorse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py index 1260e584b..4ced7f36c 100644 --- a/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py +++ b/policyengine_canada/variables/household/demographic/geographic/in_whitehorse.py @@ -7,4 +7,4 @@ class in_whitehorse(Variable): label = "Household that resides in Whitehorse" unit = CAD definition_period = YEAR - defined_for = ProvinceCode.YT \ No newline at end of file + defined_for = ProvinceCode.YT