Skip to content

feat: Add filter_strategy column and strategy reconstruction#105

Open
anth-volk wants to merge 2 commits intomainfrom
feat/enable-uk-districts
Open

feat: Add filter_strategy column and strategy reconstruction#105
anth-volk wants to merge 2 commits intomainfrom
feat/enable-uk-districts

Conversation

@anth-volk
Copy link
Contributor

Fixes #104

Summary

  • Alembic migration adding filter_strategy column to regions and simulations tables (with data backfill)
  • Strategy reconstruction utility (utils/strategy_reconstruction.py) to rebuild ScopingStrategy objects from DB columns at runtime
  • Updated analysis endpoints to extract filter_strategy from regions and pass through simulation creation
  • Updated seed script to derive filter_strategy from policyengine.py region objects
  • 36 new unit tests covering strategy reconstruction, deterministic ID generation with filter_strategy, simulation creation, and region resolution

Test plan

  • pytest tests/test_strategy_reconstruction.py — all 21 tests pass
  • pytest tests/test_analysis.py — all 43 tests pass (15 new)
  • Full non-integration test suite (485 tests) passes with no regressions

🤖 Generated with Claude Code

anth-volk and others added 2 commits March 8, 2026 19:27
…istricts

- Alembic migration adding filter_strategy to regions and simulations tables
- Strategy reconstruction utility to rebuild ScopingStrategy objects from DB columns
- Updated analysis endpoints to extract and pass filter_strategy
- Updated seed script to derive filter_strategy from policyengine.py regions
- Comprehensive unit tests for strategy reconstruction and filter_strategy integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move imports inside reconstruct_strategy() function body so the module
can be loaded without the unpublished scoping_strategy module. Tests use
mock strategy classes injected via monkeypatch when the real module is
unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk anth-volk marked this pull request as ready for review March 8, 2026 18:57
@anth-volk anth-volk requested a review from SakshiKekre March 8, 2026 18:57
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.

Add filter_strategy column and strategy reconstruction for UK district scoping

1 participant