Skip to content

Conversation

@PavelMakarchuk
Copy link
Collaborator

Summary

  • Adds parametric reform providing £12.85/week extra for children under 1 year old on top of the standard £27.15/week Scottish Child Payment
  • Reform controlled by gov.contrib.scotland.scottish_child_payment.in_effect parameter (default: false)
  • Includes structural reform module for programmatic use

Changes

  • New parameters at gov/contrib/scotland/scottish_child_payment/:
    • baby_bonus.yaml - £12.85/week for children under age 1
    • in_effect.yaml - boolean toggle (default false)
  • Updated scottish_child_payment variable to conditionally apply baby bonus when reform is active
  • Added structural reform in reforms/scottland/scottish_child_payment_reform.py
  • Added 9 YAML tests covering:
    • Baseline (no reform)
    • Reform with various family compositions (1 baby, 2 babies, mixed ages)
    • Age boundary testing (1 year old gets no bonus)
    • Regional eligibility (England gets no SCP)
    • Income eligibility thresholds (£45k, £50k)

Test plan

  • All 9 new YAML tests pass
  • Existing 18 SCP tests still pass
  • CI passes

🤖 Generated with Claude Code

PavelMakarchuk and others added 3 commits January 14, 2026 20:58
Add parametric reform that provides £12.85/week extra for children under 1 year old
on top of the standard £27.15/week SCP amount. The reform is controlled by the
gov.contrib.scotland.scottish_child_payment.in_effect parameter (default: false).

Changes:
- Add baby_bonus.yaml parameter (£12.85/week for age < 1)
- Add in_effect.yaml parameter toggle
- Update scottish_child_payment variable to support parametric baby bonus
- Add structural reform module in reforms/scottland/
- Add 9 YAML tests covering various scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Revert main scottish_child_payment variable to baseline (no baby bonus logic)
- Add structural reform to reforms.py for parameter-triggered activation
- Add structural reform integration to simulation.py
- Update YAML tests to use reforms: key for structural reform application

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk marked this pull request as ready for review January 15, 2026 02:37
@vahid-ahmadi
Copy link
Collaborator

@PolicyEngine review this

@policyengine
Copy link
Contributor

policyengine bot commented Jan 15, 2026

Code Review - Scottish Child Payment Baby Bonus Reform

I've reviewed the PR implementation and found it to be well-structured with comprehensive test coverage. Here are my findings:

✅ Strengths

  1. Clean parametric approach: The reform correctly uses the bracket-based parameter system (baby_bonus.yaml) with age thresholds (£12.85/week for age < 1, £0 for age ≥ 1).

  2. Comprehensive tests: 9 YAML tests cover all key scenarios:

    • Baseline vs reform comparison
    • Multiple babies, mixed ages
    • Age boundary testing (1 year old = no bonus)
    • Regional eligibility
    • Income eligibility thresholds
  3. Proper structural reform integration:

    • Reform is registered in reforms.py
    • Applied via simulation.py using create_structural_reforms_from_parameters
    • Toggle parameter (in_effect) defaults to false for backward compatibility
  4. Logic preserved: The reform duplicates the entire scottish_child_payment variable formula, correctly preserving all eligibility logic (Scotland region check, qualifying benefits, takeup rates).

⚠️ Issues Found

  1. Critical: Directory typo - policyengine_uk/reforms/scottland/ should be scotland (missing 'n')

    • File: policyengine_uk/reforms/scottland/__init__.py
    • File: policyengine_uk/reforms/scottland/scottish_child_payment_reform.py
    • Import: Line 7 of reforms/reforms.py also uses from .scottland
  2. Minor: Unrelated formatting changes - docs/book/validation/student-loan-repayments.ipynb has Black formatting changes unrelated to this PR. Consider reverting or committing separately.

  3. Code duplication concern: The reform duplicates the entire 167-line variable formula. If the baseline scottish_child_payment variable changes, this reform won't inherit those changes. Consider:

    • Extracting shared logic to a helper function, OR
    • Accepting this as expected behavior for parametric reforms (reform captures policy as-of implementation date)

📝 Test Validation

