-
Notifications
You must be signed in to change notification settings - Fork 31
Add Scottish Child Payment benefit #1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements the Scottish Child Payment, a benefit provided by Social Security Scotland for eligible children. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
@PolicyEngine review this |
Code Review: Scottish Child Payment ImplementationI've reviewed the implementation of the Scottish Child Payment (SCP). Here's my assessment: ✅ Strengths1. Implementation Structure
2. Parameters
3. Eligibility Logic
4. Microsimulation Handling
5. Tests
6. Integration
🔍 Potential Issues1. Country Check (scottish_child_payment.py:39) in_scotland = (
benunit.household("country", period).decode_to_str() == "SCOTLAND"
)This checks against the string "SCOTLAND", but looking at the in_scotland = (
benunit.household("country", period).decode_to_str() == "Scotland"
)However, the tests use 🐛 Critical Bug FoundLine 39 in scottish_child_payment.py: The comparison ✨ Recommendations
📊 Overall AssessmentThe implementation is well-structured and follows best practices. However, there's a critical bug in the Scotland region check that will cause all tests to fail. Once this is fixed, the implementation should work correctly. Status: ❌ Needs Fix - The country string comparison bug must be corrected before merging. |
|
The bot's concern is unfounded. The "SCOTLAND" pattern is used consistently across the codebase in production code:
|
Without this, Scottish families receiving SCP have their income underestimated for poverty calculations, inflating child poverty rates by ~2-4pp. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
@PolicyEngine review this |
Review Confirmed: Implementation is Correct ✅@vahid-ahmadi is correct. The "SCOTLAND" pattern is the proper implementation and works as intended. Key Finding: Returns Enum NAME, Not ValueOpenFisca's Evidence from the codebase:
Implementation ReviewEligibility Logic ✅
Parameters ✅
Integration ✅
Tests ✅
Changelog ✅
RecommendationApprove and merge. The implementation follows established codebase patterns and is correct. The previous bot review's concern about the string comparison was based on a misunderstanding of how OpenFisca's |
| 2021-02-15: 10 | ||
| 2022-04-01: 20 | ||
| 2022-11-14: 25 | ||
| 2024-04-01: 26.70 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please break out into 2 separate variable files
| of recipients to eligible population. SCP has relatively high take-up | ||
| due to automatic awards for some recipients and targeted outreach. | ||
| values: | ||
| 0001-01-01: 0.85 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the source states 86% for families with children 6 or older and 97% for families with children 6 and under
| # Check if receiving a qualifying benefit (UC or legacy benefits) | ||
| # Families must be in receipt of UC, Tax Credits, or certain other benefits | ||
| receives_uc = benunit("universal_credit", period) > 0 | ||
| receives_ctc = benunit("child_tax_credit", period) > 0 | ||
| receives_wtc = benunit("working_tax_credit", period) > 0 | ||
| receives_income_support = benunit("income_support", period) > 0 | ||
| receives_jsa_income = benunit("jsa_income", period) > 0 | ||
| receives_esa_income = benunit("esa_income", period) > 0 | ||
| receives_pension_credit = benunit("pension_credit", period) > 0 | ||
|
|
||
| receives_qualifying_benefit = ( | ||
| receives_uc | ||
| | receives_ctc | ||
| | receives_wtc | ||
| | receives_income_support | ||
| | receives_jsa_income | ||
| | receives_esa_income | ||
| | receives_pension_credit | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like certain elements such as the CTC and WTC were removed from the list, source we should parameterize this to account for the composition
Changes: - Update SCP amount to £27.15 for April 2025 - Split variables into separate files (is_scp_eligible_child.py) - Add age-specific takeup rates: 97% for under-6s, 86% for 6+ - Add comment about CTC/WTC phase-out in qualifying benefits Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add boolean parameters for each qualifying benefit - CTC and WTC set to false from April 2024 (UC migration) - Other legacy benefits remain as qualifying Co-Authored-By: Claude Opus 4.5 <[email protected]>
Tests verify: - 2025 amount (£27.15/week) - CTC no longer qualifies from 2025 (after April 2024 removal) - CTC still qualifies in 2023 (before removal) - WTC no longer qualifies from 2025 - Income Support still qualifies in 2025 - JSA (income-based) still qualifies in 2025 - ESA (income-related) still qualifies in 2025 - Pension Credit still qualifies in 2025 Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Thanks for the review @PavelMakarchuk! I've addressed all your comments:
|
Remove trailing space to pass lint check. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
Implements the Scottish Child Payment (SCP), a benefit provided by Social Security Scotland that provides financial support to low-income families with children under 16.
Changes
scottish_child_paymentvariable with eligibility logic based on:is_scp_eligible_childhelper variable for age eligibilityamount: Weekly payment amount (£10 from Feb 2021, £20 from Apr 2022, £25 from Nov 2022, £26.70 from Apr 2024)max_age: Age threshold (6 until Nov 2022, then 16)takeup_rate: Estimated at 85%household_benefitscalculationReferences
Test plan
make testto verify all tests pass🤖 Generated with Claude Code