Commit 9256e6b
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
- changelog.d
- policyengine_canada
- parameters/gov
- cra/deductions/child_care_expense
- limit
- provinces
- ab/benefits/child_care
- age_threshold
- subsidy_schedule
- bc/benefits
- child_care_fee_reduction
- age
- max_reduction
- family
- group
- child_care
- age
- max_amount
- on/tax/income/credits/child_care
- max_amount
- tests/gov
- cra/deductions/child_care_expense
- provinces
- ab/benefits/child_care
- bc/benefits/child_care
- on/tax/income/credits/child_care
- variables/gov
- cra/deductions
- child_care_expense
- provinces
- ab/benefits/child_care
- bc/benefits/child_care
- on/tax/income/credits/child_care
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments