Phase 4: Custom computation modules#88
Merged
anth-volk merged 5 commits intoapp-v2-migrationfrom Feb 23, 2026
Merged
Conversation
Define ComputationModule dataclass and MODULE_REGISTRY with 10 modules (decile, program_statistics, poverty, inequality, budget_summary, intra_decile, congressional_district, constituency, local_authority, wealth_decile) plus helper functions for country filtering and validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns available economy analysis modules from the registry, with optional country query param to filter by UK/US applicability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Accepts same inputs as /analysis/economic-impact plus a modules list. Validates module names against the registry for the given country, triggers computation, and filters the response to only include fields for the requested modules. Includes GET polling endpoint with optional modules query param. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tions Move each module's computation logic (decile, poverty, inequality, budget_summary, program_statistics, intra_decile, constituency, local_authority, wealth_decile, congressional_district) into standalone functions in computation_modules.py with UK/US dispatch tables. The local economy comparison functions now call run_modules() with an optional modules list, enabling selective computation from the /analysis/economy-custom endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive test coverage for module registry, analysis options, economy-custom endpoint, and computation module dispatch system. Includes lint/format fixes from ruff. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
GET /analysis/options: Lists available computation modules, filterable by countryPOST /analysis/economy-custom: Runs only selected modules and returns a filtered response (nullifies unrelated fields)run_modules()helperTest plan
pytest tests/test_module_registry.py tests/test_analysis_options.py tests/test_economy_custom.py tests/test_computation_modules.py)/analysis/optionsreturns correct modules per country in staging/analysis/economy-customruns only requested modules end-to-end🤖 Generated with Claude Code