Repository navigation
Allow intermediate geographies between meta and seed levels - #225
Open
nick-fournier wants to merge 5 commits into
Open
nick-fournier wants to merge 5 commits into
nick-fournier wants to merge 5 commits into
Conversation
The test ran the pipeline and asserted nothing, so it only caught a crash. Give it the isolation the rest of the suite has and check what the feature actually does. Reverting the control_spec filtering now fails this test with KeyError: "['persons_occ_1'] not in index" from meta_control_factoring, so completing the run is itself meaningful -- but the run alone does not pin which controls survive where. It now also asserts that the intermediate geography's control is kept out of the seed-level control table, that the meta geography's controls are still factored into it, and that the intermediate control still constrains its own geography rather than being discarded. Adds a setup_function restoring the decorated `settings` injectable. Without it this module inherits whatever settings an earlier test pinned, and fails on a `geographies` list that is not its own. Also asserts sub-geography balancing conserves the seed household total, and that expand_households produces nothing, since this example sets NO_INTEGERIZATION_EVER. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Seven of the twelve fixture files were byte-identical copies of the base example_test fixtures: seed_households.csv, seed_persons.csv, taz_controls.csv, tract_controls.csv, repop_taz_controls.csv, logging.yaml and repop_controls.csv -- 429 of the example's 728 lines. The two repop files were never exercised at all, since the test runs no repop steps. configs_dir and data_dir both resolve through config.cascading_input_file_path, which accepts a list of directories and takes the first one holding a given file, so the test can layer the intermediate directories over the base example. That is already how tests/test_steps.py supplies its configs. The *_intermediate directories now carry only what this example really changes: its settings and controls, the crosswalk with the extra geography levels, and the DISTRICT and REGION control data. Beyond the size, the copies were a correctness risk: editing a seed table in examples/example_test/data would have left this example testing stale inputs with no indication anything had diverged. Verified: full suite passes on python 3.12 / pandas 3.0.3 and on python 3.10 / pandas 2.3.3. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
nick-fournier
marked this pull request as ready for review
October 5, 2026 17:25
This branch has not been deployed
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.
With a geography between the meta and seed levels, meta-control factoring previously requested an intermediate target from the seed control table and raised a KeyError. Filter those intermediate targets consistently during meta-control factoring, final seed balancing, and seed integerization, allowing hierarchies such as REGION > DISTRICT > PUMA > TRACT > TAZ to complete.
Supersedes #217 and builds on the stabilization work merged in #219. Preserves @JoeJimFlood's original feature and initial regression-test commits, with their original authorship, followed by focused cleanup. The replacement omits #217's dependency, CI, platform-specific baseline, and test-stabilization experiments. Basically we can close #217, this cherry-picked the important bits and builds on the CI-testing stabilization of #219.
Validation: Ruff passes; the full local suite passes (41 tests) on Windows / Python 3.12, including all four feature scenarios. Independently replacing each changed step with its upstream implementation causes the integerized regression to fail on the missing target or mismatched control columns. All 15 existing CI jobs pass on Windows, Linux, and macOS across Python 3.10–3.14.