Skip to content

Conversation

@nikhilwoodruff
Copy link
Collaborator

No description provided.

nwoodruff-co and others added 9 commits November 17, 2025 11:59
…alues

Add support for custom values and multiple aggregation methods to the entity
mapping system, making it more flexible for complex analysis workflows.

Features added:
- values parameter: Map custom value arrays instead of existing columns
- Extended how parameter with new aggregation methods:
  * Person → Group: 'sum' (default), 'first'
  * Group → Person: 'project' (default), 'divide'
  * Group → Group: 'sum', 'first', 'project', 'divide'

Refactoring:
- Created base YearData class to eliminate code duplication
- UKYearData and USYearData now inherit from base class
- Removed duplicate map_to_entity implementations

Documentation:
- Added comprehensive entity mapping section to core-concepts.md
- Added examples to UK and US model documentation
- Documented all aggregation methods with use cases

All existing tests pass, confirming backward compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive guides for AI assistants to use policyengine.py:
- .claude/policyengine-guide.md: Detailed patterns and examples
- .claude/quick-reference.md: Quick lookup for common operations

Includes:
- 7 common workflow patterns (synthetic scenarios, parameter sweeps, reforms)
- Minimal working examples for UK and US
- Entity mapping examples with all aggregation methods
- Critical fields reference
- Common parameters cheat sheet
- Troubleshooting guide

These guides help AI assistants quickly understand and use the package
for tax-benefit microsimulation analysis.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Add convenience methods to look up parameters and variables by name:
- get_parameter(name): Returns Parameter object by name
- get_variable(name): Returns Variable object by name
- Both raise ValueError if not found with helpful error messages

Tests added (12 tests, all passing):
- UK and US variable lookup tests
- UK and US parameter lookup tests
- Error handling tests for non-existent parameters/variables
- Multiple parameter/variable lookup tests

Usage:
  var = uk_latest.get_variable('income_tax')
  param = uk_latest.get_parameter('gov.hmrc.income_tax.allowances.personal_allowance.amount')

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@nikhilwoodruff nikhilwoodruff merged commit 05586f0 into main Nov 18, 2025
2 checks passed
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