Skip to content

Universal Credit: port full programme structure (43 Python files → ~1 Rust fn) #40

@vahid-ahmadi

Description

@vahid-ahmadi

Gap

The Python policyengine-uk model has 43 files under policyengine_uk/variables/gov/dwp/universal_credit/ covering the childcare element, work allowance, taper, capital limits, transitional protection, managed migration, housing element, standard allowance, child element, carer element, and limited-capability-for-work element.

The Rust port currently has one function: compute_universal_credit in src/variables/benefits.rs.

Why it matters

UC is the largest UK welfare programme by caseload and spend. Until UC is fully modelled, Rust outputs cannot be used for any policy analysis touching working-age means-tested support — which covers the majority of distributional/revenue work the team does (transitional protection alone moves billions in scoring). Every reform notebook in the wider PolicyEngine catalogue that touches UC will diverge from Python.

What to port

Source of truth (Python): policyengine_uk/variables/gov/dwp/universal_credit/

Subdirectories to mirror in Rust:

  • elements/ — standard allowance, child element, childcare element, housing element, carer element, LCWRA element
  • work_allowance.py, earnings/ — work allowance + taper logic
  • capital/ — £6k disregard, £16k cliff, tariff income
  • transitional_protection/ — managed-migration top-up calculation
  • entitlement/ — final UC amount, take-up adjustments

Effort

Large. Recommend landing alongside issue for the YAML test harness so each ported variable arrives with regression coverage cross-checked against Python.

References

  • Python: policyengine_uk/variables/gov/dwp/universal_credit/
  • Rust: src/variables/benefits.rs::compute_universal_credit
  • Parameter tree: policyengine_uk/parameters/gov/dwp/universal_credit/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions