feat: add capabilities() to Python wrapper#26
Closed
nikhilwoodruff wants to merge 7 commits intomainfrom
Closed
Conversation
Python scripts pull calibration targets from OBR EFO (tax/benefit aggregates), HMRC SPI (income distributions by band), DWP stat-xplore (benefit caseloads), and ONS (demographics). Rust module reweights household data using Adam optimiser in log-space to minimise mean squared relative error, with holdout validation for HMRC count targets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
UC_Monthly measure is V_F_UC_CASELOAD_FULL (people), not V_F_UC_HOUSEHOLD. PIP uses PIP_Monthly_new database (post-2019). Simplified queries to use no dimensions — stat-xplore auto-selects the latest month. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds pension credit, carer's allowance, attendance allowance, state pension, ESA, and DLA caseloads from stat-xplore, plus UC household breakdowns by family type, child/carer/LCWRA/housing entitlement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run a baseline simulation before calibrating so targets can reference simulated variables (income_tax, national_insurance, vat, etc.) rather than raw input proxies. Income tax RMSRE drops from 79% to 1%. Also adds benunit entity support to the calibration matrix builder, and updates OBR targets to use simulated tax/benefit variables (income_tax, national_insurance, vat, fuel_duty, capital_gains_tax, stamp_duty) and benunit-level benefit variables (universal_credit, housing_benefit, etc.). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add BenunitFilter struct for UC subgroup targets (is_couple, has_children, has_carer, has_lcwra, has_lcw, has_housing) - Add total_ni variable (employee + employer NI) for OBR NI receipts - ONS targets now emitted for years 2024-2030 so they bind regardless of calibration year (fixes weight sum blowup from 34m to ~29m) - DWP UC subgroup targets now carry benunit_filter conditions - Add historical FRS years 1994-2021 to rebuild_all manifest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse sheet 1.6 for employment count, wages & salaries, self-employment income, and self-employed count. Brings total target count to 385 (283 training, 102 holdout). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns a structured dict describing available datasets, locally cached years, programmes modelled, and microdata columns. Useful for LLM consumers that need to know what the engine can and can't do. Co-Authored-By: Nikhil Woodruff <nikhil@policyengine.org>
Contributor
Author
|
Superseded by #27 which is already merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a capabilities() function to policyengine_uk_compiled that returns a structured dict: available datasets with descriptions, locally cached years, programmes modelled, available microdata columns, and notes on limitations. Used by the chatbot to ground its understanding of what the engine can do at the start of every conversation.