Skip to content

Commit 9256e6b

Browse files
vahid-ahmadiPavelMakarchukclaude
authored
Implement childcare expense deductions and benefits (#540)
* Implement childcare expense deductions and benefits * debug * debug * debug again * Fix all review findings: Ontario rate table, BC/AB values, federal refs, tests Critical fixes: - Ontario CARE: fix rate table (+2pp error from duplicate 0.73 at $22,500), rewrite formula to use federal CCED (line 21400), fix income variable - BC CCFRI: fix preschool $145→$545, add kindergarten $320 category, parameterize all hard-coded ages, flatten nested where() to np.select - Alberta: replace unsourced $200/$250 with actual discrete income bracket tables (14 preschool + 10 school-age brackets), remove linear phase-out - Federal CCED: fix all 7 references to cite ITA s.63 + T778, broaden earned income to include self-employment, fix claimant allocation to use total income with deterministic tiebreaker for equal-income case Should-address fixes: - Migrate changelog to towncrier format (changelog.d/540.added.md) - Fix 30 parameter descriptions (trailing periods, active voice) - Add period metadata to 8 parameter files - Remove scope creep (armed forces deduction from deductions_from_total) - Change documentation→reference field on all variable files - Remove np.round() calls, add #page=5 to BC CCFRI PDF references Tests: 797 passing (11 new boundary/allocation tests added) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Ontario rate thresholds, Alberta subsidy values, and improve references - Ontario CARE: Add 2024 rate schedule with correct income thresholds from ON479-A ($5k steps $40k-$60k, $3.6k steps $60k-$146.4k) - Alberta school-age: Correct 7 bracket amounts ($348/$311/$275/$238/$201/$165/$128) - Alberta preschool: Fix 5 brackets off by $1 ($253/$226/$213/$160/$120) - References: Add subsection detail to ON/CRA citations, BC legislation refs, Alberta regulation refs, specific PDF page anchors - Tests: Fix 9 expected values, add 8 boundary tests (age 6/7, 15/16, disabled 17+, BC $111k, AB age 5) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Ontario rate shift, Alberta wrong regulation citations, and metadata - Ontario rate.yaml: Remove incorrect 2024 rate overrides at $20k-$40k (rates unchanged from 2019), fix spurious $42,500 bracket with 2024 threshold override, add 2019 ON479-A form reference - Alberta: Replace wrong AR 143/2008 (licensing reg) citations with Early Learning and Child Care Act (SA 2007, c E-0.1), fix rate_unit to amount_unit in subsidy schedules - Tests: Update 2 Ontario expected values to match corrected rates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Ontario rate table, BC ACCB regulation citation, and federal deduction guard - Ontario rate.yaml: Rewrite brackets to match ON479-A PDFs (2019 and 2024 are identical). Remove all unnecessary 2024 overrides, fix 27 wrong 2019 thresholds, remove spurious $42,500 bracket - BC ACCB: Fix B.C. Reg. 74/2018 (Gypsy Moth pest control) to correct B.C. Reg. 74/97 (Child Care Subsidy Regulation) in all 12 files - Federal: Add max_(0, ...) guard to prevent negative deduction when self-employment losses exceed employment income Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix claimant income, bracket offsets, references, and add family rates - Federal CCED: Fix earned income limit to use claimant's income (not family total) per ITA s. 63(1)(e). Extract shared claimant logic into is_child_care_expense_claimant variable. - Ontario CARE: Shift all 39 bracket thresholds by +1 to match "more than $X" semantics. Fix reference to s. 103.0.3(6). - BC ACCB: Update 12 files from repealed B.C. Reg. 74/97 to 189/2024. Add period metadata, simplify phase-out formula. - BC CCFRI: Add Family/In-Home rates (group/ and family/ subfolders), new is_family_child_care input variable. Remove redundant multiplier. - Alberta: Replace Act reference with alberta.ca source, add preschool discontinuation note and school-age verification note. - Orphaned params: Document Ontario max_amount and federal child_income_limit with metadata notes. - Tests: Add 8 new edge-case and boundary tests (816 total, all pass). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Format bc_child_care_fee_reduction.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: PavelMakarchuk <pavel.ma99@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 232de65 commit 9256e6b

58 files changed

Lines changed: 2377 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog.d/540.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added child care expense deductions and provincial child care benefits (Ontario CARE credit, BC ACCB, BC CCFRI, Alberta subsidy).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act sets this maximum age for a child to qualify for the child care expense deduction, unless the child has a disability.
2+
values:
3+
2015-01-01: 16
4+
metadata:
5+
unit: year
6+
period: year
7+
label: Child care expense deduction age limit
8+
reference:
9+
- title: Income Tax Act, s. 63(3) — definition of "eligible child" — Maximum age without disability
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part A — Eligible child age limit
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=2
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
description: The Income Tax Act sets this maximum net income for an eligible child claiming the child care expense deduction.
2+
values:
3+
2023-01-01: 15_000
4+
2024-01-01: 15_705
5+
metadata:
6+
unit: currency-CAD
7+
period: year
8+
label: Child income limit for child care expense deduction
9+
note: "Documents ITA s. 63(3)(b) child income limit. Not used in formula — implementing this check would create a circular dependency (child's net income depends on the deduction being calculated)."
10+
reference:
11+
- title: Income Tax Act, s. 63(3) — definition of "eligible child", paragraph (b)
12+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
13+
- title: CRA T778 Child Care Expenses Deduction (2024) — Eligible child income limit
14+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=2
15+
- title: CRA T778 Child Care Expenses Deduction (2023) — Eligible child income limit
16+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-23e.pdf#page=2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act limits the child care expense deduction to this fraction of the claimant's earned income.
2+
values:
3+
2015-01-01: 0.6667
4+
metadata:
5+
unit: /1
6+
period: year
7+
label: Earned income fraction for child care expense deduction
8+
reference:
9+
- title: Income Tax Act, s. 63(1) — paragraph (e) — Two-thirds earned income limit
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part D — Earned income fraction
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=4
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act sets this age threshold that determines the annual child care expense amount per eligible child.
2+
values:
3+
2015-01-01: 7
4+
metadata:
5+
unit: year
6+
period: year
7+
label: Age threshold for child care expense limits
8+
reference:
9+
- title: Income Tax Act, s. 63(3) — definition of "annual child care expense amount" — Age threshold between limit tiers
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part B — Age threshold for expense limits
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act sets this maximum annual child care expense amount for a child eligible for the disability tax credit.
2+
values:
3+
2015-01-01: 11_000
4+
metadata:
5+
unit: currency-CAD
6+
period: year
7+
label: Child care expense limit for children with disabilities
8+
reference:
9+
- title: Income Tax Act, s. 63(3) — "annual child care expense amount", paragraph (a) — Limit for disabled child
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part B — Limit per disabled child
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act sets this maximum annual child care expense amount for a child aged 7 to 16.
2+
values:
3+
2015-01-01: 5_000
4+
metadata:
5+
unit: currency-CAD
6+
period: year
7+
label: Child care expense limit for children 7-16
8+
reference:
9+
- title: Income Tax Act, s. 63(3) — "annual child care expense amount", paragraph (c) — Limit for child aged 7 to 16
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part B — Limit per child aged 7 to 16
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description: The Income Tax Act sets this maximum annual child care expense amount for a child under age 7.
2+
values:
3+
2015-01-01: 8_000
4+
metadata:
5+
unit: currency-CAD
6+
period: year
7+
label: Child care expense limit for children under 7
8+
reference:
9+
- title: Income Tax Act, s. 63(3) — "annual child care expense amount", paragraph (b) — Limit for child under 7
10+
href: https://laws-lois.justice.gc.ca/eng/acts/I-3.3/section-63.html
11+
- title: CRA T778 Child Care Expenses Deduction (2024), Part B — Limit per child under 7
12+
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/t778/t778-24e.pdf#page=3
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
description: Alberta applies the preschool child care subsidy schedule to children below this age.
2+
values:
3+
2024-01-01: 5
4+
metadata:
5+
unit: year
6+
period: year
7+
label: Alberta child care subsidy preschool age threshold
8+
note: Preschool parent subsidy was discontinued April 1, 2025, replaced by $15/day Affordability Grant paid to providers. These 2024 rates were valid prior to discontinuation but the official page no longer displays them.
9+
reference:
10+
- title: Alberta Child Care Subsidy Program — Preschool age eligibility (2024)
11+
href: https://www.alberta.ca/child-care-subsidy
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
description: Alberta applies the school-age child care subsidy schedule to children up to and including this age.
2+
values:
3+
2024-01-01: 12
4+
metadata:
5+
unit: year
6+
period: year
7+
label: Alberta child care subsidy school-age maximum age
8+
note: Age threshold for school-age subsidy (kindergarten through grade 6).
9+
reference:
10+
- title: Alberta Child Care Subsidy Program — School-age age eligibility (2024)
11+
href: https://www.alberta.ca/child-care-subsidy

0 commit comments

Comments
 (0)