The test calculations appear correct:

  • Base SCP: £27.15/week × 52 = £1,411.80/child/year
  • Baby bonus: £12.85/week × 52 = £668.20/baby/year
  • Test 2: 1 baby = £1,411.80 + £668.20 = £2,080 ✅
  • Test 3: 2 babies = £2,823.60 + £1,336.40 = £4,160 ✅

🔧 Recommended Actions

  1. Must fix: Rename scottlandscotland throughout
  2. Should fix: Remove or separate the notebook formatting changes
  3. Optional: Document the code duplication pattern in comments (if intentional)

✅ Approval Status

Once the directory typo is fixed, this PR will be ready to merge. The implementation is sound and the test coverage is excellent.

Note: I couldn't run the tests locally due to Python version mismatch (system has 3.12, package requires 3.13), but the test structure and expected values look correct based on manual calculation.

Fixed directory and import typo identified in code review:
- Renamed policyengine_uk/reforms/scottland/ → scotland/
- Updated import in reforms.py
- Updated all test references in scottish_child_payment_baby_bonus.yaml

This addresses the critical issue found in PR review where the directory
was named "scottland" instead of "scotland" (missing 'n').

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The policy specifies children under 1 receive £40/week TOTAL payment,
not a fixed £12.85 bonus added to the base rate.

As the base SCP rate inflates over time, this ensures under-1s
continue receiving exactly £40/week rather than an increasing amount.

Changes:
- Changed from base_rate + fixed_bonus to where(age < 1, 40.0, base_rate)
- Updated all test comments to reflect £40 as TOTAL payment
- Updated docstrings to explain policy correctly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vahid-ahmadi
Copy link
Collaborator

After researching the official policy sources, I found that the original implementation did not match the actual Scottish Government policy. I've now pushed a fix.

The Actual Policy

The Scottish Government policy is: "the Scottish Child Payment will rise to £40 for families with children under the age of one" (https://www.gov.scot/publications/scottish-budget-2026-2027-finance-secretarys-statement-13-january-2026-2/)

Key word: "to £40" (not "by £12.85")

This means:

  • £40 total weekly payment for children under 1
  • Standard rate (inflating with inflation) for children 1+
  • When child turns 1, payment reverts to standard rate

The Fix (Now Applied)

I've updated the implementation in commit 845e2f7 to use:

Calculate per-child weekly amount (age-dependent)

PREMIUM_RATE_UNDER_ONE = 40.0 # £40/week fixed total
per_child_weekly = where(
age < 1,
PREMIUM_RATE_UNDER_ONE, # £40/week for under-1s (TOTAL, not bonus)
weekly_amount # Standard rate for 1+ (inflates with inflation)
)

Calculate total for all eligible children

total_weekly = benunit.sum(per_child_weekly * is_eligible_child)
annual_amount = total_weekly * WEEKS_IN_YEAR

This ensures under-1s always receive exactly £40/week regardless of base rate inflation.

Test Updates

I've also updated all test comments in scottish_child_payment_baby_bonus.yaml to explicitly document that £40 is a TOTAL payment, not a base + bonus.

Sources Confirming Fixed £40 Total

  1. https://www.gov.scot/publications/scottish-budget-2026-2027-finance-secretarys-statement-13-january-2026-2/: "boosting the payment... to £40 a week"
  2. https://www.which.co.uk/news/article/scottish-budget-2026-what-does-it-mean-for-your-money-atK4N0K3j4W9: "From 2027, the rate will rise to £40"
  3. https://fraserofallander.org/budget-2026/a-budget-where-the-silences-were-loudest/: Base rate £28.85 in 2027-28, under-1s get £40 total (implied bonus of £11.15, not £12.85)

vahid-ahmadi and others added 2 commits January 15, 2026 10:32
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…riable

Enable parametric SCP baby bonus by checking gov.contrib.scotland.scottish_child_payment.in_effect
in the base variable. When in_effect=True, children under 1 receive £40/week total instead of
the standard rate.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vahid-ahmadi vahid-ahmadi merged commit c491858 into main Jan 15, 2026
3 checks passed
@vahid-ahmadi vahid-ahmadi deleted the sc_cb_reform- branch January 15, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants