From 8047380eb2136a742f283a78d68d5e921408d128 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 2 Nov 2026 08:02:51 -0500 Subject: [PATCH 01/32] Add a SHA-pinned registry for US local-jurisdiction flags policyengine-us declares in_denver, in_yonkers, in_wilmington and pa_philadelphia_wage_tax_resident as inputs with no formula. The registry maps each to its 2020 county (Denver 08031, Philadelphia 42101) or place (Yonkers 36/84000, Wilmington 10/77580), checked against the 2020 Gazetteer, P.L. 94-171 P1_001N and block ladders 7ba39b95 and 6840b990. Co-Authored-By: Claude Opus 5.5 --- .../build/us_runtime/local_jurisdictions.py | 663 ++++++++++++++++++ .../us_runtime/us_local_jurisdictions.json | 190 +++++ .../verify_us_local_jurisdiction_registry.py | 265 +++++++ 3 files changed, 1118 insertions(+) create mode 100644 packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py create mode 100644 packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json create mode 100644 tools/verify_us_local_jurisdiction_registry.py diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py new file mode 100644 index 0000000000..b2c799d895 --- /dev/null +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py @@ -0,0 +1,663 @@ +"""US local-jurisdiction flags derived from household geography. + +policyengine-us 2.2.1 declares a few local-tax jurisdictions as plain inputs +with no formula, so they default to ``False`` unless the dataset writes them: + +- ``in_denver`` (household): read by the Denver property-tax-relief + eligibility variables; +- ``in_yonkers`` (household): read by ``ny_yonkers_income_tax`` (the resident + surcharge); +- ``in_wilmington`` (household): read by ``de_wilmington_earned_income_tax``; +- ``pa_philadelphia_wage_tax_resident`` (person): read by + ``pa_philadelphia_wage_tax`` to pick the resident rate. + +Local flags with a ``county_str`` formula (``in_nyc``, ``in_la`` and the +rest) need nothing: the engine computes them from ``county_fips``. + +The packaged registry ``us_local_jurisdictions.json`` maps each input-only +flag to one 2020 geography, and its SHA-256 is pinned here: + +- rule ``county``: the flag is true exactly when ``county_fips`` equals the + registry county (Denver ``08031``; Philadelphia ``42101``); +- rule ``place``: the flag is true exactly when the household's state (the + first two digits of ``county_fips``) and ``place_fips`` equal the registry + state and 2020 place code (Yonkers city ``36``/``84000``; Wilmington city + ``10``/``77580``). Place codes are unique only within a state, so the state + is part of the match. + +A geography line derives the flags from the rungs it actually writes. The +block ladder (and the block-location draw) writes county and place from one +block, so every flag is derived. The PUMA ladder writes a county but no +place, so the place-rule flags are *unavailable* there: the line never writes +them (any stale column is removed) and its receipt records them as +unavailable with the reason, rather than writing ``False``. +""" + +from __future__ import annotations + +import hashlib +import json +from collections.abc import Collection, Mapping +from dataclasses import dataclass +from functools import cache +from importlib.resources import files +from pathlib import Path +from typing import Any + +import numpy as np +import pandas as pd + +from microcosm.frame import US_SCHEMA, Frame + +US_LOCAL_JURISDICTION_REGISTRY_RESOURCE = "us_local_jurisdictions.json" +#: SHA-256 of the packaged registry; :func:`packaged_us_local_jurisdiction_registry` +#: refuses any other bytes. +US_LOCAL_JURISDICTION_REGISTRY_SHA256 = ( + "45035eee30beddc0bccceadc7a00363635b0c9012662bf722435ee83243a053c" +) +US_LOCAL_JURISDICTION_REGISTRY_KIND = "us_local_jurisdiction_registry" +US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION = 1 + +#: Geography rungs a line can supply. ``county`` needs ``county_fips``; +#: ``place`` needs ``place_fips`` (and the county's state prefix). +JURISDICTION_RUNG_COUNTY = "county" +JURISDICTION_RUNG_PLACE = "place" +JURISDICTION_RUNGS = (JURISDICTION_RUNG_COUNTY, JURISDICTION_RUNG_PLACE) +#: What the block ladder and the block-location draw write. +BLOCK_GEOGRAPHY_RUNGS = JURISDICTION_RUNGS +#: What the PUMA ladder writes. +PUMA_GEOGRAPHY_RUNGS = (JURISDICTION_RUNG_COUNTY,) + +#: Receipt statuses. +JURISDICTION_FLAG_DERIVED = "derived" +JURISDICTION_FLAG_UNAVAILABLE = "unavailable" + +_ENTITIES = ("household", "person") +_REQUIRED_JURISDICTION_KEYS = ( + "flag", + "entity", + "jurisdiction", + "rule", + "state_fips", + "population_2020", +) + + +@dataclass(frozen=True) +class UsLocalJurisdiction: + """One input-only engine flag and the 2020 geography that decides it. + + Attributes: + flag: The policyengine-us input variable. + entity: ``household`` or ``person`` (a person flag is the person's + household's value). + jurisdiction: Human-readable name. + rule: ``county`` or ``place``; the rung the flag needs. + state_fips: Two-digit state FIPS. + county_fips: Five-digit county FIPS (rule ``county``). + place_fips: Five-digit 2020 place code within ``state_fips`` + (rule ``place``). + coextensive_place_fips: For a county-rule jurisdiction whose city is + the same area as the county, that city's place code; the + block-ladder check requires the two block sets to be identical. + population_2020: 2020 P.L. 94-171 population (``P1_001N``) of the + jurisdiction; the block-ladder check requires the ladder's blocks + to sum to it. + """ + + flag: str + entity: str + jurisdiction: str + rule: str + state_fips: str + county_fips: str | None + place_fips: str | None + coextensive_place_fips: str | None + population_2020: int + + @property + def geoid(self) -> str: + """The deciding geography's 2020 GEOID (county 5 digits, place 7).""" + + if self.rule == JURISDICTION_RUNG_COUNTY: + assert self.county_fips is not None + return self.county_fips + assert self.place_fips is not None + return self.state_fips + self.place_fips + + +@dataclass(frozen=True) +class UsLocalJurisdictionRegistry: + """The parsed registry plus the SHA-256 of the bytes it came from.""" + + jurisdictions: tuple[UsLocalJurisdiction, ...] + sha256: str + metadata: Mapping[str, Any] + + @property + def flags(self) -> tuple[str, ...]: + return tuple(item.flag for item in self.jurisdictions) + + def for_entity(self, entity: str) -> tuple[UsLocalJurisdiction, ...]: + return tuple(item for item in self.jurisdictions if item.entity == entity) + + +def load_us_local_jurisdiction_registry( + path: str | Path, + *, + expected_sha256: str | None = None, +) -> UsLocalJurisdictionRegistry: + """Load and validate a registry file, optionally pinning its SHA-256.""" + + payload = Path(path).read_bytes() + return _registry_from_bytes(payload, expected_sha256=expected_sha256) + + +@cache +def packaged_us_local_jurisdiction_registry() -> UsLocalJurisdictionRegistry: + """The packaged registry, refused unless its bytes match the pinned SHA-256.""" + + payload = ( + files("microcosm.build.us_runtime") + .joinpath(US_LOCAL_JURISDICTION_REGISTRY_RESOURCE) + .read_bytes() + ) + return _registry_from_bytes( + payload, expected_sha256=US_LOCAL_JURISDICTION_REGISTRY_SHA256 + ) + + +def _registry_from_bytes( + payload: bytes, + *, + expected_sha256: str | None, +) -> UsLocalJurisdictionRegistry: + digest = hashlib.sha256(payload).hexdigest() + if expected_sha256 is not None and digest != expected_sha256: + raise ValueError( + "US local-jurisdiction registry bytes do not match the pinned " + f"SHA-256: expected {expected_sha256}, observed {digest}." + ) + document = json.loads(payload) + if not isinstance(document, Mapping): + raise ValueError("US local-jurisdiction registry must be a JSON object.") + if document.get("kind") != US_LOCAL_JURISDICTION_REGISTRY_KIND: + raise ValueError( + "US local-jurisdiction registry kind must be " + f"{US_LOCAL_JURISDICTION_REGISTRY_KIND!r}, got {document.get('kind')!r}." + ) + if document.get("schema_version") != US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION: + raise ValueError( + "US local-jurisdiction registry schema_version must be " + f"{US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION}, got " + f"{document.get('schema_version')!r}." + ) + raw = document.get("jurisdictions") + if not isinstance(raw, list) or not raw: + raise ValueError("US local-jurisdiction registry has no jurisdictions.") + jurisdictions = tuple(_jurisdiction(item, index) for index, item in enumerate(raw)) + flags = [item.flag for item in jurisdictions] + if len(set(flags)) != len(flags): + raise ValueError(f"US local-jurisdiction registry repeats a flag: {flags}.") + if flags != sorted(flags): + raise ValueError( + f"US local-jurisdiction registry flags must be sorted: {flags}." + ) + geoids = [item.geoid for item in jurisdictions] + if len(set(geoids)) != len(geoids): + raise ValueError( + f"US local-jurisdiction registry repeats a geography: {geoids}." + ) + metadata = { + key: value for key, value in document.items() if key != "jurisdictions" + } + return UsLocalJurisdictionRegistry( + jurisdictions=jurisdictions, sha256=digest, metadata=metadata + ) + + +def _jurisdiction(item: object, index: int) -> UsLocalJurisdiction: + label = f"jurisdictions[{index}]" + if not isinstance(item, Mapping): + raise ValueError(f"{label} must be an object.") + missing = [key for key in _REQUIRED_JURISDICTION_KEYS if key not in item] + if missing: + raise ValueError(f"{label} is missing {missing}.") + flag = item["flag"] + if not isinstance(flag, str) or not flag.isidentifier() or flag != flag.lower(): + raise ValueError(f"{label}.flag must be a lowercase identifier: {flag!r}.") + entity = item["entity"] + if entity not in _ENTITIES: + raise ValueError(f"{label}.entity must be one of {_ENTITIES}: {entity!r}.") + rule = item["rule"] + if rule not in JURISDICTION_RUNGS: + raise ValueError(f"{label}.rule must be one of {JURISDICTION_RUNGS}.") + state = _digits(item["state_fips"], 2, label=f"{label}.state_fips") + county = _optional_digits(item.get("county_fips"), 5, label=f"{label}.county_fips") + place = _optional_digits(item.get("place_fips"), 5, label=f"{label}.place_fips") + coextensive = _optional_digits( + item.get("coextensive_place_fips"), + 5, + label=f"{label}.coextensive_place_fips", + ) + if rule == JURISDICTION_RUNG_COUNTY: + if county is None or place is not None: + raise ValueError( + f"{label}: a county rule names county_fips and no place_fips." + ) + if county[:2] != state: + raise ValueError(f"{label}: county_fips {county} is not in state {state}.") + else: + if place is None or county is not None or coextensive is not None: + raise ValueError( + f"{label}: a place rule names place_fips and no county fields." + ) + population = item["population_2020"] + if isinstance(population, bool) or not isinstance(population, int): + raise ValueError(f"{label}.population_2020 must be an integer.") + if population <= 0: + raise ValueError(f"{label}.population_2020 must be positive.") + name = item["jurisdiction"] + if not isinstance(name, str) or not name: + raise ValueError(f"{label}.jurisdiction must be a non-empty string.") + return UsLocalJurisdiction( + flag=flag, + entity=entity, + jurisdiction=name, + rule=rule, + state_fips=state, + county_fips=county, + place_fips=place, + coextensive_place_fips=coextensive, + population_2020=population, + ) + + +def _digits(value: object, width: int, *, label: str) -> str: + if not isinstance(value, str) or len(value) != width or not value.isdigit(): + raise ValueError(f"{label} must be a {width}-digit string, got {value!r}.") + return value + + +def _optional_digits(value: object, width: int, *, label: str) -> str | None: + return None if value is None else _digits(value, width, label=label) + + +# --------------------------------------------------------------------------- +# Derivation +# --------------------------------------------------------------------------- + + +def _normalized_rungs(rungs: Collection[str]) -> tuple[str, ...]: + unknown = sorted(set(rungs) - set(JURISDICTION_RUNGS)) + if unknown: + raise ValueError( + f"Unknown local-jurisdiction rung(s) {unknown}; expected a subset of " + f"{JURISDICTION_RUNGS}." + ) + return tuple(rung for rung in JURISDICTION_RUNGS if rung in set(rungs)) + + +def _text_codes(values: pd.Series, *, column: str, widths: tuple[int, ...]) -> np.ndarray: + """Return ``values`` as text codes, refusing nulls, non-text and bad widths.""" + + out = np.empty(len(values), dtype=object) + bad: list[object] = [] + for position, value in enumerate(values.tolist()): + if isinstance(value, bytes): + value = value.decode("ascii") + if ( + not isinstance(value, str) + or len(value) not in widths + or (value and not value.isdigit()) + ): + if len(bad) < 5: + bad.append(value) + out[position] = None + continue + out[position] = value + if bad: + allowed = " or ".join("empty" if width == 0 else f"{width}-digit" for width in widths) + raise ValueError( + f"{column} must hold {allowed} text codes on every row to derive local " + f"jurisdiction flags; invalid value(s) {bad}." + ) + return out + + +def us_local_jurisdiction_flag_values( + household: pd.DataFrame, + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, np.ndarray]: + """Per-household flag arrays for every registry flag ``rungs`` can decide. + + Returns one boolean array per derivable flag, aligned to ``household``'s + rows, whatever the flag's entity (a person flag is its household's value). + A flag whose rule is not in ``rungs`` is left out. Missing, null or + malformed geography on a supplied rung raises: a household whose county or + place is unknown cannot be decided, and writing ``False`` for it would be + a silent guess. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + needed = {item.rule for item in resolved.jurisdictions} & set(supplied) + if not needed: + return {} + for column in ("county_fips", *(("place_fips",) if JURISDICTION_RUNG_PLACE in needed else ())): + if column not in household: + raise ValueError( + f"household table has no {column!r}; it cannot supply the " + f"local-jurisdiction rung(s) {sorted(needed)}." + ) + county = _text_codes(household["county_fips"], column="county_fips", widths=(5,)) + state = np.array([value[:2] for value in county.tolist()], dtype=object) + place = ( + _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) + if JURISDICTION_RUNG_PLACE in needed + else None + ) + flags: dict[str, np.ndarray] = {} + for item in resolved.jurisdictions: + if item.rule not in needed: + continue + if item.rule == JURISDICTION_RUNG_COUNTY: + flags[item.flag] = county == item.county_fips + else: + assert place is not None + flags[item.flag] = (state == item.state_fips) & (place == item.place_fips) + flags[item.flag] = np.asarray(flags[item.flag], dtype=bool) + return flags + + +def apply_us_local_jurisdiction_flags( + tables: Mapping[str, pd.DataFrame], + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, + household_weights: np.ndarray | None = None, +) -> tuple[dict[str, pd.DataFrame], dict[str, Any]]: + """Write every derivable flag into copies of ``tables`` and return a receipt. + + Household flags go on the household table; person flags on the person + table, each person taking its household's value through + ``person_household_id``. A flag ``rungs`` cannot decide is removed from + its table if a stale or partially populated column is present, and the + receipt records it as unavailable: the engine default then applies to + every row, and the receipt says so, instead of a written ``False``. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + household = tables["household"] + values = us_local_jurisdiction_flag_values( + household, rungs=supplied, registry=resolved + ) + out = {name: table.copy() for name, table in tables.items()} + person_rows: np.ndarray | None = None + if any(item.entity == "person" and item.flag in values for item in resolved.jurisdictions): + person_rows = _person_household_positions(out["household"], out["person"]) + for item in resolved.jurisdictions: + table = out[item.entity] + if item.flag not in values: + if item.flag in table: + out[item.entity] = table.drop(columns=[item.flag]) + continue + household_values = values[item.flag] + if item.entity == "household": + table[item.flag] = household_values + else: + assert person_rows is not None + table[item.flag] = household_values[person_rows] + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=supplied, + registry=resolved, + household_weights=household_weights, + ) + return out, receipt + + +def with_us_local_jurisdiction_flags( + frame: Frame, + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, +) -> tuple[Frame, dict[str, Any]]: + """Return ``frame`` with its local-jurisdiction flags and the receipt. + + The one call every geography line makes once its county (and, where it + has one, place) is final: ``rungs`` is :data:`BLOCK_GEOGRAPHY_RUNGS` for + a block-anchored line and :data:`PUMA_GEOGRAPHY_RUNGS` for the PUMA + ladder. + """ + + tables = {entity: frame.table(entity) for entity in frame.entities} + written, receipt = apply_us_local_jurisdiction_flags( + tables, + rungs=rungs, + registry=registry, + household_weights=frame.weights_for("household").values, + ) + for link_name in frame.links: + written[link_name] = frame.link(link_name).copy() + weights = {entity: frame.weights_for(entity) for entity in frame.weighted_entities} + return ( + Frame( + written, + frame.schema, + weights, + frame.strata, + mass_log=frame.mass_log, + metadata=frame.metadata, + ), + receipt, + ) + + +def _person_household_positions( + household: pd.DataFrame, person: pd.DataFrame +) -> np.ndarray: + id_column = US_SCHEMA.entity_id_column("household") + membership = US_SCHEMA.membership_column("household") + for table, column in ((household, id_column), (person, membership)): + if column not in table: + raise ValueError( + f"Person local-jurisdiction flags need {column!r}; it is missing." + ) + ids = pd.Index(household[id_column].to_numpy()) + if not ids.is_unique: + raise ValueError("household_id must be unique to broadcast person flags.") + positions = ids.get_indexer(person[membership].to_numpy()) + if (positions < 0).any(): + raise ValueError( + "Every person must belong to a household in the table to receive " + "its local-jurisdiction flags." + ) + return positions + + +def us_local_jurisdiction_flag_receipt( + values: Mapping[str, np.ndarray], + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, + household_weights: np.ndarray | None = None, +) -> dict[str, Any]: + """JSON-ready provenance: registry digest, rungs, and each flag's status.""" + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + weights = ( + None if household_weights is None else np.asarray(household_weights, dtype=np.float64) + ) + flags: dict[str, Any] = {} + for item in resolved.jurisdictions: + entry: dict[str, Any] = { + "entity": item.entity, + "rule": item.rule, + "geoid": item.geoid, + } + if item.flag in values: + mask = np.asarray(values[item.flag], dtype=bool) + entry["status"] = JURISDICTION_FLAG_DERIVED + entry["households_in_jurisdiction"] = int(mask.sum()) + if weights is not None: + if len(weights) != len(mask): + raise ValueError( + "household_weights must align with the household table." + ) + entry["weighted_households_in_jurisdiction"] = float(weights[mask].sum()) + else: + entry["status"] = JURISDICTION_FLAG_UNAVAILABLE + entry["reason"] = ( + f"the line supplies no {item.rule} rung; the flag is not written, " + "so the engine default (False) applies to every row" + ) + flags[item.flag] = entry + return { + "registry": US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + "registry_sha256": resolved.sha256, + "rungs": list(supplied), + "flags": flags, + } + + +def us_local_jurisdiction_flag_failures( + household: pd.DataFrame, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> list[str]: + """Gate check: every household flag column present agrees with geography. + + A flag column is optional (an artifact built before the flags existed + carries none), but one that is present must equal its rule applied to the + table's own ``county_fips``/``place_fips``. A place-rule flag on a table + with no complete ``place_fips`` fails: nothing could have decided it. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + failures: list[str] = [] + for item in resolved.for_entity("household"): + if item.flag not in household: + continue + try: + expected = us_local_jurisdiction_flag_values( + household, rungs=(item.rule,), registry=resolved + )[item.flag] + except ValueError as error: + failures.append( + f"{item.flag}: present but its {item.rule} rung cannot decide it ({error})" + ) + continue + observed = household[item.flag] + if observed.isna().any(): + failures.append(f"{item.flag}: {int(observed.isna().sum())} null row(s)") + continue + disagree = observed.astype(bool).to_numpy() != expected + if disagree.any(): + failures.append( + f"{item.flag}: {int(disagree.sum())}/{len(household)} row(s) " + f"disagree with the {item.rule} rule for {item.geoid}" + ) + return failures + + +# --------------------------------------------------------------------------- +# Block-ladder verification +# --------------------------------------------------------------------------- + + +def check_us_local_jurisdictions_against_block_ladder( + block_geoid: np.ndarray, + population: np.ndarray, + place_fips: np.ndarray, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, dict[str, Any]]: + """Check every registry geography against a 2020 block ladder. + + Derives each flag for one row per block exactly as a household on that + block gets it (county = the block geoid's first five digits, place = the + ladder's place code), then requires, per jurisdiction: + + - at least one block; + - flag-weighted block population equal to ``population_2020``; and + - for a county rule with a coextensive city, the flagged blocks equal + that city's blocks. + + Returns the per-jurisdiction block count and population; raises on the + first disagreement. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + blocks = np.asarray(block_geoid, dtype=np.int64) + pop = np.asarray(population, dtype=np.float64) + places = np.asarray(place_fips, dtype=np.int64) + if not (len(blocks) == len(pop) == len(places)): + raise ValueError("block_geoid, population and place_fips must align.") + block_table = pd.DataFrame( + { + "county_fips": [f"{value // 10**10:05d}" for value in blocks.tolist()], + "place_fips": [ + "" if value == 0 else f"{value:05d}" for value in places.tolist() + ], + } + ) + flags = us_local_jurisdiction_flag_values( + block_table, rungs=JURISDICTION_RUNGS, registry=resolved + ) + state = blocks // 10**13 + report: dict[str, dict[str, Any]] = {} + for item in resolved.jurisdictions: + mask = flags[item.flag] + blocks_in = int(mask.sum()) + population_in = float(pop[mask].sum()) + if blocks_in == 0: + raise ValueError(f"{item.flag}: no block in the ladder matches {item.geoid}.") + if population_in != float(item.population_2020): + raise ValueError( + f"{item.flag}: ladder population {population_in:,.0f} differs from " + f"the registry's 2020 population {item.population_2020:,}." + ) + entry: dict[str, Any] = {"blocks": blocks_in, "population": int(population_in)} + if item.coextensive_place_fips is not None: + city = (state == int(item.state_fips)) & ( + places == int(item.coextensive_place_fips) + ) + if not np.array_equal(city, mask): + raise ValueError( + f"{item.flag}: county {item.county_fips} and place " + f"{item.state_fips}{item.coextensive_place_fips} are not the " + "same blocks in this ladder." + ) + entry["coextensive_place_blocks"] = int(city.sum()) + report[item.flag] = entry + return report + + +__all__ = [ + "BLOCK_GEOGRAPHY_RUNGS", + "JURISDICTION_FLAG_DERIVED", + "JURISDICTION_FLAG_UNAVAILABLE", + "JURISDICTION_RUNGS", + "JURISDICTION_RUNG_COUNTY", + "JURISDICTION_RUNG_PLACE", + "PUMA_GEOGRAPHY_RUNGS", + "US_LOCAL_JURISDICTION_REGISTRY_KIND", + "US_LOCAL_JURISDICTION_REGISTRY_RESOURCE", + "US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION", + "US_LOCAL_JURISDICTION_REGISTRY_SHA256", + "UsLocalJurisdiction", + "UsLocalJurisdictionRegistry", + "apply_us_local_jurisdiction_flags", + "check_us_local_jurisdictions_against_block_ladder", + "load_us_local_jurisdiction_registry", + "packaged_us_local_jurisdiction_registry", + "us_local_jurisdiction_flag_failures", + "us_local_jurisdiction_flag_receipt", + "us_local_jurisdiction_flag_values", + "with_us_local_jurisdiction_flags", +] diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json b/packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json new file mode 100644 index 0000000000..5b6e59b1d5 --- /dev/null +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json @@ -0,0 +1,190 @@ +{ + "kind": "us_local_jurisdiction_registry", + "schema_version": 1, + "description": "policyengine-us input-only local-jurisdiction flags and the 2020 Census geography that decides each one. A county rule is true when county_fips equals county_fips; a place rule is true when the first two digits of county_fips equal state_fips and place_fips equals place_fips.", + "engine": { + "package": "policyengine-us", + "versions_checked": [ + "2.2.1", + "2.60.4" + ], + "note": "Each flag is an input variable with no formula in both versions, so it defaults to False unless the dataset writes it." + }, + "sources": { + "population": { + "table": "2020 Census P.L. 94-171 Redistricting Data, P1_001N (total population)", + "api": "https://api.census.gov/data/2020/dec/pl", + "national_total_2020": 331449281 + }, + "gazetteer_place": { + "url": "https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2020_Gazetteer/2020_Gaz_place_national.zip", + "sha256": "6e5745b3e1adf7a1e024a988301d484697e2a0f25b3cf10114eef676f09d5c18" + }, + "gazetteer_county": { + "url": "https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2020_Gazetteer/2020_Gaz_counties_national.zip", + "sha256": "02ef546e4c4f9c032c19616eabb9526caa016f778f41ede3b8c9755dacce20ef" + } + }, + "jurisdictions": [ + { + "flag": "in_denver", + "entity": "household", + "jurisdiction": "City and County of Denver, Colorado", + "rule": "county", + "state_fips": "08", + "county_fips": "08031", + "place_fips": null, + "coextensive_place_fips": "20000", + "population_2020": 715522, + "engine_consumers": [ + "co_denver_property_tax_relief_homeowner_eligible", + "co_denver_property_tax_relief_renter_eligible" + ], + "gazetteer": { + "county": { + "geoid": "08031", + "ansicode": "00198131", + "name": "Denver County", + "aland": 396463432, + "awater": 4275563 + }, + "place": { + "geoid": "0820000", + "ansicode": "02410324", + "name": "Denver city", + "aland": 396463432, + "awater": 4275563 + } + } + }, + { + "flag": "in_wilmington", + "entity": "household", + "jurisdiction": "City of Wilmington, Delaware", + "rule": "place", + "state_fips": "10", + "county_fips": null, + "place_fips": "77580", + "coextensive_place_fips": null, + "population_2020": 70898, + "engine_consumers": [ + "de_wilmington_earned_income_tax" + ], + "gazetteer": { + "place": { + "geoid": "1077580", + "ansicode": "02390676", + "name": "Wilmington city", + "aland": 28218288, + "awater": 16303525 + } + } + }, + { + "flag": "in_yonkers", + "entity": "household", + "jurisdiction": "City of Yonkers, New York", + "rule": "place", + "state_fips": "36", + "county_fips": null, + "place_fips": "84000", + "coextensive_place_fips": null, + "population_2020": 211569, + "engine_consumers": [ + "ny_yonkers_income_tax" + ], + "gazetteer": { + "place": { + "geoid": "3684000", + "ansicode": "00979660", + "name": "Yonkers city", + "aland": 46634438, + "awater": 5850607 + } + } + }, + { + "flag": "pa_philadelphia_wage_tax_resident", + "entity": "person", + "jurisdiction": "City and County of Philadelphia, Pennsylvania", + "rule": "county", + "state_fips": "42", + "county_fips": "42101", + "place_fips": null, + "coextensive_place_fips": "60000", + "population_2020": 1603797, + "engine_consumers": [ + "pa_philadelphia_wage_tax" + ], + "residence_rule": "A person is a Philadelphia wage-tax resident exactly when the person's household lies in Philadelphia County, which is the same area as Philadelphia city. The flag records residence only; the tax also needs pa_philadelphia_wage_tax_taxable_wages, which this registry does not supply.", + "gazetteer": { + "county": { + "geoid": "42101", + "ansicode": "01209187", + "name": "Philadelphia County", + "aland": 347981634, + "awater": 21606282 + }, + "place": { + "geoid": "4260000", + "ansicode": "01215531", + "name": "Philadelphia city", + "aland": 347981634, + "awater": 21606282 + } + } + } + ], + "block_ladder_checks": [ + { + "block_ladder_sha256": "6840b990acdfa2003d7723da5595e3cfff7205a4fa3d8d6206ed835c85c3f233", + "blocks": 5769942, + "population": 331449281, + "jurisdictions": { + "in_denver": { + "blocks": 8394, + "population": 715522, + "coextensive_place_blocks": 8394 + }, + "in_wilmington": { + "blocks": 1071, + "population": 70898 + }, + "in_yonkers": { + "blocks": 1336, + "population": 211569 + }, + "pa_philadelphia_wage_tax_resident": { + "blocks": 14549, + "population": 1603797, + "coextensive_place_blocks": 14549 + } + } + }, + { + "block_ladder_sha256": "7ba39b959068181b56a7ce1dc8f2477b31af33f28d0a1803ff6cba84cdfab06b", + "blocks": 5769942, + "population": 331449281, + "jurisdictions": { + "in_denver": { + "blocks": 8394, + "population": 715522, + "coextensive_place_blocks": 8394 + }, + "in_wilmington": { + "blocks": 1071, + "population": 70898 + }, + "in_yonkers": { + "blocks": 1336, + "population": 211569 + }, + "pa_philadelphia_wage_tax_resident": { + "blocks": 14549, + "population": 1603797, + "coextensive_place_blocks": 14549 + } + } + } + ] +} diff --git a/tools/verify_us_local_jurisdiction_registry.py b/tools/verify_us_local_jurisdiction_registry.py new file mode 100644 index 0000000000..756183ecfd --- /dev/null +++ b/tools/verify_us_local_jurisdiction_registry.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python3 +"""Verify the US local-jurisdiction registry against Census sources. + +Checks the registry (``us_local_jurisdictions.json``) three ways: + +- ``--gazetteer-place`` / ``--gazetteer-county``: each registry place and + county appears in the 2020 Gazetteer with the recorded GEOID, ANSI code, + name and land/water area, the zip matches the SHA-256 the registry records, + and a county-rule jurisdiction's county and coextensive city have the same + land and water area; +- ``--pl-populations``: the registry's ``population_2020`` equals the 2020 + P.L. 94-171 ``P1_001N`` the Census API returns for the place (and, for a + county rule, the county). The file holds one API response per line; +- ``--block-ladder`` (repeatable): every flag derived from the ladder's blocks + covers exactly the registry population, and a county-rule flag covers the + same blocks as its coextensive city + (:func:`check_us_local_jurisdictions_against_block_ladder`). A ladder the + registry already records must reproduce the recorded counts. + +``--record`` writes each ladder's counts into ``block_ladder_checks`` and +prints the new registry SHA-256, which must then be pinned as +``US_LOCAL_JURISDICTION_REGISTRY_SHA256``. +""" + +from __future__ import annotations + +import argparse +import csv +import hashlib +import io +import json +import sys +import zipfile +from collections.abc import Mapping, Sequence +from pathlib import Path +from typing import Any + +from microcosm.build.us_runtime.geography_ladder import load_us_block_ladder +from microcosm.build.us_runtime.local_jurisdictions import ( + JURISDICTION_RUNG_COUNTY, + US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + UsLocalJurisdictionRegistry, + check_us_local_jurisdictions_against_block_ladder, + load_us_local_jurisdiction_registry, +) + +DEFAULT_REGISTRY = ( + Path(__file__).resolve().parents[1] + / "packages/microcosm-build/src/microcosm/build/us_runtime" + / US_LOCAL_JURISDICTION_REGISTRY_RESOURCE +) + + +def _sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def _gazetteer_rows(path: Path) -> dict[str, dict[str, str]]: + with zipfile.ZipFile(path) as archive: + (member,) = archive.namelist() + text = archive.read(member).decode("utf-8") + reader = csv.DictReader(io.StringIO(text), delimiter="\t") + rows: dict[str, dict[str, str]] = {} + for row in reader: + clean = {key.strip(): (value or "").strip() for key, value in row.items()} + rows[clean["GEOID"]] = clean + return rows + + +def check_gazetteer( + document: Mapping[str, Any], + *, + place_zip: Path, + county_zip: Path, +) -> list[str]: + """Return failures comparing registry gazetteer records to the zips.""" + + failures: list[str] = [] + sources = document["sources"] + for label, path in (("gazetteer_place", place_zip), ("gazetteer_county", county_zip)): + observed = _sha256(path) + if observed != sources[label]["sha256"]: + failures.append( + f"{label}: zip SHA-256 {observed} differs from the registry's " + f"{sources[label]['sha256']}" + ) + tables = {"place": _gazetteer_rows(place_zip), "county": _gazetteer_rows(county_zip)} + for item in document["jurisdictions"]: + records = item["gazetteer"] + for level, record in records.items(): + row = tables[level].get(record["geoid"]) + if row is None: + failures.append(f"{item['flag']}: {level} {record['geoid']} not in gazetteer") + continue + for key, column in ( + ("ansicode", "ANSICODE"), + ("name", "NAME"), + ("aland", "ALAND"), + ("awater", "AWATER"), + ): + if str(record[key]) != row[column]: + failures.append( + f"{item['flag']}: {level} {record['geoid']} {column} is " + f"{row[column]!r}, registry records {record[key]!r}" + ) + if item["rule"] == JURISDICTION_RUNG_COUNTY: + county = records.get("county", {}) + place = records.get("place", {}) + if county.get("geoid") != item["county_fips"]: + failures.append(f"{item['flag']}: gazetteer county is not county_fips") + if place.get("geoid") != item["state_fips"] + str( + item["coextensive_place_fips"] + ): + failures.append(f"{item['flag']}: gazetteer place is not the coextensive city") + if (county.get("aland"), county.get("awater")) != ( + place.get("aland"), + place.get("awater"), + ): + failures.append( + f"{item['flag']}: county and city land/water areas differ, so " + "they are not the same area" + ) + elif records.get("place", {}).get("geoid") != item["state_fips"] + item["place_fips"]: + failures.append(f"{item['flag']}: gazetteer place is not state_fips+place_fips") + return failures + + +def check_pl_populations(document: Mapping[str, Any], *, path: Path) -> list[str]: + """Return failures comparing ``population_2020`` to P.L. 94-171 counts.""" + + counts: dict[tuple[str, str], int] = {} + for line in path.read_text().splitlines(): + if not line.strip(): + continue + header, *rows = json.loads(line) + for row in rows: + record = dict(zip(header, row, strict=True)) + if "place" in record: + counts[("place", record["state"] + record["place"])] = int(record["P1_001N"]) + elif "county" in record: + counts[("county", record["state"] + record["county"])] = int( + record["P1_001N"] + ) + elif "us" in record: + counts[("us", "1")] = int(record["P1_001N"]) + failures: list[str] = [] + national = document["sources"]["population"]["national_total_2020"] + if counts.get(("us", "1")) not in (None, national): + failures.append(f"US total {counts[('us', '1')]} differs from the registry's {national}") + for item in document["jurisdictions"]: + if item["rule"] == JURISDICTION_RUNG_COUNTY: + keys = [ + ("county", item["county_fips"]), + ("place", item["state_fips"] + item["coextensive_place_fips"]), + ] + else: + keys = [("place", item["state_fips"] + item["place_fips"])] + for key in keys: + if key not in counts: + failures.append(f"{item['flag']}: no P1_001N row for {key[0]} {key[1]}") + elif counts[key] != item["population_2020"]: + failures.append( + f"{item['flag']}: P1_001N for {key[0]} {key[1]} is {counts[key]:,}, " + f"registry records {item['population_2020']:,}" + ) + return failures + + +def check_block_ladder( + registry: UsLocalJurisdictionRegistry, + document: Mapping[str, Any], + *, + path: Path, +) -> tuple[dict[str, Any], list[str]]: + """Run the block-ladder check and compare to any recorded entry.""" + + ladder_sha256 = _sha256(path) + ladder = load_us_block_ladder(path) + report = check_us_local_jurisdictions_against_block_ladder( + ladder.block_geoid, + ladder.population, + ladder.place_fips, + registry=registry, + ) + entry = { + "block_ladder_sha256": ladder_sha256, + "blocks": int(len(ladder)), + "population": int(ladder.population.sum()), + "jurisdictions": report, + } + failures: list[str] = [] + national = document["sources"]["population"]["national_total_2020"] + if entry["population"] != national: + failures.append( + f"ladder {ladder_sha256}: total population {entry['population']:,} " + f"differs from the 2020 national total {national:,}" + ) + for recorded in document.get("block_ladder_checks", []): + if recorded["block_ladder_sha256"] == ladder_sha256 and recorded != entry: + failures.append( + f"ladder {ladder_sha256}: counts differ from the recorded check" + ) + return entry, failures + + +def main(argv: Sequence[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--registry", type=Path, default=DEFAULT_REGISTRY) + parser.add_argument("--gazetteer-place", type=Path) + parser.add_argument("--gazetteer-county", type=Path) + parser.add_argument("--pl-populations", type=Path) + parser.add_argument("--block-ladder", type=Path, action="append", default=[]) + parser.add_argument( + "--record", + action="store_true", + help="write each ladder's counts into block_ladder_checks", + ) + args = parser.parse_args(argv) + if (args.gazetteer_place is None) != (args.gazetteer_county is None): + parser.error("--gazetteer-place and --gazetteer-county go together") + + document = json.loads(args.registry.read_text()) + registry = load_us_local_jurisdiction_registry(args.registry) + failures: list[str] = [] + if args.gazetteer_place is not None: + failures += check_gazetteer( + document, + place_zip=args.gazetteer_place, + county_zip=args.gazetteer_county, + ) + print("gazetteer: checked", file=sys.stderr) + if args.pl_populations is not None: + failures += check_pl_populations(document, path=args.pl_populations) + print("P.L. 94-171 populations: checked", file=sys.stderr) + entries = [] + for path in args.block_ladder: + entry, ladder_failures = check_block_ladder(registry, document, path=path) + failures += ladder_failures + entries.append(entry) + print(json.dumps(entry, indent=2, sort_keys=True)) + if failures: + for failure in failures: + print(f"FAIL: {failure}", file=sys.stderr) + return 1 + if args.record and entries: + recorded = { + item["block_ladder_sha256"]: item + for item in document.get("block_ladder_checks", []) + } + recorded.update({item["block_ladder_sha256"]: item for item in entries}) + document["block_ladder_checks"] = sorted( + recorded.values(), key=lambda item: item["block_ladder_sha256"] + ) + args.registry.write_text(json.dumps(document, indent=2, sort_keys=False) + "\n") + print( + f"recorded; pin US_LOCAL_JURISDICTION_REGISTRY_SHA256 = " + f"{_sha256(args.registry)}", + file=sys.stderr, + ) + print("OK", file=sys.stderr) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From dd68d862d3e238047c988214cd2376f868a16811 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 2 Nov 2026 08:12:04 -0500 Subject: [PATCH 02/32] Derive local-jurisdiction flags in the block, PUMA and pooled lines The block-ladder frame wrapper derives all four flags from the block's county and place. The PUMA ladder and the pooled ACS line derive the county-rule flags (in_denver, pa_philadelphia_wage_tax_resident) from the final county and remove the place-rule flags (in_yonkers, in_wilmington), which no place rung can decide there. Summaries record each flag as derived or unavailable, and both ladder gates fail a present flag that disagrees with its rule. The pool manifest moves the county-rule flags to geography_derived_jurisdiction_input (assembled) and the place-rule flags to unavailable_place_jurisdiction_input, and relabels county_fips and congressional_district_geoid, which the stacked PUMA operator writes, as preserved_stacked_engine_input. tools/repin_us_pool_engine_contracts.py re-derived the provision counts, the manifest digest and the engine ABI lock. Co-Authored-By: Claude Opus 5.5 --- .../microcosm/build/us/engine_abi.lock.json | 2 +- .../microcosm/build/us_runtime/base_pool.py | 17 +++ .../build/us_runtime/geography_ladder.py | 29 ++++- .../build/us_runtime/local_jurisdictions.py | 101 ++++++++++++------ .../build/us_runtime/multispine_pool.py | 31 +++++- .../microcosm/build/us_runtime/puma_ladder.py | 30 +++++- .../verify_us_local_jurisdiction_registry.py | 35 ++++-- 7 files changed, 194 insertions(+), 51 deletions(-) diff --git a/packages/microcosm-build/src/microcosm/build/us/engine_abi.lock.json b/packages/microcosm-build/src/microcosm/build/us/engine_abi.lock.json index f1bd8a1e11..c2fc59f3ff 100644 --- a/packages/microcosm-build/src/microcosm/build/us/engine_abi.lock.json +++ b/packages/microcosm-build/src/microcosm/build/us/engine_abi.lock.json @@ -1 +1 @@ -{"engine":{"package":"policyengine-us","version":"2.2.1"},"programs":{"aca":{"consumers":["assigned_aca_ptc","person_receives_aca","selected_marketplace_plan_actuarial_value","selected_marketplace_plan_premium_proxy"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_aca_if_eligible"},"basic_health_program":{"consumers":["basic_health_program_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_basic_health_program_if_eligible"},"ca_premium_subsidy":{"consumers":["assigned_ca_premium_subsidy"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_ca_premium_subsidy_if_eligible"},"chip":{"consumers":["chip_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_chip_if_eligible"},"co_premium_assistance":{"consumers":["assigned_co_premium_assistance"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_co_premium_assistance_if_eligible"},"dc_ptc":{"consumers":["dc_ptc"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_dc_ptc"},"early_head_start":{"consumers":["early_head_start"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_early_head_start_if_eligible"},"eitc":{"consumers":["dc_eitc_without_qualifying_child","eitc","nj_eitc","ok_federal_eitc","wa_working_families_tax_credit","wa_working_families_tax_credit_age_expansion_eligible"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_eitc"},"head_start":{"consumers":["head_start"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_head_start_if_eligible"},"housing_assistance":{"consumers":["housing_assistance"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_housing_assistance_if_eligible"},"medicaid":{"consumers":["medicaid_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_medicaid_if_eligible"},"medicare":{"consumers":["medicare_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_medicare_if_eligible"},"nm_premium_assistance":{"consumers":["assigned_nm_premium_assistance"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_nm_premium_assistance_if_eligible"},"snap":{"consumers":["snap"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_snap_if_eligible"},"ssi":{"consumers":["ca_sbd_general_relief_receives_other_cash_assistance","ssi"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_ssi_if_eligible"},"tanf":{"consumers":["ca_calworks_child_care_eligible","tanf"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_tanf_if_eligible"},"wic":{"consumers":["wic"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_wic_if_eligible"}},"remaining_stage_input_manifest":{"receipt":{"consumer_counts":{"PolicyEngineUSEngine.materialize":12,"_complete_schedule_d_input":5,"_simulation_projection":926,"prepare_stacked_tail_derivation":2,"seed_multispine_pool_inputs":17,"ssi_static_dependency_closure":54,"with_us_qbi_input_reconciliation":27,"with_us_take_up_inputs":16},"engine_input_projection_contract":{"default_count":925,"defaults_sha256":"f938af6506623f453ca55922cf4a8ba6443d5f780f85e4381b777083a90396a0","engine_version_ref":{"kind":"engine_abi_lock","pointer":"/engine/version"},"input_count":926,"sha256":"cefb137f164c6629589a887bbb56831ebc463cd46909a72ead4dbe0557961e61"},"entry_count":1059,"manifest_sha256":"d4fb9de9c0b8081474a24d0abde84ebf05eb346483fc20e3852e29abc769a501","schema_version":1,"sha256":"c6f1e936179aab0db0436e8c9620327d0a379b614f3a03523246792d2ad4b20a","ssi_dependency_contract":{"edge_count":187,"engine_version_ref":{"kind":"engine_abi_lock","pointer":"/engine/version"},"formula_node_count":63,"input_leaf_count":54,"root":"ssi","sha256":"200ca39e784511e9ede685261f5e0840198ec2b9c4292a522c0fc504c535b31c"},"stage_counts":{"derive":34,"seed":33,"simulate":992}},"rows":[{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"long_term_capital_gains_before_response"},{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"non_sch_d_capital_gains"},{"available_by":"assembled","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"derive","variable":"person_tax_unit_id"},{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":"derive_from_finite_transferred_parents","provision":"optional_transferred_or_schedule_d_derived","stage":"derive","variable":"schedule_d_capital_gain_distributions"},{"available_by":"assembled","consumer":"_complete_schedule_d_input","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"derive","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"prepare_stacked_tail_derivation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_clone_index"},{"available_by":"transferred","consumer":"prepare_stacked_tail_derivation","entity":"person","execution_scope":"clone_2","fallback":"absent_or_cleared_then_schedule_d_derived","provision":"optional_existing_derived_leaf","stage":"derive","variable":"schedule_d_capital_gain_distributions"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_raw_acs_source_authority","stage":"derive","variable":"SEMP"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"derive","variable":"age"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"business_is_sstb"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"estate_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"estate_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"farm_operations_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"farm_rent_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"partnership_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"partnership_s_corp_income_would_be_qualified"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"derive","variable":"person_id"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":"person_id_for_unstacked_lineage_digest","provision":"assembly_support_source_identity","stage":"derive","variable":"person_source_id"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_channel"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_clone_index"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"derive","variable":"person_tax_unit_id"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"qualified_bdc_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"qualified_reit_and_ptp_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"rental_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"s_corp_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:primary_puf_qrf_nontransfer","stage":"derive","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_w2_wages_from_qualified_business"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"w2_wages_from_qualified_business"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_basic_health_program_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_chip_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_early_head_start_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_head_start_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_medicaid_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_medicare_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_ssi_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_wic_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_housing_assistance_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_snap_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":"sourced_seed_when_input_is_missing","provision":"administrative_seed_or_preserved_input","stage":"seed","variable":"takes_up_tanf_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_aca_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_ca_premium_subsidy_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_co_premium_assistance_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_dc_ptc"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"sourced_seed_when_input_is_missing","provision":"administrative_seed_or_preserved_input","stage":"seed","variable":"takes_up_eitc"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_nm_premium_assistance_if_eligible"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"family","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"family_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"household_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"marital_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"marital_unit_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"seed","variable":"age"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"person_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"seed","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"seed","variable":"person_tax_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_household_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_person_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_year"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_resolve_weights_from_household_weight","stage":"seed","variable":""},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"seed","variable":"spm_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"spm_unit_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_resolve_weights_from_household_weight","stage":"seed","variable":""},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"seed","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"tax_unit_source_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"family","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"family_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"frame_household_weight","stage":"simulate","variable":""},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"household_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"marital_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"marital_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_family_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_household_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"person_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_marital_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_tax_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"spm_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"family","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"family_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"family","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"family_weight"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ssp_excluded_institutional_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"auto_loan_balance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"auto_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"average_home_energy_use_in_state"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"bedrooms"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"block_geoid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbo_corporate_income_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbo_excise_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbsa_code"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"congressional_district_geoid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"county_fips"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_tfa_region"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"current_home_energy_use"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"household_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_income_ami_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_owned"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_weight"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_denver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_wilmington"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_yonkers"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_homeless"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_public_housing"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_non_english_speaking_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_on_tribal_land"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_rural"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_shared_living"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_sro"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"living_arrangements_allow_for_food_preparation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_state_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"net_worth"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_purchased_qualifying_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_vehicle_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_vehicle_electric_range"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"parent_has_less_than_high_school_education"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"place_fips"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_for_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"puma"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_passenger_vehicle_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sldl"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sldu"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"state_fips"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tenant_pays_utilities"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"tenure_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tract_geoid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"vtd"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"zcta"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"zip_code"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"marital_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"marital_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"able_contributions_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"adopted_this_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"after_school_expenses"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"age"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_care_schedule"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_charged_rate"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_resides_in_assisted_living_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_level_b_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_meets_snf_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_receives_elderly_disabled_medicaid_waiver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_care_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_grandfathered"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_second_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_weekly_earnings"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ambulance_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"american_opportunity_credit_claimed_prior_years"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_foreign_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_sra_care_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"attends_eligible_educational_institution_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"attends_eligible_educational_institution_for_lifetime_learning_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_530a_distribution"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_quality_enhanced_provider"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bank_account_assets"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bond_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"business_is_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"business_is_sstb"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_factor_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_time_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_welfare_to_work"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_cvrp_vehicle_rebate_amount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_in_home_supportive_services"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_in_medical_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_state_disability_insurance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"care_and_support_costs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"care_and_support_payments_from_tax_filer"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"casualty_loss"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"charitable_cash_donations"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"charitable_non_cash_donations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"charitable_non_cash_donations_non_50_pct_orgs"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_received"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_attending_days_per_month"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_days_per_week"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_hours_per_day"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_provider_type_group"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"claimed_as_dependent_on_another_return"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"claimed_ma_covid_19_essential_employee_premium_pay_program_2020"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_care_worker_credit_eligible_care_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_denver_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_glendale_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_greenwood_village_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_quality_rating_of_child_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_sheridan_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cost_of_attending_college"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"count_529_contribution_beneficiaries"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cps_race"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"csrs_retirement_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_c4k_provider_accredited"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_c4k_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_has_therapeutic_diet"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_lives_with_others"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_resides_in_boarding_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"current_pregnancy_month"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_childcare_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_schedule_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ossp_facility_size"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ossp_in_adult_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_poc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_wilmington_nonresident_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"debt_relief"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dependent_care_employer_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"detailed_industry_recode"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"detailed_occupation_recode"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"disability_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"divorce_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e00700"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e01100"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e01200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e02000"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03220"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03230"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03240"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03270"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03290"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03300"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03400"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03500"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07240"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07260"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07300"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09700"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09900"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e11200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e18500"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e19200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e19800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e20100"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e20400"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e24515"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e24518"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e26270"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e27200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e32800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e58990"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e62900"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e87521"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e87530"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"early_withdrawal_penalty"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"educational_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"educator_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_contribution_to_health_insurance_premiums_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_headcount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_ny_mctmt_zone_1_quarterly_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_ny_mctmt_zone_2_quarterly_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_quarterly_payroll_expense_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_sponsored_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_state_unemployment_tax_rate_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_denver_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_denver_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_glendale_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_glendale_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_greenwood_village_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_greenwood_village_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_sheridan_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_mo_st_louis_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_or_lane_transit_district_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_or_trimet_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_payroll_tax_gross_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_federal_unemployment_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_social_security"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_state_unemployment_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_current_year_total"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_lower_band_taxable_payroll"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_prior_year_total"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_upper_band_taxable_payroll"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_social_housing_excess_compensation"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"employment_income_before_lsr"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"er_visit_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"estate_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"estate_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"excess_withheld_payroll_tax"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_operations_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_operations_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_rent_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_rent_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"financial_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_oss_community_care_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_oss_program_track"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_sr_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"four_year_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fsla_overtime_premium"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_care_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_ssp_in_nursing_home_or_institutionalized_hospice"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gambling_losses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gambling_winnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"general_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"general_business_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gi_cash_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_american_opportunity_credit_1098_t_or_exception"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_american_opportunity_credit_institution_ein"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_applied_for_unemployment_compensation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_bcc_qualifying_coverage"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_champva_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_chip_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_completed_first_four_years_of_postsecondary_education"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_developmental_delay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_emergency_medical_condition"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_esi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_felony_drug_conviction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_health_coverage_other_than_chip"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_indian_health_service_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_individualized_education_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_lifetime_learning_credit_1098_t_or_exception"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_long_distance_medical_travel_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_marketplace_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_medicaid_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_never_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_no_prior_formal_early_learning"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_non_marketplace_direct_purchase_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_other_means_tested_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_tricare_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_va_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"health_insurance_premiums"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"health_insurance_premiums_without_medicare_part_b"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"health_savings_account_payroll_contributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_expense_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hi_ccap_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hi_oss_care_facility_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_is_on_agricultural_land"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"home_mortgage_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hourly_wage"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"hours_worked_last_week"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_aabd_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_iccp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_is_bedfast"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_base_day_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"illicit_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"imaging_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"immigration_status_str"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_ccdf_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_ccdf_ptq_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_out_of_home_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_resides_in_licensed_residential_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_resides_in_unlicensed_residential_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"inpatient_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_in_529_plan_indv"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"investment_income_elected_form_4952"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"investment_interest_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_american_indian_or_alaska_native_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_blind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_born_outside_us"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_breastfeeding"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_complying_with_tanf_work_requirements"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_computer_scientist"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_deaf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_deceased"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_english_proficient"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_enrolled_at_least_half_time_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_enrolled_in_ccdf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_enrolled_in_head_start"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_executive_administrative_professional"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_farmer_fisher"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_federal_work_study_participant"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"is_female"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_full_time_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_fully_disabled_service_connected_veteran"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_grandparent_of_filer_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_hispanic"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_hospitalized_for_medicaid_ce"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"is_household_head"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_household_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_adult_residential_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_foster_care_group_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_k12_nonpublic_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_medicaid_community_engagement_treatment_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_medicaid_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_residential_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_secondary_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_substance_use_treatment_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_work_program"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_incapable_of_self_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_incarcerated"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medicaid_1115_mec_adult"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medicaid_community_engagement_seasonal_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medically_frail_or_has_special_medical_needs_for_medicaid_ce"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_migratory_child"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_military"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_paid_hourly"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_parent_of_filer_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_part_time_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_permanently_and_totally_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_permanently_disabled_veteran"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_pregnant"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_pursuing_credential_for_american_opportunity_credit"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"is_related_to_head_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_runaway_child"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_self_employed"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_separated"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_severely_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_abawd_discretionary_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_abawd_indian_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_employment_training_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_incentive_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_program_participant"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_registration_noncompliant"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_workfare_participant"},{"available_by":"release","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"refuse_null_if_present_no_default","provision":"unprovisioned_source_input","stage":"simulate","variable":"is_spm_independent_minor_role"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_surviving_child_of_disabled_veteran"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_surviving_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_surviving_spouse_of_disabled_veteran"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_tafdc_related_to_head_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_union_member_or_covered"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_unmarried_partner_of_household_head"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wccc_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wic_at_nutritional_risk"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wic_fully_breastfeeding"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"keogh_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ks_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_service_credit_months_post_1997"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_service_credit_months_pre_1998"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ssp_care_receivers"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ssp_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_quality_rating_of_child_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_receives_blind_exemption"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"lab_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"life_insurance_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_basis"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"long_term_capital_gains_before_response"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_on_assets_eligible_for_vt_exclusion"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"long_term_capital_gains_on_collectibles"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_on_small_business_stock"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_years_held"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_health_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_care_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_is_in_relatives_home_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_schedule_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"major_industry_recode"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_ccs_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_paa_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_paa_pending_federal_benefit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_claiming_tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_community_service_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_less_than_half_time_education_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_six_month_average_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_work_program_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_tax_dependent_exception_non_custodial_parent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicare_part_b_premiums_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicare_quarters_of_coverage"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ssi_disability_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_exempt_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_basic_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_retirement_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_retirement_pay_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_service_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"miscellaneous_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_has_guardian"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_housing_assistance_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_uses_representative_payee"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ccs_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_kansas_city_earnings_tax_taxable_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_snc_facility_base_charge"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_st_louis_earnings_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_st_louis_earnings_tax_taxable_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"months_receiving_social_security_disability"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_ccpp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_care_time"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_ccap_provider_qris_step"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_aabd_alternate_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_school_readiness_credit_child_care_worker_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_school_readiness_credit_eligible_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"never_eligible_for_social_security_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nh_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_grow_nj_kids_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_base_period_weeks"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_qualifying_dependents"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_spouse_employed_when_claim_established"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_weekly_gross_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_weeks_claimed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_working_less_than_full_time"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_focus_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"non_public_school_tuition"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_sch_d_capital_gains"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_provider_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_second_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_weekly_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_yonkers_nonresident_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"offered_aca_disqualifying_esi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_bonus_depreciation_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_has_special_accommodations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_is_accredited"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_owf_transitional"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_educator_expense_deduction_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_federal_conformity_deductions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_has_taken_oh_lump_sum_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_homestead_exemption_qualifying_surviving_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_other_add_backs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_uniformed_services_retirement_income_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ccs_provider_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ccs_star_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_base_period_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_base_period_total_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_high_quarter_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_high_quarter_total_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_erdc_provider_area"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_erdc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_health_insurance_premiums"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"other_medical_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"outpatient_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"over_the_counter_health_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"own_children_in_household"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"p08000"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_reduced_rate_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_resident"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_base_year_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_credit_weeks"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_highest_quarter_wages"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_s_corp_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_self_employment_net_earnings"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"passive_partnership_s_corp_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_countable_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_dependent_available_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_dependent_other_allowances"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_head_allowances"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_months_in_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pension_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"person_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_family_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_household_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_marital_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"personal_property"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pfml_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"physician_services_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"pre_subsidy_care_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"pre_subsidy_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_subsidy_transportation_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_tax_health_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prescription_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"previous_year_income_available"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"primary_residence_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_year_minimum_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_adoption_assistance_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_bdc_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_dividend_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_reit_and_ptp_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_tuition_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"railroad_benefits"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"real_estate_taxes"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_medicaid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_or_needs_protective_services"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_ssi"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_wic"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_from_federal_government"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_from_ky_government"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_on_total_disability"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retirement_benefits_from_ss_exempt_employment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_step_rating"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"roth_401k_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"roth_403b_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"roth_ira_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"s_corp_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"salt_refund_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_quality_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_registered_quality_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_second_child_discount_rate"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_tuition_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_tuition_credit_eligible"},{"available_by":"derived","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"derived_schedule_d_input","stage":"simulate","variable":"schedule_d_capital_gain_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sd_cca_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employed_pension_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"short_term_capital_gains"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_dependents"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_disability"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_retirement"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ss_aime_input"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_another_persons_household"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_medical_treatment_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_medicaid_pays_majority_of_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_others_pay_all_meals"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_qualifying_quarters_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_food_from_others"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_outside_shelter_support"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_shelter_from_others_in_household"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_for_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"ssi_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_shelter_support_value"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"ssn_card_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_w2_wages_from_qualified_business"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"state_or_federal_salary"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"stock_assets"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"strike_benefits"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"student_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"survivor_benefits"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_basic_health_program_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_chip_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_early_head_start_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_head_start_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_medicaid_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_medicare_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ssi_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_wic_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_401k_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_403b_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_interest_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_ira_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_private_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_public_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_sep_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_preparation_fees"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_401k_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_403b_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_estate_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_federal_pension_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_interest_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_ira_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_private_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_public_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_roth_conversions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_sep_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"technical_institution_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tip_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_qris_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"total_disability_payments"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"traditional_401k_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"traditional_403b_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"traditional_ira_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"treasury_tipped_occupation_code"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_care_schedule"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_provider_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unadjusted_basis_qualified_property"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"under_12_months_postpartum"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"under_60_days_postpartum"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unemployment_compensation"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unreimbursed_business_employee_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"urgent_care_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"us_bonds_for_higher_ed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"us_govt_interest_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"use_reported_ssi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_weekly_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_weeks_unemployed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_is_full_day"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_educator_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"veterans_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"vt_ccfap_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"w2_wages_from_qualified_business"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_eceap_slot_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_average_weekly_wage_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_leave_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_qualifying_period_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_wccc_day_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_wccc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_in_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_recently_incarcerated_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"weekly_hours_worked_before_lsr"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"weekly_snap_work_program_hours"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"weeks_unemployed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wi_shares_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wic_breastfeeding_infant_count"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wic_infant_feeding_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"worked_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"workers_compensation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"year_deceased"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"year_of_retirement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"years_in_military"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"years_since_us_entry"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_months_since_tea_exit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_was_tea_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"bottled_gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"broadband_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_riv_share_eligible_for_emergency_payment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_scc_general_assistance_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_clothing_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_food_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_housing_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_is_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_utilities_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_smc_general_assistance_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_ccap_is_in_entry_process"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_ccap_is_in_re_determination_process"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"coal_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cooking_fuel_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_liheap_housing_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_poc_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"enrolled_in_ebb"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"experienced_covid_income_loss"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fdpir"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_sr_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_oil_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_cooling_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"head_start_applies_housing_cost_adjustment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"head_start_uses_discretionary_income_limit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_expense_included_in_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_cooling_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_expense_last_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"homeowners_association_fees"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"homeowners_insurance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"housing_designated_welfare"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_iccp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_institutional_status"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_vehicle_is_essential"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_non_parent_relative_child_only_tanf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_protective_care_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_liheap_eligible_for_crisis_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_ccdf_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nd_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_sd_cca_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wi_shares_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_disability_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_housing_subsidy_program_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_eaedc_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_ccs_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ccdf_activity_test"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"metered_gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_registration_fee"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ccs_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"months_since_calworks_exit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mortgage_payments"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_at_redetermination"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_owf_basic_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_heating_fuel_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_has_stepparent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"phone_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_subsidy_electricity_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_housing_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_snap"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_tanf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sd_tanf_is_shared_living"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sewage_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"snap_self_employment_income_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_count"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"spm_unit_energy_subsidy"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"spm_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_net_income_reported"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"spm_unit_pre_subsidy_childcare_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_school_lunch_subsidy"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_snap"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"spm_unit_tenure_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_total_income_reported"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_housing_assistance_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_snap_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_tanf_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_protective_services_waiver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"trash_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ottanf_crisis_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_show_all_cash_assistance_programs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_calworks_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"water_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wood_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_power_shelter_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"advanced_main_air_circulating_fan_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"air_sealing_ventilation_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_form_completed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_non_agi_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_charitable_contributions_to_qualifying_charitable_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_charitable_contributions_to_qualifying_foster_care_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"biomass_stove_boiler_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_property_tax_exemption"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cohabitating_spouses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_amt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_section_179_expense_add_back"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"domestic_production_ald"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_heat_pump_clothes_dryer_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_load_service_center_upgrade_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_stove_cooktop_range_or_oven_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_wiring_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_central_air_conditioner_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_door_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_insulation_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_roof_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_window_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"excess_payroll_tax_withheld"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_balance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_interest"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_origination_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"foreign_earned_income_exclusion"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"foreign_tax_credit_potential"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"form_4972_lumpsum_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_cell_property_capacity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_cell_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_investment_in_529_plan_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_itemized_deductions_adjustment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"geothermal_heat_pump_property_expenditures"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"health_savings_account_ald"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_pump_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_pump_water_heater_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_energy_audit_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_pass_through_entity_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_pass_through_withholding"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_schedule_m_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_schedule_m_subtractions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_bonus_depreciation_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_healthcare_sharing_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_nol"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_nol_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_oos_municipal_obligation_interest_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_other_add_backs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_other_deductions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_tax_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_use_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_income_form_4952"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_barred_from_american_opportunity_credit_due_to_improper_claims"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nonresident_alien_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nonresident_alien_for_lifetime_learning_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"k12_tuition_and_fees"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ks_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_total_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_affordability_payment_subtraction_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_property_tax_fairness_credit_utilities_in_rent_amount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_step_4_share_of_child_care_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_renters_credit_property_tax_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_renters_credit_qualifying_crp"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_charitable_contributions_to_qualifying_foster_care_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nc_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_renters_refund_property_tax_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_capacity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_components_made_in_north_america"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_critical_minerals_extracted_in_trading_partner_country"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_classification"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_msrp"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nh_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_senior_freeze"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_qualified_geothermal_energy_system_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_qualified_solar_energy_systems_equipment_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nyc_unincorporated_business_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_adjustments"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_federal_pension_subtraction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_tax_before_credits_in_prior_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_net_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_primary_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_energy_efficient_home_improvement_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_energy_efficient_window_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"property_sales_net_capital_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"puerto_rico_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"purchased_qualifying_new_clean_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"purchased_qualifying_used_clean_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_battery_storage_technology_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_furnace_or_hot_water_boiler_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_retirement_penalty"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"recapture_of_investment_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"refundable_payroll_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"rent_is_shared_with_another_tax_unit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"residential_efficiency_electrification_retrofit_energy_savings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"residential_efficiency_electrification_retrofit_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"salt_refund_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_balance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_interest"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_origination_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"selected_marketplace_plan_benchmark_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"selected_marketplace_plan_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"separate_filer_itemizes"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"small_wind_energy_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"solar_electric_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"solar_water_heating_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"specified_possession_income"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_aca_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ca_premium_subsidy_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_co_premium_assistance_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_dc_ptc"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_eitc"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_nm_premium_assistance_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_income_ami_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_stillborn_children"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxsim_pprofinc"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxsim_sprofinc"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tuition_and_fees"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unrecaptured_section_1250_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"unreported_payroll_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"used_clean_vehicle_sale_price"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"utilities_included_in_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pte_cotenant_disposable_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"would_file_if_eligible_for_refundable_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"would_file_taxes_voluntarily"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_additions"},{"available_by":"assembled","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"simulate","variable":"age"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bank_account_assets"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bond_assets"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_received"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"disability_benefits"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"employment_income_before_lsr"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"financial_assistance"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"gi_cash_assistance"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"immigration_status_str"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_blind"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_full_time_college_student"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_separated"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"keogh_distributions"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ssi_disability_criteria"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"own_children_in_household"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_dividend_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_dependents"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_disability"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_retirement"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_survivors"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_another_persons_household"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_medical_treatment_facility"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_medicaid_pays_majority_of_care"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_others_pay_all_meals"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_qualifying_quarters_earnings"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_food_from_others"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_outside_shelter_support"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_shelter_from_others_in_household"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_shelter_support_value"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"stock_assets"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"survivor_benefits"},{"available_by":"seeded","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"seed_receipted_value_or_disclosed_engine_default","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ssi_if_eligible"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_401k_distributions"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_403b_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_interest_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_ira_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_private_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_public_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_sep_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_401k_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_403b_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_interest_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_ira_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_private_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_public_pension_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_sep_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"unemployment_compensation"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"veterans_benefits"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"workers_compensation"}]}} +{"engine":{"package":"policyengine-us","version":"2.2.1"},"programs":{"aca":{"consumers":["assigned_aca_ptc","person_receives_aca","selected_marketplace_plan_actuarial_value","selected_marketplace_plan_premium_proxy"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_aca_if_eligible"},"basic_health_program":{"consumers":["basic_health_program_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_basic_health_program_if_eligible"},"ca_premium_subsidy":{"consumers":["assigned_ca_premium_subsidy"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_ca_premium_subsidy_if_eligible"},"chip":{"consumers":["chip_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_chip_if_eligible"},"co_premium_assistance":{"consumers":["assigned_co_premium_assistance"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_co_premium_assistance_if_eligible"},"dc_ptc":{"consumers":["dc_ptc"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_dc_ptc"},"early_head_start":{"consumers":["early_head_start"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_early_head_start_if_eligible"},"eitc":{"consumers":["dc_eitc_without_qualifying_child","eitc","nj_eitc","ok_federal_eitc","wa_working_families_tax_credit","wa_working_families_tax_credit_age_expansion_eligible"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_eitc"},"head_start":{"consumers":["head_start"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_head_start_if_eligible"},"housing_assistance":{"consumers":["housing_assistance"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_housing_assistance_if_eligible"},"medicaid":{"consumers":["medicaid_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_medicaid_if_eligible"},"medicare":{"consumers":["medicare_enrolled"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_medicare_if_eligible"},"nm_premium_assistance":{"consumers":["assigned_nm_premium_assistance"],"default":true,"engine_class":"data_seeded","entity":"tax_unit","value_type":"bool","variable":"takes_up_nm_premium_assistance_if_eligible"},"snap":{"consumers":["snap"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_snap_if_eligible"},"ssi":{"consumers":["ca_sbd_general_relief_receives_other_cash_assistance","ssi"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_ssi_if_eligible"},"tanf":{"consumers":["ca_calworks_child_care_eligible","tanf"],"default":true,"engine_class":"data_seeded","entity":"spm_unit","value_type":"bool","variable":"takes_up_tanf_if_eligible"},"wic":{"consumers":["wic"],"default":true,"engine_class":"data_seeded","entity":"person","value_type":"bool","variable":"takes_up_wic_if_eligible"}},"remaining_stage_input_manifest":{"receipt":{"consumer_counts":{"PolicyEngineUSEngine.materialize":12,"_complete_schedule_d_input":5,"_simulation_projection":926,"prepare_stacked_tail_derivation":2,"seed_multispine_pool_inputs":17,"ssi_static_dependency_closure":54,"with_us_qbi_input_reconciliation":27,"with_us_take_up_inputs":16},"engine_input_projection_contract":{"default_count":925,"defaults_sha256":"f938af6506623f453ca55922cf4a8ba6443d5f780f85e4381b777083a90396a0","engine_version_ref":{"kind":"engine_abi_lock","pointer":"/engine/version"},"input_count":926,"sha256":"cefb137f164c6629589a887bbb56831ebc463cd46909a72ead4dbe0557961e61"},"entry_count":1059,"manifest_sha256":"6e70bc749ab7fd34d6bb902423a3240029d14533819cb5c6f1f75457875cf956","schema_version":1,"sha256":"d4045cdc524c0dabc6625776e27f229fd40521e0c569ddeea7b822a29346059a","ssi_dependency_contract":{"edge_count":187,"engine_version_ref":{"kind":"engine_abi_lock","pointer":"/engine/version"},"formula_node_count":63,"input_leaf_count":54,"root":"ssi","sha256":"200ca39e784511e9ede685261f5e0840198ec2b9c4292a522c0fc504c535b31c"},"stage_counts":{"derive":34,"seed":33,"simulate":992}},"rows":[{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"long_term_capital_gains_before_response"},{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"non_sch_d_capital_gains"},{"available_by":"assembled","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"derive","variable":"person_tax_unit_id"},{"available_by":"transferred","consumer":"_complete_schedule_d_input","entity":"person","execution_scope":"whole_pool","fallback":"derive_from_finite_transferred_parents","provision":"optional_transferred_or_schedule_d_derived","stage":"derive","variable":"schedule_d_capital_gain_distributions"},{"available_by":"assembled","consumer":"_complete_schedule_d_input","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"derive","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"prepare_stacked_tail_derivation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_clone_index"},{"available_by":"transferred","consumer":"prepare_stacked_tail_derivation","entity":"person","execution_scope":"clone_2","fallback":"absent_or_cleared_then_schedule_d_derived","provision":"optional_existing_derived_leaf","stage":"derive","variable":"schedule_d_capital_gain_distributions"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_raw_acs_source_authority","stage":"derive","variable":"SEMP"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"derive","variable":"age"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"business_is_sstb"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"estate_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"estate_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"farm_operations_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"farm_rent_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"partnership_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"partnership_s_corp_income_would_be_qualified"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"derive","variable":"person_id"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":"person_id_for_unstacked_lineage_digest","provision":"assembly_support_source_identity","stage":"derive","variable":"person_source_id"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_channel"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_provenance","stage":"derive","variable":"person_support_clone_index"},{"available_by":"assembled","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"derive","variable":"person_tax_unit_id"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"qualified_bdc_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"qualified_reit_and_ptp_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"rental_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"s_corp_income"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:primary_puf_qrf_nontransfer","stage":"derive","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"sstb_w2_wages_from_qualified_business"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"with_us_qbi_input_reconciliation","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"pool_input_surface:puf_tax_itemization","stage":"derive","variable":"w2_wages_from_qualified_business"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_basic_health_program_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_chip_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_early_head_start_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_head_start_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_medicaid_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_medicare_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_ssi_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_wic_if_eligible"},{"available_by":"transferred","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"transferred_or_preserved_input","stage":"seed","variable":"takes_up_housing_assistance_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_snap_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":"sourced_seed_when_input_is_missing","provision":"administrative_seed_or_preserved_input","stage":"seed","variable":"takes_up_tanf_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_aca_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_ca_premium_subsidy_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_co_premium_assistance_if_eligible"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_dc_ptc"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"sourced_seed_when_input_is_missing","provision":"administrative_seed_or_preserved_input","stage":"seed","variable":"takes_up_eitc"},{"available_by":"seeded","consumer":"seed_multispine_pool_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":"checked_take_up_contract_engine_default","provision":"preserved_input_or_disclosed_engine_default","stage":"seed","variable":"takes_up_nm_premium_assistance_if_eligible"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"family","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"family_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"household_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"marital_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"marital_unit_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"seed","variable":"age"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"person_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"seed","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"seed","variable":"person_tax_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_household_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_person_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"person","execution_scope":"whole_pool","fallback":"support_source_id_then_entity_id","provision":"optional_assembled_source_identity","stage":"seed","variable":"source_year"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_resolve_weights_from_household_weight","stage":"seed","variable":""},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"seed","variable":"spm_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"spm_unit_source_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_resolve_weights_from_household_weight","stage":"seed","variable":""},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"seed","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"with_us_take_up_inputs","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"assembly_support_source_identity","stage":"seed","variable":"tax_unit_source_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"family","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"family_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"frame_household_weight","stage":"simulate","variable":""},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"household","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"household_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"marital_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"marital_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_family_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_household_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"person_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_marital_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"frame_membership","stage":"simulate","variable":"person_tax_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"spm_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"spm_unit_id"},{"available_by":"assembled","consumer":"PolicyEngineUSEngine.materialize","entity":"tax_unit","execution_scope":"whole_pool","fallback":null,"provision":"frame_entity_id","stage":"simulate","variable":"tax_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"family","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"family_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"family","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"family_weight"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ssp_excluded_institutional_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"auto_loan_balance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"auto_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"average_home_energy_use_in_state"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"bedrooms"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"block_geoid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbo_corporate_income_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbo_excise_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cbsa_code"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"congressional_district_geoid"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"county_fips"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_tfa_region"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"current_home_energy_use"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_business_assets_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"household_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_income_ami_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_other_real_estate_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_rental_property_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_debt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_owned"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_vehicles_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"household_weight"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"geography_derived_jurisdiction_input","stage":"simulate","variable":"in_denver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_no_place_rung","provision":"unavailable_place_jurisdiction_input","stage":"simulate","variable":"in_wilmington"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_no_place_rung","provision":"unavailable_place_jurisdiction_input","stage":"simulate","variable":"in_yonkers"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_homeless"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_public_housing"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_non_english_speaking_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_on_tribal_land"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_rural"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_shared_living"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_sro"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"living_arrangements_allow_for_food_preparation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_state_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"net_worth"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_purchased_qualifying_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_vehicle_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_drive_clean_vehicle_electric_range"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"parent_has_less_than_high_school_education"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"place_fips"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_for_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"puma"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_passenger_vehicle_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sldl"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sldu"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"state_fips"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tenant_pays_utilities"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"tenure_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tract_geoid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"vtd"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"zcta"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"household","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"zip_code"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"marital_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"marital_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"able_contributions_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"adopted_this_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"after_school_expenses"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"age"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_care_schedule"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_charged_rate"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ak_resides_in_assisted_living_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_level_b_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_meets_snf_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_receives_elderly_disabled_medicaid_waiver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_care_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_grandfathered"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_second_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ui_weekly_earnings"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ambulance_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"american_opportunity_credit_claimed_prior_years"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_foreign_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_sra_care_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"attends_eligible_educational_institution_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"attends_eligible_educational_institution_for_lifetime_learning_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_530a_distribution"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_quality_enhanced_provider"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bank_account_assets"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bond_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"business_is_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"business_is_sstb"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_factor_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_time_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_calworks_child_care_welfare_to_work"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_cvrp_vehicle_rebate_amount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_in_home_supportive_services"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_in_medical_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_state_disability_insurance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"care_and_support_costs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"care_and_support_payments_from_tax_filer"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"casualty_loss"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"charitable_cash_donations"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"charitable_non_cash_donations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"charitable_non_cash_donations_non_50_pct_orgs"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_received"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_attending_days_per_month"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_days_per_week"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_hours_per_day"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"childcare_provider_type_group"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"claimed_as_dependent_on_another_return"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"claimed_ma_covid_19_essential_employee_premium_pay_program_2020"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_care_worker_credit_eligible_care_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_denver_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_glendale_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_greenwood_village_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_quality_rating_of_child_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_sheridan_employee_occupational_privilege_tax_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cost_of_attending_college"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"count_529_contribution_beneficiaries"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cps_race"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"csrs_retirement_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_c4k_provider_accredited"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_c4k_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_has_therapeutic_diet"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_lives_with_others"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_ssp_resides_in_boarding_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"current_pregnancy_month"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_childcare_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_schedule_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ossp_facility_size"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ossp_in_adult_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_poc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_wilmington_nonresident_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"debt_relief"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dependent_care_employer_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"detailed_industry_recode"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"detailed_occupation_recode"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"disability_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"divorce_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e00700"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e01100"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e01200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e02000"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03220"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03230"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03240"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03270"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03290"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03300"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03400"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e03500"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07240"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07260"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e07300"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09700"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e09900"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e11200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e18500"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e19200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e19800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e20100"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e20400"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e24515"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e24518"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e26270"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e27200"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e32800"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e58990"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e62900"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e87521"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"e87530"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"early_withdrawal_penalty"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"educational_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"educator_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_contribution_to_health_insurance_premiums_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_headcount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_ny_mctmt_zone_1_quarterly_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_ny_mctmt_zone_2_quarterly_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_quarterly_payroll_expense_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_sponsored_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_state_unemployment_tax_rate_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_denver_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_denver_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_glendale_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_glendale_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_greenwood_village_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_greenwood_village_occupational_privilege_tax_owner_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_co_sheridan_occupational_privilege_tax_employee_months"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_mo_st_louis_payroll_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_or_lane_transit_district_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_or_trimet_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_payroll_tax_gross_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_federal_unemployment_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_social_security"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_taxable_earnings_for_state_unemployment_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_current_year_total"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_lower_band_taxable_payroll"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_prior_year_total"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_payroll_expense_upper_band_taxable_payroll"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"employer_total_wa_seattle_social_housing_excess_compensation"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"employment_income_before_lsr"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"er_visit_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"estate_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"estate_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"excess_withheld_payroll_tax"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_operations_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_operations_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_rent_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"farm_rent_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"financial_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_oss_community_care_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_oss_program_track"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_sr_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"four_year_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fsla_overtime_premium"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_care_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_ssp_in_nursing_home_or_institutionalized_hospice"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gambling_losses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gambling_winnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"general_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"general_business_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gi_cash_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_american_opportunity_credit_1098_t_or_exception"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_american_opportunity_credit_institution_ein"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_applied_for_unemployment_compensation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_bcc_qualifying_coverage"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_champva_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_chip_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_completed_first_four_years_of_postsecondary_education"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_developmental_delay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_emergency_medical_condition"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_esi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_felony_drug_conviction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_health_coverage_other_than_chip"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_indian_health_service_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_individualized_education_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_lifetime_learning_credit_1098_t_or_exception"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_long_distance_medical_travel_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_marketplace_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_medicaid_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_never_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_no_prior_formal_early_learning"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_non_marketplace_direct_purchase_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_other_means_tested_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_tricare_health_coverage_at_interview"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"has_va_health_coverage_at_interview"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"health_insurance_premiums"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"health_insurance_premiums_without_medicare_part_b"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"health_savings_account_payroll_contributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_expense_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hi_ccap_provider_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hi_oss_care_facility_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_equity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_is_on_agricultural_land"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"home_mortgage_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"hourly_wage"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"hours_worked_last_week"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_aabd_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_iccp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_is_bedfast"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_base_day_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"illicit_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"imaging_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"immigration_status_str"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_ccdf_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_ccdf_ptq_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_out_of_home_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_resides_in_licensed_residential_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_resides_in_unlicensed_residential_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"inpatient_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_in_529_plan_indv"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"investment_income_elected_form_4952"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"investment_interest_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_american_indian_or_alaska_native_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_blind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_born_outside_us"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_breastfeeding"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_complying_with_tanf_work_requirements"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_computer_scientist"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_deaf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_deceased"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_english_proficient"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_enrolled_at_least_half_time_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_enrolled_in_ccdf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_enrolled_in_head_start"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_executive_administrative_professional"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_farmer_fisher"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_federal_work_study_participant"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"is_female"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_full_time_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_fully_disabled_service_connected_veteran"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_grandparent_of_filer_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_hispanic"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_hospitalized_for_medicaid_ce"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"is_household_head"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_household_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_adult_residential_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_foster_care_group_home"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_k12_nonpublic_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_medicaid_community_engagement_treatment_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_medicaid_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_residential_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_secondary_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_substance_use_treatment_program"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_work_program"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_incapable_of_self_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_incarcerated"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medicaid_1115_mec_adult"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medicaid_community_engagement_seasonal_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_medically_frail_or_has_special_medical_needs_for_medicaid_ce"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_migratory_child"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_military"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_paid_hourly"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_parent_of_filer_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_part_time_college_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_permanently_and_totally_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_permanently_disabled_veteran"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_pregnant"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_pursuing_credential_for_american_opportunity_credit"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"is_related_to_head_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_runaway_child"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_self_employed"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_separated"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_severely_disabled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_abawd_discretionary_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_abawd_indian_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_employment_training_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_incentive_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_program_participant"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_work_registration_noncompliant"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_snap_workfare_participant"},{"available_by":"release","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"refuse_null_if_present_no_default","provision":"unprovisioned_source_input","stage":"simulate","variable":"is_spm_independent_minor_role"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_surviving_child_of_disabled_veteran"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_surviving_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_surviving_spouse_of_disabled_veteran"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_tafdc_related_to_head_or_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_union_member_or_covered"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_unmarried_partner_of_household_head"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wccc_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wic_at_nutritional_risk"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wic_fully_breastfeeding"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"keogh_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ks_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_service_credit_months_post_1997"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_service_credit_months_pre_1998"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ssp_care_receivers"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_ssp_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_quality_rating_of_child_care_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_receives_blind_exemption"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"lab_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"life_insurance_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_basis"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"long_term_capital_gains_before_response"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_on_assets_eligible_for_vt_exclusion"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"long_term_capital_gains_on_collectibles"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_on_small_business_stock"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_capital_gains_years_held"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"long_term_health_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_care_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_is_in_relatives_home_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_schedule_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"major_industry_recode"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_ccs_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_paa_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_paa_pending_federal_benefit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_claiming_tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_community_service_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_less_than_half_time_education_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_six_month_average_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_community_engagement_work_program_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicaid_tax_dependent_exception_non_custodial_parent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicare_part_b_premiums_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"medicare_quarters_of_coverage"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ssi_disability_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_exempt_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_basic_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_retirement_pay"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_retirement_pay_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"military_service_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"miscellaneous_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_quality_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_has_guardian"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_housing_assistance_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_msa_uses_representative_payee"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ccs_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_kansas_city_earnings_tax_taxable_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_snc_facility_base_charge"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ssp_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_st_louis_earnings_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_st_louis_earnings_tax_taxable_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"months_receiving_social_security_disability"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_ccpp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_care_time"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_ccap_provider_qris_step"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_aabd_alternate_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_school_readiness_credit_child_care_worker_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_school_readiness_credit_eligible_worker"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"never_eligible_for_social_security_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nh_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_grow_nj_kids_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_base_period_weeks"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_qualifying_dependents"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_spouse_employed_when_claim_established"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_weekly_gross_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_weeks_claimed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_unemployment_insurance_working_less_than_full_time"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_focus_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"non_public_school_tuition"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_sch_d_capital_gains"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_provider_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_second_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_ui_weekly_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_yonkers_nonresident_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"offered_aca_disqualifying_esi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_bonus_depreciation_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_has_special_accommodations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_is_accredited"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_owf_transitional"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_educator_expense_deduction_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_federal_conformity_deductions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_has_taken_oh_lump_sum_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_homestead_exemption_qualifying_surviving_spouse"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_other_add_backs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_uniformed_services_retirement_income_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ccs_provider_setting"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ccs_star_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_base_period_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_base_period_total_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_high_quarter_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_ui_high_quarter_total_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_erdc_provider_area"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_erdc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_health_insurance_premiums"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"other_medical_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"outpatient_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"over_the_counter_health_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"own_children_in_household"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"p08000"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_reduced_rate_eligible"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"geography_derived_jurisdiction_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_resident"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_philadelphia_wage_tax_taxable_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_base_year_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_credit_weeks"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_uc_highest_quarter_wages"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_s_corp_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"partnership_self_employment_net_earnings"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"passive_partnership_s_corp_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_countable_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_dependent_available_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_dependent_other_allowances"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_head_allowances"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_months_in_school"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pension_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"person_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_family_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_household_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_marital_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_spm_unit_id"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"person_tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"personal_property"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pfml_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"physician_services_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"pre_subsidy_care_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"pre_subsidy_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_subsidy_transportation_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_tax_health_insurance_premiums"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prescription_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"previous_year_income_available"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"primary_residence_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_year_minimum_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_adoption_assistance_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_bdc_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_dividend_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_reit_and_ptp_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_tuition_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"railroad_benefits"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"real_estate_taxes"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_medicaid"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_or_needs_protective_services"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"receives_ssi"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_wic"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income_would_be_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_from_federal_government"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_from_ky_government"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retired_on_total_disability"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"retirement_benefits_from_ss_exempt_employment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_star_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_step_rating"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"roth_401k_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"roth_403b_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"roth_ira_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"s_corp_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"salt_refund_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_quality_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_registered_quality_level"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_ccap_second_child_discount_rate"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_tuition_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sc_tuition_credit_eligible"},{"available_by":"derived","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"derived_schedule_d_input","stage":"simulate","variable":"schedule_d_capital_gain_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sd_cca_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employed_pension_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"short_term_capital_gains"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_dependents"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_disability"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_retirement"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_survivors"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ss_aime_input"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_another_persons_household"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_medical_treatment_facility"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_medicaid_pays_majority_of_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_others_pay_all_meals"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_qualifying_quarters_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_food_from_others"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_outside_shelter_support"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_shelter_from_others_in_household"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_for_null","provision":"preserved_stacked_engine_input","stage":"simulate","variable":"ssi_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_shelter_support_value"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"ssn_card_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_would_be_qualified"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_unadjusted_basis_qualified_property"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_w2_wages_from_qualified_business"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"state_or_federal_salary"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"stock_assets"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"strike_benefits"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"student_loan_interest"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"survivor_benefits"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_basic_health_program_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_chip_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_early_head_start_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_head_start_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_medicaid_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_medicare_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ssi_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_wic_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_401k_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_403b_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_interest_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_ira_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_private_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_public_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_sep_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_preparation_fees"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_401k_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_403b_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_estate_value"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_federal_pension_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_interest_income"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_ira_distributions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_private_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_public_pension_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_roth_conversions"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_sep_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"technical_institution_student"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tip_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_qris_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"total_disability_payments"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"traditional_401k_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"traditional_403b_contributions_desired"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"traditional_ira_contributions_desired"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"treasury_tipped_occupation_code"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_care_schedule"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_provider_rating"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ccs_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unadjusted_basis_qualified_property"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"under_12_months_postpartum"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"under_60_days_postpartum"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unemployment_compensation"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unreimbursed_business_employee_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"urgent_care_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"us_bonds_for_higher_ed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"us_govt_interest_person"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"use_reported_ssi"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_base_period_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_gross_weekly_earnings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_high_quarter_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_quarters_with_wages"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_weekly_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_ui_weeks_unemployed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_is_full_day"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_educator_expenses"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"veterans_benefits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"vt_ccfap_provider_type"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"w2_wages_from_qualified_business"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_eceap_slot_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_average_weekly_wage_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_leave_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pfml_qualifying_period_hours_worked"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_wccc_day_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_wccc_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_in_foster_care"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_recently_incarcerated_for_medicaid_ce"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"weekly_hours_worked_before_lsr"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"weekly_snap_work_program_hours"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"weeks_unemployed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wi_shares_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wic_breastfeeding_infant_count"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wic_infant_feeding_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"worked_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"workers_compensation"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_non_traditional_hours"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_ccap_quality_tier"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_ccap_provider_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"year_deceased"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"year_of_retirement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"years_in_military"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"person","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"years_since_us_entry"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_months_since_tea_exit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ar_was_tea_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"bottled_gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"broadband_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_riv_share_eligible_for_emergency_payment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_scc_general_assistance_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_clothing_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_food_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_housing_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_is_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_sf_caap_utilities_provided_in_kind"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ca_smc_general_assistance_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_ccap_is_in_entry_process"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_ccap_is_in_re_determination_process"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"coal_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cooking_fuel_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"dc_liheap_housing_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"de_poc_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"enrolled_in_ebb"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"experienced_covid_income_loss"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fdpir"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fl_sr_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_oil_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_caps_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"has_cooling_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"head_start_applies_housing_cost_adjustment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"head_start_uses_discretionary_income_limit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_expense_included_in_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_cooling_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_expense_last_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heating_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"homeowners_association_fees"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"homeowners_insurance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"housing_designated_welfare"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ia_cca_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_iccp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_institutional_status"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_aabd_vehicle_is_essential"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_non_parent_relative_child_only_tanf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_ccap_protective_care_override"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_liheap_eligible_for_crisis_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_in_ccdf_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nd_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_sd_cca_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_wi_shares_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_disability_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_housing_subsidy_program_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"la_general_relief_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_ccfa_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ma_eaedc_living_arrangement"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_ccs_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ccdf_activity_test"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"metered_gas_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_ccap_registration_fee"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mo_ccs_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"months_since_calworks_exit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mortgage_payments"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mt_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_at_redetermination"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_child_care_subsidy_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nv_ccdp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_ccap_owf_basic_assistance"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_heating_fuel_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pa_ccw_has_stepparent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"phone_cost"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pre_subsidy_electricity_expense"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_housing_assistance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_snap"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"receives_tanf"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sd_tanf_is_shared_living"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"sewage_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"snap_self_employment_income_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_assets"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_count"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"spm_unit_energy_subsidy"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"spm_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_net_income_reported"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"spm_unit_pre_subsidy_childcare_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_school_lunch_subsidy"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_snap"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"assembled_native_engine_input","stage":"simulate","variable":"spm_unit_tenure_type"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"spm_unit_total_income_reported"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_housing_assistance_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_snap_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_tanf_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tn_ccap_protective_services_waiver"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"trash_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tx_ottanf_crisis_criteria"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_ccsp_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_show_all_cash_assistance_programs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"was_calworks_recipient"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"water_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wood_expense"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_ccap_enrolled"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"spm_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wy_power_shelter_qualified"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"advanced_main_air_circulating_fan_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"air_sealing_ventilation_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"al_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_form_completed"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"amt_non_agi_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_charitable_contributions_to_qualifying_charitable_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"az_charitable_contributions_to_qualifying_foster_care_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"biomass_stove_boiler_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"co_property_tax_exemption"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"cohabitating_spouses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_amt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ct_section_179_expense_add_back"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"domestic_production_ald"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_heat_pump_clothes_dryer_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_load_service_center_upgrade_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_stove_cooktop_range_or_oven_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"electric_wiring_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_central_air_conditioner_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_door_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_insulation_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_roof_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"energy_efficient_window_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"excess_payroll_tax_withheld"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_balance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_interest"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"first_home_mortgage_origination_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"foreign_earned_income_exclusion"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"foreign_tax_credit_potential"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"form_4972_lumpsum_distributions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_cell_property_capacity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"fuel_cell_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_investment_in_529_plan_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ga_itemized_deductions_adjustment"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"geothermal_heat_pump_property_expenditures"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"health_savings_account_ald"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_pump_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"heat_pump_water_heater_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"home_energy_audit_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"id_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_pass_through_entity_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_pass_through_withholding"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_schedule_m_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"il_schedule_m_subtractions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_bonus_depreciation_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_healthcare_sharing_deduction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_nol"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_nol_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_oos_municipal_obligation_interest_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_other_add_backs"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_other_deductions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_tax_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"in_use_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"investment_income_form_4952"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_barred_from_american_opportunity_credit_due_to_improper_claims"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nonresident_alien_for_american_opportunity_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"is_nonresident_alien_for_lifetime_learning_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"k12_tuition_and_fees"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ks_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ky_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"md_total_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_affordability_payment_subtraction_reported"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_property_tax_fairness_credit_utilities_in_rent_amount"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"me_step_4_share_of_child_care_expenses"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mi_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_renters_credit_property_tax_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"mn_renters_credit_qualifying_crp"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_charitable_contributions_to_qualifying_foster_care_organizations"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ms_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nc_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nd_renters_refund_property_tax_exempt"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ne_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_capacity"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_components_made_in_north_america"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_battery_critical_minerals_extracted_in_trading_partner_country"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_classification"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"new_clean_vehicle_msrp"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nh_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nj_senior_freeze"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nm_non_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_qualified_geothermal_energy_system_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ny_qualified_solar_energy_systems_equipment_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"nyc_unincorporated_business_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"oh_refundable_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ok_adjustments"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_federal_pension_subtraction"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"or_tax_before_credits_in_prior_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"other_net_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"pell_grant_primary_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_energy_efficient_home_improvement_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"prior_energy_efficient_window_credits"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"property_sales_net_capital_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"puerto_rico_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"purchased_qualifying_new_clean_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"purchased_qualifying_used_clean_vehicle"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_battery_storage_technology_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_furnace_or_hot_water_boiler_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"qualified_retirement_penalty"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"recapture_of_investment_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"refundable_payroll_tax_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"rent_is_shared_with_another_tax_unit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"residential_efficiency_electrification_retrofit_energy_savings"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"residential_efficiency_electrification_retrofit_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ri_section_179_expense_add_back"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"salt_refund_last_year"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_balance"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_interest"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"second_home_mortgage_origination_year"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"selected_marketplace_plan_benchmark_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"selected_marketplace_plan_category"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"separate_filer_itemizes"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"small_wind_energy_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"solar_electric_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"solar_water_heating_property_expenditures"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"specified_possession_income"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_aca_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ca_premium_subsidy_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_co_premium_assistance_if_eligible"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_dc_ptc"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_eitc"},{"available_by":"seeded","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_nm_premium_assistance_if_eligible"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_count"},{"available_by":"assembled","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"frame_structural_engine_input","stage":"simulate","variable":"tax_unit_id"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_income_ami_ratio"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_unit_stillborn_children"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxsim_pprofinc"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxsim_sprofinc"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"tuition_and_fees"},{"available_by":"transferred","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"ephemeral_simulation_projection_engine_default_if_present_null","provision":"materialized_pool_input_surface","stage":"simulate","variable":"unrecaptured_section_1250_gain"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"unreported_payroll_tax"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"used_clean_vehicle_sale_price"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"ut_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"utilities_included_in_rent"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"va_additions"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wa_pte_cotenant_disposable_income"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"would_file_if_eligible_for_refundable_credit"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"would_file_taxes_voluntarily"},{"available_by":"simulate","consumer":"_simulation_projection","entity":"tax_unit","execution_scope":"disposable_simulation_copy","fallback":"policyengine_default_if_absent","provision":"declared_absent_engine_input","stage":"simulate","variable":"wv_additions"},{"available_by":"assembled","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"assembled_native_person_input","stage":"simulate","variable":"age"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"alimony_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bank_account_assets"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"bond_assets"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"child_support_received"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"disability_benefits"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"employment_income_before_lsr"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"financial_assistance"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"gi_cash_assistance"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"immigration_status_str"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_blind"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_full_time_college_student"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"is_separated"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"keogh_distributions"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"meets_ssi_disability_criteria"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"non_qualified_dividend_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"own_children_in_household"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"qualified_dividend_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"rental_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_dependents"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_disability"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_retirement"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"social_security_survivors"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_another_persons_household"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_lives_in_medical_treatment_facility"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_medicaid_pays_majority_of_care"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_others_pay_all_meals"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_qualifying_quarters_earnings"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_food_from_others"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_outside_shelter_support"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_receives_shelter_from_others_in_household"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"ssi_shelter_support_value"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"sstb_self_employment_income_before_lsr"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"ephemeral_simulation_projection_engine_default","provision":"declared_deferred_null_input","stage":"simulate","variable":"stock_assets"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"survivor_benefits"},{"available_by":"seeded","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"seed_receipted_value_or_disclosed_engine_default","provision":"seed_stage_program_contract","stage":"simulate","variable":"takes_up_ssi_if_eligible"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_401k_distributions"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_403b_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_interest_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_ira_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"tax_exempt_private_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_public_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"tax_exempt_sep_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_401k_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_403b_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_interest_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_ira_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_private_pension_income"},{"available_by":"simulate","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":"policyengine_default_for_absent_input","provision":"declared_absent_engine_input","stage":"simulate","variable":"taxable_public_pension_income"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"taxable_sep_distributions"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"unemployment_compensation"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"veterans_benefits"},{"available_by":"transferred","consumer":"ssi_static_dependency_closure","entity":"person","execution_scope":"whole_pool","fallback":null,"provision":"materialized_pool_input_surface","stage":"simulate","variable":"workers_compensation"}]}} diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py index 7cacda4d22..29efc897ea 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py @@ -13,6 +13,10 @@ COUNTY_FIPS_2023_COLUMN, county_fips_2023_from_tracts, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + PUMA_GEOGRAPHY_RUNGS, + apply_us_local_jurisdiction_flags, +) from microcosm.build.us_runtime.puf_support import ( support_channel_column, support_clone_index_column, @@ -106,6 +110,13 @@ def with_optional_acs_spine( :class:`~microcosm.frame.Frame` construction, avoiding a second copy of every entity table. + A block-line base carries local-jurisdiction flags that the ACS rows lack. + With ``puma_ladder`` the county-rule flags are re-derived for every row + from the final county and the place-rule flags are removed (ACS rows have + no place); without it every flag is removed, since ACS rows then have no + county either. A flag column is never left half-null for the engine + default to fill. + ``max_peak_bytes`` is a fail-fast bound on estimated frame-resident peak memory. Pass ``None`` to disable the preflight. The estimate includes both inputs and the defensive copies made by :class:`~microcosm.frame.Frame`; it @@ -189,6 +200,12 @@ def with_optional_acs_spine( expected_congressional_district_vintage ), ) + tables.update( + apply_us_local_jurisdiction_flags( + tables, + rungs=PUMA_GEOGRAPHY_RUNGS if puma_ladder is not None else (), + )[0] + ) if household_order is not None: reordered = household_weights.values[household_order] household_weights = Weights(reordered, household_weights.kind) diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py index 3237643d07..fb01c07229 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py @@ -25,7 +25,11 @@ (``block_geoid``, ``tract_geoid``, ``county_fips``, ``place_fips``, ``sldu``, ``sldl``, ``cbsa_code``): the exported artifact carries engine inputs, never formula outputs, so ``in_nyc``/``nyc_income_tax`` recompute from the county -rung instead of being persisted (the #34 regression). +rung instead of being persisted (the #34 regression). The few local flags the +engine declares as plain inputs (``in_denver``, ``in_yonkers``, +``in_wilmington``, ``pa_philadelphia_wage_tax_resident``) have no formula to +recompute them, so the frame wrapper derives them from the assigned county and +place through the pinned registry in :mod:`.local_jurisdictions`. """ from __future__ import annotations @@ -48,6 +52,13 @@ county_fips_2023_assignment_failures, county_fips_2023_from_blocks, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + apply_us_local_jurisdiction_flags, + us_local_jurisdiction_flag_failures, + us_local_jurisdiction_flag_receipt, + us_local_jurisdiction_flag_values, +) from microcosm.frame import Frame #: Derived (crosswalk-sourced) layers the ladder artifact must carry a @@ -384,7 +395,12 @@ def with_household_us_geography_ladder( seed: int = 0, expected_congressional_district_vintage: str | None = None, ) -> Frame: - """Return ``frame`` with the household geography ladder assigned.""" + """Return ``frame`` with the household geography ladder assigned. + + The block fixes county and place together, so every registry + local-jurisdiction flag is derived from them and written as an engine + input (person flags through ``person_household_id``). + """ tables = {entity: frame.table(entity).copy() for entity in frame.entities} tables["household"] = assign_us_geography_ladder( @@ -395,6 +411,7 @@ def with_household_us_geography_ladder( expected_congressional_district_vintage ), ) + tables, _ = apply_us_local_jurisdiction_flags(tables, rungs=BLOCK_GEOGRAPHY_RUNGS) for link_name in frame.links: tables[link_name] = frame.link(link_name).copy() weights = {entity: frame.weights_for(entity) for entity in frame.weighted_entities} @@ -456,6 +473,11 @@ def us_geography_ladder_assignment_summary( summary["nyc_weighted_household_share"] = ( float(weights[nyc].sum() / total) if total > 0 else 0.0 ) + summary["local_jurisdiction_flags"] = us_local_jurisdiction_flag_receipt( + us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS), + rungs=BLOCK_GEOGRAPHY_RUNGS, + household_weights=weights, + ) return summary @@ -562,6 +584,9 @@ def us_geography_ladder_gate( f"{cd_column}: {int(cd_mismatch.sum())}/{len(block)} row(s) " "have a state prefix disagreeing with block_geoid" ) + # A flag column is optional here (base H5s built before the flags carry + # none), but one that is present must match its county or place rule. + failures.extend(us_local_jurisdiction_flag_failures(household)) total = float(weights.sum()) if total <= 0: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py index b2c799d895..55b6646e06 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py @@ -208,9 +208,7 @@ def _registry_from_bytes( raise ValueError( f"US local-jurisdiction registry repeats a geography: {geoids}." ) - metadata = { - key: value for key, value in document.items() if key != "jurisdictions" - } + metadata = {key: value for key, value in document.items() if key != "jurisdictions"} return UsLocalJurisdictionRegistry( jurisdictions=jurisdictions, sha256=digest, metadata=metadata ) @@ -298,31 +296,41 @@ def _normalized_rungs(rungs: Collection[str]) -> tuple[str, ...]: return tuple(rung for rung in JURISDICTION_RUNGS if rung in set(rungs)) -def _text_codes(values: pd.Series, *, column: str, widths: tuple[int, ...]) -> np.ndarray: - """Return ``values`` as text codes, refusing nulls, non-text and bad widths.""" +def _text_codes( + values: pd.Series, *, column: str, widths: tuple[int, ...] +) -> pd.Series: + """Return ``values`` as text codes, refusing nulls, non-text and bad widths. - out = np.empty(len(values), dtype=object) - bad: list[object] = [] - for position, value in enumerate(values.tolist()): - if isinstance(value, bytes): - value = value.decode("ascii") - if ( - not isinstance(value, str) - or len(value) not in widths - or (value and not value.isdigit()) - ): - if len(bad) < 5: - bad.append(value) - out[position] = None - continue - out[position] = value - if bad: - allowed = " or ".join("empty" if width == 0 else f"{width}-digit" for width in widths) + An integer code is refused rather than zero-filled: the geography lines + write text, and a numeric column here means something upstream changed. + """ + + series = pd.Series(values.to_numpy(dtype=object), dtype=object) + if series.empty: + return series + kind = pd.api.types.infer_dtype(series, skipna=False) + if kind == "bytes": + series = series.str.decode("ascii") + kind = pd.api.types.infer_dtype(series, skipna=False) + allowed = " or ".join( + "empty" if width == 0 else f"{width}-digit" for width in widths + ) + if kind != "string": + examples = ( + series[~series.map(lambda value: isinstance(value, str))].head(5).tolist() + ) + raise ValueError( + f"{column} must hold {allowed} text codes on every row to derive local " + f"jurisdiction flags; it holds {kind} values, e.g. {examples}." + ) + pattern = "|".join(rf"\d{{{width}}}" if width else "" for width in widths) + valid = series.str.fullmatch(f"(?:{pattern})").astype(bool) + if not valid.all(): raise ValueError( f"{column} must hold {allowed} text codes on every row to derive local " - f"jurisdiction flags; invalid value(s) {bad}." + f"jurisdiction flags; invalid value(s) {series[~valid].head(5).tolist()}." ) - return out + return series def us_local_jurisdiction_flag_values( @@ -346,14 +354,16 @@ def us_local_jurisdiction_flag_values( needed = {item.rule for item in resolved.jurisdictions} & set(supplied) if not needed: return {} - for column in ("county_fips", *(("place_fips",) if JURISDICTION_RUNG_PLACE in needed else ())): + for column in ( + "county_fips", + *(("place_fips",) if JURISDICTION_RUNG_PLACE in needed else ()), + ): if column not in household: raise ValueError( f"household table has no {column!r}; it cannot supply the " f"local-jurisdiction rung(s) {sorted(needed)}." ) county = _text_codes(household["county_fips"], column="county_fips", widths=(5,)) - state = np.array([value[:2] for value in county.tolist()], dtype=object) place = ( _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) if JURISDICTION_RUNG_PLACE in needed @@ -364,11 +374,11 @@ def us_local_jurisdiction_flag_values( if item.rule not in needed: continue if item.rule == JURISDICTION_RUNG_COUNTY: - flags[item.flag] = county == item.county_fips + mask = county.eq(item.county_fips) else: assert place is not None - flags[item.flag] = (state == item.state_fips) & (place == item.place_fips) - flags[item.flag] = np.asarray(flags[item.flag], dtype=bool) + mask = county.str[:2].eq(item.state_fips) & place.eq(item.place_fips) + flags[item.flag] = mask.to_numpy(dtype=bool) return flags @@ -379,7 +389,7 @@ def apply_us_local_jurisdiction_flags( registry: UsLocalJurisdictionRegistry | None = None, household_weights: np.ndarray | None = None, ) -> tuple[dict[str, pd.DataFrame], dict[str, Any]]: - """Write every derivable flag into copies of ``tables`` and return a receipt. + """Write every derivable flag and return the tables with a receipt. Household flags go on the household table; person flags on the person table, each person taking its household's value through @@ -387,6 +397,10 @@ def apply_us_local_jurisdiction_flags( its table if a stale or partially populated column is present, and the receipt records it as unavailable: the engine default then applies to every row, and the receipt says so, instead of a written ``False``. + + The household and person tables are returned as new (shallow-copied) + frames; the input tables are never modified, and the other tables are + passed through as-is. """ resolved = registry or packaged_us_local_jurisdiction_registry() @@ -395,9 +409,14 @@ def apply_us_local_jurisdiction_flags( values = us_local_jurisdiction_flag_values( household, rungs=supplied, registry=resolved ) - out = {name: table.copy() for name, table in tables.items()} + out = dict(tables) + for entity in {item.entity for item in resolved.jurisdictions}: + out[entity] = tables[entity].copy(deep=False) person_rows: np.ndarray | None = None - if any(item.entity == "person" and item.flag in values for item in resolved.jurisdictions): + if any( + item.entity == "person" and item.flag in values + for item in resolved.jurisdictions + ): person_rows = _person_household_positions(out["household"], out["person"]) for item in resolved.jurisdictions: table = out[item.entity] @@ -491,7 +510,9 @@ def us_local_jurisdiction_flag_receipt( resolved = registry or packaged_us_local_jurisdiction_registry() supplied = _normalized_rungs(rungs) weights = ( - None if household_weights is None else np.asarray(household_weights, dtype=np.float64) + None + if household_weights is None + else np.asarray(household_weights, dtype=np.float64) ) flags: dict[str, Any] = {} for item in resolved.jurisdictions: @@ -509,7 +530,9 @@ def us_local_jurisdiction_flag_receipt( raise ValueError( "household_weights must align with the household table." ) - entry["weighted_households_in_jurisdiction"] = float(weights[mask].sum()) + entry["weighted_households_in_jurisdiction"] = float( + weights[mask].sum() + ) else: entry["status"] = JURISDICTION_FLAG_UNAVAILABLE entry["reason"] = ( @@ -556,6 +579,12 @@ def us_local_jurisdiction_flag_failures( if observed.isna().any(): failures.append(f"{item.flag}: {int(observed.isna().sum())} null row(s)") continue + if ( + not pd.api.types.is_bool_dtype(observed) + and not observed.isin([True, False]).all() + ): + failures.append(f"{item.flag}: holds non-boolean values") + continue disagree = observed.astype(bool).to_numpy() != expected if disagree.any(): failures.append( @@ -616,7 +645,9 @@ def check_us_local_jurisdictions_against_block_ladder( blocks_in = int(mask.sum()) population_in = float(pop[mask].sum()) if blocks_in == 0: - raise ValueError(f"{item.flag}: no block in the ladder matches {item.geoid}.") + raise ValueError( + f"{item.flag}: no block in the ladder matches {item.geoid}." + ) if population_in != float(item.population_2020): raise ValueError( f"{item.flag}: ladder population {population_in:,.0f} differs from " diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py b/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py index 65006c5c40..c9a48ce6b2 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py @@ -62,6 +62,10 @@ with_us_housing_inputs, ) from microcosm.build.us_runtime.immigration import with_us_immigration_inputs +from microcosm.build.us_runtime.local_jurisdictions import ( + PUMA_GEOGRAPHY_RUNGS, + packaged_us_local_jurisdiction_registry, +) from microcosm.build.us_runtime.medicare_take_up import ( with_us_medicare_take_up_input, ) @@ -367,13 +371,15 @@ class PoolEngineInputProjectionContract: POOL_PROJECTION_INPUT_PROVISION_COUNTS: tuple[tuple[str, int], ...] = ( ("assembled_native_engine_input", 5), - ("declared_absent_engine_input", 762), + ("declared_absent_engine_input", 756), ("declared_deferred_null_input", 3), ("derived_schedule_d_input", 1), ("frame_structural_engine_input", 10), + ("geography_derived_jurisdiction_input", 2), ("materialized_pool_input_surface", 123), - ("preserved_stacked_engine_input", 4), + ("preserved_stacked_engine_input", 6), ("seed_stage_program_contract", 17), + ("unavailable_place_jurisdiction_input", 2), ("unprovisioned_source_input", 1), ) """How every installed engine input is provisioned, by count. @@ -383,7 +389,7 @@ class PoolEngineInputProjectionContract: """ POOL_REMAINING_STAGE_INPUT_MANIFEST_SHA256 = ( - "d4fb9de9c0b8081474a24d0abde84ebf05eb346483fc20e3852e29abc769a501" + "6e70bc749ab7fd34d6bb902423a3240029d14533819cb5c6f1f75457875cf956" ) """Pinned content digest of all 1,059 post-transfer consumer/input rows.""" @@ -694,6 +700,10 @@ class SourceOperatorContract: tuple[str, str], tuple[str, str | None] ] = { ("person", "is_related_to_head_or_spouse"): ("assembled", None), + # The stacked post-assembly PUMA-ladder operator writes both on every + # household (``_assign_stacked_household_geography``). + ("household", "congressional_district_geoid"): ("assembled", None), + ("household", "county_fips"): ("assembled", None), ("household", "puma"): ( "assembled", "ephemeral_simulation_projection_engine_default_for_null", @@ -1556,6 +1566,13 @@ def surface_provision(variable: str) -> str: for entity, variables in _POOL_NATIVE_COMPLETE_OUTPUTS.items() for variable in variables } + # The stacked pool's geography comes from the PUMA ladder, which draws a + # county but no place: county-rule jurisdiction flags are derived with + # it, place-rule flags are never written (local_jurisdictions). + local_jurisdiction_inputs = { + (item.entity, item.flag): item.rule in PUMA_GEOGRAPHY_RUNGS + for item in packaged_us_local_jurisdiction_registry().jurisdictions + } projection_provisions: dict[str, int] = {} for entity, variable in _pool_engine_input_projection( resolved_metadata_index, @@ -1584,6 +1601,14 @@ def surface_provision(variable: str) -> str: elif (entity, variable) in engine_structural_inputs: provision = "frame_structural_engine_input" available_by = "assembled" + elif (entity, variable) in local_jurisdiction_inputs: + if local_jurisdiction_inputs[(entity, variable)]: + provision = "geography_derived_jurisdiction_input" + available_by = "assembled" + else: + provision = "unavailable_place_jurisdiction_input" + available_by = "simulate" + fallback = "policyengine_default_no_place_rung" elif (entity, variable) in _POOL_SIMULATION_PRESERVED_ENGINE_INPUTS: provision = "preserved_stacked_engine_input" available_by, preserved_fallback = _POOL_SIMULATION_PRESERVED_ENGINE_INPUTS[ diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py index 40b2d46371..21b559253c 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py @@ -41,7 +41,12 @@ input, exactly as the UK ladder carries ``*_code`` columns policyengine-uk has no input for). The exported artifact carries engine inputs, never formula outputs, so ``in_nyc``/``nyc_income_tax`` recompute from the county rung -instead of being persisted (the #34 regression). +instead of being persisted (the #34 regression). Of the local flags the engine +declares as plain inputs, the county-rule ones (``in_denver``, +``pa_philadelphia_wage_tax_resident``) are derived from the drawn county. The +ladder has no place rung, so the place-rule flags (``in_yonkers``, +``in_wilmington``) are unavailable: they are never written, and the summary +records why (:mod:`.local_jurisdictions`). """ from __future__ import annotations @@ -67,6 +72,13 @@ US_NYC_COUNTY_FIPS, non_text_county_fips_failure, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + PUMA_GEOGRAPHY_RUNGS, + apply_us_local_jurisdiction_flags, + us_local_jurisdiction_flag_failures, + us_local_jurisdiction_flag_receipt, + us_local_jurisdiction_flag_values, +) from microcosm.build.us_runtime.puma_county_vintage import ( county_fips_2023_for_puma_assignment, ) @@ -413,7 +425,12 @@ def with_household_us_puma_ladder( assign_tract: bool = False, expected_congressional_district_vintage: str | None = None, ) -> Frame: - """Return ``frame`` with the household PUMA ladder assigned.""" + """Return ``frame`` with the household PUMA ladder assigned. + + The county-rule local-jurisdiction flags are derived from the drawn county + and written as engine inputs; the place-rule flags are left unwritten + (any stale column is removed) because the ladder assigns no place. + """ tables = {entity: frame.table(entity).copy() for entity in frame.entities} tables["household"] = assign_us_puma_ladder( @@ -425,6 +442,7 @@ def with_household_us_puma_ladder( expected_congressional_district_vintage ), ) + tables, _ = apply_us_local_jurisdiction_flags(tables, rungs=PUMA_GEOGRAPHY_RUNGS) for link_name in frame.links: tables[link_name] = frame.link(link_name).copy() weights = {entity: frame.weights_for(entity) for entity in frame.weighted_entities} @@ -485,6 +503,11 @@ def us_puma_ladder_assignment_summary( summary["nyc_weighted_household_share"] = ( float(weights[nyc].sum() / total) if total > 0 else 0.0 ) + summary["local_jurisdiction_flags"] = us_local_jurisdiction_flag_receipt( + us_local_jurisdiction_flag_values(household, rungs=PUMA_GEOGRAPHY_RUNGS), + rungs=PUMA_GEOGRAPHY_RUNGS, + household_weights=weights, + ) return summary @@ -594,6 +617,9 @@ def us_puma_ladder_gate( f"{label}: {int(mismatched.sum())}/{len(values)} row(s) " "disagree with the expected state/county prefix" ) + # A present flag must match its rule; a place-rule flag fails here unless + # the table carries a complete place rung to decide it. + failures.extend(us_local_jurisdiction_flag_failures(household)) total = float(weights.sum()) if total <= 0: diff --git a/tools/verify_us_local_jurisdiction_registry.py b/tools/verify_us_local_jurisdiction_registry.py index 756183ecfd..c6279f50c0 100644 --- a/tools/verify_us_local_jurisdiction_registry.py +++ b/tools/verify_us_local_jurisdiction_registry.py @@ -77,20 +77,28 @@ def check_gazetteer( failures: list[str] = [] sources = document["sources"] - for label, path in (("gazetteer_place", place_zip), ("gazetteer_county", county_zip)): + for label, path in ( + ("gazetteer_place", place_zip), + ("gazetteer_county", county_zip), + ): observed = _sha256(path) if observed != sources[label]["sha256"]: failures.append( f"{label}: zip SHA-256 {observed} differs from the registry's " f"{sources[label]['sha256']}" ) - tables = {"place": _gazetteer_rows(place_zip), "county": _gazetteer_rows(county_zip)} + tables = { + "place": _gazetteer_rows(place_zip), + "county": _gazetteer_rows(county_zip), + } for item in document["jurisdictions"]: records = item["gazetteer"] for level, record in records.items(): row = tables[level].get(record["geoid"]) if row is None: - failures.append(f"{item['flag']}: {level} {record['geoid']} not in gazetteer") + failures.append( + f"{item['flag']}: {level} {record['geoid']} not in gazetteer" + ) continue for key, column in ( ("ansicode", "ANSICODE"), @@ -111,7 +119,9 @@ def check_gazetteer( if place.get("geoid") != item["state_fips"] + str( item["coextensive_place_fips"] ): - failures.append(f"{item['flag']}: gazetteer place is not the coextensive city") + failures.append( + f"{item['flag']}: gazetteer place is not the coextensive city" + ) if (county.get("aland"), county.get("awater")) != ( place.get("aland"), place.get("awater"), @@ -120,8 +130,13 @@ def check_gazetteer( f"{item['flag']}: county and city land/water areas differ, so " "they are not the same area" ) - elif records.get("place", {}).get("geoid") != item["state_fips"] + item["place_fips"]: - failures.append(f"{item['flag']}: gazetteer place is not state_fips+place_fips") + elif ( + records.get("place", {}).get("geoid") + != item["state_fips"] + item["place_fips"] + ): + failures.append( + f"{item['flag']}: gazetteer place is not state_fips+place_fips" + ) return failures @@ -136,7 +151,9 @@ def check_pl_populations(document: Mapping[str, Any], *, path: Path) -> list[str for row in rows: record = dict(zip(header, row, strict=True)) if "place" in record: - counts[("place", record["state"] + record["place"])] = int(record["P1_001N"]) + counts[("place", record["state"] + record["place"])] = int( + record["P1_001N"] + ) elif "county" in record: counts[("county", record["state"] + record["county"])] = int( record["P1_001N"] @@ -146,7 +163,9 @@ def check_pl_populations(document: Mapping[str, Any], *, path: Path) -> list[str failures: list[str] = [] national = document["sources"]["population"]["national_total_2020"] if counts.get(("us", "1")) not in (None, national): - failures.append(f"US total {counts[('us', '1')]} differs from the registry's {national}") + failures.append( + f"US total {counts[('us', '1')]} differs from the registry's {national}" + ) for item in document["jurisdictions"]: if item["rule"] == JURISDICTION_RUNG_COUNTY: keys = [ From b7b3e21f828cf8fd2e130e29d668fd0ae9079bf7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 2 Nov 2026 08:40:07 -0500 Subject: [PATCH 03/32] Repin US spec contracts and test the local-jurisdiction flags Re-derived with the repo tools after the derivation change: repin_us_spec_engine_contracts.py (--legacy-only, then full), generate_us_bundle_from_constants.py (US spec_sha256 0b5c29e4...) and spec_engine_coverage.py (42305/42305 fields, 41/41 checks); --check passes on all three and on repin_us_pool_engine_contracts.py. Tests: Hypothesis properties for the iff rule, block-population conservation, row-order invariance and person broadcast, plus registry pin, gate, PUMA and pooled-line cases (engine_free); an engine contract that each flag is an input-only boolean its consumers read; and an engine scenario in which Yonkers, Wilmington, Denver and Philadelphia residents placed by the block ladder get their local tax or benefit and their neighbours do not. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 1 + docs/evidence/spec-engine/us-f0-coverage.json | 22 +- .../build/spec_engine/inventory_coverage.py | 6 +- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 68 ++ .../build/us_runtime/US_PUMA_LADDER.md | 5 + ...t_us_local_jurisdiction_engine_contract.py | 64 ++ .../shared/test_spec_engine_loader.py | 2 +- .../tests/engine_free/us/test_us_base_pool.py | 65 ++ .../us/test_us_local_jurisdictions.py | 808 ++++++++++++++++++ .../engine_free/us/test_us_multispine_pool.py | 54 +- ...test_us_local_jurisdiction_flags_engine.py | 174 ++++ .../us/test_us_multispine_pool_tool.py | 2 +- .../microcosm_build/us_local_jurisdictions.py | 151 ++++ 13 files changed, 1404 insertions(+), 18 deletions(-) create mode 100644 changelog.d/us-local-jurisdiction-flags.added.md create mode 100644 packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md create mode 100644 packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py create mode 100644 packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py create mode 100644 packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py create mode 100644 test_support/microcosm_build/us_local_jurisdictions.py diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md new file mode 100644 index 0000000000..91c03e0812 --- /dev/null +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -0,0 +1 @@ +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 9071607114..63bec3740a 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1656,13 +1656,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "488846129a3c47e89d54538515e6bdbd7ce849e4081ab8a4ad40c9ce2a1e1391", - "protocol_sha256": "87f44e60621c45d2fc1448fda11cd446960d6bab7cb51b346367339e2e751e1f" + "map_sha256": "6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536", + "protocol_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59" }, "failures": [], "observed": { - "map_sha256": "488846129a3c47e89d54538515e6bdbd7ce849e4081ab8a4ad40c9ce2a1e1391", - "protocol_sha256": "87f44e60621c45d2fc1448fda11cd446960d6bab7cb51b346367339e2e751e1f" + "map_sha256": "6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536", + "protocol_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59" }, "status": "covered" }, @@ -1677,7 +1677,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "87f44e60621c45d2fc1448fda11cd446960d6bab7cb51b346367339e2e751e1f", + "implementation_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1698,7 +1698,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "87f44e60621c45d2fc1448fda11cd446960d6bab7cb51b346367339e2e751e1f", + "implementation_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1887,7 +1887,7 @@ "alpha", "zeta" ], - "sha256": "69c2e4fcc8ebdf1e6257ccaf4787b736c4822beda5f4ee01a53ffa3945f4936f" + "sha256": "94ed381f17dc9cafb80396b2ea0f02ed8745d9359ec3f4d551a65a5a7f2fc26d" }, "failures": [], "observed": { @@ -1911,7 +1911,7 @@ "alpha", "zeta" ], - "sha256": "69c2e4fcc8ebdf1e6257ccaf4787b736c4822beda5f4ee01a53ffa3945f4936f" + "sha256": "94ed381f17dc9cafb80396b2ea0f02ed8745d9359ec3f4d551a65a5a7f2fc26d" }, "status": "covered" }, @@ -1975,7 +1975,7 @@ "take_up_contract", "us_qbi_reconciliation_contract" ], - "sha256": "7248c2831f3772e75f22dbabcbb5794d5d81138009a38aae8410e43aa05fb656" + "sha256": "e31727246ecd547071778fb91c2f6b102cf024f3c0cc64252bbc8040b9fb1201" }, "status": "covered" }, @@ -2599,7 +2599,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "9b4b3260c20c30ba71a0947f8d78e322c8d2a3e6cb94e87a3729be950a9e90f2" + "spec_sha256": "0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c" } }, "report_schema_version": 3, @@ -2609,7 +2609,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "9b4b3260c20c30ba71a0947f8d78e322c8d2a3e6cb94e87a3729be950a9e90f2" + "spec_sha256": "0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 2845ac1496..b21e586c4e 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -350,7 +350,7 @@ "acs_person_predictors": "878c788a6f037d7aca12b3586ea034eff04f3034ffa11935a736493042551f25", "authority": "bf681aedc859fd6398ef72da68f584069b7d25b3085c549bf99f82e8324c4eef", "early_families": "4aa9f736fd76e83955477ad1667e58f48f264783f05bdc7f0102cd32d61323bd", - "full_checkpoint": "69c2e4fcc8ebdf1e6257ccaf4787b736c4822beda5f4ee01a53ffa3945f4936f", + "full_checkpoint": '94ed381f17dc9cafb80396b2ea0f02ed8745d9359ec3f4d551a65a5a7f2fc26d', "gap_fill_schedule": "1c31f9868f7884347cc19cf1ff65da43f950b9114941a715bab168246db414a7", "graph_nodes": "1b208fff4f6d878c522147fee617177544bda8963c940f98a4bfc37507cb955f", "geography_assignment": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c", @@ -380,8 +380,8 @@ # microcosm#1259's recipient-share bound in puf_support moves both again. # microcosm#1261 moves both again: the PUF donor carries partnership and # S-corp line-32 shares as separate leaves. - "seed_map": "488846129a3c47e89d54538515e6bdbd7ce849e4081ab8a4ad40c9ce2a1e1391", - "seed_protocol": "87f44e60621c45d2fc1448fda11cd446960d6bab7cb51b346367339e2e751e1f", + "seed_map": '6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536', + "seed_protocol": '898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59', "source_manifest": "608c3621b1e4a108e57c8f83d16a184acdb3d05e16a81b895f7f72dbf5d0685c", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "071d418bb49976f4682c320d2ad07097c177de3a645d2524f235e1ff33ac83f9", diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md new file mode 100644 index 0000000000..f5714a0939 --- /dev/null +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -0,0 +1,68 @@ +# US local-jurisdiction flags + +policyengine-us 2.2.1 (and 2.60.4) declares four local-tax jurisdictions as +plain inputs with no formula. A flag stays `False` unless the dataset writes +it: + +| Flag | Entity | Rule | 2020 geography | Population | Engine consumer | +| --- | --- | --- | --- | ---: | --- | +| `in_denver` | household | county | county 08031 (same blocks as Denver city, 08/20000) | 715,522 | Denver property-tax relief eligibility | +| `in_yonkers` | household | place | NY place 84000 (Yonkers city) | 211,569 | `ny_yonkers_income_tax` | +| `in_wilmington` | household | place | DE place 77580 (Wilmington city) | 70,898 | `de_wilmington_earned_income_tax` | +| `pa_philadelphia_wage_tax_resident` | person | county | county 42101 (same blocks as Philadelphia city, 42/60000) | 1,603,797 | `pa_philadelphia_wage_tax` | + +Local flags that have a formula on `county_fips` (`in_nyc`, `in_la` and the +rest) need nothing: the engine computes them from the county the geography +line writes. + +## Registry + +`us_local_jurisdictions.json` holds the table above, and +`local_jurisdictions.py` pins its SHA-256. A county rule holds when +`county_fips` equals the registry county. A place rule holds when the first two +digits of `county_fips` equal the registry state and `place_fips` equals the +registry place code; place codes repeat across states, so the state is part of +the match. A person flag takes its household's value. + +`tools/verify_us_local_jurisdiction_registry.py` checks the registry against +three Census sources: + +- the 2020 Gazetteer place and county files (GEOID, ANSI code, name, land and + water area; a county-rule jurisdiction's county and city have identical + areas); +- the 2020 P.L. 94-171 `P1_001N` count for each place and county; and +- any block ladder: the blocks whose household would get a flag sum to the + registry population, and a county-rule flag covers the same blocks as its + city. + +`block_ladder_checks` records the result for ladders `7ba39b95` and `6840b990`. +With `--record` the tool writes a ladder's counts into the registry and prints +the new SHA-256 to pin. + +## Geography lines + +- **Block ladder** (`with_household_us_geography_ladder`): one block fixes + county and place, so the line writes all four flags. +- **Block-location draw** (microcosm#1047): call + `with_us_local_jurisdiction_flags(frame, rungs=BLOCK_GEOGRAPHY_RUNGS)` once + `county_fips` and `place_fips` are final. +- **PUMA ladder** (`with_household_us_puma_ladder`, the stacked pool): the + ladder draws a county but no place. The line writes `in_denver` and the + Philadelphia flag and never writes `in_yonkers` or `in_wilmington`; it also + removes a stale column. The assignment summary records those two as + `unavailable`, and the engine ABI lock lists them as + `unavailable_place_jurisdiction_input`. +- **Pooled ACS line** (`with_optional_acs_spine`): donor rows arrive with + block-line flags and ACS rows without. The pool re-derives the county-rule + flags for every row from the final county and removes the place-rule flags. + Without a PUMA ladder it removes every flag, because ACS rows then have no + county. + +Missing, null or malformed geography raises; no line writes `False` for a +household whose county or place it does not know. Both ladder gates fail a +flag column that disagrees with its rule, or a place-rule flag on a table with +no complete `place_fips`. + +The Philadelphia flag records residence only. `pa_philadelphia_wage_tax` also +needs `pa_philadelphia_wage_tax_taxable_wages`, which no line supplies yet, so +the tax stays zero in built datasets. diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md index 8702bd870e..c15dd4fa96 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md @@ -26,6 +26,11 @@ from its `seed`. The dense ACS-spine artifact is filtered to state / congressional district / county for local analysis because every record carries all three. +The ladder also writes the county-rule local-jurisdiction flags (`in_denver`, +`pa_philadelphia_wage_tax_resident`) from the drawn county. It has no place +rung, so it never writes `in_yonkers` or `in_wilmington`, and its summary +records them as unavailable ([US_LOCAL_JURISDICTIONS.md](US_LOCAL_JURISDICTIONS.md)). + ## Why one block pass 2020 tabulation blocks nest in 2020 census tracts, and 2020 tracts nest in 2020 diff --git a/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py b/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py new file mode 100644 index 0000000000..cddc1e1590 --- /dev/null +++ b/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py @@ -0,0 +1,64 @@ +"""The registry flags are policyengine-us inputs the engine cannot compute. + +Each registry flag must exist in the pinned engine as an input variable with +no formula, a boolean defaulting to ``False`` on the registry's entity, and +each listed consumer must read it. If a later engine gives a flag a formula, +this fails and the registry entry should be retired rather than kept writing +a column the engine would treat as formula-owned. +""" + +from __future__ import annotations + +import inspect +import json +from importlib.resources import files + +import pytest + +from microcosm.build.us_runtime.local_jurisdictions import ( + US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + packaged_us_local_jurisdiction_registry, +) + +REGISTRY = packaged_us_local_jurisdiction_registry() +DOCUMENT = json.loads( + files("microcosm.build.us_runtime") + .joinpath(US_LOCAL_JURISDICTION_REGISTRY_RESOURCE) + .read_text() +) +CONSUMERS = { + item["flag"]: item["engine_consumers"] for item in DOCUMENT["jurisdictions"] +} + + +@pytest.fixture(scope="module") +def system(): + from policyengine_us import CountryTaxBenefitSystem + + return CountryTaxBenefitSystem() + + +@pytest.mark.parametrize("item", REGISTRY.jurisdictions, ids=lambda item: item.flag) +def test_registry_flag_is_an_input_only_boolean_on_its_entity(system, item) -> None: + variable = system.variables[item.flag] + + assert variable.is_input_variable() + assert not getattr(variable, "formulas", None) + assert variable.entity.key == item.entity + assert variable.value_type is bool + assert variable.default_value is False + assert str(variable.definition_period).lower() == "year" + + +@pytest.mark.parametrize("item", REGISTRY.jurisdictions, ids=lambda item: item.flag) +def test_each_listed_consumer_reads_the_flag(system, item) -> None: + for consumer in CONSUMERS[item.flag]: + variable = system.variables[consumer] + defined_for = getattr(variable, "defined_for", None) + reads_in_formula = any( + f'"{item.flag}"' in inspect.getsource(formula) + for formula in variable.formulas.values() + ) + assert reads_in_formula or getattr(defined_for, "name", defined_for) == ( + item.flag + ), consumer diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index de2cf00847..95c0e6a093 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -18,7 +18,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # self-employment feature in the imputation schema moves the schema-set # receipt, and its post-transfer step moves acs_transfer's attested bytes. assert first.spec_sha256 == ( - "8654884dc7dde724af39b78d07cffb151c61680d388c05576cd34dee83fb79fb" + '13cd46573e0291b3305c97d6b0b741b16d8be78c12368e2b3b6935826820c62e' ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_base_pool.py b/packages/microcosm-build/tests/engine_free/us/test_us_base_pool.py index 9b0700128e..9d7ac6479c 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_base_pool.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_base_pool.py @@ -938,3 +938,68 @@ def test__preflight_validates_geography_before_transfer() -> None: unknown_puma["puma"] = ["0999901"] with pytest.raises(ValueError, match="absent from the ladder"): preflight_pooled_ladder_geography(good_base, unknown_puma, ladder) + + +def _block_line_donor_base() -> Frame: + """Donors placed by the block line: Denver and Arapahoe, with flags.""" + + base = _assigned_geography_base_frame( + state_fips=8, + tracts=["08031000100", "08005000100"], + congressional_districts=[801, 801], + counties=["08031", "08005"], + ) + tables = {entity: base.table(entity).copy() for entity in base.entities} + household = tables["household"] + household["place_fips"] = ["20000", "04000"] + household["in_denver"] = [True, False] + household["in_yonkers"] = [False, False] + household["in_wilmington"] = [False, False] + tables["person"]["pa_philadelphia_wage_tax_resident"] = False + return Frame( + tables, + US_SCHEMA, + {entity: base.weights_for(entity) for entity in base.weighted_entities}, + base.strata, + ) + + +def test__given_block_line_flags__then_pool_rederives_county_flags_for_every_row() -> ( + None +): + # Given: the ACS row draws its county from a PUMA spanning Denver and + # Arapahoe, and has no place; the donors carry block-line flags. + tracts = ["08031000100", "08005000100"] + ladder = _single_puma_ladder("0800101", tracts, ["08031", "08005"], 801) + acs = _acs_frame(state_fips=8, puma="0800101") + + # When + result = with_optional_acs_spine( + _block_line_donor_base(), + acs, + puma_ladder=ladder, + geography_seed=4, + expected_congressional_district_vintage="119th_congress", + ) + + # Then: county flags cover every row from the final county, place flags + # are gone rather than half-null, and persons follow their household. + household = result.table("household") + person = result.table("person") + assert "in_yonkers" not in household + assert "in_wilmington" not in household + assert household["in_denver"].dtype == bool + assert ( + household["in_denver"].tolist() == household["county_fips"].eq("08031").tolist() + ) + assert person["pa_philadelphia_wage_tax_resident"].dtype == bool + assert not person["pa_philadelphia_wage_tax_resident"].any() + assert len(person) == 5 + + +def test__given_block_line_flags_and_no_ladder__then_pool_drops_every_flag() -> None: + result = with_optional_acs_spine(_block_line_donor_base(), _acs_frame(state_fips=8)) + + for flag in ("in_denver", "in_yonkers", "in_wilmington"): + assert flag not in result.table("household") + assert "pa_philadelphia_wage_tax_resident" not in result.table("person") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py new file mode 100644 index 0000000000..dadf6817b7 --- /dev/null +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -0,0 +1,808 @@ +"""US local-jurisdiction flags: registry pin, derivation properties and gates. + +Invariants exercised here (stated for every input, then checked by +Hypothesis): + +- a flag is true exactly when the household's county (county rule) or its + state and place (place rule) equal the registry geography; +- over a block ladder, the population of the blocks whose household gets a + flag equals the population of the jurisdiction's blocks; +- derivation is deterministic and commutes with any reordering of household + or person rows, and each person carries its household's value; +- a line without a place rung never writes a place-rule flag, and missing or + malformed geography raises instead of yielding ``False``. +""" + +from __future__ import annotations + +import hashlib +import json +from pathlib import Path + +import numpy as np +import pandas as pd +import pytest +from hypothesis import given, settings +from hypothesis import strategies as st + +from microcosm.build.us_runtime.geography_ladder import ( + assign_us_geography_ladder, + us_geography_ladder_assignment_summary, + us_geography_ladder_gate, + with_household_us_geography_ladder, +) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + JURISDICTION_FLAG_DERIVED, + JURISDICTION_FLAG_UNAVAILABLE, + PUMA_GEOGRAPHY_RUNGS, + US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + US_LOCAL_JURISDICTION_REGISTRY_SHA256, + apply_us_local_jurisdiction_flags, + check_us_local_jurisdictions_against_block_ladder, + load_us_local_jurisdiction_registry, + packaged_us_local_jurisdiction_registry, + us_local_jurisdiction_flag_failures, + us_local_jurisdiction_flag_values, + with_us_local_jurisdiction_flags, +) +from microcosm.build.us_runtime.puma_ladder import ( + UsPumaLadder, + us_puma_ladder_assignment_summary, + us_puma_ladder_gate, + with_household_us_puma_ladder, +) +from microcosm.frame import US_SCHEMA +from test_support.microcosm_build.us_local_jurisdictions import ( + FIXTURE_BLOCK_BY_NAME, + FIXTURE_BLOCKS, + FixtureBlock, + block_ladder, + households_on_blocks, + us_frame, +) +from test_support.paths import paths_for + +REGISTRY_PATH = ( + paths_for("microcosm-build").package + / "src/microcosm/build/us_runtime" + / US_LOCAL_JURISDICTION_REGISTRY_RESOURCE +) +REGISTRY = packaged_us_local_jurisdiction_registry() +HOUSEHOLD_FLAGS = ("in_denver", "in_wilmington", "in_yonkers") +PERSON_FLAGS = ("pa_philadelphia_wage_tax_resident",) +PLACE_FLAGS = ("in_wilmington", "in_yonkers") + +# The registry geographies, written out independently of the registry file: +# a code mistyped there fails these oracles. +EXPECTED_RULES = { + "in_denver": ("county", "08031"), + "pa_philadelphia_wage_tax_resident": ("county", "42101"), + "in_yonkers": ("place", "36", "84000"), + "in_wilmington": ("place", "10", "77580"), +} + + +def _oracle(flag: str, county: str, place: str) -> bool: + rule = EXPECTED_RULES[flag] + if rule[0] == "county": + return county == rule[1] + return county[:2] == rule[1] and place == rule[2] + + +# --------------------------------------------------------------------------- # +# Registry +# --------------------------------------------------------------------------- # + + +def test_packaged_registry_bytes_match_the_pinned_sha256() -> None: + payload = REGISTRY_PATH.read_bytes() + + assert hashlib.sha256(payload).hexdigest() == US_LOCAL_JURISDICTION_REGISTRY_SHA256 + assert REGISTRY.sha256 == US_LOCAL_JURISDICTION_REGISTRY_SHA256 + + +def test_registry_maps_each_input_only_flag_to_its_2020_geography() -> None: + by_flag = {item.flag: item for item in REGISTRY.jurisdictions} + + assert set(by_flag) == set(EXPECTED_RULES) + assert {flag: by_flag[flag].entity for flag in by_flag} == { + "in_denver": "household", + "in_wilmington": "household", + "in_yonkers": "household", + "pa_philadelphia_wage_tax_resident": "person", + } + for flag, rule in EXPECTED_RULES.items(): + item = by_flag[flag] + assert item.rule == rule[0] + if rule[0] == "county": + assert item.county_fips == rule[1] + else: + assert (item.state_fips, item.place_fips) == rule[1:] + assert by_flag["in_denver"].coextensive_place_fips == "20000" + assert by_flag["pa_philadelphia_wage_tax_resident"].coextensive_place_fips == ( + "60000" + ) + + +def test_registry_records_block_ladder_checks_that_match_its_populations() -> None: + document = json.loads(REGISTRY_PATH.read_text()) + populations = {item.flag: item.population_2020 for item in REGISTRY.jurisdictions} + national = document["sources"]["population"]["national_total_2020"] + + checks = document["block_ladder_checks"] + assert {check["block_ladder_sha256"][:8] for check in checks} == { + "6840b990", + "7ba39b95", + } + for check in checks: + assert check["population"] == national + assert { + flag: entry["population"] for flag, entry in check["jurisdictions"].items() + } == populations + for flag in ("in_denver", "pa_philadelphia_wage_tax_resident"): + entry = check["jurisdictions"][flag] + assert entry["coextensive_place_blocks"] == entry["blocks"] + + +def test_packaged_registry_refuses_bytes_that_differ_from_the_pin(tmp_path) -> None: + edited = tmp_path / "registry.json" + edited.write_bytes(REGISTRY_PATH.read_bytes() + b" ") + + with pytest.raises(ValueError, match="do not match the pinned SHA-256"): + load_us_local_jurisdiction_registry( + edited, expected_sha256=US_LOCAL_JURISDICTION_REGISTRY_SHA256 + ) + + +def _write_registry(path: Path, jurisdictions: list[dict]) -> Path: + path.write_text( + json.dumps( + { + "kind": "us_local_jurisdiction_registry", + "schema_version": 1, + "jurisdictions": jurisdictions, + } + ) + ) + return path + + +def _county_entry(**overrides: object) -> dict: + entry: dict[str, object] = { + "flag": "in_denver", + "entity": "household", + "jurisdiction": "Denver", + "rule": "county", + "state_fips": "08", + "county_fips": "08031", + "place_fips": None, + "coextensive_place_fips": "20000", + "population_2020": 700, + } + entry.update(overrides) + return entry + + +@pytest.mark.parametrize( + ("overrides", "message"), + [ + ({"county_fips": "8031"}, "5-digit string"), + ({"county_fips": 8031}, "5-digit string"), + ({"state_fips": "09"}, "is not in state"), + ({"rule": "tract"}, "rule must be one of"), + ({"entity": "tax_unit"}, "entity must be one of"), + ({"place_fips": "20000"}, "county rule names county_fips and no place_fips"), + ({"population_2020": 0}, "must be positive"), + ({"population_2020": True}, "must be an integer"), + ({"flag": "In_Denver"}, "lowercase identifier"), + ], +) +def test_registry_loader_refuses_malformed_entries( + tmp_path, overrides: dict, message: str +) -> None: + path = _write_registry(tmp_path / "registry.json", [_county_entry(**overrides)]) + + with pytest.raises(ValueError, match=message): + load_us_local_jurisdiction_registry(path) + + +def test_registry_loader_refuses_repeated_flags_and_geographies(tmp_path) -> None: + repeated_flag = _write_registry( + tmp_path / "flag.json", [_county_entry(), _county_entry(county_fips="08005")] + ) + repeated_geography = _write_registry( + tmp_path / "geography.json", + [_county_entry(), _county_entry(flag="in_denver_too")], + ) + + with pytest.raises(ValueError, match="repeats a flag"): + load_us_local_jurisdiction_registry(repeated_flag) + with pytest.raises(ValueError, match="repeats a geography"): + load_us_local_jurisdiction_registry(repeated_geography) + + +# --------------------------------------------------------------------------- # +# Derivation properties +# --------------------------------------------------------------------------- # + +# Registry codes, their neighbours and near misses, plus arbitrary codes. +_COUNTIES = st.one_of( + st.sampled_from( + [ + "08031", + "42101", + "36119", + "10003", + "08005", + "08032", + "18031", + "42103", + "42045", + "06037", + "37129", + "36005", + ] + ), + st.from_regex(r"\A[0-9]{5}\Z"), +) +_PLACES = st.one_of( + st.sampled_from( + ["", "84000", "77580", "20000", "60000", "84001", "77581", "04000"] + ), + st.from_regex(r"\A[0-9]{5}\Z"), +) +_GEOGRAPHY_ROWS = st.lists(st.tuples(_COUNTIES, _PLACES), min_size=1, max_size=40) + + +def _household_table(rows: list[tuple[str, str]]) -> pd.DataFrame: + return pd.DataFrame( + { + "household_id": np.arange(1, len(rows) + 1), + "county_fips": [county for county, _ in rows], + "place_fips": [place for _, place in rows], + } + ) + + +@settings(max_examples=200, deadline=None) +@given(_GEOGRAPHY_ROWS) +def test_flag_is_true_iff_county_or_state_and_place_match(rows) -> None: + household = _household_table(rows) + + values = us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + + assert set(values) == set(EXPECTED_RULES) + for flag, observed in values.items(): + assert observed.dtype == bool + expected = [_oracle(flag, county, place) for county, place in rows] + assert observed.tolist() == expected + + +@settings(max_examples=100, deadline=None) +@given(_GEOGRAPHY_ROWS, st.randoms(use_true_random=False)) +def test_derivation_commutes_with_household_row_order(rows, random) -> None: + household = _household_table(rows) + order = list(range(len(rows))) + random.shuffle(order) + shuffled = household.iloc[order].reset_index(drop=True) + + original = us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + reordered = us_local_jurisdiction_flag_values(shuffled, rungs=BLOCK_GEOGRAPHY_RUNGS) + repeated = us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + + for flag in original: + np.testing.assert_array_equal(reordered[flag], original[flag][order]) + np.testing.assert_array_equal(repeated[flag], original[flag]) + + +@settings(max_examples=100, deadline=None) +@given( + _GEOGRAPHY_ROWS.flatmap( + lambda rows: st.tuples( + st.just(rows), + st.lists( + st.integers(min_value=1, max_value=len(rows)), min_size=1, max_size=60 + ), + ) + ), + st.randoms(use_true_random=False), +) +def test_person_flags_carry_their_household_value_in_any_person_order( + case, random +) -> None: + rows, memberships = case + random.shuffle(memberships) + household = _household_table(rows) + person = pd.DataFrame( + { + "person_id": np.arange(1, len(memberships) + 1), + "person_household_id": memberships, + } + ) + + tables, _ = apply_us_local_jurisdiction_flags( + {"household": household, "person": person}, rungs=BLOCK_GEOGRAPHY_RUNGS + ) + + county = dict(zip(household["household_id"], household["county_fips"], strict=True)) + place = dict(zip(household["household_id"], household["place_fips"], strict=True)) + for flag in PERSON_FLAGS: + expected = [ + _oracle(flag, county[member], place[member]) for member in memberships + ] + assert tables["person"][flag].tolist() == expected + assert flag not in tables["household"] + for flag in HOUSEHOLD_FLAGS: + assert flag not in tables["person"] + assert "pa_philadelphia_wage_tax_resident" not in person # input untouched + + +@settings(max_examples=100, deadline=None) +@given(_GEOGRAPHY_ROWS) +def test_a_line_without_a_place_rung_never_writes_a_place_flag(rows) -> None: + household = _household_table(rows).drop(columns=["place_fips"]) + household["in_yonkers"] = False # a stale column from an earlier line + household["in_wilmington"] = np.nan + person = pd.DataFrame( + { + "person_id": household["household_id"], + "person_household_id": household["household_id"], + } + ) + + tables, receipt = apply_us_local_jurisdiction_flags( + {"household": household, "person": person}, rungs=PUMA_GEOGRAPHY_RUNGS + ) + + for flag in PLACE_FLAGS: + assert flag not in tables["household"] + assert receipt["flags"][flag]["status"] == JURISDICTION_FLAG_UNAVAILABLE + assert "no place rung" in receipt["flags"][flag]["reason"] + assert tables["household"]["in_denver"].tolist() == [ + county == "08031" for county, _ in rows + ] + assert receipt["flags"]["in_denver"]["status"] == JURISDICTION_FLAG_DERIVED + assert receipt["rungs"] == ["county"] + assert receipt["registry_sha256"] == US_LOCAL_JURISDICTION_REGISTRY_SHA256 + + +@pytest.mark.parametrize( + ("column", "value", "message"), + [ + ("county_fips", None, "county_fips must hold 5-digit"), + ("county_fips", np.nan, "county_fips must hold 5-digit"), + ("county_fips", 8031, "county_fips must hold 5-digit"), + ("county_fips", "8031", "county_fips must hold 5-digit"), + ("place_fips", None, "place_fips must hold empty or 5-digit"), + ("place_fips", "8400", "place_fips must hold empty or 5-digit"), + ("place_fips", 84000, "place_fips must hold empty or 5-digit"), + ], +) +def test_unknown_or_malformed_geography_raises_instead_of_writing_false( + column: str, value: object, message: str +) -> None: + household = _household_table([("36119", "84000"), ("08031", "")]) + household[column] = household[column].astype(object) + household.loc[1, column] = value + + with pytest.raises(ValueError, match=message): + us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + + +def test_missing_rung_column_raises() -> None: + household = _household_table([("36119", "84000")]).drop(columns=["place_fips"]) + + with pytest.raises(ValueError, match="no 'place_fips'"): + us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + + +def test_bytes_codes_from_an_h5_round_trip_are_decoded() -> None: + household = pd.DataFrame( + {"county_fips": [b"36119", b"10003"], "place_fips": [b"84000", b""]} + ) + + values = us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + + assert values["in_yonkers"].tolist() == [True, False] + assert values["in_wilmington"].tolist() == [False, False] + + +# --------------------------------------------------------------------------- # +# Population conservation over a block ladder +# --------------------------------------------------------------------------- # + +_LADDER_BLOCK = st.tuples( + st.sampled_from( + ["08031", "08005", "36119", "36005", "10003", "42101", "42045", "06037"] + ), + st.sampled_from([0, 84000, 77580, 20000, 60000, 4000]), + st.integers(min_value=1, max_value=5_000), +) + + +@settings(max_examples=60, deadline=None) +@given(st.lists(_LADDER_BLOCK, min_size=1, max_size=30)) +def test_flag_weighted_block_population_equals_the_jurisdictions_blocks(rows) -> None: + blocks = [ + FixtureBlock( + name=f"block_{index}", + block_geoid=int(f"{county}{index:06d}1000"), + place_fips=place, + congressional_district_geoid=int(county[:2]) * 100 + index % 100, + population=float(population), + ) + for index, (county, place, population) in enumerate(rows) + ] + # One household per block: the ladder's district-then-block draw is + # deterministic when every block owns its district. + blocks = list( + {block.congressional_district_geoid: block for block in blocks}.values() + ) + ladder = block_ladder(blocks) + household = pd.DataFrame(households_on_blocks_for(blocks)) + + assigned = assign_us_geography_ladder(household, ladder, seed=3) + values = us_local_jurisdiction_flag_values(assigned, rungs=BLOCK_GEOGRAPHY_RUNGS) + population = np.asarray([block.population for block in blocks]) + assert assigned["block_geoid"].tolist() == [ + f"{block.block_geoid:015d}" for block in blocks + ] + + for flag in EXPECTED_RULES: + expected = sum( + block.population + for block in blocks + if _oracle( + flag, + block.county_fips, + "" if block.place_fips == 0 else f"{block.place_fips:05d}", + ) + ) + assert float(population[values[flag]].sum()) == expected + + +def households_on_blocks_for(blocks: list[FixtureBlock]) -> list[dict[str, int]]: + return [ + { + "household_id": index + 1, + "state_fips": block.state_fips, + "congressional_district_geoid": block.congressional_district_geoid, + } + for index, block in enumerate(blocks) + ] + + +def _fixture_registry(tmp_path: Path, **population: int) -> object: + jurisdictions = [] + for item in REGISTRY.jurisdictions: + entry = { + "flag": item.flag, + "entity": item.entity, + "jurisdiction": item.jurisdiction, + "rule": item.rule, + "state_fips": item.state_fips, + "county_fips": item.county_fips, + "place_fips": item.place_fips, + "coextensive_place_fips": item.coextensive_place_fips, + "population_2020": population[item.flag], + } + jurisdictions.append(entry) + return load_us_local_jurisdiction_registry( + _write_registry(tmp_path / "registry.json", jurisdictions) + ) + + +def test_block_ladder_check_passes_on_exact_populations_and_coextensive_blocks( + tmp_path, +) -> None: + ladder = block_ladder() + registry = _fixture_registry( + tmp_path, + in_denver=700, + in_wilmington=70, + in_yonkers=210, + pa_philadelphia_wage_tax_resident=1600, + ) + + report = check_us_local_jurisdictions_against_block_ladder( + ladder.block_geoid, ladder.population, ladder.place_fips, registry=registry + ) + + assert report == { + "in_denver": {"blocks": 1, "population": 700, "coextensive_place_blocks": 1}, + "in_wilmington": {"blocks": 1, "population": 70}, + "in_yonkers": {"blocks": 1, "population": 210}, + "pa_philadelphia_wage_tax_resident": { + "blocks": 1, + "population": 1600, + "coextensive_place_blocks": 1, + }, + } + + +def test_block_ladder_check_refuses_a_population_off_by_one(tmp_path) -> None: + ladder = block_ladder() + registry = _fixture_registry( + tmp_path, + in_denver=700, + in_wilmington=70, + in_yonkers=211, + pa_philadelphia_wage_tax_resident=1600, + ) + + with pytest.raises(ValueError, match="in_yonkers: ladder population 210"): + check_us_local_jurisdictions_against_block_ladder( + ladder.block_geoid, ladder.population, ladder.place_fips, registry=registry + ) + + +def test_block_ladder_check_refuses_a_county_that_is_not_its_city(tmp_path) -> None: + denver = FIXTURE_BLOCK_BY_NAME["denver"] + outside_city = FixtureBlock("denver_outside_city", 80310002001000, 0, 802, 5.0) + ladder = block_ladder([*FIXTURE_BLOCKS, outside_city]) + registry = _fixture_registry( + tmp_path, + in_denver=int(denver.population + outside_city.population), + in_wilmington=70, + in_yonkers=210, + pa_philadelphia_wage_tax_resident=1600, + ) + + with pytest.raises(ValueError, match="are not the same blocks"): + check_us_local_jurisdictions_against_block_ladder( + ladder.block_geoid, ladder.population, ladder.place_fips, registry=registry + ) + + +# --------------------------------------------------------------------------- # +# Lines: block ladder, PUMA ladder, helper for the block-location draw +# --------------------------------------------------------------------------- # + +_NAMES = [block.name for block in FIXTURE_BLOCKS] + + +def _expected_block_flags(name: str) -> dict[str, bool]: + block = FIXTURE_BLOCK_BY_NAME[name] + place = "" if block.place_fips == 0 else f"{block.place_fips:05d}" + return {flag: _oracle(flag, block.county_fips, place) for flag in EXPECTED_RULES} + + +def test_block_line_writes_every_flag_as_an_engine_input() -> None: + people = [[{"age": 40}, {"age": 9}] for _ in _NAMES] + frame = us_frame(households_on_blocks(_NAMES), person_inputs=people) + + assigned = with_household_us_geography_ladder(frame, block_ladder(), seed=11) + + household = assigned.table("household") + person = assigned.table("person") + for position, name in enumerate(_NAMES): + expected = _expected_block_flags(name) + for flag in HOUSEHOLD_FLAGS: + assert bool(household[flag].iloc[position]) is expected[flag], (name, flag) + members = person["person_household_id"].eq( + household["household_id"].iloc[position] + ) + assert ( + person.loc[members, PERSON_FLAGS[0]].tolist() + == [expected[PERSON_FLAGS[0]]] * 2 + ) + assert sorted( + name for name in _NAMES if _expected_block_flags(name)["in_yonkers"] + ) == ["yonkers"] + assert sorted( + name for name in _NAMES if _expected_block_flags(name)["in_wilmington"] + ) == ["wilmington"] + assert household[list(HOUSEHOLD_FLAGS)].dtypes.eq(bool).all() + assert us_local_jurisdiction_flag_failures(household) == [] + + +def test_block_line_is_deterministic_and_receipts_every_flag_as_derived() -> None: + frame = us_frame(households_on_blocks(_NAMES), weights=np.arange(1, 11)) + + first = with_household_us_geography_ladder(frame, block_ladder(), seed=5) + second = with_household_us_geography_ladder(frame, block_ladder(), seed=5) + summary = us_geography_ladder_assignment_summary( + first.table("household"), + block_ladder(), + weight_values=first.weights_for("household").values, + ) + + for entity in ("household", "person"): + pd.testing.assert_frame_equal(first.table(entity), second.table(entity)) + receipt = summary["local_jurisdiction_flags"] + assert receipt["registry_sha256"] == US_LOCAL_JURISDICTION_REGISTRY_SHA256 + assert receipt["rungs"] == ["county", "place"] + assert {flag: entry["status"] for flag, entry in receipt["flags"].items()} == { + flag: JURISDICTION_FLAG_DERIVED for flag in EXPECTED_RULES + } + # Household weights are 1..10 in fixture order: yonkers is the third. + assert receipt["flags"]["in_yonkers"]["weighted_households_in_jurisdiction"] == 3.0 + assert receipt["flags"]["in_denver"]["households_in_jurisdiction"] == 1 + + +def test_frame_helper_matches_the_block_line_for_the_block_location_draw() -> None: + frame = us_frame(households_on_blocks(_NAMES)) + assigned = with_household_us_geography_ladder(frame, block_ladder(), seed=2) + stripped = assigned.table("household").drop(columns=list(HOUSEHOLD_FLAGS)) + tables = {entity: assigned.table(entity) for entity in assigned.entities} + tables["household"] = stripped + tables["person"] = tables["person"].drop(columns=list(PERSON_FLAGS)) + bare = type(assigned)( + tables, + assigned.schema, + {"household": assigned.weights_for("household")}, + ) + + rederived, receipt = with_us_local_jurisdiction_flags( + bare, rungs=BLOCK_GEOGRAPHY_RUNGS + ) + + for entity in ("household", "person"): + pd.testing.assert_frame_equal( + rederived.table(entity), assigned.table(entity), check_like=True + ) + assert receipt["flags"]["in_wilmington"]["status"] == JURISDICTION_FLAG_DERIVED + + +def _co_ny_pa_puma_ladder() -> UsPumaLadder: + # PUMA 0800101 spans Denver (600) and Arapahoe (400); PUMA 3600101 is in + # Westchester; PUMA 4200101 is Philadelphia. + puma = np.asarray([800101, 3600101, 4200101], dtype=np.int64) + return UsPumaLadder( + puma=puma, + puma_population=np.asarray([1000.0, 500.0, 800.0]), + cd_overlap_puma=puma.copy(), + cd_overlap_cd=np.asarray([801, 3616, 4203], dtype=np.int64), + cd_overlap_population=np.asarray([1000.0, 500.0, 800.0]), + county_overlap_puma=np.asarray( + [800101, 800101, 3600101, 4200101], dtype=np.int64 + ), + county_overlap_county=np.asarray([8031, 8005, 36119, 42101], dtype=np.int32), + county_overlap_population=np.asarray([600.0, 400.0, 500.0, 800.0]), + tract_overlap_puma=np.asarray( + [800101, 800101, 3600101, 4200101], dtype=np.int64 + ), + tract_overlap_tract=np.asarray( + [8031000100, 8005000100, 36119000100, 42101000100], dtype=np.int64 + ), + tract_overlap_population=np.asarray([600.0, 400.0, 500.0, 800.0]), + metadata={ + "schema_version": 1, + "kind": "us_puma_ladder", + "puma_vintage": "2020_puma", + "sampling_basis": "population", + "layers": { + "congressional_district": {"vintage": "119th_congress"}, + "county": {"vintage": "2020_census"}, + "tract": {"vintage": "2020_census"}, + }, + }, + ) + + +def test_puma_line_derives_county_flags_and_records_place_flags_unavailable() -> None: + households = [ + {"state_fips": 8, "puma": 800101, "in_yonkers": True, "in_wilmington": False} + for _ in range(40) + ] + [ + {"state_fips": 36, "puma": 3600101, "in_yonkers": True, "in_wilmington": False}, + { + "state_fips": 42, + "puma": 4200101, + "in_yonkers": False, + "in_wilmington": False, + }, + ] + frame = us_frame(households, person_inputs=[[{}, {}] for _ in households]) + + assigned = with_household_us_puma_ladder(frame, _co_ny_pa_puma_ladder(), seed=7) + household = assigned.table("household") + person = assigned.table("person") + summary = us_puma_ladder_assignment_summary(household, _co_ny_pa_puma_ladder()) + + for flag in PLACE_FLAGS: + assert flag not in household + county = household["county_fips"] + assert household["in_denver"].tolist() == county.eq("08031").tolist() + assert 0 < int(household["in_denver"].sum()) < 40 # both counties drawn + philly = household.set_index("household_id")["county_fips"].eq("42101") + assert person["pa_philadelphia_wage_tax_resident"].tolist() == ( + philly.loc[person["person_household_id"]].tolist() + ) + statuses = { + flag: entry["status"] + for flag, entry in summary["local_jurisdiction_flags"]["flags"].items() + } + assert statuses == { + "in_denver": JURISDICTION_FLAG_DERIVED, + "in_wilmington": JURISDICTION_FLAG_UNAVAILABLE, + "in_yonkers": JURISDICTION_FLAG_UNAVAILABLE, + "pa_philadelphia_wage_tax_resident": JURISDICTION_FLAG_DERIVED, + } + assert us_local_jurisdiction_flag_failures(household) == [] + + +# --------------------------------------------------------------------------- # +# Gates +# --------------------------------------------------------------------------- # + + +def _assigned_block_household() -> pd.DataFrame: + frame = us_frame(households_on_blocks(_NAMES)) + return with_household_us_geography_ladder(frame, block_ladder()).table("household") + + +def test_gate_accepts_consistent_or_absent_flags() -> None: + household = _assigned_block_household() + + assert us_local_jurisdiction_flag_failures(household) == [] + assert ( + us_local_jurisdiction_flag_failures( + household.drop(columns=list(HOUSEHOLD_FLAGS)) + ) + == [] + ) + + +@pytest.mark.parametrize("flag", HOUSEHOLD_FLAGS) +def test_gate_fails_a_flag_that_disagrees_with_its_rule(flag: str) -> None: + household = _assigned_block_household() + household[flag] = ~household[flag] + + failures = us_local_jurisdiction_flag_failures(household) + block_gate = us_geography_ladder_gate(household, np.ones(len(household))) + + assert failures == [ + f"{flag}: {len(household)}/{len(household)} row(s) disagree with the " + f"{REGISTRY_RULES[flag]} rule for {REGISTRY_GEOIDS[flag]}" + ] + assert failures[0] in block_gate.failures + + +REGISTRY_RULES = {item.flag: item.rule for item in REGISTRY.jurisdictions} +REGISTRY_GEOIDS = {item.flag: item.geoid for item in REGISTRY.jurisdictions} + + +def test_gate_fails_null_or_non_boolean_flags() -> None: + household = _assigned_block_household() + household["in_denver"] = household["in_denver"].astype(object) + household.loc[0, "in_denver"] = None + household["in_yonkers"] = household["in_yonkers"].map({True: "yes", False: "no"}) + + failures = us_local_jurisdiction_flag_failures(household) + + assert "in_denver: 1 null row(s)" in failures + assert "in_yonkers: holds non-boolean values" in failures + + +def test_puma_gate_fails_a_place_flag_with_no_place_rung() -> None: + household = pd.DataFrame( + { + "household_id": [1, 2], + "state_fips": [36, 36], + "puma": ["3600101", "3600101"], + "congressional_district_geoid": [3616, 3616], + "county_fips": ["36119", "36119"], + "county_fips_2023": ["36119", "36119"], + "in_yonkers": [False, False], + } + ) + + gate = us_puma_ladder_gate(household, np.ones(2), nyc_share_bounds=(0, 1)) + + assert any( + failure.startswith("in_yonkers: present but its place rung cannot decide it") + for failure in gate.failures + ) + + +def test_person_flag_column_requires_resolvable_households() -> None: + household = _household_table([("42101", "60000")]) + person = pd.DataFrame({"person_id": [1], "person_household_id": [99]}) + + with pytest.raises(ValueError, match="Every person must belong"): + apply_us_local_jurisdiction_flags( + {"household": household, "person": person}, rungs=BLOCK_GEOGRAPHY_RUNGS + ) + assert US_SCHEMA.membership_column("household") == "person_household_id" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool.py b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool.py index e53afbc40a..fe354b6e61 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool.py @@ -1036,9 +1036,11 @@ def test_remaining_stage_manifest_enumerates_every_simulation_projection_input() "declared_deferred_null_input": 3, "assembled_native_engine_input": 5, "frame_structural_engine_input": 10, - "preserved_stacked_engine_input": 4, + "preserved_stacked_engine_input": 6, + "geography_derived_jurisdiction_input": 2, + "unavailable_place_jurisdiction_input": 2, "derived_schedule_d_input": 1, - "declared_absent_engine_input": 762, + "declared_absent_engine_input": 756, "unprovisioned_source_input": 1, } ) @@ -1048,6 +1050,16 @@ def test_remaining_stage_manifest_enumerates_every_simulation_projection_input() if entry.provision == "preserved_stacked_engine_input" } assert preserved == { + ( + "household", + "congressional_district_geoid", + "ephemeral_simulation_projection_engine_default_if_present_null", + ), + ( + "household", + "county_fips", + "ephemeral_simulation_projection_engine_default_if_present_null", + ), ( "person", "is_related_to_head_or_spouse", @@ -1069,6 +1081,44 @@ def test_remaining_stage_manifest_enumerates_every_simulation_projection_input() "ephemeral_simulation_projection_engine_default_if_present_null", ), } + # The stacked pool draws county from the PUMA ladder but no place: the + # county-rule jurisdiction flags are derived with it at assembly, the + # place-rule ones are never written (local_jurisdictions). + jurisdiction = { + (entry.entity, entry.variable): ( + entry.provision, + entry.available_by, + entry.fallback, + ) + for entry in projection + if entry.provision + in { + "geography_derived_jurisdiction_input", + "unavailable_place_jurisdiction_input", + } + } + assert jurisdiction == { + ("household", "in_denver"): ( + "geography_derived_jurisdiction_input", + "assembled", + "ephemeral_simulation_projection_engine_default_if_present_null", + ), + ("person", "pa_philadelphia_wage_tax_resident"): ( + "geography_derived_jurisdiction_input", + "assembled", + "ephemeral_simulation_projection_engine_default_if_present_null", + ), + ("household", "in_wilmington"): ( + "unavailable_place_jurisdiction_input", + "simulate", + "policyengine_default_no_place_rung", + ), + ("household", "in_yonkers"): ( + "unavailable_place_jurisdiction_input", + "simulate", + "policyengine_default_no_place_rung", + ), + } assert all(entry.fallback is not None for entry in projection) diff --git a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py new file mode 100644 index 0000000000..2b22b63ded --- /dev/null +++ b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py @@ -0,0 +1,174 @@ +"""Local taxes reach households placed through the block-ladder line. + +Synthetic households are pinned to fixture blocks in Yonkers, Wilmington, +Denver and Philadelphia (and a neighbour of each), placed by +``with_household_us_geography_ladder``, and run through +``PolicyEngineUSEngine.materialize``. Each local tax or benefit is nonzero +for the resident and zero (or at the nonresident rate) for the neighbour, +and stripping the derived flags returns the resident to the neighbour's +result, so the flags, not other geography, drive the difference. +""" + +from __future__ import annotations + +import numpy as np +import pytest + +from microcosm.build.us_runtime.geography_ladder import ( + with_household_us_geography_ladder, +) +from microcosm.frame import Frame +from microcosm.frame.adapters.policyengine_us import PolicyEngineUSEngine +from test_support.microcosm_build.us_local_jurisdictions import ( + block_ladder, + households_on_blocks, + us_frame, +) + +PERIOD = 2026 +FLAGS = { + "household": ("in_denver", "in_wilmington", "in_yonkers"), + "person": ("pa_philadelphia_wage_tax_resident",), +} +# Every person carries every input column, so no table holds a null the +# engine would refuse. +NO_INPUTS = { + "age": 40, + "employment_income": 0.0, + "rent": 0.0, + "social_security_retirement": 0.0, + "pa_philadelphia_wage_tax_taxable_wages": 0.0, +} +WORKER = {**NO_INPUTS, "employment_income": 100_000.0} +PHILADELPHIA_WORKER = { + **NO_INPUTS, + "employment_income": 50_000.0, + "pa_philadelphia_wage_tax_taxable_wages": 50_000.0, +} +# Elderly low-income renter: Denver's renter relief needs rent, an elderly or +# disabled member, and income under the AMI-based limit. +DENVER_RENTER = { + **NO_INPUTS, + "age": 72, + "rent": 14_400.0, + "social_security_retirement": 9_000.0, +} +CASES = ( + ("yonkers", WORKER), + ("new_rochelle_westchester", WORKER), + ("wilmington", WORKER), + ("new_castle_unincorporated", WORKER), + ("denver", DENVER_RENTER), + ("aurora_arapahoe", DENVER_RENTER), + ("philadelphia", PHILADELPHIA_WORKER), + ("delaware_county_pa", PHILADELPHIA_WORKER), +) +ROW = {name: position for position, (name, _) in enumerate(CASES)} +OUTPUTS = ( + "ny_yonkers_income_tax", + "de_wilmington_earned_income_tax", + "co_denver_property_tax_relief_renter_eligible", + "co_denver_property_tax_relief", + "pa_philadelphia_wage_tax", + "in_denver", + "in_wilmington", + "in_yonkers", + "pa_philadelphia_wage_tax_resident", +) + + +@pytest.fixture(scope="module") +def placed() -> Frame: + frame = us_frame( + households_on_blocks([name for name, _ in CASES]), + person_inputs=[[dict(person)] for _, person in CASES], + ) + return with_household_us_geography_ladder(frame, block_ladder(), seed=0) + + +def _without_flags(frame: Frame) -> Frame: + tables = {entity: frame.table(entity) for entity in frame.entities} + for entity, flags in FLAGS.items(): + tables[entity] = tables[entity].drop(columns=list(flags)) + return Frame( + tables, + frame.schema, + {"household": frame.weights_for("household")}, + ) + + +@pytest.fixture(scope="module") +def engine() -> PolicyEngineUSEngine: + return PolicyEngineUSEngine() + + +@pytest.fixture(scope="module") +def with_flags(engine, placed) -> dict[str, np.ndarray]: + return dict(engine.materialize(placed, OUTPUTS, PERIOD)) + + +@pytest.fixture(scope="module") +def without_flags(engine, placed) -> dict[str, np.ndarray]: + return dict(engine.materialize(_without_flags(placed), OUTPUTS, PERIOD)) + + +def test_the_engine_loads_the_derived_flags(with_flags) -> None: + for flag, resident in ( + ("in_yonkers", "yonkers"), + ("in_wilmington", "wilmington"), + ("in_denver", "denver"), + ("pa_philadelphia_wage_tax_resident", "philadelphia"), + ): + assert np.flatnonzero(with_flags[flag]).tolist() == [ROW[resident]], flag + + +def test_yonkers_resident_surcharge_is_nonzero_only_in_yonkers( + with_flags, without_flags +) -> None: + tax = with_flags["ny_yonkers_income_tax"] + + assert tax[ROW["yonkers"]] > 0 + assert tax[ROW["new_rochelle_westchester"]] == 0 + assert without_flags["ny_yonkers_income_tax"][ROW["yonkers"]] == 0 + + +def test_wilmington_earned_income_tax_is_nonzero_only_in_wilmington( + with_flags, without_flags +) -> None: + tax = with_flags["de_wilmington_earned_income_tax"] + + assert tax[ROW["wilmington"]] > 0 + assert tax[ROW["new_castle_unincorporated"]] == 0 + assert without_flags["de_wilmington_earned_income_tax"][ROW["wilmington"]] == 0 + + +def test_denver_renter_relief_reaches_only_the_denver_renter( + with_flags, without_flags +) -> None: + eligible = with_flags["co_denver_property_tax_relief_renter_eligible"] + relief = with_flags["co_denver_property_tax_relief"] + + assert eligible[ROW["denver"]] > 0 + assert relief[ROW["denver"]] > 0 + assert eligible[ROW["aurora_arapahoe"]] == 0 + assert relief[ROW["aurora_arapahoe"]] == 0 + assert without_flags["co_denver_property_tax_relief"][ROW["denver"]] == 0 + + +def test_philadelphia_wage_tax_uses_the_resident_rate_for_residents( + with_flags, without_flags +) -> None: + from policyengine_us import CountryTaxBenefitSystem + + rates = CountryTaxBenefitSystem().parameters(PERIOD).gov.local.pa.philadelphia + resident_rate = rates.tax.income.resident_rate + nonresident_rate = rates.tax.income.nonresident_rate + wages = PHILADELPHIA_WORKER["pa_philadelphia_wage_tax_taxable_wages"] + tax = with_flags["pa_philadelphia_wage_tax"] + + assert resident_rate != nonresident_rate + assert tax[ROW["philadelphia"]] == pytest.approx(wages * resident_rate) + assert tax[ROW["delaware_county_pa"]] == pytest.approx(wages * nonresident_rate) + assert without_flags["pa_philadelphia_wage_tax"][ + ROW["philadelphia"] + ] == pytest.approx(wages * nonresident_rate) diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 58ea9b4bbc..7935076e6e 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -350,7 +350,7 @@ def capture_equality(expected: object, actual: object) -> None: # microcosm#1251's passive partnership/S-corp leaf in puf_support moves it. # microcosm#1259's recipient-share bound in puf_support moves it again. # microcosm#1261's entity split of line 32 moves it too. - "spec_sha256": "9b4b3260c20c30ba71a0947f8d78e322c8d2a3e6cb94e87a3729be950a9e90f2", + "spec_sha256": '0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c', }, } diff --git a/test_support/microcosm_build/us_local_jurisdictions.py b/test_support/microcosm_build/us_local_jurisdictions.py new file mode 100644 index 0000000000..a432c235c8 --- /dev/null +++ b/test_support/microcosm_build/us_local_jurisdictions.py @@ -0,0 +1,151 @@ +"""Shared fixtures for the US local-jurisdiction flag tests. + +A synthetic block ladder whose blocks sit in the registry jurisdictions, in a +neighbour of each, and in near misses (a registry place code in another +state), plus a small US frame builder. Each block has its own congressional +district, so assigning a household to that district pins it to that block and +the ladder assignment is deterministic. +""" + +from __future__ import annotations + +from collections.abc import Mapping, Sequence +from dataclasses import dataclass + +import numpy as np +import pandas as pd + +from microcosm.build.us_runtime.geography_ladder import UsBlockLadder +from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights + + +@dataclass(frozen=True) +class FixtureBlock: + name: str + block_geoid: int + place_fips: int + congressional_district_geoid: int + population: float + + @property + def state_fips(self) -> int: + return self.block_geoid // 10**13 + + @property + def county_fips(self) -> str: + return f"{self.block_geoid:015d}"[:5] + + +FIXTURE_BLOCKS: tuple[FixtureBlock, ...] = ( + FixtureBlock("denver", 80310001001000, 20000, 801, 700.0), + FixtureBlock("aurora_arapahoe", 80050001001000, 4000, 806, 300.0), + FixtureBlock("yonkers", 361190001001000, 84000, 3616, 210.0), + FixtureBlock("new_rochelle_westchester", 361190002001000, 50617, 3617, 80.0), + FixtureBlock("wilmington", 100030001001000, 77580, 1000, 70.0), + FixtureBlock("new_castle_unincorporated", 100030002001000, 0, 1001, 50.0), + FixtureBlock("philadelphia", 421010001001000, 60000, 4203, 1600.0), + FixtureBlock("delaware_county_pa", 420450001001000, 0, 4205, 500.0), + # Near misses: a registry place code in another state. + FixtureBlock("place_84000_in_california", 60370001001000, 84000, 630, 40.0), + FixtureBlock("place_77580_in_north_carolina", 371290001001000, 77580, 3707, 30.0), +) +FIXTURE_BLOCK_BY_NAME = {block.name: block for block in FIXTURE_BLOCKS} + + +def block_ladder_metadata() -> dict[str, object]: + layers = { + "congressional_district": {"vintage": "119th_congress"}, + "sldu": {"vintage": "2020_baf"}, + "sldl": {"vintage": "2020_baf"}, + "place": {"vintage": "2020_census"}, + "cbsa": {"vintage": "omb_2023_delineations"}, + } + return { + "schema_version": 1, + "kind": "us_block_ladder", + "block_vintage": "2020_tabulation_blocks", + "sampling_basis": "population", + "layers": layers, + } + + +def block_ladder(blocks: Sequence[FixtureBlock] = FIXTURE_BLOCKS) -> UsBlockLadder: + """A ladder holding ``blocks``, one congressional district per block.""" + + count = len(blocks) + return UsBlockLadder( + block_geoid=np.asarray([block.block_geoid for block in blocks], dtype=np.int64), + population=np.asarray([block.population for block in blocks], dtype=np.float64), + congressional_district_geoid=np.asarray( + [block.congressional_district_geoid for block in blocks], dtype=np.int64 + ), + sldu=np.asarray(["001"] * count, dtype="U3"), + sldl=np.asarray(["001"] * count, dtype="U3"), + place_fips=np.asarray([block.place_fips for block in blocks], dtype=np.int32), + cbsa_code=np.asarray([0] * count, dtype=np.int32), + metadata=block_ladder_metadata(), + ) + + +def us_frame( + households: Sequence[Mapping[str, object]], + *, + person_inputs: Sequence[Sequence[Mapping[str, object]]] | None = None, + weights: Sequence[float] | None = None, +) -> Frame: + """A US frame with one group unit of each kind per household. + + ``households`` gives each household's columns (``household_id`` is + assigned 1..n when absent); ``person_inputs`` gives each household's + people, one mapping of person columns each (one empty person by default). + """ + + household = pd.DataFrame(list(households)) + if "household_id" not in household: + household.insert(0, "household_id", np.arange(1, len(household) + 1)) + people = person_inputs or [[{}] for _ in range(len(household))] + if len(people) != len(household): + raise ValueError("person_inputs must give one list per household.") + rows: list[dict[str, object]] = [] + for household_id, members in zip(household["household_id"], people, strict=True): + for member in members: + row: dict[str, object] = {} + for group in US_SCHEMA.group_entities: + row[US_SCHEMA.membership_column(group)] = int(household_id) + row.update(member) + rows.append(row) + person = pd.DataFrame(rows) + person.insert(0, US_SCHEMA.person_id_column, np.arange(1, len(person) + 1)) + tables: dict[str, pd.DataFrame] = {"person": person, "household": household} + for group in US_SCHEMA.group_entities: + if group == "household": + continue + tables[group] = pd.DataFrame( + {US_SCHEMA.id_column(group): household["household_id"].to_numpy()} + ) + values = np.ones(len(household)) if weights is None else np.asarray(weights) + return Frame( + tables, + US_SCHEMA, + { + "household": Weights( + values=values.astype(np.float64), kind=WeightKind.DESIGN + ) + }, + ) + + +def households_on_blocks( + names: Sequence[str], +) -> list[dict[str, object]]: + """Household rows whose district pins each to the named fixture block.""" + + return [ + { + "state_fips": FIXTURE_BLOCK_BY_NAME[name].state_fips, + "congressional_district_geoid": ( + FIXTURE_BLOCK_BY_NAME[name].congressional_district_geoid + ), + } + for name in names + ] From 84ab87470e1640b4b76ed308d95012516bb81830 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 2 Nov 2026 09:55:05 -0500 Subject: [PATCH 04/32] Re-derive flags for existing artifacts, require flags in ladder gates, record the no-ladder pool receipt Answers the round-1 review of b7b3e21f: - rederive_us_local_jurisdiction_flags reads the rungs an existing artifact's own geography supports (county when county_fips is on every row; place only when place_fips and a 15-digit block_geoid are too), refuses carried household or person flags that disagree, and writes the flags. export_us_l0_refit_h5 and the fiscal refresh release builder call it on the loaded base and record the receipt. - Both ladder gates fail an absent flag whose rule the line's own rung decides (block: county and place; PUMA: county), so a missing column can no longer reach the engine as an all-False default. - build_optional_acs_multispine records the pool's flag receipt in provenance on both the ladder and no-ladder paths. Also classifies local_jurisdictions.py for the spine-blindness test, repins the engine ABI digest, and reruns the US spec repin chain (seed-kernel attestations hash geography_ladder.py and puma_ladder.py). Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- docs/evidence/spec-engine/us-f0-coverage.json | 16 +- .../build/spec_engine/inventory_coverage.py | 4 +- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 42 +++- .../build/us_runtime/acs_multispine.py | 19 ++ .../microcosm/build/us_runtime/base_pool.py | 21 +- .../build/us_runtime/geography_ladder.py | 11 +- .../build/us_runtime/l0_refit_export.py | 13 +- .../build/us_runtime/local_jurisdictions.py | 128 +++++++++++- .../microcosm/build/us_runtime/puma_ladder.py | 11 +- .../us/test_spec_engine_engine_abi.py | 2 +- .../shared/test_spec_engine_loader.py | 2 +- .../engine_free/us/test_us_acs_multispine.py | 39 +++- .../us/test_us_county_vintage_ladders.py | 1 + .../us/test_us_fiscal_refresh_builder.py | 39 ++++ .../us/test_us_geography_ladder.py | 15 ++ .../engine_free/us/test_us_l0_refit_export.py | 110 ++++++++++ .../us/test_us_local_jurisdictions.py | 193 +++++++++++++++++- .../engine_free/us/test_us_puma_ladder.py | 21 ++ .../engine_free/us/test_us_spine_blindness.py | 11 +- .../us/test_us_multispine_pool_tool.py | 2 +- tools/build_us_fiscal_refresh_release.py | 22 ++ 22 files changed, 678 insertions(+), 46 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 91c03e0812..580599da26 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, so a base built before this change no longer exports without them, and both ladder gates now fail a table that lacks a flag its geography decides. diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 63bec3740a..892852394a 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1656,13 +1656,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536", - "protocol_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59" + "map_sha256": "42c141d97283222723e0e96822f62f49829d3c5a1904fac950b1110af85028da", + "protocol_sha256": "cf465029597523a6efc4fd411601180ff811d26614f3af85ef0e0610f8b8f24d" }, "failures": [], "observed": { - "map_sha256": "6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536", - "protocol_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59" + "map_sha256": "42c141d97283222723e0e96822f62f49829d3c5a1904fac950b1110af85028da", + "protocol_sha256": "cf465029597523a6efc4fd411601180ff811d26614f3af85ef0e0610f8b8f24d" }, "status": "covered" }, @@ -1677,7 +1677,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59", + "implementation_sha256": "cf465029597523a6efc4fd411601180ff811d26614f3af85ef0e0610f8b8f24d", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1698,7 +1698,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59", + "implementation_sha256": "cf465029597523a6efc4fd411601180ff811d26614f3af85ef0e0610f8b8f24d", "protocol": "legacy-v1", "streams": [ "build_model", @@ -2599,7 +2599,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c" + "spec_sha256": "395510a7a23f8474ca9ce79daa87c7808c851474e82ad5e2be2a00e18b0c1fd2" } }, "report_schema_version": 3, @@ -2609,7 +2609,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c" + "spec_sha256": "395510a7a23f8474ca9ce79daa87c7808c851474e82ad5e2be2a00e18b0c1fd2" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index b21e586c4e..c2ee972e3e 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -380,8 +380,8 @@ # microcosm#1259's recipient-share bound in puf_support moves both again. # microcosm#1261 moves both again: the PUF donor carries partnership and # S-corp line-32 shares as separate leaves. - "seed_map": '6bbf3ec845a090db560539f63ccad777e201de749b9b27f708fd04ecdc6b6536', - "seed_protocol": '898b8ddab801f305ba2e18a8b474e2019bc6b958ea480bcdc6ebdb7f51440c59', + "seed_map": '42c141d97283222723e0e96822f62f49829d3c5a1904fac950b1110af85028da', + "seed_protocol": 'cf465029597523a6efc4fd411601180ff811d26614f3af85ef0e0610f8b8f24d', "source_manifest": "608c3621b1e4a108e57c8f83d16a184acdb3d05e16a81b895f7f72dbf5d0685c", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "071d418bb49976f4682c320d2ad07097c177de3a645d2524f235e1ff33ac83f9", diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index f5714a0939..1f16f92f7c 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -56,12 +56,46 @@ the new SHA-256 to pin. block-line flags and ACS rows without. The pool re-derives the county-rule flags for every row from the final county and removes the place-rule flags. Without a PUMA ladder it removes every flag, because ACS rows then have no - county. + county. `build_optional_acs_multispine` records the pool's receipt as + `provenance["local_jurisdiction_flags"]` on both paths. Missing, null or malformed geography raises; no line writes `False` for a -household whose county or place it does not know. Both ladder gates fail a -flag column that disagrees with its rule, or a place-rule flag on a table with -no complete `place_fips`. +household whose county or place it does not know. + +## Existing artifacts + +A base H5 built before this registry carries no flags. Two steps start from +an existing artifact rather than a geography line, and both call +`rederive_us_local_jurisdiction_flags` first: + +- the L0/refit export (`export_us_l0_refit_h5`), which records the receipt as + `local_jurisdiction_flags` in its summary; and +- the fiscal refresh release builder, on the loaded base or prepared pool, + which records the receipt under `support_value_repairs` in the calibration + diagnostics. + +The helper reads the rungs from the artifact's own geography +(`us_local_jurisdiction_rungs_present`): the county rung when `county_fips` is +on every row, and the place rung only when every row also has `place_fips` and +a 15-digit `block_geoid`. A pooled artifact whose ACS rows have no block +therefore gets the county-rule flags only. A flag the artifact already carries +must agree with its geography (household and person flags both), or the step +fails. + +## Gates + +Both ladder gates fail: + +- a flag column that disagrees with its rule; +- a null or non-boolean flag; +- a place-rule flag on a table with no complete `place_fips`; and +- a missing flag that the line's own rung decides. The block-ladder gate + requires `in_denver`, `in_yonkers` and `in_wilmington`; the PUMA-ladder gate + requires `in_denver`. + +The gates see only the household table, so they check the household flags. +`us_local_jurisdiction_flag_failures(household, person=...)` also checks that +each person carries its household's value. The Philadelphia flag records residence only. `pa_philadelphia_wage_tax` also needs `pa_philadelphia_wage_tax_taxable_wages`, which no line supplies yet, so diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py b/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py index e34c4b8060..5c38d181e3 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py @@ -45,12 +45,17 @@ transfer_acs_inputs, ) from microcosm.build.us_runtime.base_pool import ( + acs_pool_local_jurisdiction_rungs, preflight_pooled_ladder_geography, with_optional_acs_spine, ) from microcosm.build.us_runtime.congressional_district_vintage import ( CURRENT_CONGRESSIONAL_DISTRICT_VINTAGE, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + us_local_jurisdiction_flag_receipt, + us_local_jurisdiction_flag_values, +) from microcosm.build.us_runtime.puma_ladder import ( UsPumaLadder, us_puma_ladder_assignment_summary, @@ -74,6 +79,9 @@ class AcsMultispineResult: ``None`` when the base carries no role for the ACS spine to match. ``provenance["acs_group_quarters_children"]`` is the interim drop's receipt, or ``None`` when the caller kept those records. + ``provenance["local_jurisdiction_flags"]`` records which local-jurisdiction + flags the pool derived and which it left unavailable; without a PUMA + ladder that is every flag. """ frame: Frame @@ -251,6 +259,16 @@ def build_optional_acs_multispine( ) pooled = with_optional_acs_spine(base, transferred_frame, **pool_options) del transferred_frame + # The pool writes the flags its rungs decide and removes the rest; the + # receipt records both, with or without a PUMA ladder. + jurisdiction_rungs = acs_pool_local_jurisdiction_rungs(puma_ladder) + local_jurisdiction_flags = us_local_jurisdiction_flag_receipt( + us_local_jurisdiction_flag_values( + pooled.table("household"), rungs=jurisdiction_rungs + ), + rungs=jurisdiction_rungs, + household_weights=pooled.weights_for("household").values, + ) provenance = { "enabled": True, @@ -273,6 +291,7 @@ def build_optional_acs_multispine( "n_estimators": n_estimators, "max_targets_per_fit": max_targets_per_fit, }, + "local_jurisdiction_flags": _json_ready_mapping(local_jurisdiction_flags), } if hours_donor is not None or hours_donor_factory is not None: provenance["fit_configuration"]["hours_donor_channel"] = hours_donor_channel diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py index 29efc897ea..b770b3d9db 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py @@ -39,6 +39,7 @@ "ASEC_PUF_SPINE", "DEFAULT_ACS_POOL_PEAK_LIMIT_BYTES", "DONOR_ASSIGNED_GEOGRAPHY_COLUMNS", + "acs_pool_local_jurisdiction_rungs", "donor_assigned_geography_complete", "estimate_optional_acs_pool_peak_bytes", "preflight_pooled_ladder_geography", @@ -69,6 +70,19 @@ _PUMA_LADDER_ANCHOR_COLUMN = "__microcosm_puma_ladder_anchor" +def acs_pool_local_jurisdiction_rungs( + puma_ladder: UsPumaLadder | None, +) -> tuple[str, ...]: + """The local-jurisdiction rungs :func:`with_optional_acs_spine` supplies. + + With a PUMA ladder every row has a final county, so the county-rule + flags are derived; without one the ACS rows have no county and no flag + is. A caller records the pool's receipt with these rungs. + """ + + return PUMA_GEOGRAPHY_RUNGS if puma_ladder is not None else () + + def spine_column(entity: str) -> str: """Return the entity-prefixed base-spine metadata column.""" @@ -115,7 +129,9 @@ def with_optional_acs_spine( from the final county and the place-rule flags are removed (ACS rows have no place); without it every flag is removed, since ACS rows then have no county either. A flag column is never left half-null for the engine - default to fill. + default to fill. :func:`acs_pool_local_jurisdiction_rungs` names the rungs + used, so a caller can record which flags were derived and which were + left unavailable. ``max_peak_bytes`` is a fail-fast bound on estimated frame-resident peak memory. Pass ``None`` to disable the preflight. The estimate includes both @@ -202,8 +218,7 @@ def with_optional_acs_spine( ) tables.update( apply_us_local_jurisdiction_flags( - tables, - rungs=PUMA_GEOGRAPHY_RUNGS if puma_ladder is not None else (), + tables, rungs=acs_pool_local_jurisdiction_rungs(puma_ladder) )[0] ) if household_order is not None: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py index fb01c07229..1ed035bc50 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/geography_ladder.py @@ -584,9 +584,14 @@ def us_geography_ladder_gate( f"{cd_column}: {int(cd_mismatch.sum())}/{len(block)} row(s) " "have a state prefix disagreeing with block_geoid" ) - # A flag column is optional here (base H5s built before the flags carry - # none), but one that is present must match its county or place rule. - failures.extend(us_local_jurisdiction_flag_failures(household)) + # The block decides every household flag, so each must be present and + # match its county or place rule. A base H5 built before the flags + # existed fails here; rederive_us_local_jurisdiction_flags repairs it. + failures.extend( + us_local_jurisdiction_flag_failures( + household, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + ) total = float(weights.sum()) if total <= 0: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py index 10cd209e3d..c5e16b446d 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py @@ -77,6 +77,9 @@ US_IMMIGRATION_NONCONSTANT_PERSON_COLUMNS, ) from microcosm.build.us_runtime.input_mass import us_input_mass_totals +from microcosm.build.us_runtime.local_jurisdictions import ( + rederive_us_local_jurisdiction_flags, +) from microcosm.build.us_runtime.medicare_take_up import ( US_MEDICARE_TAKE_UP_NONCONSTANT_PERSON_COLUMNS, ) @@ -580,6 +583,11 @@ def export_us_l0_refit_h5( shipping. The geography-ladder gate runs on the selected support with its calibrated weights (microcosm #275/#34): a release whose spine is inconsistent or whose NYC mass collapsed fails by default. + + The local-jurisdiction flags are re-derived from the selected support's + own geography before the gate, so a base H5 built before the flags + existed exports them instead of leaving the engine default on every + resident; the summary records the receipt. """ root_attrs_source = ( @@ -592,7 +600,9 @@ def export_us_l0_refit_h5( weight_key=weight_key, zero_weight_tolerance=zero_weight_tolerance, ) - export_frame = attach_l0_refit_weights(base_frame, solution) + export_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags( + attach_l0_refit_weights(base_frame, solution) + ) if require_source_columns: assert_required_us_release_source_columns(export_frame) geography_ladder_gate = us_geography_ladder_gate( @@ -648,6 +658,7 @@ def export_us_l0_refit_h5( US_RELEASE_REQUIRED_HOUSEHOLD_NONCONSTANT_SOURCE_COLUMNS ), "required_source_columns_checked": bool(require_source_columns), + "local_jurisdiction_flags": local_jurisdiction_flags, "geography_ladder_gate_enforced": bool(require_geography_ladder), "geography_ladder_gate": { "passed": geography_ladder_gate.passed, diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py index 55b6646e06..be671c0057 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py @@ -31,6 +31,13 @@ place, so the place-rule flags are *unavailable* there: the line never writes them (any stale column is removed) and its receipt records them as unavailable with the reason, rather than writing ``False``. + +An artifact built before the flags existed carries none, so a step that +exports or recalibrates an existing artifact instead of running a geography +line calls :func:`rederive_us_local_jurisdiction_flags`. It derives every +flag the artifact's own geography decides and refuses a carried flag that +disagrees with that geography. Both ladder gates fail a table that lacks a +flag its geography decides. """ from __future__ import annotations @@ -333,6 +340,41 @@ def _text_codes( return series +def _holds_text_codes( + values: pd.Series, *, column: str, widths: tuple[int, ...] +) -> bool: + try: + _text_codes(values, column=column, widths=widths) + except ValueError: + return False + return True + + +def us_local_jurisdiction_rungs_present(household: pd.DataFrame) -> tuple[str, ...]: + """The rungs a finished household table's own geography supplies. + + For a step that starts from an artifact rather than a geography line. The + county rung needs ``county_fips`` on every row. The place rung also needs + every row to sit on a block: ``place_fips`` with no null row and a + 15-digit ``block_geoid`` on every row. A pooled table whose ACS rows have + no block therefore supplies only the county rung, even where a writer has + stored their missing place as an empty string. A malformed + ``county_fips`` is not judged here; deriving the flags raises on it. + """ + + if "county_fips" not in household or household["county_fips"].isna().any(): + return () + block_anchored = ( + "place_fips" in household + and not household["place_fips"].isna().any() + and "block_geoid" in household + and _holds_text_codes( + household["block_geoid"], column="block_geoid", widths=(15,) + ) + ) + return BLOCK_GEOGRAPHY_RUNGS if block_anchored else PUMA_GEOGRAPHY_RUNGS + + def us_local_jurisdiction_flag_values( household: pd.DataFrame, *, @@ -476,6 +518,48 @@ def with_us_local_jurisdiction_flags( ) +def rederive_us_local_jurisdiction_flags( + frame: Frame, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> tuple[Frame, dict[str, Any]]: + """Derive an existing artifact's flags from the geography it carries. + + For a step that exports or recalibrates an artifact rather than running a + geography line. A base H5 built before the flags existed carries none, + and exporting it as-is would leave the engine default (``False``) on + every resident. The rungs come from the artifact's own geography + (:func:`us_local_jurisdiction_rungs_present`). A flag the artifact + already carries must agree with that geography, or this raises: + re-deriving it would hide a corrupt artifact. + + The receipt adds ``carried_flags``, the flags the artifact already held. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + household = frame.table("household") + failures = us_local_jurisdiction_flag_failures( + household, person=frame.table("person"), registry=resolved + ) + if failures: + raise ValueError( + "The artifact carries local-jurisdiction flags that disagree with " + "its own geography: " + "; ".join(failures) + ) + carried = sorted( + item.flag + for item in resolved.jurisdictions + if item.flag in frame.table(item.entity) + ) + derived, receipt = with_us_local_jurisdiction_flags( + frame, + rungs=us_local_jurisdiction_rungs_present(household), + registry=resolved, + ) + receipt["carried_flags"] = carried + return derived, receipt + + def _person_household_positions( household: pd.DataFrame, person: pd.DataFrame ) -> np.ndarray: @@ -551,31 +635,51 @@ def us_local_jurisdiction_flag_receipt( def us_local_jurisdiction_flag_failures( household: pd.DataFrame, *, + person: pd.DataFrame | None = None, + required_rungs: Collection[str] = (), registry: UsLocalJurisdictionRegistry | None = None, ) -> list[str]: - """Gate check: every household flag column present agrees with geography. - - A flag column is optional (an artifact built before the flags existed - carries none), but one that is present must equal its rule applied to the - table's own ``county_fips``/``place_fips``. A place-rule flag on a table - with no complete ``place_fips`` fails: nothing could have decided it. + """Gate check: every flag column present agrees with the table's geography. + + A flag present must equal its rule applied to the table's own + ``county_fips``/``place_fips``. A place-rule flag on a table with no + complete ``place_fips`` fails: nothing could have decided it. A flag + whose rule is in ``required_rungs`` must also be present: a gate whose + line supplies that rung passes ``required_rungs``, so an artifact built + before the flags existed fails rather than leaving the engine default on + every resident. + + Person flags are checked only when ``person`` is given; each person must + carry its household's value. """ resolved = registry or packaged_us_local_jurisdiction_registry() + required = set(_normalized_rungs(required_rungs)) + tables = {"household": household, "person": person} failures: list[str] = [] - for item in resolved.for_entity("household"): - if item.flag not in household: + for item in resolved.jurisdictions: + table = tables[item.entity] + if table is None: + continue + if item.flag not in table: + if item.rule in required: + failures.append( + f"{item.flag}: absent, but this table's {item.rule} rung " + "decides it; the engine would default every row to False" + ) continue try: expected = us_local_jurisdiction_flag_values( household, rungs=(item.rule,), registry=resolved )[item.flag] + if item.entity == "person": + expected = expected[_person_household_positions(household, table)] except ValueError as error: failures.append( f"{item.flag}: present but its {item.rule} rung cannot decide it ({error})" ) continue - observed = household[item.flag] + observed = table[item.flag] if observed.isna().any(): failures.append(f"{item.flag}: {int(observed.isna().sum())} null row(s)") continue @@ -588,8 +692,8 @@ def us_local_jurisdiction_flag_failures( disagree = observed.astype(bool).to_numpy() != expected if disagree.any(): failures.append( - f"{item.flag}: {int(disagree.sum())}/{len(household)} row(s) " - f"disagree with the {item.rule} rule for {item.geoid}" + f"{item.flag}: {int(disagree.sum())}/{len(table)} {item.entity} " + f"row(s) disagree with the {item.rule} rule for {item.geoid}" ) return failures @@ -687,8 +791,10 @@ def check_us_local_jurisdictions_against_block_ladder( "check_us_local_jurisdictions_against_block_ladder", "load_us_local_jurisdiction_registry", "packaged_us_local_jurisdiction_registry", + "rederive_us_local_jurisdiction_flags", "us_local_jurisdiction_flag_failures", "us_local_jurisdiction_flag_receipt", "us_local_jurisdiction_flag_values", + "us_local_jurisdiction_rungs_present", "with_us_local_jurisdiction_flags", ] diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py index 21b559253c..a98dfdfc88 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py @@ -617,9 +617,14 @@ def us_puma_ladder_gate( f"{label}: {int(mismatched.sum())}/{len(values)} row(s) " "disagree with the expected state/county prefix" ) - # A present flag must match its rule; a place-rule flag fails here unless - # the table carries a complete place rung to decide it. - failures.extend(us_local_jurisdiction_flag_failures(household)) + # The drawn county decides the county-rule flags, so each must be present + # and match. A place-rule flag fails here unless the table carries a + # complete place rung to decide it. + failures.extend( + us_local_jurisdiction_flag_failures( + household, required_rungs=PUMA_GEOGRAPHY_RUNGS + ) + ) total = float(weights.sum()) if total <= 0: diff --git a/packages/microcosm-build/tests/engine_contract/us/test_spec_engine_engine_abi.py b/packages/microcosm-build/tests/engine_contract/us/test_spec_engine_engine_abi.py index 0e5b0343a8..5f9cf6792b 100644 --- a/packages/microcosm-build/tests/engine_contract/us/test_spec_engine_engine_abi.py +++ b/packages/microcosm-build/tests/engine_contract/us/test_spec_engine_engine_abi.py @@ -46,7 +46,7 @@ def test_checked_in_us_lock_is_fresh_schema_valid_and_not_authored() -> None: "simulate": 992, } assert remaining["receipt"]["manifest_sha256"] == ( - "d4fb9de9c0b8081474a24d0abde84ebf05eb346483fc20e3852e29abc769a501" + "6e70bc749ab7fd34d6bb902423a3240029d14533819cb5c6f1f75457875cf956" ) assert ( remaining["receipt"]["ssi_dependency_contract"]["engine_version_ref"] diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 95c0e6a093..c0793c0d9e 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -18,7 +18,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # self-employment feature in the imputation schema moves the schema-set # receipt, and its post-transfer step moves acs_transfer's attested bytes. assert first.spec_sha256 == ( - '13cd46573e0291b3305c97d6b0b741b16d8be78c12368e2b3b6935826820c62e' + '8525012b22f0edc6515d8e5261574015f8f277a7288ac601a55871c1487f9d19' ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py b/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py index f421dce480..480153eff1 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py @@ -100,7 +100,12 @@ def test__given_source__then_stages_run_in_order_and_provenance_is_json_ready( # The post-transfer adult-care gate probes the transferred frame's person # table; an empty table means "columns absent", so the gate scopes out. transferred_acs = SimpleNamespace(table=lambda entity: pd.DataFrame()) - pooled = object() + # Without a PUMA ladder the pool decides no local-jurisdiction flag, so + # its receipt reads no geography. + pooled = SimpleNamespace( + table=lambda entity: pd.DataFrame(), + weights_for=lambda entity: SimpleNamespace(values=np.ones(0)), + ) source = AcsPumsSource( tmp_path / "csv_hus.zip", tmp_path / "csv_pus.zip", @@ -189,7 +194,22 @@ def fake_pool(actual_base, actual_acs, *, acs_share): ] assert result.frame is pooled assert result.fit_records == (fit_record,) - assert result.provenance == { + provenance = dict(result.provenance) + local_jurisdiction_flags = provenance.pop("local_jurisdiction_flags") + assert local_jurisdiction_flags["rungs"] == [] + assert { + flag: (entry["status"], entry["reason"].split(";")[0]) + for flag, entry in local_jurisdiction_flags["flags"].items() + } == { + "in_denver": ("unavailable", "the line supplies no county rung"), + "in_wilmington": ("unavailable", "the line supplies no place rung"), + "in_yonkers": ("unavailable", "the line supplies no place rung"), + "pa_philadelphia_wage_tax_resident": ( + "unavailable", + "the line supplies no county rung", + ), + } + assert provenance == { "enabled": True, "acs_share": 0.4, "loader": { @@ -627,6 +647,21 @@ def test__given_ladder__then_multispine_records_geography_assignment( "block_geoid", "tract_geoid", ] + # With the ladder every row has a county: the county-rule flags are + # derived, the place-rule flags recorded unavailable. + statuses = { + flag: entry["status"] + for flag, entry in result.provenance["local_jurisdiction_flags"][ + "flags" + ].items() + } + assert statuses == { + "in_denver": "derived", + "in_wilmington": "unavailable", + "in_yonkers": "unavailable", + "pa_philadelphia_wage_tax_resident": "derived", + } + assert result.provenance["local_jurisdiction_flags"]["rungs"] == ["county"] def _test_puma_ladder() -> UsPumaLadder: diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_county_vintage_ladders.py b/packages/microcosm-build/tests/engine_free/us/test_us_county_vintage_ladders.py index 08266ad6c3..dc6b9eb4ec 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_county_vintage_ladders.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_county_vintage_ladders.py @@ -150,6 +150,7 @@ def test_puma_gate_checks_retained_donor_tracts_with_tractless_acs_rows( "county_fips": ["09013", "36061", "09013", "36001"], COUNTY_FIPS_2023_COLUMN: [donor_region, "36061", "09110", "36001"], "tract_geoid": [donor_tract, "36061000100", empty_tract, empty_tract], + "in_denver": [False] * 4, }, index=[1000, 2000, 3000, 4000], ) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index d1cf32d7ce..9545c935d6 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2559,6 +2559,22 @@ def test_legacy_cli_result_is_origin_main_three_key_fixture( assert builder.main.__annotations__["return"] in {None, "None"} +def test_builder_derives_local_jurisdiction_flags_before_selection_and_export() -> None: + import inspect + + builder = _load_builder_module() + source = inspect.getsource(builder._main) + base_load = source.index("base_frame = pool_frame") + derive = source.index( + "base_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags(" + ) + selection = source.index("base_frame, selection_report = select_frozen_support(") + export = source.index("release_engine.write_dataset(") + + assert base_load < derive < selection < export + assert source.count("rederive_us_local_jurisdiction_flags(") == 1 + + def test_frozen_support_selection_is_followed_by_weeks_unemployed_regate() -> None: builder = _load_builder_module() source = Path(builder.__file__).read_text(encoding="utf-8") @@ -7363,6 +7379,26 @@ def fake_load_frame(path, *, expected_sha256=None): return FakeFrame() monkeypatch.setattr(builder, "_load_frame", fake_load_frame) + # The household-only FakeFrame has no person table or geography; the + # flag derivation itself is covered in test_us_local_jurisdictions. + local_jurisdiction_receipt = { + "rungs": ["county", "place"], + "carried_flags": [], + "flags": {"in_yonkers": {"status": "derived"}}, + } + + def fake_rederive_local_jurisdiction_flags(frame): + captured["local_jurisdiction_frames"] = [ + *captured.get("local_jurisdiction_frames", []), + frame, + ] + return frame, local_jurisdiction_receipt + + monkeypatch.setattr( + builder, + "rederive_us_local_jurisdiction_flags", + fake_rederive_local_jurisdiction_flags, + ) if prepared_pool: def fake_load_pool(path, *, expected_manifest_sha256): @@ -9252,7 +9288,10 @@ def fake_release_gate_failures(*args, **kwargs): assert captured["diagnostics"]["support_value_repairs"] == { "social_security_components": ss_repair_payload, "non_sch_d_capital_gains": cgd_repair_payload, + "local_jurisdiction_flags": local_jurisdiction_receipt, } + # The flags are derived once, on the loaded base (or prepared pool). + assert len(captured["local_jurisdiction_frames"]) == 1 # The diagnostics carry a complete post-export scoring plan, never an # error record, so no plan line joins the terminal batch (#956). post_export_scoring = captured["diagnostics"]["post_export_scoring"] diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_geography_ladder.py b/packages/microcosm-build/tests/engine_free/us/test_us_geography_ladder.py index f60e8d02e0..9f6eec6f58 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_geography_ladder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_geography_ladder.py @@ -397,12 +397,27 @@ def _gated_household() -> tuple[pd.DataFrame, np.ndarray]: "sldu": ["027", "046", "024", "001"], "sldl": ["075", "109", "051", "001"], "cbsa_code": ["35620", "10580", "31080", ""], + # The block decides every household local-jurisdiction flag; none + # of these blocks is in Denver, Yonkers or Wilmington. + "in_denver": [False] * 4, + "in_wilmington": [False] * 4, + "in_yonkers": [False] * 4, } ) weights = np.asarray([2.6, 3.6, 73.8, 20.0]) return household, weights +@pytest.mark.parametrize("flag", ["in_denver", "in_wilmington", "in_yonkers"]) +def test_gate_fails_when_a_block_decided_flag_is_absent(flag: str) -> None: + household, weights = _gated_household() + + result = us_geography_ladder_gate(household.drop(columns=[flag]), weights) + + assert not result.passed + assert any(failure.startswith(f"{flag}: absent") for failure in result.failures) + + def _minimal_us_frame() -> Frame: tables = { "person": pd.DataFrame( diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py index 5aa49ccc9b..9950cdd5f8 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py @@ -1157,3 +1157,113 @@ def write_dataset(self, bundle, path, period): "household_vehicles_value", "tenure_type", ] + + +def _frame_with_yonkers_household(**household_extra: object) -> Frame: + """The fixture frame with household 20 moved onto a Yonkers block.""" + + frame = _us_frame() + household = frame.table("household").copy() + yonkers = { + "state_fips": 36, + "congressional_district_geoid": 3616, + "block_geoid": "361190001001000", + "tract_geoid": "36119000100", + "county_fips": "36119", + "county_fips_2023": "36119", + "place_fips": "84000", + } + for column, value in yonkers.items(): + household.loc[1, column] = value + for column, values in household_extra.items(): + household[column] = values + tables = {entity: frame.table(entity) for entity in frame.entities} + tables["household"] = household + return Frame(tables, frame.schema, {"household": frame.weights_for("household")}) + + +def test_export_derives_local_jurisdiction_flags_a_pre_flag_base_lacks( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + base_h5 = tmp_path / "base.h5" + base_h5.write_text("base") + output = tmp_path / "populace_us_2024.h5" + written: dict[str, Frame] = {} + + monkeypatch.setattr( + l0_refit_export, "load_us_frame", lambda path: _frame_with_yonkers_household() + ) + monkeypatch.setattr( + l0_refit_export, "copy_microcosm_root_attrs", lambda source, destination: () + ) + + class FakeEngine: + def write_dataset(self, bundle, path, period): + written["bundle"] = bundle + Path(path).write_text("sentinel") + + monkeypatch.setattr(l0_refit_export, "PolicyEngineUSEngine", FakeEngine) + + summary = export_us_l0_refit_h5( + base_h5=base_h5, + weights_npz=_l0_refit_npz(tmp_path), + output_h5=output, + input_mass_relative_tolerance=1.0, + # A single kept household cannot satisfy national NYC-share bounds. + require_geography_ladder=False, + ) + + household = written["bundle"].table("household") + person = written["bundle"].table("person") + assert household["household_id"].tolist() == [20] + assert household["in_yonkers"].tolist() == [True] + assert household["in_wilmington"].tolist() == [False] + assert household["in_denver"].tolist() == [False] + assert person["pa_philadelphia_wage_tax_resident"].tolist() == [False, False] + receipt = summary["local_jurisdiction_flags"] + assert receipt["carried_flags"] == [] + assert receipt["rungs"] == ["county", "place"] + assert receipt["flags"]["in_yonkers"]["status"] == "derived" + assert receipt["flags"]["in_yonkers"]["weighted_households_in_jurisdiction"] == ( + pytest.approx(333.0) + ) + # The gate ran on the derived flags: no flag failure is recorded. + assert not any( + failure.startswith(("in_", "pa_")) + for failure in summary["geography_ladder_gate"]["failures"] + ) + manifest = json.loads( + output.with_suffix(".l0_refit_export_summary.json").read_text() + ) + assert manifest["local_jurisdiction_flags"] == receipt + + +def test_export_refuses_a_base_whose_carried_flag_disagrees_with_its_geography( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + base_h5 = tmp_path / "base.h5" + base_h5.write_text("base") + output = tmp_path / "populace_us_2024.h5" + + monkeypatch.setattr( + l0_refit_export, + "load_us_frame", + lambda path: _frame_with_yonkers_household(in_yonkers=[False, False]), + ) + monkeypatch.setattr( + l0_refit_export, + "PolicyEngineUSEngine", + lambda: pytest.fail("a corrupt base must not reach the writer"), + ) + + with pytest.raises(ValueError, match="disagree with its own geography: in_yonkers"): + export_us_l0_refit_h5( + base_h5=base_h5, + weights_npz=_l0_refit_npz(tmp_path), + output_h5=output, + input_mass_relative_tolerance=1.0, + require_geography_ladder=False, + ) + assert not output.exists() diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index dadf6817b7..a89a5ec12b 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -42,8 +42,10 @@ check_us_local_jurisdictions_against_block_ladder, load_us_local_jurisdiction_registry, packaged_us_local_jurisdiction_registry, + rederive_us_local_jurisdiction_flags, us_local_jurisdiction_flag_failures, us_local_jurisdiction_flag_values, + us_local_jurisdiction_rungs_present, with_us_local_jurisdiction_flags, ) from microcosm.build.us_runtime.puma_ladder import ( @@ -754,8 +756,8 @@ def test_gate_fails_a_flag_that_disagrees_with_its_rule(flag: str) -> None: block_gate = us_geography_ladder_gate(household, np.ones(len(household))) assert failures == [ - f"{flag}: {len(household)}/{len(household)} row(s) disagree with the " - f"{REGISTRY_RULES[flag]} rule for {REGISTRY_GEOIDS[flag]}" + f"{flag}: {len(household)}/{len(household)} household row(s) disagree " + f"with the {REGISTRY_RULES[flag]} rule for {REGISTRY_GEOIDS[flag]}" ] assert failures[0] in block_gate.failures @@ -806,3 +808,190 @@ def test_person_flag_column_requires_resolvable_households() -> None: {"household": household, "person": person}, rungs=BLOCK_GEOGRAPHY_RUNGS ) assert US_SCHEMA.membership_column("household") == "person_household_id" + + +def _assigned_block_frame(): + frame = us_frame( + households_on_blocks(_NAMES), person_inputs=[[{}, {}] for _ in _NAMES] + ) + return with_household_us_geography_ladder(frame, block_ladder(), seed=3) + + +def test_gate_requires_every_flag_its_rungs_decide() -> None: + assigned = _assigned_block_frame() + household = assigned.table("household").drop(columns=list(HOUSEHOLD_FLAGS)) + person = assigned.table("person").drop(columns=list(PERSON_FLAGS)) + + block = us_local_jurisdiction_flag_failures( + household, person=person, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + puma = us_local_jurisdiction_flag_failures( + household, person=person, required_rungs=PUMA_GEOGRAPHY_RUNGS + ) + + assert sorted(failure.split(":")[0] for failure in block) == sorted(EXPECTED_RULES) + assert all("absent" in failure for failure in block) + assert sorted(failure.split(":")[0] for failure in puma) == [ + "in_denver", + "pa_philadelphia_wage_tax_resident", + ] + # Without required rungs an absent flag passes (pre-flag artifacts). + assert us_local_jurisdiction_flag_failures(household, person=person) == [] + + +def test_gate_checks_each_person_flag_against_its_household() -> None: + assigned = _assigned_block_frame() + household = assigned.table("household") + person = assigned.table("person").copy() + flag = PERSON_FLAGS[0] + + assert us_local_jurisdiction_flag_failures(household, person=person) == [] + person.loc[person.index[0], flag] = not person.loc[person.index[0], flag] + + assert us_local_jurisdiction_flag_failures(household, person=person) == [ + f"{flag}: 1/{len(person)} person row(s) disagree with the county rule for 42101" + ] + # The household-only gate cannot see person flags. + assert us_local_jurisdiction_flag_failures(household) == [] + + +# --------------------------------------------------------------------------- # +# Re-deriving an existing artifact (exports, release builder) +# --------------------------------------------------------------------------- # + + +def _block_table(**columns: list[object]) -> pd.DataFrame: + table = { + "household_id": [1, 2], + "county_fips": ["36119", "08031"], + "place_fips": ["84000", "20000"], + "block_geoid": ["361190001001000", "080310001001000"], + } + table.update(columns) + return pd.DataFrame(table) + + +@pytest.mark.parametrize( + ("columns", "expected"), + [ + ({}, BLOCK_GEOGRAPHY_RUNGS), + # A pooled table: ACS rows carry no place and no block. + ({"place_fips": ["84000", None]}, PUMA_GEOGRAPHY_RUNGS), + ( + {"place_fips": ["84000", ""], "block_geoid": ["361190001001000", ""]}, + PUMA_GEOGRAPHY_RUNGS, + ), + ( + {"block_geoid": ["361190001001000", None]}, + PUMA_GEOGRAPHY_RUNGS, + ), + ({"county_fips": ["36119", None]}, ()), + ], +) +def test_rungs_present_reads_the_artifacts_own_geography(columns, expected) -> None: + assert us_local_jurisdiction_rungs_present(_block_table(**columns)) == expected + + +def test_rungs_present_needs_the_columns_themselves() -> None: + table = _block_table() + + assert us_local_jurisdiction_rungs_present(table.drop(columns=["block_geoid"])) == ( + PUMA_GEOGRAPHY_RUNGS + ) + assert us_local_jurisdiction_rungs_present(table.drop(columns=["place_fips"])) == ( + PUMA_GEOGRAPHY_RUNGS + ) + assert ( + us_local_jurisdiction_rungs_present(table.drop(columns=["county_fips"])) == () + ) + + +def _without_flags(frame): + tables = {entity: frame.table(entity) for entity in frame.entities} + tables["household"] = tables["household"].drop(columns=list(HOUSEHOLD_FLAGS)) + tables["person"] = tables["person"].drop(columns=list(PERSON_FLAGS)) + return type(frame)( + tables, frame.schema, {"household": frame.weights_for("household")} + ) + + +@settings(max_examples=40, deadline=None) +@given(st.lists(st.sampled_from(_NAMES), min_size=1, max_size=12)) +def test_rederiving_a_pre_flag_artifact_restores_the_block_line_flags(names) -> None: + frame = us_frame(households_on_blocks(names), person_inputs=[[{}] for _ in names]) + assigned = with_household_us_geography_ladder(frame, block_ladder(), seed=1) + + rederived, receipt = rederive_us_local_jurisdiction_flags(_without_flags(assigned)) + again, again_receipt = rederive_us_local_jurisdiction_flags(rederived) + + for entity in ("household", "person"): + pd.testing.assert_frame_equal( + rederived.table(entity), assigned.table(entity), check_like=True + ) + pd.testing.assert_frame_equal(again.table(entity), rederived.table(entity)) + assert receipt["rungs"] == ["county", "place"] + assert receipt["carried_flags"] == [] + assert again_receipt["carried_flags"] == sorted(EXPECTED_RULES) + assert {entry["status"] for entry in receipt["flags"].values()} == { + JURISDICTION_FLAG_DERIVED + } + + +@pytest.mark.parametrize("flag", sorted(EXPECTED_RULES)) +def test_rederiving_refuses_a_carried_flag_that_disagrees(flag: str) -> None: + assigned = _assigned_block_frame() + tables = {entity: assigned.table(entity) for entity in assigned.entities} + entity = "person" if flag in PERSON_FLAGS else "household" + tables[entity] = tables[entity].assign(**{flag: ~tables[entity][flag]}) + corrupt = type(assigned)( + tables, assigned.schema, {"household": assigned.weights_for("household")} + ) + + with pytest.raises(ValueError, match=f"disagree with its own geography: {flag}"): + rederive_us_local_jurisdiction_flags(corrupt) + + +def test_rederiving_a_pooled_artifact_leaves_place_flags_unavailable() -> None: + # A donor row on the Yonkers block and an ACS row in Denver with no block + # or place: the place rule cannot be decided for the ACS row. + households = [ + { + "state_fips": 36, + "county_fips": "36119", + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + { + "state_fips": 8, + "county_fips": "08031", + "place_fips": None, + "block_geoid": None, + }, + ] + frame = us_frame(households, person_inputs=[[{}], [{}]]) + + rederived, receipt = rederive_us_local_jurisdiction_flags(frame) + + household = rederived.table("household") + assert "in_yonkers" not in household and "in_wilmington" not in household + assert household["in_denver"].tolist() == [False, True] + assert receipt["rungs"] == ["county"] + assert receipt["flags"]["in_yonkers"]["status"] == JURISDICTION_FLAG_UNAVAILABLE + assert receipt["carried_flags"] == [] + + +def test_rederiving_without_a_county_writes_no_flag() -> None: + rederived, receipt = rederive_us_local_jurisdiction_flags( + us_frame([{"state_fips": 36}]) + ) + + assert receipt["rungs"] == [] + assert not set(EXPECTED_RULES) & set(rederived.table("household")) + assert {entry["status"] for entry in receipt["flags"].values()} == { + JURISDICTION_FLAG_UNAVAILABLE + } + # A carried flag that no county could have decided is refused. + with pytest.raises(ValueError, match="in_denver: present but its county rung"): + rederive_us_local_jurisdiction_flags( + us_frame([{"state_fips": 36, "in_denver": False}]) + ) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_puma_ladder.py b/packages/microcosm-build/tests/engine_free/us/test_us_puma_ladder.py index dab67ef235..1546a6c5c2 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_puma_ladder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_puma_ladder.py @@ -428,12 +428,33 @@ def _gated_household() -> tuple[pd.DataFrame, np.ndarray]: "congressional_district_geoid": [3612, 3620, 653, 4802], "county_fips": ["36061", "36001", "06037", "48001"], "county_fips_2023": ["36061", "36001", "06037", "48001"], + # The drawn county decides the county-rule flag; no county here is + # Denver. + "in_denver": [False] * 4, } ) weights = np.asarray([2.6, 3.6, 73.8, 20.0]) return household, weights +def test_gate_fails_when_the_county_decided_flag_is_absent() -> None: + household, weights = _gated_household() + + result = us_puma_ladder_gate(household.drop(columns=["in_denver"]), weights) + + assert not result.passed + assert any(failure.startswith("in_denver: absent") for failure in result.failures) + + +def test_gate_does_not_require_a_place_flag() -> None: + household, weights = _gated_household() + + result = us_puma_ladder_gate(household, weights) + + assert "in_yonkers" not in household and "in_wilmington" not in household + assert result.passed, result.failures + + def _minimal_us_frame() -> Frame: tables = { "person": pd.DataFrame( diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py index 1cb0f4c622..4da9d81ac1 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py @@ -283,6 +283,9 @@ "input_mass.py", "l0_refit_export.py", "late_producer_dag.py", # Pure contract/schedule derivation; no treatment. + # Local-jurisdiction flags as a pure function of county/place codes; + # no population treatment. + "local_jurisdictions.py", "medicaid_take_up.py", # Reviewed held-out Medicare IRMAA diagnostic; no population treatment. "medicare_irmaa_holdout.py", @@ -3522,9 +3525,11 @@ def test_pool_build_tool_import_graph_is_source_spine_blind() -> None: # block_ladder_sources.py, whose CT_STATE_FIPS they import (#1376). All # are classified by the runtime registries and scanned below like every # reached module. 81 adds puf_source_schedule_e.py, the PUF donor's - # Schedule E line-32 and passive supplement (#1239). - assert len(runtime_graph) == 81, ( - f"{tool.name} must reach the pinned 81-module runtime graph; " + # Schedule E line-32 and passive supplement (#1239). 82 adds + # local_jurisdictions.py, which the PUMA ladder calls to write the + # county-rule local-jurisdiction flags. + assert len(runtime_graph) == 82, ( + f"{tool.name} must reach the pinned 82-module runtime graph; " f"reached {len(runtime_graph)}" ) assert not missing_modules, ( diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 7935076e6e..d7e1330db9 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -350,7 +350,7 @@ def capture_equality(expected: object, actual: object) -> None: # microcosm#1251's passive partnership/S-corp leaf in puf_support moves it. # microcosm#1259's recipient-share bound in puf_support moves it again. # microcosm#1261's entity split of line 32 moves it too. - "spec_sha256": '0b5c29e4155721556e7f93b278a9b01586f178c06fe945d21e2c336270fc4e3c', + "spec_sha256": '395510a7a23f8474ca9ce79daa87c7808c851474e82ad5e2be2a00e18b0c1fd2', }, } diff --git a/tools/build_us_fiscal_refresh_release.py b/tools/build_us_fiscal_refresh_release.py index 415b2e8bd1..f4a3205e58 100644 --- a/tools/build_us_fiscal_refresh_release.py +++ b/tools/build_us_fiscal_refresh_release.py @@ -271,6 +271,9 @@ attach_l0_refit_entity_weights, load_us_frame, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + rederive_us_local_jurisdiction_flags, +) from microcosm.build.us_runtime.medicare_irmaa_holdout import ( medicare_irmaa_holdout_from_sim, medicare_irmaa_holdout_unavailable, @@ -12933,6 +12936,24 @@ def _main(argv: Sequence[str] | None = None) -> int | None: base_frame = _load_frame(base_h5, expected_sha256=base_dataset_sha256) else: base_frame = pool_frame + # A base built before the local-jurisdiction flags existed carries none, + # and the engine would then default every Yonkers, Wilmington, Denver + # and Philadelphia resident to False. Derive them from the base's own + # geography; a carried flag that disagrees with it is refused. + base_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags( + base_frame + ) + if telemetry is not None: + telemetry.stage( + "local_jurisdiction_flags", + message="Derived local-jurisdiction flags from the base geography.", + rungs=local_jurisdiction_flags["rungs"], + carried_flags=local_jurisdiction_flags["carried_flags"], + flag_status={ + flag: entry["status"] + for flag, entry in local_jurisdiction_flags["flags"].items() + }, + ) capital_gains_tail_presence = assert_puf_capital_gains_tail_survives_selection( base_frame, base_frame, @@ -15448,6 +15469,7 @@ def _main(argv: Sequence[str] | None = None) -> int | None: support_value_repairs={ "social_security_components": social_security_component_repair, "non_sch_d_capital_gains": non_sch_d_cgd_repair, + "local_jurisdiction_flags": local_jurisdiction_flags, }, warm_start_calibration=warm_start_calibration, selection_source=selection_source_payload, From 51022c0de5a569eb7bb619e5640736d585011144 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 2 Nov 2026 12:24:13 -0500 Subject: [PATCH 05/32] Regenerate the H3 US post-transfer parity fixture for the new pool manifest tools/graph_us_post_transfer_fixture.py rewrote the pinned graph's remaining_stage_manifest_sha256 (d4fb9de9 -> 6e70bc74) after this PR moved the pool manifest. Sources and expected.csv are byte-identical; the tool's own graph-parity check passed. Co-Authored-By: Claude Opus 5.5 --- .../fixtures/parity/us_post_transfer/us_post_transfer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/microcosm-graph/tests/fixtures/parity/us_post_transfer/us_post_transfer.json b/packages/microcosm-graph/tests/fixtures/parity/us_post_transfer/us_post_transfer.json index 3a063d64dc..18d9252fb3 100644 --- a/packages/microcosm-graph/tests/fixtures/parity/us_post_transfer/us_post_transfer.json +++ b/packages/microcosm-graph/tests/fixtures/parity/us_post_transfer/us_post_transfer.json @@ -1 +1 @@ -{"country":"us","nodes":[{"base":null,"citation":"","description":"Load the synthetic stacked pool after ACS transfer.","id":"create_stacked_pool","inputs":[],"kernel":"us.post_transfer.create@1","mass":"conserve","outputs":[{"column":"A_AGE","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"A_SEX","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"source_year","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"measured","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_spine_source_id","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_source_id","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_support_channel","dtype":"string","entity":"person","ownership":"produced","rows":"all"},{"column":"person_support_clone_index","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"age","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"SEMP","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"long_term_capital_gains_before_response","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"non_sch_d_capital_gains","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"non_qualified_dividend_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"estate_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"farm_operations_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"farm_rent_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"partnership_s_corp_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"rental_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"business_is_sstb","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"qualified_bdc_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"qualified_reit_and_ptp_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_medicaid_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_chip_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_basic_health_program_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_medicare_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_ssi_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_early_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_wic_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"short_term_capital_gains","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"long_term_capital_gains_on_collectibles","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"TYPEHUGQ","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_spine_source_id","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_source_id","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_support_channel","dtype":"string","entity":"household","ownership":"produced","rows":"all"},{"column":"household_support_clone_index","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"tax_unit_spine_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_support_channel","dtype":"string","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_support_clone_index","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_dc_ptc","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_aca_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_ca_premium_subsidy_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_co_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_nm_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_transfer_applied","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_is_synthetic","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_filing_status_code","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_agi_band_index","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_transfer_weight","dtype":"float64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"unrecaptured_section_1250_gain","dtype":"float64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_spine_source_id","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_source_id","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_support_channel","dtype":"string","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_support_clone_index","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_snap_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_tanf_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_housing_assistance_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"family_spine_source_id","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"family_source_id","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"family_support_channel","dtype":"string","entity":"family","ownership":"produced","rows":"all"},{"column":"family_support_clone_index","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"marital_unit_spine_source_id","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_source_id","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_support_channel","dtype":"string","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_support_clone_index","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"}],"params":{"context_schema_version":1},"population":null,"sources":["stacked"],"structural":"create","weights":null},{"base":"create_stacked_pool","citation":"","description":"Open a population version for prepare_stacked_tail_derivation rewrites.","id":"prepare_stacked_tail_derivation.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Clear clone-2 Schedule-D incumbents before derivation.","id":"prepare_stacked_tail_derivation","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.prepare@1","mass":"conserve","outputs":[{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"stage":"prepare_stacked_tail_derivation"},"population":"prepare_stacked_tail_derivation.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":"prepare_stacked_tail_derivation.boundary","citation":"","description":"Open a population version for derive_multispine_pool_inputs rewrites.","id":"derive_multispine_pool_inputs.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Derive Schedule-D and reconcile the QBI input family.","id":"derive_multispine_pool_inputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","non_qualified_dividend_income","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.derive@1","mass":"conserve","outputs":[{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"estate_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"farm_operations_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"farm_rent_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"partnership_s_corp_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"rental_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"business_is_sstb","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"qualified_bdc_income","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"qualified_reit_and_ptp_income","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"qbi_contract_version":2,"remaining_stage_manifest_sha256":"d4fb9de9c0b8081474a24d0abde84ebf05eb346483fc20e3852e29abc769a501","schedule_d_asset_sha256":"e7d31a5956dc420940002b5c5120b4fa7f6af6fa8bf071d488affe35b616611d","stage":"derive_multispine_pool_inputs"},"population":"derive_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":"derive_multispine_pool_inputs.boundary","citation":"","description":"Open a population version for seed_multispine_pool_inputs rewrites.","id":"seed_multispine_pool_inputs.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Seed take-up inputs and disclose remaining defaults.","id":"seed_multispine_pool_inputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.seed@1","mass":"conserve","outputs":[{"column":"takes_up_snap_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_tanf_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_eitc","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_medicaid_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_chip_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_basic_health_program_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_medicare_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_ssi_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_dc_ptc","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_early_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_housing_assistance_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_wic_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_aca_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_ca_premium_subsidy_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_co_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_nm_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"engine_ref":"policyengine-us","seed":0,"stage":"seed_multispine_pool_inputs","take_up_contract_version":1,"take_up_resource_sha256":"9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35","time_period":2024},"population":"seed_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":null,"citation":"","description":"Materialize SSI on the disposable agreement view.","id":"materialize_multispine_agreement_outputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain","takes_up_eitc"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.materialize@1","mass":"conserve","outputs":[{"column":"ssi","dtype":"float64","entity":"person","ownership":"produced","rows":"all"}],"params":{"engine_input_defaults_sha256":"f938af6506623f453ca55922cf4a8ba6443d5f780f85e4381b777083a90396a0","engine_input_projection_sha256":"cefb137f164c6629589a887bbb56831ebc463cd46909a72ead4dbe0557961e61","engine_ref":"policyengine-us","household_batch_size":5000,"ssi_dependency_sha256":"200ca39e784511e9ede685261f5e0840198ec2b9c4292a522c0fc504c535b31c","stage":"materialize_multispine_agreement_outputs","time_period":2024},"population":"seed_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null}],"sources":[{"codec":"csv-tables","description":"Synthetic stacked US pool at the completed ACS-transfer boundary.","name":"stacked"}]} +{"country":"us","nodes":[{"base":null,"citation":"","description":"Load the synthetic stacked pool after ACS transfer.","id":"create_stacked_pool","inputs":[],"kernel":"us.post_transfer.create@1","mass":"conserve","outputs":[{"column":"A_AGE","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"A_SEX","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"source_year","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"measured","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_spine_source_id","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_source_id","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"person_support_channel","dtype":"string","entity":"person","ownership":"produced","rows":"all"},{"column":"person_support_clone_index","dtype":"int64","entity":"person","ownership":"produced","rows":"all"},{"column":"age","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"SEMP","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"long_term_capital_gains_before_response","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"non_sch_d_capital_gains","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"non_qualified_dividend_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"estate_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"farm_operations_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"farm_rent_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"partnership_s_corp_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"rental_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"business_is_sstb","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"qualified_bdc_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"qualified_reit_and_ptp_income","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"sstb_w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_medicaid_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_chip_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_basic_health_program_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_medicare_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_ssi_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_early_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"takes_up_wic_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rows":"all"},{"column":"short_term_capital_gains","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"long_term_capital_gains_on_collectibles","dtype":"float64","entity":"person","ownership":"produced","rows":"all"},{"column":"TYPEHUGQ","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_spine_source_id","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_source_id","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"household_support_channel","dtype":"string","entity":"household","ownership":"produced","rows":"all"},{"column":"household_support_clone_index","dtype":"int64","entity":"household","ownership":"produced","rows":"all"},{"column":"tax_unit_spine_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_support_channel","dtype":"string","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"tax_unit_support_clone_index","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_dc_ptc","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_aca_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_ca_premium_subsidy_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_co_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_nm_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_transfer_applied","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_is_synthetic","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_source_id","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_filing_status_code","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_donor_agi_band_index","dtype":"int64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"puf_capital_gains_tail_transfer_weight","dtype":"float64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"unrecaptured_section_1250_gain","dtype":"float64","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_spine_source_id","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_source_id","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_support_channel","dtype":"string","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"spm_unit_support_clone_index","dtype":"int64","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_snap_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_tanf_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"takes_up_housing_assistance_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rows":"all"},{"column":"family_spine_source_id","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"family_source_id","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"family_support_channel","dtype":"string","entity":"family","ownership":"produced","rows":"all"},{"column":"family_support_clone_index","dtype":"int64","entity":"family","ownership":"produced","rows":"all"},{"column":"marital_unit_spine_source_id","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_source_id","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_support_channel","dtype":"string","entity":"marital_unit","ownership":"produced","rows":"all"},{"column":"marital_unit_support_clone_index","dtype":"int64","entity":"marital_unit","ownership":"produced","rows":"all"}],"params":{"context_schema_version":1},"population":null,"sources":["stacked"],"structural":"create","weights":null},{"base":"create_stacked_pool","citation":"","description":"Open a population version for prepare_stacked_tail_derivation rewrites.","id":"prepare_stacked_tail_derivation.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Clear clone-2 Schedule-D incumbents before derivation.","id":"prepare_stacked_tail_derivation","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.prepare@1","mass":"conserve","outputs":[{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"stage":"prepare_stacked_tail_derivation"},"population":"prepare_stacked_tail_derivation.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":"prepare_stacked_tail_derivation.boundary","citation":"","description":"Open a population version for derive_multispine_pool_inputs rewrites.","id":"derive_multispine_pool_inputs.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Derive Schedule-D and reconcile the QBI input family.","id":"derive_multispine_pool_inputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","non_qualified_dividend_income","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.derive@1","mass":"conserve","outputs":[{"column":"schedule_d_capital_gain_distributions","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"estate_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"farm_operations_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"farm_rent_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"partnership_s_corp_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"rental_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_self_employment_income_would_be_qualified","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"business_is_sstb","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"qualified_bdc_income","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"qualified_reit_and_ptp_income","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"sstb_w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"unadjusted_basis_qualified_property","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"w2_wages_from_qualified_business","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"self_employment_income_before_lsr","dtype":"float64","entity":"person","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"qbi_contract_version":2,"remaining_stage_manifest_sha256":"6e70bc749ab7fd34d6bb902423a3240029d14533819cb5c6f1f75457875cf956","schedule_d_asset_sha256":"e7d31a5956dc420940002b5c5120b4fa7f6af6fa8bf071d488affe35b616611d","stage":"derive_multispine_pool_inputs"},"population":"derive_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":"derive_multispine_pool_inputs.boundary","citation":"","description":"Open a population version for seed_multispine_pool_inputs rewrites.","id":"seed_multispine_pool_inputs.boundary","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.identity@1","mass":"conserve","outputs":[],"params":{},"population":null,"sources":[],"structural":"filter","weights":null},{"base":null,"citation":"","description":"Seed take-up inputs and disclose remaining defaults.","id":"seed_multispine_pool_inputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.seed@1","mass":"conserve","outputs":[{"column":"takes_up_snap_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_tanf_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_eitc","dtype":"bool","entity":"tax_unit","ownership":"produced","rows":"all"},{"column":"takes_up_medicaid_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_chip_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_basic_health_program_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_medicare_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_ssi_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_dc_ptc","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_early_head_start_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_housing_assistance_if_eligible","dtype":"bool","entity":"spm_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_wic_if_eligible","dtype":"bool","entity":"person","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_aca_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_ca_premium_subsidy_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_co_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"},{"column":"takes_up_nm_premium_assistance_if_eligible","dtype":"bool","entity":"tax_unit","ownership":"produced","rewrite":true,"rows":"all"}],"params":{"engine_ref":"policyengine-us","seed":0,"stage":"seed_multispine_pool_inputs","take_up_contract_version":1,"take_up_resource_sha256":"9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35","time_period":2024},"population":"seed_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null},{"base":null,"citation":"","description":"Materialize SSI on the disposable agreement view.","id":"materialize_multispine_agreement_outputs","inputs":[{"columns":["A_AGE","A_SEX","source_year","measured","person_spine_source_id","person_source_id","person_support_channel","person_support_clone_index","age","SEMP","long_term_capital_gains_before_response","non_sch_d_capital_gains","schedule_d_capital_gain_distributions","self_employment_income_before_lsr","non_qualified_dividend_income","estate_income_would_be_qualified","farm_operations_income_would_be_qualified","farm_rent_income_would_be_qualified","partnership_s_corp_income_would_be_qualified","rental_income_would_be_qualified","self_employment_income_would_be_qualified","sstb_self_employment_income_would_be_qualified","business_is_sstb","qualified_bdc_income","qualified_reit_and_ptp_income","sstb_self_employment_income_before_lsr","sstb_unadjusted_basis_qualified_property","sstb_w2_wages_from_qualified_business","unadjusted_basis_qualified_property","w2_wages_from_qualified_business","takes_up_medicaid_if_eligible","takes_up_chip_if_eligible","takes_up_basic_health_program_if_eligible","takes_up_medicare_if_eligible","takes_up_ssi_if_eligible","takes_up_head_start_if_eligible","takes_up_early_head_start_if_eligible","takes_up_wic_if_eligible","short_term_capital_gains","long_term_capital_gains_on_collectibles"],"entity":"person","rows":"all"},{"columns":["TYPEHUGQ","household_spine_source_id","household_source_id","household_support_channel","household_support_clone_index"],"entity":"household","rows":"all"},{"columns":["tax_unit_spine_source_id","tax_unit_source_id","tax_unit_support_channel","tax_unit_support_clone_index","takes_up_dc_ptc","takes_up_aca_if_eligible","takes_up_ca_premium_subsidy_if_eligible","takes_up_co_premium_assistance_if_eligible","takes_up_nm_premium_assistance_if_eligible","puf_capital_gains_tail_transfer_applied","puf_capital_gains_tail_donor_is_synthetic","puf_capital_gains_tail_donor_source_id","puf_capital_gains_tail_donor_filing_status_code","puf_capital_gains_tail_donor_agi_band_index","puf_capital_gains_tail_transfer_weight","unrecaptured_section_1250_gain","takes_up_eitc"],"entity":"tax_unit","rows":"all"},{"columns":["spm_unit_spine_source_id","spm_unit_source_id","spm_unit_support_channel","spm_unit_support_clone_index","takes_up_snap_if_eligible","takes_up_tanf_if_eligible","takes_up_housing_assistance_if_eligible"],"entity":"spm_unit","rows":"all"},{"columns":["family_spine_source_id","family_source_id","family_support_channel","family_support_clone_index"],"entity":"family","rows":"all"},{"columns":["marital_unit_spine_source_id","marital_unit_source_id","marital_unit_support_channel","marital_unit_support_clone_index"],"entity":"marital_unit","rows":"all"}],"kernel":"us.post_transfer.materialize@1","mass":"conserve","outputs":[{"column":"ssi","dtype":"float64","entity":"person","ownership":"produced","rows":"all"}],"params":{"engine_input_defaults_sha256":"f938af6506623f453ca55922cf4a8ba6443d5f780f85e4381b777083a90396a0","engine_input_projection_sha256":"cefb137f164c6629589a887bbb56831ebc463cd46909a72ead4dbe0557961e61","engine_ref":"policyengine-us","household_batch_size":5000,"ssi_dependency_sha256":"200ca39e784511e9ede685261f5e0840198ec2b9c4292a522c0fc504c535b31c","stage":"materialize_multispine_agreement_outputs","time_period":2024},"population":"seed_multispine_pool_inputs.boundary","sources":["stacked"],"structural":"none","weights":null}],"sources":[{"codec":"csv-tables","description":"Synthetic stacked US pool at the completed ACS-transfer boundary.","name":"stacked"}]} From 792f3a73ca4fdca06b4e18a1848d586675bbc948 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 3 Nov 2026 08:16:23 -0500 Subject: [PATCH 06/32] Derive local-jurisdiction flags again after every support reduction Review r2 finding 1: the rungs belong to the whole household table, so a pooled base whose ACS rows carry no block decides only the county-rule flags, and a frozen support or L0 support that keeps only block-anchored donors would export without in_yonkers and in_wilmington even though its own geography decides them. The fiscal refresh builder now derives the flags on the loaded base, again right after frozen-support selection (before target materialization), and again on the export frame once the L0 or full-pool weights attach, before any export gate or the H5 write. The calibration diagnostics record each receipt under support_value_repairs.local_jurisdiction_flags, keyed base, frozen_support and export. rederive_us_local_jurisdiction_flags returns the same frame when it already carries exactly the flags its rungs decide, as boolean columns, so the repeat calls copy no tables. Property tests check that deriving a selection of a derived support equals deriving the kept rows from scratch and leaves every decidable flag, and that the unchanged return equals a rewrite. The commit also adds us_local_jurisdiction_artifact_receipt, which refuses an artifact that lacks or contradicts a flag its own geography decides and otherwise returns the receipt a derivation would give. The selection property test uses it as its completeness oracle; the annual static-aging lane uses it in the next commit. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 23 +- .../build/us_runtime/local_jurisdictions.py | 116 ++++++++-- .../us/test_us_fiscal_refresh_builder.py | 160 ++++++++++++- .../us/test_us_local_jurisdictions.py | 218 +++++++++++++++++- tools/build_us_fiscal_refresh_release.py | 89 +++++-- 6 files changed, 562 insertions(+), 46 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 580599da26..3dba6f678c 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, so a base built before this change no longer exports without them, and both ladder gates now fail a table that lacks a flag its geography decides. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index 1f16f92f7c..dd5bd08e42 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -66,12 +66,16 @@ household whose county or place it does not know. A base H5 built before this registry carries no flags. Two steps start from an existing artifact rather than a geography line, and both call -`rederive_us_local_jurisdiction_flags` first: - -- the L0/refit export (`export_us_l0_refit_h5`), which records the receipt as - `local_jurisdiction_flags` in its summary; and -- the fiscal refresh release builder, on the loaded base or prepared pool, - which records the receipt under `support_value_repairs` in the calibration +`rederive_us_local_jurisdiction_flags`: + +- the L0/refit export (`export_us_l0_refit_h5`) calls it on the selected + support and records the receipt as `local_jurisdiction_flags` in its + summary; and +- the fiscal refresh release builder calls it on the loaded base or prepared + pool, again on the frozen support when a selection source reduces it, and + again on the export support after the L0 or full-pool weights attach. It + records each receipt, keyed `base`, `frozen_support` and `export`, under + `support_value_repairs.local_jurisdiction_flags` in the calibration diagnostics. The helper reads the rungs from the artifact's own geography @@ -82,6 +86,13 @@ therefore gets the county-rule flags only. A flag the artifact already carries must agree with its geography (household and person flags both), or the step fails. +The rungs belong to the whole table, so removing rows can add one: a frozen +support or L0 support that keeps only block-anchored donors decides +`in_yonkers` and `in_wilmington` even though the pooled base did not. That is +why the builder derives the flags again after each step that removes rows. +Deriving a support that already carries exactly the flags it decides returns +the same frame, so these repeat calls copy no tables. + ## Gates Both ladder gates fail: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py index be671c0057..7f6e48fb01 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py @@ -38,6 +38,15 @@ flag the artifact's own geography decides and refuses a carried flag that disagrees with that geography. Both ladder gates fail a table that lacks a flag its geography decides. + +The rungs belong to the whole household table: one row without a block +withholds the place rung from every row. A step that removes rows (a +frozen-support or L0 selection) can therefore make a place-rule flag +decidable, so it derives the flags again on the rows it keeps; deriving a +support whose flags are already complete returns it unchanged. A step that +must keep an artifact's columns and bytes, and so cannot write the flags, +calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses +an artifact that lacks a flag its geography decides. """ from __future__ import annotations @@ -526,12 +535,19 @@ def rederive_us_local_jurisdiction_flags( """Derive an existing artifact's flags from the geography it carries. For a step that exports or recalibrates an artifact rather than running a - geography line. A base H5 built before the flags existed carries none, - and exporting it as-is would leave the engine default (``False``) on - every resident. The rungs come from the artifact's own geography - (:func:`us_local_jurisdiction_rungs_present`). A flag the artifact - already carries must agree with that geography, or this raises: - re-deriving it would hide a corrupt artifact. + geography line, and for every step that then removes rows from it. A base + H5 built before the flags existed carries none, and exporting it as-is + would leave the engine default (``False``) on every resident. The rungs + come from the artifact's own geography + (:func:`us_local_jurisdiction_rungs_present`), so a selection that drops + every row without a block makes the place-rule flags decidable on the + rows it keeps. A flag the artifact already carries must agree with that + geography, or this raises: re-deriving it would hide a corrupt artifact. + + An artifact that already carries exactly the flags its rungs decide, as + boolean columns, comes back as the same object with the same receipt + that writing them again would give; writing them would only copy every + table. The receipt adds ``carried_flags``, the flags the artifact already held. """ @@ -546,18 +562,91 @@ def rederive_us_local_jurisdiction_flags( "The artifact carries local-jurisdiction flags that disagree with " "its own geography: " + "; ".join(failures) ) - carried = sorted( - item.flag + carried = _carried_flags(frame, resolved) + rungs = us_local_jurisdiction_rungs_present(household) + values = us_local_jurisdiction_flag_values( + household, rungs=rungs, registry=resolved + ) + complete = set(carried) == set(values) and all( + frame.table(item.entity)[item.flag].dtype == np.dtype(bool) for item in resolved.jurisdictions - if item.flag in frame.table(item.entity) + if item.flag in values ) - derived, receipt = with_us_local_jurisdiction_flags( - frame, - rungs=us_local_jurisdiction_rungs_present(household), + if complete: + # Every carried flag agrees with the geography (checked above), and + # the carried set is the derivable set: writing them changes nothing. + derived = frame + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=rungs, + registry=resolved, + household_weights=frame.weights_for("household").values, + ) + else: + derived, receipt = with_us_local_jurisdiction_flags( + frame, rungs=rungs, registry=resolved + ) + receipt["carried_flags"] = carried + return derived, receipt + + +def us_local_jurisdiction_artifact_receipt( + frame: Frame, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, Any]: + """Require an artifact to carry its flags already, and return its receipt. + + For a step that must keep an artifact's columns and bytes, so it cannot + write the flags itself (the annual static-aging lane copies its parent's + source year and keeps its columns in every projected year). The artifact + must carry every flag its own geography decides + (:func:`us_local_jurisdiction_rungs_present`), each agreeing with that + geography, and no flag its rungs cannot decide. Otherwise this raises: + the engine would default a missing flag to ``False`` on every resident. + The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` + returns. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + household = frame.table("household") + rungs = us_local_jurisdiction_rungs_present(household) + failures = us_local_jurisdiction_flag_failures( + household, + person=frame.table("person"), + required_rungs=rungs, registry=resolved, ) + values = us_local_jurisdiction_flag_values( + household, rungs=rungs, registry=resolved + ) + carried = _carried_flags(frame, resolved) + failures.extend( + f"{flag}: present, but this artifact's rungs {list(rungs)} do not decide it" + for flag in carried + if flag not in values + ) + if failures: + raise ValueError( + "The artifact lacks or contradicts local-jurisdiction flags its own " + "geography decides: " + "; ".join(failures) + ) + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=rungs, + registry=resolved, + household_weights=frame.weights_for("household").values, + ) receipt["carried_flags"] = carried - return derived, receipt + return receipt + + +def _carried_flags(frame: Frame, registry: UsLocalJurisdictionRegistry) -> list[str]: + return sorted( + item.flag + for item in registry.jurisdictions + if item.flag in frame.table(item.entity) + ) def _person_household_positions( @@ -792,6 +881,7 @@ def check_us_local_jurisdictions_against_block_ladder( "load_us_local_jurisdiction_registry", "packaged_us_local_jurisdiction_registry", "rederive_us_local_jurisdiction_flags", + "us_local_jurisdiction_artifact_receipt", "us_local_jurisdiction_flag_failures", "us_local_jurisdiction_flag_receipt", "us_local_jurisdiction_flag_values", diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index 9545c935d6..6550c64752 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2559,20 +2559,140 @@ def test_legacy_cli_result_is_origin_main_three_key_fixture( assert builder.main.__annotations__["return"] in {None, "None"} -def test_builder_derives_local_jurisdiction_flags_before_selection_and_export() -> None: +def test_builder_derives_flags_after_every_support_reduction() -> None: + # The rungs belong to the whole household table, so a step that removes + # rows can make the place-rule flags decidable (microcosm#1453 review r2). + # _main derives on the loaded base, again on the frozen support before + # anything materializes targets from it, and again on the export support + # before any export gate reads it or the H5 is written from it. import inspect builder = _load_builder_module() source = inspect.getsource(builder._main) base_load = source.index("base_frame = pool_frame") - derive = source.index( - "base_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags(" - ) + base = source.index('support="base"') selection = source.index("base_frame, selection_report = select_frozen_support(") - export = source.index("release_engine.write_dataset(") + frozen = source.index('support="frozen_support"') + selection_report = source.index("selection_source_payload = selection_report") + mass_repair = source.index( + "base_frame, base_population_repair = _with_base_population_mass_repair(" + ) + full_pool_export = source.index("export_frame = _with_calibrated_weights(") + l0_export = source.index( + "export_frame = _with_l0_refit_weights(base_frame, result)" + ) + export_assignment = source.index("export_frame = _with_local_jurisdiction_flags(") + export = source.index('support="export"') + first_export_use = source.index("result = _without_calibrated_frames(", l0_export) + write = source.index("release_engine.write_dataset(export_frame") + + assert base_load < base < selection < frozen < selection_report < mass_repair + assert full_pool_export < l0_export < export_assignment < export < first_export_use + assert first_export_use < write + # Nothing reassigns the export frame after the derivation, and the + # helper is the only caller of the derivation. + assert source.rfind("export_frame = ") == export_assignment + assert source.count("_with_local_jurisdiction_flags(") == len( + builder.LOCAL_JURISDICTION_FLAG_SUPPORTS + ) + assert "rederive_us_local_jurisdiction_flags(" not in source + + +def test_builder_flags_follow_the_support_through_frozen_and_l0_selection() -> None: + # The microcosm#1453 review r2 case, on real frames: a pooled base with a + # Yonkers donor on a block and an ACS row with no block decides only the + # county-rule flags. A frozen support from a block-line release, or an L0 + # support without the ACS row, keeps only the donor, so in_yonkers becomes + # decidable; selection alone would export the donor without it. + from microcosm.build.us_runtime.l0_refit_export import ( + attach_l0_refit_entity_weights, + ) + from microcosm.build.us_runtime.warm_start_selection import ( + SelectionSource, + select_frozen_support, + ) + from test_support.microcosm_build.us_local_jurisdictions import us_frame - assert base_load < derive < selection < export - assert source.count("rederive_us_local_jurisdiction_flags(") == 1 + class StageRecorder: + def __init__(self) -> None: + self.stages: list[tuple[str, dict[str, object]]] = [] + + def stage(self, name: str, **details: object) -> None: + self.stages.append((name, details)) + + builder = _load_builder_module() + pooled = us_frame( + [ + { + "household_source_id": 101, + "state_fips": 36, + "county_fips": "36119", + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + { + "household_source_id": 202, + "state_fips": 8, + "county_fips": "08031", + "place_fips": None, + "block_geoid": None, + }, + ], + person_inputs=[[{}], [{}]], + ) + receipts: dict[str, object] = {} + telemetry = StageRecorder() + + def derive(frame, support): + return builder._with_local_jurisdiction_flags( + frame, support=support, receipts=receipts, telemetry=telemetry + ) + + base = derive(pooled, "base") + assert "in_yonkers" not in base.table("household") + assert base.table("household")["in_denver"].tolist() == [False, True] + assert receipts["base"]["rungs"] == ["county"] + assert receipts["base"]["flags"]["in_yonkers"]["status"] == "unavailable" + + frozen, _report = select_frozen_support( + base, + SelectionSource(join_key=("household_source_id",), identities=[[101]]), + ) + assert "in_yonkers" not in frozen.table("household") + frozen = derive(frozen, "frozen_support") + assert frozen.table("household")["in_yonkers"].tolist() == [True] + assert frozen.table("household")["in_wilmington"].tolist() == [False] + assert receipts["frozen_support"]["rungs"] == ["county", "place"] + assert receipts["frozen_support"]["carried_flags"] == [ + "in_denver", + "pa_philadelphia_wage_tax_resident", + ] + + l0_support = attach_l0_refit_entity_weights( + base, + weight_entity="household", + selected_entity_ids=np.asarray([1]), + selected_weights=np.asarray([5.0]), + reason="fixture L0 support", + ) + assert "in_yonkers" not in l0_support.table("household") + exported = derive(l0_support, "export") + assert exported.table("household")["in_yonkers"].tolist() == [True] + assert receipts["export"]["flags"]["in_yonkers"]["status"] == "derived" + assert receipts["export"]["flags"]["in_yonkers"][ + "weighted_households_in_jurisdiction" + ] == pytest.approx(5.0) + # A support whose flags are already complete comes back unchanged. + assert derive(exported, "export") is exported + assert [name for name, _details in telemetry.stages] == [ + "local_jurisdiction_flags_base", + "local_jurisdiction_flags_frozen_support", + "local_jurisdiction_flags_export", + "local_jurisdiction_flags_export", + ] + assert telemetry.stages[1][1]["rungs"] == ["county", "place"] + with pytest.raises(ValueError, match="Unknown local-jurisdiction flag support"): + derive(exported, "selected") def test_frozen_support_selection_is_followed_by_weeks_unemployed_regate() -> None: @@ -7159,6 +7279,7 @@ def complete(self): def fake_write_dataset(frame, path, *, period): captured["written_dataset"] = Path(path) + captured["written_frame"] = frame Path(path).parent.mkdir(parents=True, exist_ok=True) Path(path).write_bytes(b"release h5") @@ -7392,6 +7513,12 @@ def fake_rederive_local_jurisdiction_flags(frame): *captured.get("local_jurisdiction_frames", []), frame, ] + if isinstance(frame, FakeExportFrame): + # A new object, so the run can show that every export gate and + # the written H5 see the derived frame, not the L0 support. + derived = FakeExportFrame() + captured["local_jurisdiction_export_frame"] = derived + return derived, local_jurisdiction_receipt return frame, local_jurisdiction_receipt monkeypatch.setattr( @@ -8949,6 +9076,12 @@ def fake_release_gate_failures(*args, **kwargs): terminal_mode if terminal_mode in stored_input_modes else None ), ) + if terminal_mode != "stored_input_refused": + # The H5 is written from the frame the export derivation returned. + assert ( + captured["written_frame"] + is (captured["local_jurisdiction_export_frame"]) + ) return try: @@ -9288,10 +9421,17 @@ def fake_release_gate_failures(*args, **kwargs): assert captured["diagnostics"]["support_value_repairs"] == { "social_security_components": ss_repair_payload, "non_sch_d_capital_gains": cgd_repair_payload, - "local_jurisdiction_flags": local_jurisdiction_receipt, + "local_jurisdiction_flags": { + "base": local_jurisdiction_receipt, + "export": local_jurisdiction_receipt, + }, } - # The flags are derived once, on the loaded base (or prepared pool). - assert len(captured["local_jurisdiction_frames"]) == 1 + # The flags are derived on the loaded base (or prepared pool) and again + # on the export support; this harness selects no frozen support. + assert [type(frame) for frame in captured["local_jurisdiction_frames"]] == [ + FakeFrame, + FakeExportFrame, + ] # The diagnostics carry a complete post-export scoring plan, never an # error record, so no plan line joins the terminal batch (#956). post_export_scoring = captured["diagnostics"]["post_export_scoring"] diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index a89a5ec12b..29d4927c21 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -10,7 +10,10 @@ - derivation is deterministic and commutes with any reordering of household or person rows, and each person carries its household's value; - a line without a place rung never writes a place-rule flag, and missing or - malformed geography raises instead of yielding ``False``. + malformed geography raises instead of yielding ``False``; +- deriving a selection of a derived support equals deriving the selected rows + from scratch, and leaves every flag the kept rows' geography decides; +- deriving a support whose flags are already complete returns it unchanged. """ from __future__ import annotations @@ -22,7 +25,7 @@ import numpy as np import pandas as pd import pytest -from hypothesis import given, settings +from hypothesis import example, given, settings from hypothesis import strategies as st from microcosm.build.us_runtime.geography_ladder import ( @@ -43,6 +46,7 @@ load_us_local_jurisdiction_registry, packaged_us_local_jurisdiction_registry, rederive_us_local_jurisdiction_flags, + us_local_jurisdiction_artifact_receipt, us_local_jurisdiction_flag_failures, us_local_jurisdiction_flag_values, us_local_jurisdiction_rungs_present, @@ -995,3 +999,213 @@ def test_rederiving_without_a_county_writes_no_flag() -> None: rederive_us_local_jurisdiction_flags( us_frame([{"state_fips": 36, "in_denver": False}]) ) + + +# --------------------------------------------------------------------------- # +# Selections of a pooled support, and artifacts a step must keep unchanged +# --------------------------------------------------------------------------- # + +# ACS rows carry a county from the PUMA ladder and no place or block. +_ACS_COUNTIES = ("08031", "36119", "42101", "10003", "06037") +_POOLED_ROWS = st.one_of( + st.tuples(st.just("block"), st.sampled_from(_NAMES)), + st.tuples(st.just("acs"), st.sampled_from(_ACS_COUNTIES)), +) + + +def _pooled_household(row: tuple[str, str]) -> dict[str, object]: + kind, value = row + if kind == "block": + block = FIXTURE_BLOCK_BY_NAME[value] + return { + "state_fips": block.state_fips, + "county_fips": block.county_fips, + "place_fips": "" if block.place_fips == 0 else f"{block.place_fips:05d}", + "block_geoid": f"{block.block_geoid:015d}", + } + return { + "state_fips": int(value[:2]), + "county_fips": value, + "place_fips": None, + "block_geoid": None, + } + + +def _pooled_frame(rows: list[tuple[str, str]]): + return us_frame( + [_pooled_household(row) for row in rows], + person_inputs=[[{}, {}] for _ in rows], + weights=np.arange(1, len(rows) + 1, dtype=np.float64), + ) + + +def _select_households(frame, positions: list[int]): + """Keep the households at ``positions``, as a frozen or L0 support does.""" + + kept = frame.table("household")["household_id"].to_numpy()[positions] + return frame.select(frame.table("person")["person_household_id"].isin(kept)) + + +@st.composite +def _pool_and_selection(draw) -> tuple[list[tuple[str, str]], list[int]]: + rows = draw(st.lists(_POOLED_ROWS, min_size=1, max_size=10)) + keep = draw(st.sets(st.integers(0, len(rows) - 1), min_size=1)) + return rows, sorted(keep) + + +def _without_carried(receipt: dict[str, object]) -> dict[str, object]: + return {key: value for key, value in receipt.items() if key != "carried_flags"} + + +def _derived_flags(receipt: dict[str, object]) -> list[str]: + return sorted( + flag + for flag, entry in receipt["flags"].items() + if entry["status"] == JURISDICTION_FLAG_DERIVED + ) + + +@settings(max_examples=80, deadline=None) +@example(case=([("block", "yonkers"), ("acs", "08031")], [0])) +@given(case=_pool_and_selection()) +def test_rederiving_after_a_selection_equals_deriving_the_kept_rows(case) -> None: + # Invariant: for every pooled support and every non-empty selection of its + # households, deriving the selection of a derived support gives the same + # tables and receipt as deriving the selected rows from scratch, and the + # result carries every flag its own geography decides. Selection alone + # can break the last property: the rungs belong to the whole table, so + # dropping every row without a block makes the place-rule flags decidable. + rows, keep = case + frame = _pooled_frame(rows) + derived, derived_receipt = rederive_us_local_jurisdiction_flags(frame) + selected = _select_households(derived, keep) + + rederived, receipt = rederive_us_local_jurisdiction_flags(selected) + fresh, fresh_receipt = rederive_us_local_jurisdiction_flags( + _select_households(frame, keep) + ) + + for entity in ("household", "person"): + pd.testing.assert_frame_equal( + rederived.table(entity), fresh.table(entity), check_like=True + ) + assert _without_carried(receipt) == _without_carried(fresh_receipt) + complete = us_local_jurisdiction_artifact_receipt(rederived) + assert _without_carried(complete) == _without_carried(receipt) + assert complete["carried_flags"] == _derived_flags(receipt) + if receipt["rungs"] != derived_receipt["rungs"]: + # Only a gain is possible: the selection turned the place rung on. + assert derived_receipt["rungs"] == list(PUMA_GEOGRAPHY_RUNGS) + assert receipt["rungs"] == list(BLOCK_GEOGRAPHY_RUNGS) + with pytest.raises(ValueError, match="in_yonkers: absent"): + us_local_jurisdiction_artifact_receipt(selected) + + +@settings(max_examples=60, deadline=None) +@given(case=_pool_and_selection()) +def test_rederiving_a_complete_support_returns_it_unchanged(case) -> None: + # Invariant: re-deriving a support whose flags are already complete + # returns the same object with the receipt writing them would give. + rows, _keep = case + derived, _receipt = rederive_us_local_jurisdiction_flags(_pooled_frame(rows)) + + again, again_receipt = rederive_us_local_jurisdiction_flags(derived) + written, written_receipt = with_us_local_jurisdiction_flags( + derived, + rungs=us_local_jurisdiction_rungs_present(derived.table("household")), + ) + + assert again is derived + for entity in ("household", "person"): + pd.testing.assert_frame_equal(again.table(entity), written.table(entity)) + assert _without_carried(again_receipt) == written_receipt + assert again_receipt["carried_flags"] == _derived_flags(written_receipt) + + +def test_rederiving_rewrites_a_carried_flag_stored_without_a_boolean_dtype() -> None: + assigned = _assigned_block_frame() + tables = {entity: assigned.table(entity) for entity in assigned.entities} + tables["household"] = tables["household"].assign( + in_denver=tables["household"]["in_denver"].astype(object) + ) + carried = type(assigned)( + tables, assigned.schema, {"household": assigned.weights_for("household")} + ) + + rederived, receipt = rederive_us_local_jurisdiction_flags(carried) + + assert rederived is not carried + assert rederived.table("household")["in_denver"].dtype == bool + assert receipt["carried_flags"] == sorted(EXPECTED_RULES) + + +def test_artifact_receipt_refuses_an_artifact_without_the_flags_it_decides() -> None: + assigned = _assigned_block_frame() + + with pytest.raises(ValueError, match="lacks or contradicts") as refused: + us_local_jurisdiction_artifact_receipt(_without_flags(assigned)) + + for flag in EXPECTED_RULES: + assert f"{flag}: absent, but this table's" in str(refused.value) + + +@pytest.mark.parametrize("flag", sorted(EXPECTED_RULES)) +def test_artifact_receipt_refuses_a_flag_that_disagrees(flag: str) -> None: + assigned = _assigned_block_frame() + tables = {entity: assigned.table(entity) for entity in assigned.entities} + entity = "person" if flag in PERSON_FLAGS else "household" + tables[entity] = tables[entity].assign(**{flag: ~tables[entity][flag]}) + corrupt = type(assigned)( + tables, assigned.schema, {"household": assigned.weights_for("household")} + ) + + with pytest.raises(ValueError, match=f"{flag}: [0-9]+/[0-9]+ {entity} row"): + us_local_jurisdiction_artifact_receipt(corrupt) + + +def test_artifact_receipt_refuses_a_place_flag_its_rungs_cannot_decide() -> None: + # The ACS row stores its missing place and block as empty strings: the + # stored in_yonkers agrees with the place rule, but no place rung + # decided it for that row. + households = [ + { + "state_fips": 36, + "county_fips": "36119", + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + {"state_fips": 36, "county_fips": "36119", "place_fips": "", "block_geoid": ""}, + ] + derived, _receipt = rederive_us_local_jurisdiction_flags( + us_frame(households, person_inputs=[[{}], [{}]]) + ) + tables = {entity: derived.table(entity) for entity in derived.entities} + tables["household"] = tables["household"].assign(in_yonkers=[True, False]) + carrying = type(derived)( + tables, derived.schema, {"household": derived.weights_for("household")} + ) + + with pytest.raises( + ValueError, + match=r"in_yonkers: present, but this artifact's rungs \['county'\] do not", + ): + us_local_jurisdiction_artifact_receipt(carrying) + # Re-deriving removes it instead. + rederived, receipt = rederive_us_local_jurisdiction_flags(carrying) + assert "in_yonkers" not in rederived.table("household") + assert receipt["flags"]["in_yonkers"]["status"] == JURISDICTION_FLAG_UNAVAILABLE + + +def test_artifact_receipt_matches_the_rederived_receipt_on_a_complete_artifact() -> ( + None +): + assigned = _assigned_block_frame() + + receipt = us_local_jurisdiction_artifact_receipt(assigned) + + assert receipt == rederive_us_local_jurisdiction_flags(assigned)[1] + assert receipt["carried_flags"] == sorted(EXPECTED_RULES) + # An artifact with no county decides no flag, so it carries none. + bare = us_local_jurisdiction_artifact_receipt(us_frame([{"state_fips": 36}])) + assert bare["rungs"] == [] + assert bare["carried_flags"] == [] diff --git a/tools/build_us_fiscal_refresh_release.py b/tools/build_us_fiscal_refresh_release.py index f4a3205e58..da5739d0b7 100644 --- a/tools/build_us_fiscal_refresh_release.py +++ b/tools/build_us_fiscal_refresh_release.py @@ -7368,6 +7368,56 @@ def _with_l0_refit_weights(base_frame: Frame, result) -> Frame: ) +#: The supports ``_main`` derives local-jurisdiction flags on, in build order: +#: the loaded base (or prepared pool), the frozen support when a selection +#: source reduces it, and the export support the H5 is written from. +LOCAL_JURISDICTION_FLAG_SUPPORTS = ("base", "frozen_support", "export") + + +def _with_local_jurisdiction_flags( + frame: Frame, + *, + support: str, + receipts: dict[str, object], + telemetry: _BuildProgress | None, +) -> Frame: + """Derive the local-jurisdiction flags this support's geography decides. + + The rungs belong to the whole household table + (``us_local_jurisdiction_rungs_present``): a pooled base whose ACS rows + carry no block decides only the county-rule flags. A step that removes + rows can make the place-rule flags decidable, as when frozen-support + selection or the final L0 support keeps only block-anchored donors, so + ``_main`` derives again after each such step and the written support + carries every flag its own geography decides. A carried flag that + disagrees with the geography is refused; a support whose flags are + already complete comes back unchanged. ``receipts[support]`` records + each derivation for the calibration diagnostics. + """ + + if support not in LOCAL_JURISDICTION_FLAG_SUPPORTS: + raise ValueError( + f"Unknown local-jurisdiction flag support {support!r}; expected one " + f"of {LOCAL_JURISDICTION_FLAG_SUPPORTS}." + ) + frame, receipt = rederive_us_local_jurisdiction_flags(frame) + receipts[support] = receipt + if telemetry is not None: + telemetry.stage( + f"local_jurisdiction_flags_{support}", + message=( + f"Derived local-jurisdiction flags from the {support} support's " + "geography." + ), + rungs=receipt["rungs"], + carried_flags=receipt["carried_flags"], + flag_status={ + flag: entry["status"] for flag, entry in receipt["flags"].items() + }, + ) + return frame + + def _without_calibrated_frames(result, *, export_frame: Frame | None = None): """Drop calibrated target tables while keeping weights and diagnostics. @@ -12939,21 +12989,15 @@ def _main(argv: Sequence[str] | None = None) -> int | None: # A base built before the local-jurisdiction flags existed carries none, # and the engine would then default every Yonkers, Wilmington, Denver # and Philadelphia resident to False. Derive them from the base's own - # geography; a carried flag that disagrees with it is refused. - base_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags( - base_frame + # geography; a carried flag that disagrees with it is refused. The + # frozen-support selection and the export support derive them again. + local_jurisdiction_flags: dict[str, object] = {} + base_frame = _with_local_jurisdiction_flags( + base_frame, + support="base", + receipts=local_jurisdiction_flags, + telemetry=telemetry, ) - if telemetry is not None: - telemetry.stage( - "local_jurisdiction_flags", - message="Derived local-jurisdiction flags from the base geography.", - rungs=local_jurisdiction_flags["rungs"], - carried_flags=local_jurisdiction_flags["carried_flags"], - flag_status={ - flag: entry["status"] - for flag, entry in local_jurisdiction_flags["flags"].items() - }, - ) capital_gains_tail_presence = assert_puf_capital_gains_tail_survives_selection( base_frame, base_frame, @@ -13052,6 +13096,15 @@ def _main(argv: Sequence[str] | None = None) -> int | None: selection_candidate_frame, selection_source, ) + # A frozen support that keeps only block-anchored donors decides the + # place-rule flags the pooled base could not; target materialization + # and the export both see the flags this support's geography decides. + base_frame = _with_local_jurisdiction_flags( + base_frame, + support="frozen_support", + receipts=local_jurisdiction_flags, + telemetry=telemetry, + ) selection_source_payload = selection_report.as_manifest() selection_source_payload["puf_capital_gains_tail_retention"] = ( assert_puf_capital_gains_tail_survives_selection( @@ -15089,6 +15142,14 @@ def _main(argv: Sequence[str] | None = None) -> int | None: ) else: export_frame = _with_l0_refit_weights(base_frame, result) + # The L0 support can drop every row without a block and so decide the + # place-rule flags; every later gate and the written H5 see this frame. + export_frame = _with_local_jurisdiction_flags( + export_frame, + support="export", + receipts=local_jurisdiction_flags, + telemetry=telemetry, + ) result = _without_calibrated_frames( result, export_frame=export_frame if ladder_outcome is not None else None, From 4a57518f6e6a703637706d9826f905835f749fed Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 3 Nov 2026 08:28:00 -0500 Subject: [PATCH 07/32] Require a flag-complete parent in the annual static-aging lane Review r2 finding 2: the annual lane copies its parent's base year byte for byte and keeps the parent's columns in every projected year, and the annual publication validator requires exactly those columns. A parent built before the local-jurisdiction flags therefore produced annual files without in_yonkers or in_denver, and the engine defaulted every resident to False. The lane cannot write the flags without breaking that preservation contract (the base-year file is the certified release's own base artifact), so it now requires them. build_annual_static_aging reads the parent before the model provenance check and calls us_local_jurisdiction_artifact_receipt, which refuses a parent that lacks a flag its own geography decides, carries one that disagrees with it, or carries one its rungs cannot decide. The candidate manifest records the receipt as base.local_jurisdiction_flags. Engine-free tests write parents with block, county-only and no geography: six refusal cases fail before the model provenance check and before the output directory exists, and complete parents reach it. Against the previous lane the six refusal cases and the three receipt cases fail. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- docs/us-annual-static-aging.md | 13 +- .../microcosm/build/us_annual_static_aging.py | 47 +++- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 8 + ...est_us_annual_static_aging_parent_flags.py | 247 ++++++++++++++++++ .../us/test_us_annual_static_aging.py | 6 + 6 files changed, 314 insertions(+), 9 deletions(-) create mode 100644 packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 3dba6f678c..d6cbf846fa 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. diff --git a/docs/us-annual-static-aging.md b/docs/us-annual-static-aging.md index 554d8eacc1..24e85d5fd3 100644 --- a/docs/us-annual-static-aging.md +++ b/docs/us-annual-static-aging.md @@ -41,12 +41,23 @@ fields. Fixed-format inputs, including missing nullable booleans that require that storage format, are rejected before building and need a separate certified layout contract. +Because the lane adds no column, the parent must already carry every +local-jurisdiction flag its own geography decides (see +`packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md`): +`in_denver` and `pa_philadelphia_wage_tax_resident` when every household has a +county, and also `in_yonkers` and `in_wilmington` when every household has a +place and a block. The builder reads the parent first and refuses one that lacks +such a flag, or carries one that disagrees with its geography, before any model +or output work. Rebuild a parent that predates the flags before it seeds annual +files. + The output directory must be new. A failed attempt retains its partial files and `build_status.json`; rerunning requires another directory. `annual_manifest.json` is written last, after all years finish and source/input hashes are rechecked. It contains: -- `base`: source dataset, year, parent release claim, path, and SHA256. +- `base`: source dataset, year, parent release claim, path, SHA256, and the + parent's local-jurisdiction flag receipt (`local_jurisdiction_flags`). - `inputs`, `model`, and `runtime`: SSA pin, model commit and source hashes, actual implementation hashes, and dependency versions. - `metadata.dataset_years`: a map from the source dataset to year-keyed annual diff --git a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py index 1022364ec5..f77e6b01c1 100644 --- a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py +++ b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py @@ -3,6 +3,9 @@ Each projection starts from the same base frame. Only one projected year is held in memory at a time. The original H5 is copied byte for byte, and all later files retain its entity/column/row layout with an explicit ``_time_period``. +No file adds a column, so the parent must already carry every local-jurisdiction +flag its own geography decides; the lane refuses a parent that lacks one before +any model work. Run ``python -m microcosm.build.us_annual_static_aging --help``. """ @@ -54,6 +57,32 @@ def _check_pin(path: Path, expected: str) -> None: raise ValueError(f"SHA256 mismatch for {path}") +def _parent_local_jurisdiction_flags(frame: Frame) -> dict: + """Require the parent to carry its local-jurisdiction flags, with a receipt. + + The lane copies the parent's base year byte for byte and keeps the + parent's columns in every projected year, so it cannot write a flag the + parent lacks: the engine would default it to ``False`` for every resident + in every year. + """ + + # Imported here so that importing this module (for --help, or for the + # serializer registry's _write_year) does not load the us_runtime package. + from microcosm.build.us_runtime.local_jurisdictions import ( + us_local_jurisdiction_artifact_receipt, + ) + + try: + return us_local_jurisdiction_artifact_receipt(frame) + except ValueError as error: + raise ValueError( + "The annual lane keeps its parent's columns and base-year bytes, so " + "it needs a parent that already carries every local-jurisdiction " + "flag its own geography decides; rebuild the parent with the flags. " + f"{error}" + ) from error + + def _model_provenance(*, source: Path, commit: str, version: str) -> dict: import policyengine_us @@ -238,13 +267,8 @@ def build_annual_static_aging( ssa = Path(ssa_csv).expanduser().absolute() _check_pin(base, base_sha256) _check_pin(ssa, ssa_sha256) - model_kwargs = { - "source": Path(model_source), - "commit": model_commit, - "version": model_version, - } - model = _model_provenance(**model_kwargs) - runtime = _runtime_provenance() + # Read the parent before any model work, so a parent this lane cannot + # carry forward fails first. with pd.HDFStore(base, "r") as store: _period(store, base_year) tables = { @@ -261,6 +285,14 @@ def build_annual_static_aging( frame = Frame( tables, US_SCHEMA, {"household": Weights(weights, WeightKind.CALIBRATED)} ) + local_jurisdiction_flags = _parent_local_jurisdiction_flags(frame) + model_kwargs = { + "source": Path(model_source), + "commit": model_commit, + "version": model_version, + } + model = _model_provenance(**model_kwargs) + runtime = _runtime_provenance() base_tables = { entity: table.loc[:, columns[entity]] for entity, table in engine_tables( @@ -297,6 +329,7 @@ def build_annual_static_aging( "parent_release": parent_release, "path": str(base), "sha256": base_sha256, + "local_jurisdiction_flags": local_jurisdiction_flags, }, "inputs": {"ssa": {"path": str(ssa), "sha256": ssa_sha256}}, "model": model, diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index dd5bd08e42..b09c55f1d6 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -78,6 +78,14 @@ an existing artifact rather than a geography line, and both call `support_value_repairs.local_jurisdiction_flags` in the calibration diagnostics. +A third step, the annual static-aging lane (`us_annual_static_aging`), keeps its +parent's columns and base-year bytes, so it cannot write the flags. It calls +`us_local_jurisdiction_artifact_receipt` instead, which refuses a parent that +lacks a flag its geography decides or carries one that disagrees with it, and +records the receipt as `base.local_jurisdiction_flags` in the candidate +manifest. A parent built before the flags existed therefore cannot seed annual +files until a rebuild adds them. + The helper reads the rungs from the artifact's own geography (`us_local_jurisdiction_rungs_present`): the county rung when `county_fips` is on every row, and the place rung only when every row also has `place_fips` and diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py new file mode 100644 index 0000000000..2f9b5948cf --- /dev/null +++ b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py @@ -0,0 +1,247 @@ +"""The annual static-aging lane refuses a parent that lacks its local flags. + +The lane copies its parent's base year byte for byte and keeps the parent's +columns in every projected year, so a local-jurisdiction flag the parent lacks +stays absent from every annual file and the engine defaults it to ``False`` +for every resident. The lane checks the parent before the model provenance +check, and these tests stop every build there, so they need no engine. + +Invariants: + +- a parent that lacks a flag its own geography decides, or carries one that + disagrees with that geography, fails before the model provenance check and + before the output directory exists; +- a parent that carries exactly the flags its geography decides reaches the + model provenance check, and its receipt lists those flags as carried; +- a parent with no county decides no flag, so it needs none. +""" + +from __future__ import annotations + +from collections.abc import Mapping, Sequence +from pathlib import Path + +import pandas as pd +import pytest + +from microcosm.build import us_annual_static_aging as annual +from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights +from microcosm.frame.materialize import put_frame_table, read_frame_table +from test_support.microcosm_build.us_local_jurisdictions import FIXTURE_BLOCK_BY_NAME + +# One household per block, in this order; each household has one person. +BLOCKS = ("yonkers", "denver", "philadelphia", "wilmington", "aurora_arapahoe") +# The flags these blocks decide, written out independently of the registry. +FLAGS = { + "in_yonkers": ("household", [True, False, False, False, False]), + "in_denver": ("household", [False, True, False, False, False]), + "in_wilmington": ("household", [False, False, False, True, False]), + "pa_philadelphia_wage_tax_resident": ( + "person", + [False, False, True, False, False], + ), +} +COUNTY_FLAGS = ("in_denver", "pa_philadelphia_wage_tax_resident") + + +class _ReachedModelProvenanceError(Exception): + """Stands in for the model provenance check: the parent passed.""" + + +def _tables( + *, geography: str, flags: Mapping[str, Sequence[bool]] +) -> dict[str, pd.DataFrame]: + """A five-household parent on ``BLOCKS`` with the given flag columns. + + ``geography`` is ``block`` (county, place and block on every row), + ``county`` (a county, with the place and block an ACS row leaves empty) + or ``none`` (a state only). + """ + + ids = list(range(1, len(BLOCKS) + 1)) + tables = { + entity: pd.DataFrame({US_SCHEMA.entity_id_column(entity): ids}) + for entity in US_SCHEMA.entities + } + for group in US_SCHEMA.group_entities: + tables["person"][US_SCHEMA.membership_column(group)] = ids + tables["person"]["age"] = [40] * len(ids) + tables["person"]["is_female"] = [index % 2 == 0 for index in ids] + household = tables["household"] + household["household_weight"] = [float(index) for index in ids] + blocks = [FIXTURE_BLOCK_BY_NAME[name] for name in BLOCKS] + household["state_fips"] = [block.state_fips for block in blocks] + if geography in {"block", "county"}: + household["county_fips"] = [block.county_fips for block in blocks] + household["place_fips"] = [ + "" + if geography == "county" or block.place_fips == 0 + else f"{block.place_fips:05d}" + for block in blocks + ] + household["block_geoid"] = [ + "" if geography == "county" else f"{block.block_geoid:015d}" + for block in blocks + ] + for flag, values in flags.items(): + entity = FLAGS[flag][0] + tables[entity][flag] = list(values) + return tables + + +def _write_parent(path: Path, tables: Mapping[str, pd.DataFrame]) -> Path: + with pd.HDFStore(path, "w") as store: + for entity, table in tables.items(): + put_frame_table( + store, entity, table, preferred_format="table", data_columns=True + ) + store.put("_time_period", pd.Series([2024]), format="table") + return path + + +def _inputs(tmp_path: Path, tables: Mapping[str, pd.DataFrame]) -> dict: + base = _write_parent(tmp_path / "base.h5", tables) + ssa = tmp_path / "ssa.csv" + pd.DataFrame( + {"Year": [2024, 2025], "Age": [40, 40], "M Tot": [4, 5], "F Tot": [2, 3]} + ).to_csv(ssa, index=False) + return dict( + base_h5=base, + base_sha256=annual._sha256(base), + parent_release="pinned-parent", + ssa_csv=ssa, + ssa_sha256=annual._sha256(ssa), + model_source=tmp_path, + model_commit="a" * 40, + model_version="test", + output_dir=tmp_path / "candidate", + base_year=2024, + end_year=2025, + epochs=1, + ) + + +def _complete(geography: str) -> dict[str, list[bool]]: + decided = {"block": tuple(FLAGS), "county": COUNTY_FLAGS, "none": ()}[geography] + return {flag: FLAGS[flag][1] for flag in decided} + + +def _flipped(flags: Mapping[str, list[bool]], flag: str) -> dict[str, list[bool]]: + return {**flags, flag: [not value for value in flags[flag]]} + + +def _without(flags: Mapping[str, list[bool]], *names: str) -> dict[str, list[bool]]: + return {flag: values for flag, values in flags.items() if flag not in names} + + +@pytest.mark.parametrize( + ("geography", "flags", "failure"), + [ + pytest.param( + "block", {}, "in_yonkers: absent", id="block-parent-without-flags" + ), + pytest.param( + "block", + _without(_complete("block"), "in_yonkers", "in_wilmington"), + "in_wilmington: absent", + id="block-parent-with-county-flags-only", + ), + pytest.param( + "block", + _flipped(_complete("block"), "in_yonkers"), + "in_yonkers: 5/5 household row(s) disagree", + id="block-parent-with-a-wrong-place-flag", + ), + pytest.param( + "block", + _flipped(_complete("block"), "pa_philadelphia_wage_tax_resident"), + "pa_philadelphia_wage_tax_resident: 5/5 person row(s) disagree", + id="block-parent-with-a-wrong-person-flag", + ), + pytest.param( + "county", {}, "in_denver: absent", id="county-parent-without-flags" + ), + pytest.param( + "county", + {**_complete("county"), "in_yonkers": FLAGS["in_yonkers"][1]}, + "in_yonkers: present, but this artifact's rungs ['county'] do not", + id="county-parent-with-a-place-flag-it-cannot-decide", + ), + ], +) +def test_parent_without_its_flags_is_refused_before_model_work( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + geography: str, + flags: dict[str, list[bool]], + failure: str, +) -> None: + inputs = _inputs(tmp_path, _tables(geography=geography, flags=flags)) + monkeypatch.setattr( + annual, "_model_provenance", lambda **kwargs: pytest.fail("must refuse first") + ) + monkeypatch.setattr( + annual, "_runtime_provenance", lambda: pytest.fail("must refuse first") + ) + + with pytest.raises( + ValueError, match="needs a parent that already carries" + ) as error: + annual.build_annual_static_aging(**inputs) + + assert failure in str(error.value) + assert not inputs["output_dir"].exists() + + +@pytest.mark.parametrize("geography", ["block", "county", "none"]) +def test_parent_carrying_its_flags_reaches_model_work( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, geography: str +) -> None: + inputs = _inputs(tmp_path, _tables(geography=geography, flags=_complete(geography))) + + def reached(**kwargs: object) -> dict: + raise _ReachedModelProvenanceError + + monkeypatch.setattr(annual, "_model_provenance", reached) + + with pytest.raises(_ReachedModelProvenanceError): + annual.build_annual_static_aging(**inputs) + + assert not inputs["output_dir"].exists() + + +@pytest.mark.parametrize("geography", ["block", "county", "none"]) +def test_parent_receipt_lists_the_flags_it_carries( + tmp_path: Path, geography: str +) -> None: + expected = _complete(geography) + path = _write_parent( + tmp_path / "base.h5", _tables(geography=geography, flags=expected) + ) + with pd.HDFStore(path, "r") as store: + tables = { + entity: read_frame_table(store, entity) for entity in US_SCHEMA.entities + } + weights = tables["household"].pop("household_weight").to_numpy(dtype=float) + frame = Frame( + tables, US_SCHEMA, {"household": Weights(weights, WeightKind.CALIBRATED)} + ) + + receipt = annual._parent_local_jurisdiction_flags(frame) + + assert receipt["carried_flags"] == sorted(expected) + assert ( + receipt["rungs"] + == { + "block": ["county", "place"], + "county": ["county"], + "none": [], + }[geography] + ) + for flag, (_entity, values) in FLAGS.items(): + entry = receipt["flags"][flag] + if flag in expected: + assert entry["status"] == "derived" + assert entry["households_in_jurisdiction"] == sum(values) + else: + assert entry["status"] == "unavailable" diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_annual_static_aging.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_annual_static_aging.py index 708cd5e8f8..2422557963 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_annual_static_aging.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_annual_static_aging.py @@ -96,6 +96,12 @@ def project(frame, **kwargs): assert manifest["metadata"]["dataset_years"] == { "populace_us_2024": {str(y): f"populace_us_{y}" for y in (2024, 2025, 2026)} } + # The fixture parent has no county, so it decides and carries no local + # flag; tests/engine_free/us/test_us_annual_static_aging_parent_flags.py + # covers parents whose geography decides them. + flags = manifest["base"]["local_jurisdiction_flags"] + assert flags["rungs"] == [] + assert flags["carried_flags"] == [] for year in (2025, 2026): path = output / f"populace_us_{year}.h5" import h5py From 22cf88f0fd8a382f26ffa757776c50d57322c06f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 3 Nov 2026 08:33:49 -0500 Subject: [PATCH 08/32] Name the live PUMA-ladder gate failures when a stored receipt drifts Review r2 nit 3: an assembled checkpoint from before the local-jurisdiction flags holds a passing PUMA-ladder receipt but no in_denver. The live gate now fails it, and the rejection said only that the receipt changed from live output, so the operator could not see the repair it needs. _validate_stacked_geography_assignment_receipt now appends the live gate's failure lines (in_denver: absent, but this table's county rung decides it, ...) when the live gate fails, and says that the live gate passes but its details differ otherwise. It still fails closed in both cases. Engine-free tests build an assembled pool with every column the live gate reads, with and without in_denver, and check that the message names the missing flag only when it is missing; a third test covers the passing, changed-details branch. All three fail against the previous message. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_multispine_pool_tool.py | 81 +++++++++++++++++++ tools/build_us_multispine_pool.py | 16 +++- 2 files changed, 93 insertions(+), 4 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_tool.py index 5403902555..8e66e83c05 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_tool.py @@ -694,6 +694,87 @@ def test_geography_assignment_receipt_rejects_coherent_valid_target_rewrite( ) +def _assembled_frame_the_live_puma_gate_reaches( + pool_tool: ModuleType, *, in_denver: bool +) -> Frame: + """An assembled pool with every column the live PUMA-ladder gate reads.""" + + stack = pool_tool.assemble_stacked_spine( + _many_household_source_frame(count=2), + _many_household_source_frame(count=2, measured_offset=1_000.0), + sample_fraction=1.0, + sample_seed=578, + ) + assigned = _with_fixture_household_geography(stack.frame) + household = assigned.table("household") + household["state_fips"] = 6 + household["county_fips_2023"] = household["county_fips"] + if in_denver: + household["in_denver"] = False + return assigned + + +@pytest.mark.parametrize("in_denver", [False, True]) +def test_geography_assignment_receipt_names_the_live_gate_failures( + pool_tool: ModuleType, in_denver: bool +) -> None: + # An assembled checkpoint from before the local-jurisdiction flags holds a + # passing PUMA-ladder receipt but no in_denver. The live gate fails it, and + # the rejection names what the live gate finds, so the operator sees the + # missing flag. (The fixture's Alameda-only pool also fails the NYC mass + # checks, with or without the flag.) + assigned = _assembled_frame_the_live_puma_gate_reaches( + pool_tool, in_denver=in_denver + ) + receipt = _fixture_geography_assignment_receipt(pool_tool, assigned) + + with pytest.raises( + ValueError, + match="PUMA-ladder gate receipt changed from live output; the live gate fails", + ) as rejected: + pool_tool._validate_stacked_geography_assignment_receipt( + assigned, + receipt, + target_districts=(601,), + boundary="fixture pre-flag checkpoint", + require_exact_assembled_rows=True, + ) + + message = str(rejected.value) + assert "[us_puma_ladder] New York State carries zero household weight" in message + missing_flag = "[us_puma_ladder] in_denver: absent, but this table's county rung" + assert (missing_flag in message) is not in_denver + + +def test_geography_assignment_receipt_says_when_a_passing_live_gate_differs( + pool_tool: ModuleType, monkeypatch: pytest.MonkeyPatch +) -> None: + assigned = _assembled_frame_the_live_puma_gate_reaches(pool_tool, in_denver=True) + receipt = _fixture_geography_assignment_receipt(pool_tool, assigned) + monkeypatch.setattr( + pool_tool, + "us_puma_ladder_gate", + lambda *args, **kwargs: GateResult( + name="us_puma_ladder", passed=True, details={"fixture": False} + ), + ) + + with pytest.raises( + ValueError, + match=( + "gate receipt changed from live output; the live gate passes, but its " + "details differ from the receipt's" + ), + ): + pool_tool._validate_stacked_geography_assignment_receipt( + assigned, + receipt, + target_districts=(601,), + boundary="fixture changed gate details", + require_exact_assembled_rows=True, + ) + + @pytest.mark.parametrize( ("route", "stage_receipts"), ( diff --git a/tools/build_us_multispine_pool.py b/tools/build_us_multispine_pool.py index 68abde6c13..dcfc9217a4 100644 --- a/tools/build_us_multispine_pool.py +++ b/tools/build_us_multispine_pool.py @@ -1822,7 +1822,7 @@ def _validate_stacked_geography_assignment_receipt( ): raise ValueError(f"{boundary}: PUMA-ladder gate receipt did not pass.") if require_exact_assembled_rows: - live_gate = GateReport( + live_report = GateReport( ( us_puma_ladder_gate( household, @@ -1830,10 +1830,18 @@ def _validate_stacked_geography_assignment_receipt( assign_tract=False, ), ) - ).to_manifest() - if gate_receipt != live_gate: + ) + if gate_receipt != live_report.to_manifest(): + # Name what the live gate finds, so an operator holding an older + # checkpoint sees the repair it needs (a missing in_denver, say). + drift = ( + "the live gate passes, but its details differ from the receipt's" + if live_report.passed + else "the live gate fails: " + "; ".join(live_report.failures) + ) raise ValueError( - f"{boundary}: PUMA-ladder gate receipt changed from live output." + f"{boundary}: PUMA-ladder gate receipt changed from live output; " + f"{drift}." ) provenance_columns = ( From 1818486a0ff3409f8adaf68e52e00659b6ed39f0 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 3 Nov 2026 08:52:04 -0500 Subject: [PATCH 09/32] Name who acts in the builder's local-jurisdiction comments Rewrites six passive comments and docstring lines from the support re-derivation commit so each names its actor (_main, the derivation, the release engine). Comments only; the builder tests pass unchanged. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_fiscal_refresh_builder.py | 6 +++--- tools/build_us_fiscal_refresh_release.py | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index 07324069c4..d92e0c95fa 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2564,7 +2564,7 @@ def test_builder_derives_flags_after_every_support_reduction() -> None: # rows can make the place-rule flags decidable (microcosm#1453 review r2). # _main derives on the loaded base, again on the frozen support before # anything materializes targets from it, and again on the export support - # before any export gate reads it or the H5 is written from it. + # before any export gate reads it or the release engine writes it to H5. import inspect builder = _load_builder_module() @@ -9077,7 +9077,7 @@ def fake_release_gate_failures(*args, **kwargs): ), ) if terminal_mode != "stored_input_refused": - # The H5 is written from the frame the export derivation returned. + # The release engine writes the frame the export derivation returned. assert ( captured["written_frame"] is (captured["local_jurisdiction_export_frame"]) @@ -9426,7 +9426,7 @@ def fake_release_gate_failures(*args, **kwargs): "export": local_jurisdiction_receipt, }, } - # The flags are derived on the loaded base (or prepared pool) and again + # _main derives the flags on the loaded base (or prepared pool) and again # on the export support; this harness selects no frozen support. assert [type(frame) for frame in captured["local_jurisdiction_frames"]] == [ FakeFrame, diff --git a/tools/build_us_fiscal_refresh_release.py b/tools/build_us_fiscal_refresh_release.py index d1b55e22ae..867fefd80d 100644 --- a/tools/build_us_fiscal_refresh_release.py +++ b/tools/build_us_fiscal_refresh_release.py @@ -7370,7 +7370,7 @@ def _with_l0_refit_weights(base_frame: Frame, result) -> Frame: #: The supports ``_main`` derives local-jurisdiction flags on, in build order: #: the loaded base (or prepared pool), the frozen support when a selection -#: source reduces it, and the export support the H5 is written from. +#: source reduces it, and the export support the release engine writes to H5. LOCAL_JURISDICTION_FLAG_SUPPORTS = ("base", "frozen_support", "export") @@ -7389,10 +7389,10 @@ def _with_local_jurisdiction_flags( rows can make the place-rule flags decidable, as when frozen-support selection or the final L0 support keeps only block-anchored donors, so ``_main`` derives again after each such step and the written support - carries every flag its own geography decides. A carried flag that - disagrees with the geography is refused; a support whose flags are - already complete comes back unchanged. ``receipts[support]`` records - each derivation for the calibration diagnostics. + carries every flag its own geography decides. The derivation refuses a + carried flag that disagrees with the geography and returns a support + whose flags are already complete unchanged. ``receipts[support]`` + records each derivation for the calibration diagnostics. """ if support not in LOCAL_JURISDICTION_FLAG_SUPPORTS: @@ -12995,8 +12995,9 @@ def _main(argv: Sequence[str] | None = None) -> int | None: # A base built before the local-jurisdiction flags existed carries none, # and the engine would then default every Yonkers, Wilmington, Denver # and Philadelphia resident to False. Derive them from the base's own - # geography; a carried flag that disagrees with it is refused. The - # frozen-support selection and the export support derive them again. + # geography, refusing a carried flag that disagrees with it. _main + # derives them again after frozen-support selection and on the export + # support. local_jurisdiction_flags: dict[str, object] = {} base_frame = _with_local_jurisdiction_flags( base_frame, From 3a6d247a3fedacd3183005dd4c4879d53bd3684c Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 09:28:47 -0500 Subject: [PATCH 10/32] Move the local-jurisdiction flags out of us_runtime (lead's condition 1) The annual static-aging lane checks its parent's flags before any model work, but it imported the check from microcosm.build.us_runtime. Importing any us_runtime module runs that package's __init__, which builds US_SPINE_AGREEMENT_REGISTRY (spine_agreement.py), which loads the take-up contract, which calls assert_engine_abi_lock_current. With policyengine-us installed that compares a lock derived from the installed engine against us/engine_abi.lock.json (2.2.1), so under any other engine version the lane raised inside its import and refused every parent, flags or not (gate-lens review S1). - us_runtime/local_jurisdictions.py and us_local_jurisdictions.json move to microcosm/build/us_local_jurisdictions.py and .json. The module imports only the standard library, numpy, pandas and microcosm.frame; the one change besides its docstring is files("microcosm.build") for the registry. The registry bytes and US_LOCAL_JURISDICTION_REGISTRY_SHA256 are unchanged. - us_runtime/local_jurisdictions.py re-exports the same names (same __all__), so geography_ladder.py, puma_ladder.py and the other importers keep their import lines and their attested bytes. - The annual lane imports microcosm.build.us_local_jurisdictions. - tools/verify_us_local_jurisdiction_registry.py and the registry test read the JSON at its new path; US_LOCAL_JURISDICTIONS.md and the changelog fragment say where it lives and why. - New engine-free test test_us_annual_static_aging_gate_imports.py: a fresh interpreter runs build_annual_static_aging up to the model-provenance step on a parent that carries its flags and on one that lacks them, and asserts that no microcosm.build.us_runtime module is in sys.modules. It must be a fresh interpreter because the test process has usually loaded us_runtime already. A second test checks that the re-export hands out the same objects. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- .../microcosm/build/us_annual_static_aging.py | 8 +- .../us_local_jurisdictions.json | 0 .../microcosm/build/us_local_jurisdictions.py | 900 ++++++++++++++++++ .../us_runtime/US_LOCAL_JURISDICTIONS.md | 12 +- .../build/us_runtime/local_jurisdictions.py | 888 +---------------- ...est_us_annual_static_aging_gate_imports.py | 179 ++++ .../us/test_us_local_jurisdictions.py | 16 +- .../verify_us_local_jurisdiction_registry.py | 2 +- 9 files changed, 1134 insertions(+), 873 deletions(-) rename packages/microcosm-build/src/microcosm/build/{us_runtime => }/us_local_jurisdictions.json (100%) create mode 100644 packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py create mode 100644 packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index d6cbf846fa..ff41e99ba7 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py index 681b6ea4c8..4e9000045d 100644 --- a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py +++ b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py @@ -102,9 +102,11 @@ def _parent_local_jurisdiction_flags(frame: Frame) -> dict: in every year. """ - # Imported here so that importing this module (for --help, or for the - # serializer registry's _write_year) does not load the us_runtime package. - from microcosm.build.us_runtime.local_jurisdictions import ( + # From microcosm.build.us_local_jurisdictions, never through us_runtime: + # importing any us_runtime module asserts the engine ABI lock wherever + # policyengine-us is installed, so this check would refuse every parent + # under another engine version (test_us_annual_static_aging_gate_imports). + from microcosm.build.us_local_jurisdictions import ( us_local_jurisdiction_artifact_receipt, ) diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.json similarity index 100% rename from packages/microcosm-build/src/microcosm/build/us_runtime/us_local_jurisdictions.json rename to packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.json diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py new file mode 100644 index 0000000000..3899068d14 --- /dev/null +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -0,0 +1,900 @@ +"""US local-jurisdiction flags derived from household geography. + +policyengine-us 2.2.1 declares a few local-tax jurisdictions as plain inputs +with no formula, so they default to ``False`` unless the dataset writes them: + +- ``in_denver`` (household): read by the Denver property-tax-relief + eligibility variables; +- ``in_yonkers`` (household): read by ``ny_yonkers_income_tax`` (the resident + surcharge); +- ``in_wilmington`` (household): read by ``de_wilmington_earned_income_tax``; +- ``pa_philadelphia_wage_tax_resident`` (person): read by + ``pa_philadelphia_wage_tax`` to pick the resident rate. + +Local flags with a ``county_str`` formula (``in_nyc``, ``in_la`` and the +rest) need nothing: the engine computes them from ``county_fips``. + +The packaged registry ``us_local_jurisdictions.json`` maps each input-only +flag to one 2020 geography, and its SHA-256 is pinned here: + +- rule ``county``: the flag is true exactly when ``county_fips`` equals the + registry county (Denver ``08031``; Philadelphia ``42101``); +- rule ``place``: the flag is true exactly when the household's state (the + first two digits of ``county_fips``) and ``place_fips`` equal the registry + state and 2020 place code (Yonkers city ``36``/``84000``; Wilmington city + ``10``/``77580``). Place codes are unique only within a state, so the state + is part of the match. + +A geography line derives the flags from the rungs it actually writes. The +block ladder (and the block-location draw) writes county and place from one +block, so every flag is derived. The PUMA ladder writes a county but no +place, so the place-rule flags are *unavailable* there: the line never writes +them (any stale column is removed) and its receipt records them as +unavailable with the reason, rather than writing ``False``. + +An artifact built before the flags existed carries none, so a step that +exports or recalibrates an existing artifact instead of running a geography +line calls :func:`rederive_us_local_jurisdiction_flags`. It derives every +flag the artifact's own geography decides and refuses a carried flag that +disagrees with that geography. Both ladder gates fail a table that lacks a +flag its geography decides. + +The rungs belong to the whole household table: one row without a block +withholds the place rung from every row. A step that removes rows (a +frozen-support or L0 selection) can therefore make a place-rule flag +decidable, so it derives the flags again on the rows it keeps; deriving a +support whose flags are already complete returns it unchanged. A step that +must keep an artifact's columns and bytes, and so cannot write the flags, +calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses +an artifact that lacks a flag its geography decides. + +This module and its registry sit outside ``microcosm.build.us_runtime`` on +purpose, and import only the standard library, numpy, pandas and +``microcosm.frame``. Importing any ``us_runtime`` module runs that package's +``__init__``, which builds the spine-agreement registry; that loads the +take-up contract, which asserts the engine ABI lock wherever policyengine-us +is installed. The annual static-aging lane checks its parent here before any +model work, so through ``us_runtime`` it would refuse every parent under any +policyengine-us other than the locked one. ``us_runtime.local_jurisdictions`` +re-exports these names for the geography lines. +""" + +from __future__ import annotations + +import hashlib +import json +from collections.abc import Collection, Mapping +from dataclasses import dataclass +from functools import cache +from importlib.resources import files +from pathlib import Path +from typing import Any + +import numpy as np +import pandas as pd + +from microcosm.frame import US_SCHEMA, Frame + +US_LOCAL_JURISDICTION_REGISTRY_RESOURCE = "us_local_jurisdictions.json" +#: SHA-256 of the packaged registry; :func:`packaged_us_local_jurisdiction_registry` +#: refuses any other bytes. +US_LOCAL_JURISDICTION_REGISTRY_SHA256 = ( + "45035eee30beddc0bccceadc7a00363635b0c9012662bf722435ee83243a053c" +) +US_LOCAL_JURISDICTION_REGISTRY_KIND = "us_local_jurisdiction_registry" +US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION = 1 + +#: Geography rungs a line can supply. ``county`` needs ``county_fips``; +#: ``place`` needs ``place_fips`` (and the county's state prefix). +JURISDICTION_RUNG_COUNTY = "county" +JURISDICTION_RUNG_PLACE = "place" +JURISDICTION_RUNGS = (JURISDICTION_RUNG_COUNTY, JURISDICTION_RUNG_PLACE) +#: What the block ladder and the block-location draw write. +BLOCK_GEOGRAPHY_RUNGS = JURISDICTION_RUNGS +#: What the PUMA ladder writes. +PUMA_GEOGRAPHY_RUNGS = (JURISDICTION_RUNG_COUNTY,) + +#: Receipt statuses. +JURISDICTION_FLAG_DERIVED = "derived" +JURISDICTION_FLAG_UNAVAILABLE = "unavailable" + +_ENTITIES = ("household", "person") +_REQUIRED_JURISDICTION_KEYS = ( + "flag", + "entity", + "jurisdiction", + "rule", + "state_fips", + "population_2020", +) + + +@dataclass(frozen=True) +class UsLocalJurisdiction: + """One input-only engine flag and the 2020 geography that decides it. + + Attributes: + flag: The policyengine-us input variable. + entity: ``household`` or ``person`` (a person flag is the person's + household's value). + jurisdiction: Human-readable name. + rule: ``county`` or ``place``; the rung the flag needs. + state_fips: Two-digit state FIPS. + county_fips: Five-digit county FIPS (rule ``county``). + place_fips: Five-digit 2020 place code within ``state_fips`` + (rule ``place``). + coextensive_place_fips: For a county-rule jurisdiction whose city is + the same area as the county, that city's place code; the + block-ladder check requires the two block sets to be identical. + population_2020: 2020 P.L. 94-171 population (``P1_001N``) of the + jurisdiction; the block-ladder check requires the ladder's blocks + to sum to it. + """ + + flag: str + entity: str + jurisdiction: str + rule: str + state_fips: str + county_fips: str | None + place_fips: str | None + coextensive_place_fips: str | None + population_2020: int + + @property + def geoid(self) -> str: + """The deciding geography's 2020 GEOID (county 5 digits, place 7).""" + + if self.rule == JURISDICTION_RUNG_COUNTY: + assert self.county_fips is not None + return self.county_fips + assert self.place_fips is not None + return self.state_fips + self.place_fips + + +@dataclass(frozen=True) +class UsLocalJurisdictionRegistry: + """The parsed registry plus the SHA-256 of the bytes it came from.""" + + jurisdictions: tuple[UsLocalJurisdiction, ...] + sha256: str + metadata: Mapping[str, Any] + + @property + def flags(self) -> tuple[str, ...]: + return tuple(item.flag for item in self.jurisdictions) + + def for_entity(self, entity: str) -> tuple[UsLocalJurisdiction, ...]: + return tuple(item for item in self.jurisdictions if item.entity == entity) + + +def load_us_local_jurisdiction_registry( + path: str | Path, + *, + expected_sha256: str | None = None, +) -> UsLocalJurisdictionRegistry: + """Load and validate a registry file, optionally pinning its SHA-256.""" + + payload = Path(path).read_bytes() + return _registry_from_bytes(payload, expected_sha256=expected_sha256) + + +@cache +def packaged_us_local_jurisdiction_registry() -> UsLocalJurisdictionRegistry: + """The packaged registry, refused unless its bytes match the pinned SHA-256.""" + + payload = ( + files("microcosm.build") + .joinpath(US_LOCAL_JURISDICTION_REGISTRY_RESOURCE) + .read_bytes() + ) + return _registry_from_bytes( + payload, expected_sha256=US_LOCAL_JURISDICTION_REGISTRY_SHA256 + ) + + +def _registry_from_bytes( + payload: bytes, + *, + expected_sha256: str | None, +) -> UsLocalJurisdictionRegistry: + digest = hashlib.sha256(payload).hexdigest() + if expected_sha256 is not None and digest != expected_sha256: + raise ValueError( + "US local-jurisdiction registry bytes do not match the pinned " + f"SHA-256: expected {expected_sha256}, observed {digest}." + ) + document = json.loads(payload) + if not isinstance(document, Mapping): + raise ValueError("US local-jurisdiction registry must be a JSON object.") + if document.get("kind") != US_LOCAL_JURISDICTION_REGISTRY_KIND: + raise ValueError( + "US local-jurisdiction registry kind must be " + f"{US_LOCAL_JURISDICTION_REGISTRY_KIND!r}, got {document.get('kind')!r}." + ) + if document.get("schema_version") != US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION: + raise ValueError( + "US local-jurisdiction registry schema_version must be " + f"{US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION}, got " + f"{document.get('schema_version')!r}." + ) + raw = document.get("jurisdictions") + if not isinstance(raw, list) or not raw: + raise ValueError("US local-jurisdiction registry has no jurisdictions.") + jurisdictions = tuple(_jurisdiction(item, index) for index, item in enumerate(raw)) + flags = [item.flag for item in jurisdictions] + if len(set(flags)) != len(flags): + raise ValueError(f"US local-jurisdiction registry repeats a flag: {flags}.") + if flags != sorted(flags): + raise ValueError( + f"US local-jurisdiction registry flags must be sorted: {flags}." + ) + geoids = [item.geoid for item in jurisdictions] + if len(set(geoids)) != len(geoids): + raise ValueError( + f"US local-jurisdiction registry repeats a geography: {geoids}." + ) + metadata = {key: value for key, value in document.items() if key != "jurisdictions"} + return UsLocalJurisdictionRegistry( + jurisdictions=jurisdictions, sha256=digest, metadata=metadata + ) + + +def _jurisdiction(item: object, index: int) -> UsLocalJurisdiction: + label = f"jurisdictions[{index}]" + if not isinstance(item, Mapping): + raise ValueError(f"{label} must be an object.") + missing = [key for key in _REQUIRED_JURISDICTION_KEYS if key not in item] + if missing: + raise ValueError(f"{label} is missing {missing}.") + flag = item["flag"] + if not isinstance(flag, str) or not flag.isidentifier() or flag != flag.lower(): + raise ValueError(f"{label}.flag must be a lowercase identifier: {flag!r}.") + entity = item["entity"] + if entity not in _ENTITIES: + raise ValueError(f"{label}.entity must be one of {_ENTITIES}: {entity!r}.") + rule = item["rule"] + if rule not in JURISDICTION_RUNGS: + raise ValueError(f"{label}.rule must be one of {JURISDICTION_RUNGS}.") + state = _digits(item["state_fips"], 2, label=f"{label}.state_fips") + county = _optional_digits(item.get("county_fips"), 5, label=f"{label}.county_fips") + place = _optional_digits(item.get("place_fips"), 5, label=f"{label}.place_fips") + coextensive = _optional_digits( + item.get("coextensive_place_fips"), + 5, + label=f"{label}.coextensive_place_fips", + ) + if rule == JURISDICTION_RUNG_COUNTY: + if county is None or place is not None: + raise ValueError( + f"{label}: a county rule names county_fips and no place_fips." + ) + if county[:2] != state: + raise ValueError(f"{label}: county_fips {county} is not in state {state}.") + else: + if place is None or county is not None or coextensive is not None: + raise ValueError( + f"{label}: a place rule names place_fips and no county fields." + ) + population = item["population_2020"] + if isinstance(population, bool) or not isinstance(population, int): + raise ValueError(f"{label}.population_2020 must be an integer.") + if population <= 0: + raise ValueError(f"{label}.population_2020 must be positive.") + name = item["jurisdiction"] + if not isinstance(name, str) or not name: + raise ValueError(f"{label}.jurisdiction must be a non-empty string.") + return UsLocalJurisdiction( + flag=flag, + entity=entity, + jurisdiction=name, + rule=rule, + state_fips=state, + county_fips=county, + place_fips=place, + coextensive_place_fips=coextensive, + population_2020=population, + ) + + +def _digits(value: object, width: int, *, label: str) -> str: + if not isinstance(value, str) or len(value) != width or not value.isdigit(): + raise ValueError(f"{label} must be a {width}-digit string, got {value!r}.") + return value + + +def _optional_digits(value: object, width: int, *, label: str) -> str | None: + return None if value is None else _digits(value, width, label=label) + + +# --------------------------------------------------------------------------- +# Derivation +# --------------------------------------------------------------------------- + + +def _normalized_rungs(rungs: Collection[str]) -> tuple[str, ...]: + unknown = sorted(set(rungs) - set(JURISDICTION_RUNGS)) + if unknown: + raise ValueError( + f"Unknown local-jurisdiction rung(s) {unknown}; expected a subset of " + f"{JURISDICTION_RUNGS}." + ) + return tuple(rung for rung in JURISDICTION_RUNGS if rung in set(rungs)) + + +def _text_codes( + values: pd.Series, *, column: str, widths: tuple[int, ...] +) -> pd.Series: + """Return ``values`` as text codes, refusing nulls, non-text and bad widths. + + An integer code is refused rather than zero-filled: the geography lines + write text, and a numeric column here means something upstream changed. + """ + + series = pd.Series(values.to_numpy(dtype=object), dtype=object) + if series.empty: + return series + kind = pd.api.types.infer_dtype(series, skipna=False) + if kind == "bytes": + series = series.str.decode("ascii") + kind = pd.api.types.infer_dtype(series, skipna=False) + allowed = " or ".join( + "empty" if width == 0 else f"{width}-digit" for width in widths + ) + if kind != "string": + examples = ( + series[~series.map(lambda value: isinstance(value, str))].head(5).tolist() + ) + raise ValueError( + f"{column} must hold {allowed} text codes on every row to derive local " + f"jurisdiction flags; it holds {kind} values, e.g. {examples}." + ) + pattern = "|".join(rf"\d{{{width}}}" if width else "" for width in widths) + valid = series.str.fullmatch(f"(?:{pattern})").astype(bool) + if not valid.all(): + raise ValueError( + f"{column} must hold {allowed} text codes on every row to derive local " + f"jurisdiction flags; invalid value(s) {series[~valid].head(5).tolist()}." + ) + return series + + +def _holds_text_codes( + values: pd.Series, *, column: str, widths: tuple[int, ...] +) -> bool: + try: + _text_codes(values, column=column, widths=widths) + except ValueError: + return False + return True + + +def us_local_jurisdiction_rungs_present(household: pd.DataFrame) -> tuple[str, ...]: + """The rungs a finished household table's own geography supplies. + + For a step that starts from an artifact rather than a geography line. The + county rung needs ``county_fips`` on every row. The place rung also needs + every row to sit on a block: ``place_fips`` with no null row and a + 15-digit ``block_geoid`` on every row. A pooled table whose ACS rows have + no block therefore supplies only the county rung, even where a writer has + stored their missing place as an empty string. A malformed + ``county_fips`` is not judged here; deriving the flags raises on it. + """ + + if "county_fips" not in household or household["county_fips"].isna().any(): + return () + block_anchored = ( + "place_fips" in household + and not household["place_fips"].isna().any() + and "block_geoid" in household + and _holds_text_codes( + household["block_geoid"], column="block_geoid", widths=(15,) + ) + ) + return BLOCK_GEOGRAPHY_RUNGS if block_anchored else PUMA_GEOGRAPHY_RUNGS + + +def us_local_jurisdiction_flag_values( + household: pd.DataFrame, + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, np.ndarray]: + """Per-household flag arrays for every registry flag ``rungs`` can decide. + + Returns one boolean array per derivable flag, aligned to ``household``'s + rows, whatever the flag's entity (a person flag is its household's value). + A flag whose rule is not in ``rungs`` is left out. Missing, null or + malformed geography on a supplied rung raises: a household whose county or + place is unknown cannot be decided, and writing ``False`` for it would be + a silent guess. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + needed = {item.rule for item in resolved.jurisdictions} & set(supplied) + if not needed: + return {} + for column in ( + "county_fips", + *(("place_fips",) if JURISDICTION_RUNG_PLACE in needed else ()), + ): + if column not in household: + raise ValueError( + f"household table has no {column!r}; it cannot supply the " + f"local-jurisdiction rung(s) {sorted(needed)}." + ) + county = _text_codes(household["county_fips"], column="county_fips", widths=(5,)) + place = ( + _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) + if JURISDICTION_RUNG_PLACE in needed + else None + ) + flags: dict[str, np.ndarray] = {} + for item in resolved.jurisdictions: + if item.rule not in needed: + continue + if item.rule == JURISDICTION_RUNG_COUNTY: + mask = county.eq(item.county_fips) + else: + assert place is not None + mask = county.str[:2].eq(item.state_fips) & place.eq(item.place_fips) + flags[item.flag] = mask.to_numpy(dtype=bool) + return flags + + +def apply_us_local_jurisdiction_flags( + tables: Mapping[str, pd.DataFrame], + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, + household_weights: np.ndarray | None = None, +) -> tuple[dict[str, pd.DataFrame], dict[str, Any]]: + """Write every derivable flag and return the tables with a receipt. + + Household flags go on the household table; person flags on the person + table, each person taking its household's value through + ``person_household_id``. A flag ``rungs`` cannot decide is removed from + its table if a stale or partially populated column is present, and the + receipt records it as unavailable: the engine default then applies to + every row, and the receipt says so, instead of a written ``False``. + + The household and person tables are returned as new (shallow-copied) + frames; the input tables are never modified, and the other tables are + passed through as-is. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + household = tables["household"] + values = us_local_jurisdiction_flag_values( + household, rungs=supplied, registry=resolved + ) + out = dict(tables) + for entity in {item.entity for item in resolved.jurisdictions}: + out[entity] = tables[entity].copy(deep=False) + person_rows: np.ndarray | None = None + if any( + item.entity == "person" and item.flag in values + for item in resolved.jurisdictions + ): + person_rows = _person_household_positions(out["household"], out["person"]) + for item in resolved.jurisdictions: + table = out[item.entity] + if item.flag not in values: + if item.flag in table: + out[item.entity] = table.drop(columns=[item.flag]) + continue + household_values = values[item.flag] + if item.entity == "household": + table[item.flag] = household_values + else: + assert person_rows is not None + table[item.flag] = household_values[person_rows] + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=supplied, + registry=resolved, + household_weights=household_weights, + ) + return out, receipt + + +def with_us_local_jurisdiction_flags( + frame: Frame, + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, +) -> tuple[Frame, dict[str, Any]]: + """Return ``frame`` with its local-jurisdiction flags and the receipt. + + The one call every geography line makes once its county (and, where it + has one, place) is final: ``rungs`` is :data:`BLOCK_GEOGRAPHY_RUNGS` for + a block-anchored line and :data:`PUMA_GEOGRAPHY_RUNGS` for the PUMA + ladder. + """ + + tables = {entity: frame.table(entity) for entity in frame.entities} + written, receipt = apply_us_local_jurisdiction_flags( + tables, + rungs=rungs, + registry=registry, + household_weights=frame.weights_for("household").values, + ) + for link_name in frame.links: + written[link_name] = frame.link(link_name).copy() + weights = {entity: frame.weights_for(entity) for entity in frame.weighted_entities} + return ( + Frame( + written, + frame.schema, + weights, + frame.strata, + mass_log=frame.mass_log, + metadata=frame.metadata, + ), + receipt, + ) + + +def rederive_us_local_jurisdiction_flags( + frame: Frame, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> tuple[Frame, dict[str, Any]]: + """Derive an existing artifact's flags from the geography it carries. + + For a step that exports or recalibrates an artifact rather than running a + geography line, and for every step that then removes rows from it. A base + H5 built before the flags existed carries none, and exporting it as-is + would leave the engine default (``False``) on every resident. The rungs + come from the artifact's own geography + (:func:`us_local_jurisdiction_rungs_present`), so a selection that drops + every row without a block makes the place-rule flags decidable on the + rows it keeps. A flag the artifact already carries must agree with that + geography, or this raises: re-deriving it would hide a corrupt artifact. + + An artifact that already carries exactly the flags its rungs decide, as + boolean columns, comes back as the same object with the same receipt + that writing them again would give; writing them would only copy every + table. + + The receipt adds ``carried_flags``, the flags the artifact already held. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + household = frame.table("household") + failures = us_local_jurisdiction_flag_failures( + household, person=frame.table("person"), registry=resolved + ) + if failures: + raise ValueError( + "The artifact carries local-jurisdiction flags that disagree with " + "its own geography: " + "; ".join(failures) + ) + carried = _carried_flags(frame, resolved) + rungs = us_local_jurisdiction_rungs_present(household) + values = us_local_jurisdiction_flag_values( + household, rungs=rungs, registry=resolved + ) + complete = set(carried) == set(values) and all( + frame.table(item.entity)[item.flag].dtype == np.dtype(bool) + for item in resolved.jurisdictions + if item.flag in values + ) + if complete: + # Every carried flag agrees with the geography (checked above), and + # the carried set is the derivable set: writing them changes nothing. + derived = frame + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=rungs, + registry=resolved, + household_weights=frame.weights_for("household").values, + ) + else: + derived, receipt = with_us_local_jurisdiction_flags( + frame, rungs=rungs, registry=resolved + ) + receipt["carried_flags"] = carried + return derived, receipt + + +def us_local_jurisdiction_artifact_receipt( + frame: Frame, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, Any]: + """Require an artifact to carry its flags already, and return its receipt. + + For a step that must keep an artifact's columns and bytes, so it cannot + write the flags itself (the annual static-aging lane copies its parent's + source year and keeps its columns in every projected year). The artifact + must carry every flag its own geography decides + (:func:`us_local_jurisdiction_rungs_present`), each agreeing with that + geography, and no flag its rungs cannot decide. Otherwise this raises: + the engine would default a missing flag to ``False`` on every resident. + The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` + returns. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + household = frame.table("household") + rungs = us_local_jurisdiction_rungs_present(household) + failures = us_local_jurisdiction_flag_failures( + household, + person=frame.table("person"), + required_rungs=rungs, + registry=resolved, + ) + values = us_local_jurisdiction_flag_values( + household, rungs=rungs, registry=resolved + ) + carried = _carried_flags(frame, resolved) + failures.extend( + f"{flag}: present, but this artifact's rungs {list(rungs)} do not decide it" + for flag in carried + if flag not in values + ) + if failures: + raise ValueError( + "The artifact lacks or contradicts local-jurisdiction flags its own " + "geography decides: " + "; ".join(failures) + ) + receipt = us_local_jurisdiction_flag_receipt( + values, + rungs=rungs, + registry=resolved, + household_weights=frame.weights_for("household").values, + ) + receipt["carried_flags"] = carried + return receipt + + +def _carried_flags(frame: Frame, registry: UsLocalJurisdictionRegistry) -> list[str]: + return sorted( + item.flag + for item in registry.jurisdictions + if item.flag in frame.table(item.entity) + ) + + +def _person_household_positions( + household: pd.DataFrame, person: pd.DataFrame +) -> np.ndarray: + id_column = US_SCHEMA.entity_id_column("household") + membership = US_SCHEMA.membership_column("household") + for table, column in ((household, id_column), (person, membership)): + if column not in table: + raise ValueError( + f"Person local-jurisdiction flags need {column!r}; it is missing." + ) + ids = pd.Index(household[id_column].to_numpy()) + if not ids.is_unique: + raise ValueError("household_id must be unique to broadcast person flags.") + positions = ids.get_indexer(person[membership].to_numpy()) + if (positions < 0).any(): + raise ValueError( + "Every person must belong to a household in the table to receive " + "its local-jurisdiction flags." + ) + return positions + + +def us_local_jurisdiction_flag_receipt( + values: Mapping[str, np.ndarray], + *, + rungs: Collection[str], + registry: UsLocalJurisdictionRegistry | None = None, + household_weights: np.ndarray | None = None, +) -> dict[str, Any]: + """JSON-ready provenance: registry digest, rungs, and each flag's status.""" + + resolved = registry or packaged_us_local_jurisdiction_registry() + supplied = _normalized_rungs(rungs) + weights = ( + None + if household_weights is None + else np.asarray(household_weights, dtype=np.float64) + ) + flags: dict[str, Any] = {} + for item in resolved.jurisdictions: + entry: dict[str, Any] = { + "entity": item.entity, + "rule": item.rule, + "geoid": item.geoid, + } + if item.flag in values: + mask = np.asarray(values[item.flag], dtype=bool) + entry["status"] = JURISDICTION_FLAG_DERIVED + entry["households_in_jurisdiction"] = int(mask.sum()) + if weights is not None: + if len(weights) != len(mask): + raise ValueError( + "household_weights must align with the household table." + ) + entry["weighted_households_in_jurisdiction"] = float( + weights[mask].sum() + ) + else: + entry["status"] = JURISDICTION_FLAG_UNAVAILABLE + entry["reason"] = ( + f"the line supplies no {item.rule} rung; the flag is not written, " + "so the engine default (False) applies to every row" + ) + flags[item.flag] = entry + return { + "registry": US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + "registry_sha256": resolved.sha256, + "rungs": list(supplied), + "flags": flags, + } + + +def us_local_jurisdiction_flag_failures( + household: pd.DataFrame, + *, + person: pd.DataFrame | None = None, + required_rungs: Collection[str] = (), + registry: UsLocalJurisdictionRegistry | None = None, +) -> list[str]: + """Gate check: every flag column present agrees with the table's geography. + + A flag present must equal its rule applied to the table's own + ``county_fips``/``place_fips``. A place-rule flag on a table with no + complete ``place_fips`` fails: nothing could have decided it. A flag + whose rule is in ``required_rungs`` must also be present: a gate whose + line supplies that rung passes ``required_rungs``, so an artifact built + before the flags existed fails rather than leaving the engine default on + every resident. + + Person flags are checked only when ``person`` is given; each person must + carry its household's value. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + required = set(_normalized_rungs(required_rungs)) + tables = {"household": household, "person": person} + failures: list[str] = [] + for item in resolved.jurisdictions: + table = tables[item.entity] + if table is None: + continue + if item.flag not in table: + if item.rule in required: + failures.append( + f"{item.flag}: absent, but this table's {item.rule} rung " + "decides it; the engine would default every row to False" + ) + continue + try: + expected = us_local_jurisdiction_flag_values( + household, rungs=(item.rule,), registry=resolved + )[item.flag] + if item.entity == "person": + expected = expected[_person_household_positions(household, table)] + except ValueError as error: + failures.append( + f"{item.flag}: present but its {item.rule} rung cannot decide it ({error})" + ) + continue + observed = table[item.flag] + if observed.isna().any(): + failures.append(f"{item.flag}: {int(observed.isna().sum())} null row(s)") + continue + if ( + not pd.api.types.is_bool_dtype(observed) + and not observed.isin([True, False]).all() + ): + failures.append(f"{item.flag}: holds non-boolean values") + continue + disagree = observed.astype(bool).to_numpy() != expected + if disagree.any(): + failures.append( + f"{item.flag}: {int(disagree.sum())}/{len(table)} {item.entity} " + f"row(s) disagree with the {item.rule} rule for {item.geoid}" + ) + return failures + + +# --------------------------------------------------------------------------- +# Block-ladder verification +# --------------------------------------------------------------------------- + + +def check_us_local_jurisdictions_against_block_ladder( + block_geoid: np.ndarray, + population: np.ndarray, + place_fips: np.ndarray, + *, + registry: UsLocalJurisdictionRegistry | None = None, +) -> dict[str, dict[str, Any]]: + """Check every registry geography against a 2020 block ladder. + + Derives each flag for one row per block exactly as a household on that + block gets it (county = the block geoid's first five digits, place = the + ladder's place code), then requires, per jurisdiction: + + - at least one block; + - flag-weighted block population equal to ``population_2020``; and + - for a county rule with a coextensive city, the flagged blocks equal + that city's blocks. + + Returns the per-jurisdiction block count and population; raises on the + first disagreement. + """ + + resolved = registry or packaged_us_local_jurisdiction_registry() + blocks = np.asarray(block_geoid, dtype=np.int64) + pop = np.asarray(population, dtype=np.float64) + places = np.asarray(place_fips, dtype=np.int64) + if not (len(blocks) == len(pop) == len(places)): + raise ValueError("block_geoid, population and place_fips must align.") + block_table = pd.DataFrame( + { + "county_fips": [f"{value // 10**10:05d}" for value in blocks.tolist()], + "place_fips": [ + "" if value == 0 else f"{value:05d}" for value in places.tolist() + ], + } + ) + flags = us_local_jurisdiction_flag_values( + block_table, rungs=JURISDICTION_RUNGS, registry=resolved + ) + state = blocks // 10**13 + report: dict[str, dict[str, Any]] = {} + for item in resolved.jurisdictions: + mask = flags[item.flag] + blocks_in = int(mask.sum()) + population_in = float(pop[mask].sum()) + if blocks_in == 0: + raise ValueError( + f"{item.flag}: no block in the ladder matches {item.geoid}." + ) + if population_in != float(item.population_2020): + raise ValueError( + f"{item.flag}: ladder population {population_in:,.0f} differs from " + f"the registry's 2020 population {item.population_2020:,}." + ) + entry: dict[str, Any] = {"blocks": blocks_in, "population": int(population_in)} + if item.coextensive_place_fips is not None: + city = (state == int(item.state_fips)) & ( + places == int(item.coextensive_place_fips) + ) + if not np.array_equal(city, mask): + raise ValueError( + f"{item.flag}: county {item.county_fips} and place " + f"{item.state_fips}{item.coextensive_place_fips} are not the " + "same blocks in this ladder." + ) + entry["coextensive_place_blocks"] = int(city.sum()) + report[item.flag] = entry + return report + + +__all__ = [ + "BLOCK_GEOGRAPHY_RUNGS", + "JURISDICTION_FLAG_DERIVED", + "JURISDICTION_FLAG_UNAVAILABLE", + "JURISDICTION_RUNGS", + "JURISDICTION_RUNG_COUNTY", + "JURISDICTION_RUNG_PLACE", + "PUMA_GEOGRAPHY_RUNGS", + "US_LOCAL_JURISDICTION_REGISTRY_KIND", + "US_LOCAL_JURISDICTION_REGISTRY_RESOURCE", + "US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION", + "US_LOCAL_JURISDICTION_REGISTRY_SHA256", + "UsLocalJurisdiction", + "UsLocalJurisdictionRegistry", + "apply_us_local_jurisdiction_flags", + "check_us_local_jurisdictions_against_block_ladder", + "load_us_local_jurisdiction_registry", + "packaged_us_local_jurisdiction_registry", + "rederive_us_local_jurisdiction_flags", + "us_local_jurisdiction_artifact_receipt", + "us_local_jurisdiction_flag_failures", + "us_local_jurisdiction_flag_receipt", + "us_local_jurisdiction_flag_values", + "us_local_jurisdiction_rungs_present", + "with_us_local_jurisdiction_flags", +] diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index b09c55f1d6..c4939c2df9 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -17,8 +17,11 @@ line writes. ## Registry -`us_local_jurisdictions.json` holds the table above, and -`local_jurisdictions.py` pins its SHA-256. A county rule holds when +`microcosm/build/us_local_jurisdictions.json` holds the table above, and +`microcosm/build/us_local_jurisdictions.py` pins its SHA-256. Both sit outside +`us_runtime`, whose package import asserts the engine ABI lock wherever +policyengine-us is installed; `us_runtime/local_jurisdictions.py` re-exports +the module's names for the geography lines. A county rule holds when `county_fips` equals the registry county. A place rule holds when the first two digits of `county_fips` equal the registry state and `place_fips` equals the registry place code; place codes repeat across states, so the state is part of @@ -84,7 +87,10 @@ parent's columns and base-year bytes, so it cannot write the flags. It calls lacks a flag its geography decides or carries one that disagrees with it, and records the receipt as `base.local_jurisdiction_flags` in the candidate manifest. A parent built before the flags existed therefore cannot seed annual -files until a rebuild adds them. +files until a rebuild adds them. The lane imports the helper from +`microcosm.build.us_local_jurisdictions`, so the check loads no `us_runtime` +module and so never asserts the engine ABI lock +(`test_us_annual_static_aging_gate_imports.py`). The helper reads the rungs from the artifact's own geography (`us_local_jurisdiction_rungs_present`): the county rung when `county_fips` is diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py index 7f6e48fb01..461c22d4c6 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/local_jurisdictions.py @@ -1,866 +1,40 @@ -"""US local-jurisdiction flags derived from household geography. +"""Re-export of :mod:`microcosm.build.us_local_jurisdictions`. -policyengine-us 2.2.1 declares a few local-tax jurisdictions as plain inputs -with no formula, so they default to ``False`` unless the dataset writes them: - -- ``in_denver`` (household): read by the Denver property-tax-relief - eligibility variables; -- ``in_yonkers`` (household): read by ``ny_yonkers_income_tax`` (the resident - surcharge); -- ``in_wilmington`` (household): read by ``de_wilmington_earned_income_tax``; -- ``pa_philadelphia_wage_tax_resident`` (person): read by - ``pa_philadelphia_wage_tax`` to pick the resident rate. - -Local flags with a ``county_str`` formula (``in_nyc``, ``in_la`` and the -rest) need nothing: the engine computes them from ``county_fips``. - -The packaged registry ``us_local_jurisdictions.json`` maps each input-only -flag to one 2020 geography, and its SHA-256 is pinned here: - -- rule ``county``: the flag is true exactly when ``county_fips`` equals the - registry county (Denver ``08031``; Philadelphia ``42101``); -- rule ``place``: the flag is true exactly when the household's state (the - first two digits of ``county_fips``) and ``place_fips`` equal the registry - state and 2020 place code (Yonkers city ``36``/``84000``; Wilmington city - ``10``/``77580``). Place codes are unique only within a state, so the state - is part of the match. - -A geography line derives the flags from the rungs it actually writes. The -block ladder (and the block-location draw) writes county and place from one -block, so every flag is derived. The PUMA ladder writes a county but no -place, so the place-rule flags are *unavailable* there: the line never writes -them (any stale column is removed) and its receipt records them as -unavailable with the reason, rather than writing ``False``. - -An artifact built before the flags existed carries none, so a step that -exports or recalibrates an existing artifact instead of running a geography -line calls :func:`rederive_us_local_jurisdiction_flags`. It derives every -flag the artifact's own geography decides and refuses a carried flag that -disagrees with that geography. Both ladder gates fail a table that lacks a -flag its geography decides. - -The rungs belong to the whole household table: one row without a block -withholds the place rung from every row. A step that removes rows (a -frozen-support or L0 selection) can therefore make a place-rule flag -decidable, so it derives the flags again on the rows it keeps; deriving a -support whose flags are already complete returns it unchanged. A step that -must keep an artifact's columns and bytes, and so cannot write the flags, -calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses -an artifact that lacks a flag its geography decides. +The flags, their registry and its JSON live outside ``us_runtime``, so the +annual static-aging lane can check a parent without running this package's +import (see that module's docstring). The geography lines keep importing the +names from here, which leaves their bytes, and the seed protocol that attests +them, unchanged. """ from __future__ import annotations -import hashlib -import json -from collections.abc import Collection, Mapping -from dataclasses import dataclass -from functools import cache -from importlib.resources import files -from pathlib import Path -from typing import Any - -import numpy as np -import pandas as pd - -from microcosm.frame import US_SCHEMA, Frame - -US_LOCAL_JURISDICTION_REGISTRY_RESOURCE = "us_local_jurisdictions.json" -#: SHA-256 of the packaged registry; :func:`packaged_us_local_jurisdiction_registry` -#: refuses any other bytes. -US_LOCAL_JURISDICTION_REGISTRY_SHA256 = ( - "45035eee30beddc0bccceadc7a00363635b0c9012662bf722435ee83243a053c" +from microcosm.build.us_local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + JURISDICTION_FLAG_DERIVED, + JURISDICTION_FLAG_UNAVAILABLE, + JURISDICTION_RUNG_COUNTY, + JURISDICTION_RUNG_PLACE, + JURISDICTION_RUNGS, + PUMA_GEOGRAPHY_RUNGS, + US_LOCAL_JURISDICTION_REGISTRY_KIND, + US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, + US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION, + US_LOCAL_JURISDICTION_REGISTRY_SHA256, + UsLocalJurisdiction, + UsLocalJurisdictionRegistry, + apply_us_local_jurisdiction_flags, + check_us_local_jurisdictions_against_block_ladder, + load_us_local_jurisdiction_registry, + packaged_us_local_jurisdiction_registry, + rederive_us_local_jurisdiction_flags, + us_local_jurisdiction_artifact_receipt, + us_local_jurisdiction_flag_failures, + us_local_jurisdiction_flag_receipt, + us_local_jurisdiction_flag_values, + us_local_jurisdiction_rungs_present, + with_us_local_jurisdiction_flags, ) -US_LOCAL_JURISDICTION_REGISTRY_KIND = "us_local_jurisdiction_registry" -US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION = 1 - -#: Geography rungs a line can supply. ``county`` needs ``county_fips``; -#: ``place`` needs ``place_fips`` (and the county's state prefix). -JURISDICTION_RUNG_COUNTY = "county" -JURISDICTION_RUNG_PLACE = "place" -JURISDICTION_RUNGS = (JURISDICTION_RUNG_COUNTY, JURISDICTION_RUNG_PLACE) -#: What the block ladder and the block-location draw write. -BLOCK_GEOGRAPHY_RUNGS = JURISDICTION_RUNGS -#: What the PUMA ladder writes. -PUMA_GEOGRAPHY_RUNGS = (JURISDICTION_RUNG_COUNTY,) - -#: Receipt statuses. -JURISDICTION_FLAG_DERIVED = "derived" -JURISDICTION_FLAG_UNAVAILABLE = "unavailable" - -_ENTITIES = ("household", "person") -_REQUIRED_JURISDICTION_KEYS = ( - "flag", - "entity", - "jurisdiction", - "rule", - "state_fips", - "population_2020", -) - - -@dataclass(frozen=True) -class UsLocalJurisdiction: - """One input-only engine flag and the 2020 geography that decides it. - - Attributes: - flag: The policyengine-us input variable. - entity: ``household`` or ``person`` (a person flag is the person's - household's value). - jurisdiction: Human-readable name. - rule: ``county`` or ``place``; the rung the flag needs. - state_fips: Two-digit state FIPS. - county_fips: Five-digit county FIPS (rule ``county``). - place_fips: Five-digit 2020 place code within ``state_fips`` - (rule ``place``). - coextensive_place_fips: For a county-rule jurisdiction whose city is - the same area as the county, that city's place code; the - block-ladder check requires the two block sets to be identical. - population_2020: 2020 P.L. 94-171 population (``P1_001N``) of the - jurisdiction; the block-ladder check requires the ladder's blocks - to sum to it. - """ - - flag: str - entity: str - jurisdiction: str - rule: str - state_fips: str - county_fips: str | None - place_fips: str | None - coextensive_place_fips: str | None - population_2020: int - - @property - def geoid(self) -> str: - """The deciding geography's 2020 GEOID (county 5 digits, place 7).""" - - if self.rule == JURISDICTION_RUNG_COUNTY: - assert self.county_fips is not None - return self.county_fips - assert self.place_fips is not None - return self.state_fips + self.place_fips - - -@dataclass(frozen=True) -class UsLocalJurisdictionRegistry: - """The parsed registry plus the SHA-256 of the bytes it came from.""" - - jurisdictions: tuple[UsLocalJurisdiction, ...] - sha256: str - metadata: Mapping[str, Any] - - @property - def flags(self) -> tuple[str, ...]: - return tuple(item.flag for item in self.jurisdictions) - - def for_entity(self, entity: str) -> tuple[UsLocalJurisdiction, ...]: - return tuple(item for item in self.jurisdictions if item.entity == entity) - - -def load_us_local_jurisdiction_registry( - path: str | Path, - *, - expected_sha256: str | None = None, -) -> UsLocalJurisdictionRegistry: - """Load and validate a registry file, optionally pinning its SHA-256.""" - - payload = Path(path).read_bytes() - return _registry_from_bytes(payload, expected_sha256=expected_sha256) - - -@cache -def packaged_us_local_jurisdiction_registry() -> UsLocalJurisdictionRegistry: - """The packaged registry, refused unless its bytes match the pinned SHA-256.""" - - payload = ( - files("microcosm.build.us_runtime") - .joinpath(US_LOCAL_JURISDICTION_REGISTRY_RESOURCE) - .read_bytes() - ) - return _registry_from_bytes( - payload, expected_sha256=US_LOCAL_JURISDICTION_REGISTRY_SHA256 - ) - - -def _registry_from_bytes( - payload: bytes, - *, - expected_sha256: str | None, -) -> UsLocalJurisdictionRegistry: - digest = hashlib.sha256(payload).hexdigest() - if expected_sha256 is not None and digest != expected_sha256: - raise ValueError( - "US local-jurisdiction registry bytes do not match the pinned " - f"SHA-256: expected {expected_sha256}, observed {digest}." - ) - document = json.loads(payload) - if not isinstance(document, Mapping): - raise ValueError("US local-jurisdiction registry must be a JSON object.") - if document.get("kind") != US_LOCAL_JURISDICTION_REGISTRY_KIND: - raise ValueError( - "US local-jurisdiction registry kind must be " - f"{US_LOCAL_JURISDICTION_REGISTRY_KIND!r}, got {document.get('kind')!r}." - ) - if document.get("schema_version") != US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION: - raise ValueError( - "US local-jurisdiction registry schema_version must be " - f"{US_LOCAL_JURISDICTION_REGISTRY_SCHEMA_VERSION}, got " - f"{document.get('schema_version')!r}." - ) - raw = document.get("jurisdictions") - if not isinstance(raw, list) or not raw: - raise ValueError("US local-jurisdiction registry has no jurisdictions.") - jurisdictions = tuple(_jurisdiction(item, index) for index, item in enumerate(raw)) - flags = [item.flag for item in jurisdictions] - if len(set(flags)) != len(flags): - raise ValueError(f"US local-jurisdiction registry repeats a flag: {flags}.") - if flags != sorted(flags): - raise ValueError( - f"US local-jurisdiction registry flags must be sorted: {flags}." - ) - geoids = [item.geoid for item in jurisdictions] - if len(set(geoids)) != len(geoids): - raise ValueError( - f"US local-jurisdiction registry repeats a geography: {geoids}." - ) - metadata = {key: value for key, value in document.items() if key != "jurisdictions"} - return UsLocalJurisdictionRegistry( - jurisdictions=jurisdictions, sha256=digest, metadata=metadata - ) - - -def _jurisdiction(item: object, index: int) -> UsLocalJurisdiction: - label = f"jurisdictions[{index}]" - if not isinstance(item, Mapping): - raise ValueError(f"{label} must be an object.") - missing = [key for key in _REQUIRED_JURISDICTION_KEYS if key not in item] - if missing: - raise ValueError(f"{label} is missing {missing}.") - flag = item["flag"] - if not isinstance(flag, str) or not flag.isidentifier() or flag != flag.lower(): - raise ValueError(f"{label}.flag must be a lowercase identifier: {flag!r}.") - entity = item["entity"] - if entity not in _ENTITIES: - raise ValueError(f"{label}.entity must be one of {_ENTITIES}: {entity!r}.") - rule = item["rule"] - if rule not in JURISDICTION_RUNGS: - raise ValueError(f"{label}.rule must be one of {JURISDICTION_RUNGS}.") - state = _digits(item["state_fips"], 2, label=f"{label}.state_fips") - county = _optional_digits(item.get("county_fips"), 5, label=f"{label}.county_fips") - place = _optional_digits(item.get("place_fips"), 5, label=f"{label}.place_fips") - coextensive = _optional_digits( - item.get("coextensive_place_fips"), - 5, - label=f"{label}.coextensive_place_fips", - ) - if rule == JURISDICTION_RUNG_COUNTY: - if county is None or place is not None: - raise ValueError( - f"{label}: a county rule names county_fips and no place_fips." - ) - if county[:2] != state: - raise ValueError(f"{label}: county_fips {county} is not in state {state}.") - else: - if place is None or county is not None or coextensive is not None: - raise ValueError( - f"{label}: a place rule names place_fips and no county fields." - ) - population = item["population_2020"] - if isinstance(population, bool) or not isinstance(population, int): - raise ValueError(f"{label}.population_2020 must be an integer.") - if population <= 0: - raise ValueError(f"{label}.population_2020 must be positive.") - name = item["jurisdiction"] - if not isinstance(name, str) or not name: - raise ValueError(f"{label}.jurisdiction must be a non-empty string.") - return UsLocalJurisdiction( - flag=flag, - entity=entity, - jurisdiction=name, - rule=rule, - state_fips=state, - county_fips=county, - place_fips=place, - coextensive_place_fips=coextensive, - population_2020=population, - ) - - -def _digits(value: object, width: int, *, label: str) -> str: - if not isinstance(value, str) or len(value) != width or not value.isdigit(): - raise ValueError(f"{label} must be a {width}-digit string, got {value!r}.") - return value - - -def _optional_digits(value: object, width: int, *, label: str) -> str | None: - return None if value is None else _digits(value, width, label=label) - - -# --------------------------------------------------------------------------- -# Derivation -# --------------------------------------------------------------------------- - - -def _normalized_rungs(rungs: Collection[str]) -> tuple[str, ...]: - unknown = sorted(set(rungs) - set(JURISDICTION_RUNGS)) - if unknown: - raise ValueError( - f"Unknown local-jurisdiction rung(s) {unknown}; expected a subset of " - f"{JURISDICTION_RUNGS}." - ) - return tuple(rung for rung in JURISDICTION_RUNGS if rung in set(rungs)) - - -def _text_codes( - values: pd.Series, *, column: str, widths: tuple[int, ...] -) -> pd.Series: - """Return ``values`` as text codes, refusing nulls, non-text and bad widths. - - An integer code is refused rather than zero-filled: the geography lines - write text, and a numeric column here means something upstream changed. - """ - - series = pd.Series(values.to_numpy(dtype=object), dtype=object) - if series.empty: - return series - kind = pd.api.types.infer_dtype(series, skipna=False) - if kind == "bytes": - series = series.str.decode("ascii") - kind = pd.api.types.infer_dtype(series, skipna=False) - allowed = " or ".join( - "empty" if width == 0 else f"{width}-digit" for width in widths - ) - if kind != "string": - examples = ( - series[~series.map(lambda value: isinstance(value, str))].head(5).tolist() - ) - raise ValueError( - f"{column} must hold {allowed} text codes on every row to derive local " - f"jurisdiction flags; it holds {kind} values, e.g. {examples}." - ) - pattern = "|".join(rf"\d{{{width}}}" if width else "" for width in widths) - valid = series.str.fullmatch(f"(?:{pattern})").astype(bool) - if not valid.all(): - raise ValueError( - f"{column} must hold {allowed} text codes on every row to derive local " - f"jurisdiction flags; invalid value(s) {series[~valid].head(5).tolist()}." - ) - return series - - -def _holds_text_codes( - values: pd.Series, *, column: str, widths: tuple[int, ...] -) -> bool: - try: - _text_codes(values, column=column, widths=widths) - except ValueError: - return False - return True - - -def us_local_jurisdiction_rungs_present(household: pd.DataFrame) -> tuple[str, ...]: - """The rungs a finished household table's own geography supplies. - - For a step that starts from an artifact rather than a geography line. The - county rung needs ``county_fips`` on every row. The place rung also needs - every row to sit on a block: ``place_fips`` with no null row and a - 15-digit ``block_geoid`` on every row. A pooled table whose ACS rows have - no block therefore supplies only the county rung, even where a writer has - stored their missing place as an empty string. A malformed - ``county_fips`` is not judged here; deriving the flags raises on it. - """ - - if "county_fips" not in household or household["county_fips"].isna().any(): - return () - block_anchored = ( - "place_fips" in household - and not household["place_fips"].isna().any() - and "block_geoid" in household - and _holds_text_codes( - household["block_geoid"], column="block_geoid", widths=(15,) - ) - ) - return BLOCK_GEOGRAPHY_RUNGS if block_anchored else PUMA_GEOGRAPHY_RUNGS - - -def us_local_jurisdiction_flag_values( - household: pd.DataFrame, - *, - rungs: Collection[str], - registry: UsLocalJurisdictionRegistry | None = None, -) -> dict[str, np.ndarray]: - """Per-household flag arrays for every registry flag ``rungs`` can decide. - - Returns one boolean array per derivable flag, aligned to ``household``'s - rows, whatever the flag's entity (a person flag is its household's value). - A flag whose rule is not in ``rungs`` is left out. Missing, null or - malformed geography on a supplied rung raises: a household whose county or - place is unknown cannot be decided, and writing ``False`` for it would be - a silent guess. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - supplied = _normalized_rungs(rungs) - needed = {item.rule for item in resolved.jurisdictions} & set(supplied) - if not needed: - return {} - for column in ( - "county_fips", - *(("place_fips",) if JURISDICTION_RUNG_PLACE in needed else ()), - ): - if column not in household: - raise ValueError( - f"household table has no {column!r}; it cannot supply the " - f"local-jurisdiction rung(s) {sorted(needed)}." - ) - county = _text_codes(household["county_fips"], column="county_fips", widths=(5,)) - place = ( - _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) - if JURISDICTION_RUNG_PLACE in needed - else None - ) - flags: dict[str, np.ndarray] = {} - for item in resolved.jurisdictions: - if item.rule not in needed: - continue - if item.rule == JURISDICTION_RUNG_COUNTY: - mask = county.eq(item.county_fips) - else: - assert place is not None - mask = county.str[:2].eq(item.state_fips) & place.eq(item.place_fips) - flags[item.flag] = mask.to_numpy(dtype=bool) - return flags - - -def apply_us_local_jurisdiction_flags( - tables: Mapping[str, pd.DataFrame], - *, - rungs: Collection[str], - registry: UsLocalJurisdictionRegistry | None = None, - household_weights: np.ndarray | None = None, -) -> tuple[dict[str, pd.DataFrame], dict[str, Any]]: - """Write every derivable flag and return the tables with a receipt. - - Household flags go on the household table; person flags on the person - table, each person taking its household's value through - ``person_household_id``. A flag ``rungs`` cannot decide is removed from - its table if a stale or partially populated column is present, and the - receipt records it as unavailable: the engine default then applies to - every row, and the receipt says so, instead of a written ``False``. - - The household and person tables are returned as new (shallow-copied) - frames; the input tables are never modified, and the other tables are - passed through as-is. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - supplied = _normalized_rungs(rungs) - household = tables["household"] - values = us_local_jurisdiction_flag_values( - household, rungs=supplied, registry=resolved - ) - out = dict(tables) - for entity in {item.entity for item in resolved.jurisdictions}: - out[entity] = tables[entity].copy(deep=False) - person_rows: np.ndarray | None = None - if any( - item.entity == "person" and item.flag in values - for item in resolved.jurisdictions - ): - person_rows = _person_household_positions(out["household"], out["person"]) - for item in resolved.jurisdictions: - table = out[item.entity] - if item.flag not in values: - if item.flag in table: - out[item.entity] = table.drop(columns=[item.flag]) - continue - household_values = values[item.flag] - if item.entity == "household": - table[item.flag] = household_values - else: - assert person_rows is not None - table[item.flag] = household_values[person_rows] - receipt = us_local_jurisdiction_flag_receipt( - values, - rungs=supplied, - registry=resolved, - household_weights=household_weights, - ) - return out, receipt - - -def with_us_local_jurisdiction_flags( - frame: Frame, - *, - rungs: Collection[str], - registry: UsLocalJurisdictionRegistry | None = None, -) -> tuple[Frame, dict[str, Any]]: - """Return ``frame`` with its local-jurisdiction flags and the receipt. - - The one call every geography line makes once its county (and, where it - has one, place) is final: ``rungs`` is :data:`BLOCK_GEOGRAPHY_RUNGS` for - a block-anchored line and :data:`PUMA_GEOGRAPHY_RUNGS` for the PUMA - ladder. - """ - - tables = {entity: frame.table(entity) for entity in frame.entities} - written, receipt = apply_us_local_jurisdiction_flags( - tables, - rungs=rungs, - registry=registry, - household_weights=frame.weights_for("household").values, - ) - for link_name in frame.links: - written[link_name] = frame.link(link_name).copy() - weights = {entity: frame.weights_for(entity) for entity in frame.weighted_entities} - return ( - Frame( - written, - frame.schema, - weights, - frame.strata, - mass_log=frame.mass_log, - metadata=frame.metadata, - ), - receipt, - ) - - -def rederive_us_local_jurisdiction_flags( - frame: Frame, - *, - registry: UsLocalJurisdictionRegistry | None = None, -) -> tuple[Frame, dict[str, Any]]: - """Derive an existing artifact's flags from the geography it carries. - - For a step that exports or recalibrates an artifact rather than running a - geography line, and for every step that then removes rows from it. A base - H5 built before the flags existed carries none, and exporting it as-is - would leave the engine default (``False``) on every resident. The rungs - come from the artifact's own geography - (:func:`us_local_jurisdiction_rungs_present`), so a selection that drops - every row without a block makes the place-rule flags decidable on the - rows it keeps. A flag the artifact already carries must agree with that - geography, or this raises: re-deriving it would hide a corrupt artifact. - - An artifact that already carries exactly the flags its rungs decide, as - boolean columns, comes back as the same object with the same receipt - that writing them again would give; writing them would only copy every - table. - - The receipt adds ``carried_flags``, the flags the artifact already held. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - household = frame.table("household") - failures = us_local_jurisdiction_flag_failures( - household, person=frame.table("person"), registry=resolved - ) - if failures: - raise ValueError( - "The artifact carries local-jurisdiction flags that disagree with " - "its own geography: " + "; ".join(failures) - ) - carried = _carried_flags(frame, resolved) - rungs = us_local_jurisdiction_rungs_present(household) - values = us_local_jurisdiction_flag_values( - household, rungs=rungs, registry=resolved - ) - complete = set(carried) == set(values) and all( - frame.table(item.entity)[item.flag].dtype == np.dtype(bool) - for item in resolved.jurisdictions - if item.flag in values - ) - if complete: - # Every carried flag agrees with the geography (checked above), and - # the carried set is the derivable set: writing them changes nothing. - derived = frame - receipt = us_local_jurisdiction_flag_receipt( - values, - rungs=rungs, - registry=resolved, - household_weights=frame.weights_for("household").values, - ) - else: - derived, receipt = with_us_local_jurisdiction_flags( - frame, rungs=rungs, registry=resolved - ) - receipt["carried_flags"] = carried - return derived, receipt - - -def us_local_jurisdiction_artifact_receipt( - frame: Frame, - *, - registry: UsLocalJurisdictionRegistry | None = None, -) -> dict[str, Any]: - """Require an artifact to carry its flags already, and return its receipt. - - For a step that must keep an artifact's columns and bytes, so it cannot - write the flags itself (the annual static-aging lane copies its parent's - source year and keeps its columns in every projected year). The artifact - must carry every flag its own geography decides - (:func:`us_local_jurisdiction_rungs_present`), each agreeing with that - geography, and no flag its rungs cannot decide. Otherwise this raises: - the engine would default a missing flag to ``False`` on every resident. - The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` - returns. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - household = frame.table("household") - rungs = us_local_jurisdiction_rungs_present(household) - failures = us_local_jurisdiction_flag_failures( - household, - person=frame.table("person"), - required_rungs=rungs, - registry=resolved, - ) - values = us_local_jurisdiction_flag_values( - household, rungs=rungs, registry=resolved - ) - carried = _carried_flags(frame, resolved) - failures.extend( - f"{flag}: present, but this artifact's rungs {list(rungs)} do not decide it" - for flag in carried - if flag not in values - ) - if failures: - raise ValueError( - "The artifact lacks or contradicts local-jurisdiction flags its own " - "geography decides: " + "; ".join(failures) - ) - receipt = us_local_jurisdiction_flag_receipt( - values, - rungs=rungs, - registry=resolved, - household_weights=frame.weights_for("household").values, - ) - receipt["carried_flags"] = carried - return receipt - - -def _carried_flags(frame: Frame, registry: UsLocalJurisdictionRegistry) -> list[str]: - return sorted( - item.flag - for item in registry.jurisdictions - if item.flag in frame.table(item.entity) - ) - - -def _person_household_positions( - household: pd.DataFrame, person: pd.DataFrame -) -> np.ndarray: - id_column = US_SCHEMA.entity_id_column("household") - membership = US_SCHEMA.membership_column("household") - for table, column in ((household, id_column), (person, membership)): - if column not in table: - raise ValueError( - f"Person local-jurisdiction flags need {column!r}; it is missing." - ) - ids = pd.Index(household[id_column].to_numpy()) - if not ids.is_unique: - raise ValueError("household_id must be unique to broadcast person flags.") - positions = ids.get_indexer(person[membership].to_numpy()) - if (positions < 0).any(): - raise ValueError( - "Every person must belong to a household in the table to receive " - "its local-jurisdiction flags." - ) - return positions - - -def us_local_jurisdiction_flag_receipt( - values: Mapping[str, np.ndarray], - *, - rungs: Collection[str], - registry: UsLocalJurisdictionRegistry | None = None, - household_weights: np.ndarray | None = None, -) -> dict[str, Any]: - """JSON-ready provenance: registry digest, rungs, and each flag's status.""" - - resolved = registry or packaged_us_local_jurisdiction_registry() - supplied = _normalized_rungs(rungs) - weights = ( - None - if household_weights is None - else np.asarray(household_weights, dtype=np.float64) - ) - flags: dict[str, Any] = {} - for item in resolved.jurisdictions: - entry: dict[str, Any] = { - "entity": item.entity, - "rule": item.rule, - "geoid": item.geoid, - } - if item.flag in values: - mask = np.asarray(values[item.flag], dtype=bool) - entry["status"] = JURISDICTION_FLAG_DERIVED - entry["households_in_jurisdiction"] = int(mask.sum()) - if weights is not None: - if len(weights) != len(mask): - raise ValueError( - "household_weights must align with the household table." - ) - entry["weighted_households_in_jurisdiction"] = float( - weights[mask].sum() - ) - else: - entry["status"] = JURISDICTION_FLAG_UNAVAILABLE - entry["reason"] = ( - f"the line supplies no {item.rule} rung; the flag is not written, " - "so the engine default (False) applies to every row" - ) - flags[item.flag] = entry - return { - "registry": US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, - "registry_sha256": resolved.sha256, - "rungs": list(supplied), - "flags": flags, - } - - -def us_local_jurisdiction_flag_failures( - household: pd.DataFrame, - *, - person: pd.DataFrame | None = None, - required_rungs: Collection[str] = (), - registry: UsLocalJurisdictionRegistry | None = None, -) -> list[str]: - """Gate check: every flag column present agrees with the table's geography. - - A flag present must equal its rule applied to the table's own - ``county_fips``/``place_fips``. A place-rule flag on a table with no - complete ``place_fips`` fails: nothing could have decided it. A flag - whose rule is in ``required_rungs`` must also be present: a gate whose - line supplies that rung passes ``required_rungs``, so an artifact built - before the flags existed fails rather than leaving the engine default on - every resident. - - Person flags are checked only when ``person`` is given; each person must - carry its household's value. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - required = set(_normalized_rungs(required_rungs)) - tables = {"household": household, "person": person} - failures: list[str] = [] - for item in resolved.jurisdictions: - table = tables[item.entity] - if table is None: - continue - if item.flag not in table: - if item.rule in required: - failures.append( - f"{item.flag}: absent, but this table's {item.rule} rung " - "decides it; the engine would default every row to False" - ) - continue - try: - expected = us_local_jurisdiction_flag_values( - household, rungs=(item.rule,), registry=resolved - )[item.flag] - if item.entity == "person": - expected = expected[_person_household_positions(household, table)] - except ValueError as error: - failures.append( - f"{item.flag}: present but its {item.rule} rung cannot decide it ({error})" - ) - continue - observed = table[item.flag] - if observed.isna().any(): - failures.append(f"{item.flag}: {int(observed.isna().sum())} null row(s)") - continue - if ( - not pd.api.types.is_bool_dtype(observed) - and not observed.isin([True, False]).all() - ): - failures.append(f"{item.flag}: holds non-boolean values") - continue - disagree = observed.astype(bool).to_numpy() != expected - if disagree.any(): - failures.append( - f"{item.flag}: {int(disagree.sum())}/{len(table)} {item.entity} " - f"row(s) disagree with the {item.rule} rule for {item.geoid}" - ) - return failures - - -# --------------------------------------------------------------------------- -# Block-ladder verification -# --------------------------------------------------------------------------- - - -def check_us_local_jurisdictions_against_block_ladder( - block_geoid: np.ndarray, - population: np.ndarray, - place_fips: np.ndarray, - *, - registry: UsLocalJurisdictionRegistry | None = None, -) -> dict[str, dict[str, Any]]: - """Check every registry geography against a 2020 block ladder. - - Derives each flag for one row per block exactly as a household on that - block gets it (county = the block geoid's first five digits, place = the - ladder's place code), then requires, per jurisdiction: - - - at least one block; - - flag-weighted block population equal to ``population_2020``; and - - for a county rule with a coextensive city, the flagged blocks equal - that city's blocks. - - Returns the per-jurisdiction block count and population; raises on the - first disagreement. - """ - - resolved = registry or packaged_us_local_jurisdiction_registry() - blocks = np.asarray(block_geoid, dtype=np.int64) - pop = np.asarray(population, dtype=np.float64) - places = np.asarray(place_fips, dtype=np.int64) - if not (len(blocks) == len(pop) == len(places)): - raise ValueError("block_geoid, population and place_fips must align.") - block_table = pd.DataFrame( - { - "county_fips": [f"{value // 10**10:05d}" for value in blocks.tolist()], - "place_fips": [ - "" if value == 0 else f"{value:05d}" for value in places.tolist() - ], - } - ) - flags = us_local_jurisdiction_flag_values( - block_table, rungs=JURISDICTION_RUNGS, registry=resolved - ) - state = blocks // 10**13 - report: dict[str, dict[str, Any]] = {} - for item in resolved.jurisdictions: - mask = flags[item.flag] - blocks_in = int(mask.sum()) - population_in = float(pop[mask].sum()) - if blocks_in == 0: - raise ValueError( - f"{item.flag}: no block in the ladder matches {item.geoid}." - ) - if population_in != float(item.population_2020): - raise ValueError( - f"{item.flag}: ladder population {population_in:,.0f} differs from " - f"the registry's 2020 population {item.population_2020:,}." - ) - entry: dict[str, Any] = {"blocks": blocks_in, "population": int(population_in)} - if item.coextensive_place_fips is not None: - city = (state == int(item.state_fips)) & ( - places == int(item.coextensive_place_fips) - ) - if not np.array_equal(city, mask): - raise ValueError( - f"{item.flag}: county {item.county_fips} and place " - f"{item.state_fips}{item.coextensive_place_fips} are not the " - "same blocks in this ladder." - ) - entry["coextensive_place_blocks"] = int(city.sum()) - report[item.flag] = entry - return report - __all__ = [ "BLOCK_GEOGRAPHY_RUNGS", diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py new file mode 100644 index 0000000000..ef8826ab54 --- /dev/null +++ b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py @@ -0,0 +1,179 @@ +"""The annual lane's parent-flag check never imports ``us_runtime``. + +Importing any ``microcosm.build.us_runtime`` module runs that package's +``__init__``, which builds the spine-agreement registry; that loads the +take-up contract, which asserts the engine ABI lock wherever policyengine-us +is installed. The annual static-aging lane checks its parent's +local-jurisdiction flags before any model work, so a check that went through +``us_runtime`` would refuse every parent under any policyengine-us other than +the locked one. The check therefore imports +:mod:`microcosm.build.us_local_jurisdictions`, which sits outside +``us_runtime``. + +Invariants: + +- in a fresh interpreter, the lane run up to its model-provenance step, on a + parent that carries its flags and on one that lacks them, leaves no + ``microcosm.build.us_runtime`` module in ``sys.modules``. It must be a fresh + interpreter: this test process has usually imported ``us_runtime`` already; +- ``us_runtime.local_jurisdictions`` re-exports every public name of the + module as the same object, so the geography lines that import it there + see one implementation. +""" + +from __future__ import annotations + +import json +import os +import subprocess +import sys + +from microcosm.build import us_annual_static_aging as annual +from microcosm.build import us_local_jurisdictions +from microcosm.build.us_runtime import local_jurisdictions as us_runtime_re_export +from test_support.paths import paths_for + +#: Runs the lane in a fresh interpreter on two parents and prints what it +#: loaded. Each parent is a Yonkers and a Denver household on their blocks. +_GATE_PROBE = r""" +import json +import sys +from pathlib import Path + +import pandas as pd + +from microcosm.build import us_annual_static_aging as annual +from microcosm.frame import US_SCHEMA +from microcosm.frame.materialize import put_frame_table + +work = Path(sys.argv[1]) +HOUSEHOLD = { + "state_fips": [36, 8], + "county_fips": ["36119", "08031"], + "place_fips": ["84000", "20000"], + "block_geoid": ["361190001001000", "080310001001000"], +} +FLAGS = { + "in_denver": ("household", [False, True]), + "in_wilmington": ("household", [False, False]), + "in_yonkers": ("household", [True, False]), + "pa_philadelphia_wage_tax_resident": ("person", [False, False]), +} + + +def parent(name, flags): + ids = [1, 2] + tables = { + entity: pd.DataFrame({US_SCHEMA.entity_id_column(entity): ids}) + for entity in US_SCHEMA.entities + } + for group in US_SCHEMA.group_entities: + tables["person"][US_SCHEMA.membership_column(group)] = ids + tables["person"]["age"] = [40, 40] + tables["person"]["is_female"] = [False, True] + tables["household"]["household_weight"] = [1.0, 2.0] + for column, values in HOUSEHOLD.items(): + tables["household"][column] = values + for flag in flags: + entity, values = FLAGS[flag] + tables[entity][flag] = values + path = work / f"{name}.h5" + with pd.HDFStore(path, "w") as store: + for entity, table in tables.items(): + put_frame_table( + store, entity, table, preferred_format="table", data_columns=True + ) + store.put("_time_period", pd.Series([2024]), format="table") + return path + + +class ReachedModelProvenance(Exception): + pass + + +def reached(**kwargs): + raise ReachedModelProvenance + + +annual._model_provenance = reached +ssa = work / "ssa.csv" +pd.DataFrame( + {"Year": [2024, 2025], "Age": [40, 40], "M Tot": [4, 5], "F Tot": [2, 3]} +).to_csv(ssa, index=False) +outcomes = {} +for name, flags in (("flagged", tuple(FLAGS)), ("unflagged", ())): + base = parent(name, flags) + try: + annual.build_annual_static_aging( + base_h5=base, + base_sha256=annual._sha256(base), + parent_release="pinned-parent", + ssa_csv=ssa, + ssa_sha256=annual._sha256(ssa), + model_source=work, + model_commit="a" * 40, + model_version="test", + output_dir=work / f"{name}-candidate", + base_year=2024, + end_year=2025, + epochs=1, + ) + except ReachedModelProvenance: + outcomes[name] = "reached model provenance" + except ValueError as error: + outcomes[name] = str(error) +print( + json.dumps( + { + "module": annual.__file__, + "outcomes": outcomes, + "us_runtime_modules": sorted( + module + for module in sys.modules + if module == "microcosm.build.us_runtime" + or module.startswith("microcosm.build.us_runtime.") + ), + } + ) +) +""" + + +def test_the_annual_parent_check_leaves_us_runtime_unloaded(tmp_path) -> None: + root = paths_for("microcosm-build").repository + # Prefer this worktree's sources to editable installs in another checkout, + # and start the child the way this interpreter started (-S, -P). + pythonpath = os.pathsep.join( + [ + *(str(path) for path in sorted((root / "packages").glob("*/src"))), + os.environ.get("PYTHONPATH", ""), + ] + ) + flags = [ + *(["-S"] if sys.flags.no_site else []), + *(["-P"] if sys.flags.safe_path else []), + ] + completed = subprocess.run( + [sys.executable, *flags, "-c", _GATE_PROBE, str(tmp_path)], + cwd=tmp_path, + env={**os.environ, "PYTHONPATH": pythonpath}, + capture_output=True, + text=True, + timeout=300, + check=False, + ) + assert completed.returncode == 0, completed.stderr[-4000:] + result = json.loads(completed.stdout.strip().splitlines()[-1]) + + assert result["module"] == annual.__file__ + assert result["outcomes"]["flagged"] == "reached model provenance" + assert "needs a parent that already carries" in result["outcomes"]["unflagged"] + assert result["us_runtime_modules"] == [] + + +def test_us_runtime_re_exports_the_same_objects() -> None: + assert us_runtime_re_export.__all__ == us_local_jurisdictions.__all__ + for name in us_local_jurisdictions.__all__: + assert getattr(us_runtime_re_export, name) is getattr( + us_local_jurisdictions, name + ), name diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index 29d4927c21..1c6d35ac73 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -28,13 +28,7 @@ from hypothesis import example, given, settings from hypothesis import strategies as st -from microcosm.build.us_runtime.geography_ladder import ( - assign_us_geography_ladder, - us_geography_ladder_assignment_summary, - us_geography_ladder_gate, - with_household_us_geography_ladder, -) -from microcosm.build.us_runtime.local_jurisdictions import ( +from microcosm.build.us_local_jurisdictions import ( BLOCK_GEOGRAPHY_RUNGS, JURISDICTION_FLAG_DERIVED, JURISDICTION_FLAG_UNAVAILABLE, @@ -52,6 +46,12 @@ us_local_jurisdiction_rungs_present, with_us_local_jurisdiction_flags, ) +from microcosm.build.us_runtime.geography_ladder import ( + assign_us_geography_ladder, + us_geography_ladder_assignment_summary, + us_geography_ladder_gate, + with_household_us_geography_ladder, +) from microcosm.build.us_runtime.puma_ladder import ( UsPumaLadder, us_puma_ladder_assignment_summary, @@ -71,7 +71,7 @@ REGISTRY_PATH = ( paths_for("microcosm-build").package - / "src/microcosm/build/us_runtime" + / "src/microcosm/build" / US_LOCAL_JURISDICTION_REGISTRY_RESOURCE ) REGISTRY = packaged_us_local_jurisdiction_registry() diff --git a/tools/verify_us_local_jurisdiction_registry.py b/tools/verify_us_local_jurisdiction_registry.py index c6279f50c0..9f69a481f5 100644 --- a/tools/verify_us_local_jurisdiction_registry.py +++ b/tools/verify_us_local_jurisdiction_registry.py @@ -46,7 +46,7 @@ DEFAULT_REGISTRY = ( Path(__file__).resolve().parents[1] - / "packages/microcosm-build/src/microcosm/build/us_runtime" + / "packages/microcosm-build/src/microcosm/build" / US_LOCAL_JURISDICTION_REGISTRY_RESOURCE ) From 96a3c927a5e64dd0bd6f6118c3eaaff832b1a37b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 09:29:02 -0500 Subject: [PATCH 11/32] List the flags modules in the binding identity and recount (B1) The transport battery's binding identity reaches every module the bindings import. The us_runtime package imports geography_ladder and puma_ladder, which now import the flags through us_runtime.local_jurisdictions, the re-export of microcosm.build.us_local_jurisdictions. Computed with the test's own describe() loop on this tree: 246 modules against the pinned 198 + 23 + 23 = 244, and the two extra are exactly those two modules (the branch's red engine-free legs at 1818486a0, assert 221 == 197 + 23, were the same count before main split the set out). Both join BINDING_MODULES_ADDED_AFTER_BASE with a comment naming #1453. test_us_spine_blindness.py: local_jurisdictions.py stays a classified us_runtime module, now as the re-export. The pool tool's runtime graph counts us_runtime files only, so it still reaches 82 modules; the comment says the implementation sits outside that graph. Co-Authored-By: Claude Opus 5.5 --- .../shared/test_transport_evidence_kernels.py | 6 ++++++ .../tests/engine_free/us/test_us_spine_blindness.py | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/shared/test_transport_evidence_kernels.py b/packages/microcosm-build/tests/engine_free/shared/test_transport_evidence_kernels.py index 6cd1dd1445..a88df26572 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_transport_evidence_kernels.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_transport_evidence_kernels.py @@ -171,6 +171,12 @@ "microcosm.data.source_enrichment", "microcosm.data.stored_inputs", "microcosm.data.us_critical_targets", + # microcosm#1453: the us_runtime package imports geography_ladder and + # puma_ladder, which import the local-jurisdiction flags through + # us_runtime.local_jurisdictions, a re-export of + # microcosm.build.us_local_jurisdictions. + "microcosm.build.us_local_jurisdictions", + "microcosm.build.us_runtime.local_jurisdictions", ] ) BATTERY = "toy.gates.terminal" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py index 70adf5ff28..88bfe01bbc 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py @@ -338,8 +338,9 @@ "input_mass.py", "l0_refit_export.py", "late_producer_dag.py", # Pure contract/schedule derivation; no treatment. - # Local-jurisdiction flags as a pure function of county/place codes; - # no population treatment. + # Re-exports microcosm.build.us_local_jurisdictions (local-jurisdiction + # flags as a pure function of county/place codes, kept outside + # us_runtime); no population treatment. "local_jurisdictions.py", "medicaid_take_up.py", # Reviewed held-out Medicare IRMAA diagnostic; no population treatment. @@ -3838,7 +3839,9 @@ def test_pool_build_tool_import_graph_is_source_spine_blind() -> None: # reached module. 81 adds puf_source_schedule_e.py, the PUF donor's # Schedule E line-32 and passive supplement (#1239). 82 adds # local_jurisdictions.py, which the PUMA ladder calls to write the - # county-rule local-jurisdiction flags. + # county-rule local-jurisdiction flags; it re-exports + # microcosm.build.us_local_jurisdictions, which sits outside + # us_runtime and so outside this graph (#1453). assert len(runtime_graph) == 82, ( f"{tool.name} must reach the pinned 82-module runtime graph; " f"reached {len(runtime_graph)}" From 234a302df5e26eb7a7ba9178945f4b05965a43e4 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 09:49:29 -0500 Subject: [PATCH 12/32] Recompute the US spec-engine pins on the merged tree Main (1e8831901) and this branch both moved the US seed and spec digests: main through its ACS local stages, the student-loan stages, the gate calibration and the housing gate; this branch through geography_ladder and puma_ladder (attested kernel modules) and the multispine pool, which write the local-jurisdiction flags. The merge took main's values, so each is recomputed here by its tool on this tree: - tools/repin_us_spec_engine_contracts.py --legacy-only --check: current (source_stages.json is unchanged). - tools/generate_us_bundle_from_constants.py --check (policyengine-us 2.2.1): current; US bundle spec_sha256 aa7433b70fa4... - tools/repin_us_spec_engine_contracts.py, run twice (its first pass measures coverage against the old seed pins and writes covered_item_count 39; the second restores 41): EXPECTED_HASHES full_checkpoint 47d4474df59d..., seed_map 17c6d8d9d5a8..., seed_protocol 780bc4112001...; the loader golden spec_sha256 4253e04fc13a...; the engine_workflow pool-tool spec_sha256 aa7433b70fa4.... - tools/spec_engine_coverage.py: docs/evidence/spec-engine/ us-f0-coverage.json (42394/42394 configuration fields, 41/41 inventory checks), including the stacked_checkpoint_pool_code_exact digest 3c5e14bef2c3.... - All three --check modes exit 0 afterwards. ruff format then changed only the quote style of the rewritten lines, and a comment line above the loader golden and the pool-tool pin names #1453. The same two checks pass on a copy of this tree with the pre-move module layout, so the move in 3a6d247a3 moves none of these pins. The pool's engine contracts are current under policyengine-us 2.2.1 (remaining-stage manifest 6e70bc749ab7..., 1,059 rows), so us/engine_abi.lock.json, the engine-contract test and the H3 post-transfer fixture keep their values. Co-Authored-By: Claude Opus 5.5 --- docs/evidence/spec-engine/us-f0-coverage.json | 22 +++++++++---------- .../build/spec_engine/inventory_coverage.py | 6 ++--- .../shared/test_spec_engine_loader.py | 4 +++- .../us/test_us_multispine_pool_tool.py | 4 +++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 517fb5a3fc..cec26878a7 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1642,13 +1642,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "bcb012edd7fdd11af328df17ff2ce530912e903514691d330c604c09854c7e0a", - "protocol_sha256": "e1f88676b849f78e198f2e4dffecf9a380015d0061e24f39e518cb7bc13d26c0" + "map_sha256": "17c6d8d9d5a8b56b73ab0147dd0ab1e3e967b8570b81dcdec8f50fa7926347a0", + "protocol_sha256": "780bc4112001b61271012dedee88bfb9c00c2ab907bd57f7231791512b8a3597" }, "failures": [], "observed": { - "map_sha256": "bcb012edd7fdd11af328df17ff2ce530912e903514691d330c604c09854c7e0a", - "protocol_sha256": "e1f88676b849f78e198f2e4dffecf9a380015d0061e24f39e518cb7bc13d26c0" + "map_sha256": "17c6d8d9d5a8b56b73ab0147dd0ab1e3e967b8570b81dcdec8f50fa7926347a0", + "protocol_sha256": "780bc4112001b61271012dedee88bfb9c00c2ab907bd57f7231791512b8a3597" }, "status": "covered" }, @@ -1663,7 +1663,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "e1f88676b849f78e198f2e4dffecf9a380015d0061e24f39e518cb7bc13d26c0", + "implementation_sha256": "780bc4112001b61271012dedee88bfb9c00c2ab907bd57f7231791512b8a3597", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1684,7 +1684,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "e1f88676b849f78e198f2e4dffecf9a380015d0061e24f39e518cb7bc13d26c0", + "implementation_sha256": "780bc4112001b61271012dedee88bfb9c00c2ab907bd57f7231791512b8a3597", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1873,7 +1873,7 @@ "alpha", "zeta" ], - "sha256": "ecf64f2bfbb59ffaaa717d8a09d38e56a38d6d43c1aa0a209d57492b038fb19a" + "sha256": "47d4474df59d47ad5e2fd9a4663002c1c34761862c679e3059bbb83687f17fba" }, "failures": [], "observed": { @@ -1897,7 +1897,7 @@ "alpha", "zeta" ], - "sha256": "ecf64f2bfbb59ffaaa717d8a09d38e56a38d6d43c1aa0a209d57492b038fb19a" + "sha256": "47d4474df59d47ad5e2fd9a4663002c1c34761862c679e3059bbb83687f17fba" }, "status": "covered" }, @@ -1961,7 +1961,7 @@ "take_up_contract", "us_qbi_reconciliation_contract" ], - "sha256": "731c8c33dc511dfc35bc4b37bed9864ee75446e45555b999a01ec9b6ad1289cf" + "sha256": "3c5e14bef2c3dfecee5c1dd8b7d9b28eb3b0ba9e72e0765b6c2576a48f3175d8" }, "status": "covered" }, @@ -2585,7 +2585,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "3dabec5cdccf3531f63b1196fb147892c4e15f06cae8fac1d2a58b68eccd7b4a" + "spec_sha256": "aa7433b70fa47883a1e4b177d8356580050068c8cfb8b842d65d52c69d4988be" } }, "report_schema_version": 3, @@ -2595,7 +2595,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "3dabec5cdccf3531f63b1196fb147892c4e15f06cae8fac1d2a58b68eccd7b4a" + "spec_sha256": "aa7433b70fa47883a1e4b177d8356580050068c8cfb8b842d65d52c69d4988be" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 0e99a0ddd5..bb7e6d4064 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -350,7 +350,7 @@ "acs_person_predictors": "878c788a6f037d7aca12b3586ea034eff04f3034ffa11935a736493042551f25", "authority": "bf681aedc859fd6398ef72da68f584069b7d25b3085c549bf99f82e8324c4eef", "early_families": "4aa9f736fd76e83955477ad1667e58f48f264783f05bdc7f0102cd32d61323bd", - "full_checkpoint": "ecf64f2bfbb59ffaaa717d8a09d38e56a38d6d43c1aa0a209d57492b038fb19a", + "full_checkpoint": "47d4474df59d47ad5e2fd9a4663002c1c34761862c679e3059bbb83687f17fba", "gap_fill_schedule": "1c31f9868f7884347cc19cf1ff65da43f950b9114941a715bab168246db414a7", "graph_nodes": "1b208fff4f6d878c522147fee617177544bda8963c940f98a4bfc37507cb955f", "geography_assignment": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c", @@ -383,8 +383,8 @@ # housing_inputs puts each ACS rent draw on its own household's head. # microcosm#1453 moves both again: geography_ladder and puma_ladder write # the local-jurisdiction flags. - "seed_map": "bcb012edd7fdd11af328df17ff2ce530912e903514691d330c604c09854c7e0a", - "seed_protocol": "e1f88676b849f78e198f2e4dffecf9a380015d0061e24f39e518cb7bc13d26c0", + "seed_map": "17c6d8d9d5a8b56b73ab0147dd0ab1e3e967b8570b81dcdec8f50fa7926347a0", + "seed_protocol": "780bc4112001b61271012dedee88bfb9c00c2ab907bd57f7231791512b8a3597", "source_manifest": "dc3879886d2a69f20fb982a675d7fb322c0e4017afef6471be54b0ee3cbd2af6", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "565f0ceeadab69d3e96a886a00dd0305f7425fa3acde24d12ba48db2b37d5fc0", diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 02e37d567a..f7d4cb16dd 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -24,8 +24,10 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # The ACS SSI disability-criteria stage (microcosm#1022) moves # ssi_disability_criteria's attested bytes. # The opt-in cross-fitted gate calibration moves the fit kernels' bytes. + # microcosm#1453's local-jurisdiction flags move geography_ladder's and + # puma_ladder's attested bytes. assert first.spec_sha256 == ( - "d5c303a4ee85aa36b86757125147340f8c43871347cab072f9673b40857d062a" + "4253e04fc13a3fdc3e7cf39419e67d5d9be3449c88fabe6f6b2315efc3039331" ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 03566dbb06..88318ae0d5 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -353,7 +353,9 @@ def capture_equality(expected: object, actual: object) -> None: # The opt-in cross-fitted gate calibration in microcosm.fit.qrf moves it. # microcosm#1073's scf_wealth education-debt declaration moves it # through the bundle's source stages. - "spec_sha256": "3dabec5cdccf3531f63b1196fb147892c4e15f06cae8fac1d2a58b68eccd7b4a", + # microcosm#1453's local-jurisdiction flags in geography_ladder, + # puma_ladder and the pool move it. + "spec_sha256": "aa7433b70fa47883a1e4b177d8356580050068c8cfb8b842d65d52c69d4988be", }, } From cda6f08e1bf3dcfed77b23a0b952d79d41af6b68 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 10:14:24 -0500 Subject: [PATCH 13/32] Give main's receipt-anchor pool test a frame-shaped pool fake Main's #1022 test (test__given_receipt_anchors__then_fs_overrides_the_ transfer_before_pooling, from 44a452818) stands in for with_optional_acs_spine with a bare object(). On this branch build_optional_acs_multispine reads the pooled frame's household table and weights to record the pool's local-jurisdiction receipt, so the merged test raised AttributeError before its assertions. The branch gave its own older pool fake the same shape when it added the receipt; this does the same for main's test and checks that the anchored path records the receipt too (rungs [] without a PUMA ladder). No behaviour changes. Co-Authored-By: Claude Opus 5.5 --- .../tests/engine_free/us/test_us_acs_multispine.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py b/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py index 209773f925..2ecc1e184d 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_acs_multispine.py @@ -316,9 +316,16 @@ def fake_anchor(frame): events.append(("anchor", frame)) return anchored_acs, receipt + # Without a PUMA ladder the pool decides no local-jurisdiction flag, so + # its receipt reads no geography. + pooled = SimpleNamespace( + table=lambda entity: pd.DataFrame(), + weights_for=lambda entity: SimpleNamespace(values=np.ones(0)), + ) + def fake_pool(actual_base, actual_acs, **kwargs): events.append(("pool", actual_base, actual_acs)) - return object() + return pooled monkeypatch.setattr( acs_multispine, "require_acs_receipt_anchor_sources", fake_check @@ -347,6 +354,8 @@ def fake_pool(actual_base, actual_acs, **kwargs): "issue": "microcosm#1022", "snap": {"units_anchored": 4}, } + assert result.frame is pooled + assert result.provenance["local_jurisdiction_flags"]["rungs"] == [] json.dumps(result.provenance, allow_nan=False) From bcb019488eb6dd9947eb9c57c17e6bd5554ebdf2 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 10:32:29 -0500 Subject: [PATCH 14/32] Read the registry at its new path in the engine contract test test_us_local_jurisdiction_engine_contract.py opened the registry JSON with files("microcosm.build.us_runtime"), which 3a6d247a3 moved to microcosm/build, so the engine-us collection failed with FileNotFoundError. It now imports from microcosm.build.us_local_jurisdictions and reads files("microcosm.build"), like the module itself. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_local_jurisdiction_engine_contract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py b/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py index cddc1e1590..15ce75167c 100644 --- a/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py +++ b/packages/microcosm-build/tests/engine_contract/us/test_us_local_jurisdiction_engine_contract.py @@ -15,14 +15,14 @@ import pytest -from microcosm.build.us_runtime.local_jurisdictions import ( +from microcosm.build.us_local_jurisdictions import ( US_LOCAL_JURISDICTION_REGISTRY_RESOURCE, packaged_us_local_jurisdiction_registry, ) REGISTRY = packaged_us_local_jurisdiction_registry() DOCUMENT = json.loads( - files("microcosm.build.us_runtime") + files("microcosm.build") .joinpath(US_LOCAL_JURISDICTION_REGISTRY_RESOURCE) .read_text() ) From 56b63ebb870a16608442b088fdc0b0b4d0175b1d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 18:55:22 -0500 Subject: [PATCH 15/32] Derive the local-jurisdiction flags after the block_v1 draw #1047's opt-in --location-rule block_v1 puts each household on one drawn 2020 block and looks county and place up from it. This pull request derives four engine inputs from county and place, and its ladder gates refuse a table that lacks one. Merged, the two did not meet: - with_household_us_block_location (the base-h5 line and the stacked pool) wrote no flag, so the base-h5 line's geography-ladder gate and the stacked pool's PUMA-ladder gate refused every block_v1 draw (17 of #1047's stacked-pool tests failed at the merge commit); - with_optional_acs_spine picked its flag rungs from the PUMA ladder alone. A block_v1 pool takes none, so it removed every flag, while build_optional_acs_multispine, which staging also hands a PUMA ladder, recorded the county-rule flags as derived. Now every line that draws derives all four flags from the drawn or kept block's county and place (BLOCK_GEOGRAPHY_RUNGS), after the draw, and overwrites any flag the frame carried before it: - with_household_us_block_location applies the flags to its tables once the block's geography is written, as the block ladder does; - acs_pool_local_jurisdiction_rungs takes the location rule and returns the block rungs under block_v1; the pool and the multispine receipt both pass it, and the block_v1 geography record carries the block-rung receipt in place of the PUMA summary's; - the stacked pool's block-location summary records local_jurisdiction_flags, as its legacy summary does. The default legacy rule is unchanged: acs_pool_local_jurisdiction_rungs returns what it did when location_rule is left at its default, and no legacy ladder, gate or receipt is touched. Tests: a shared synthetic ladder carrying Denver, Philadelphia, Yonkers, Wilmington and a decoy for each place code, and an expectation written out in the test support, not read from the registry. On each line (kernel with 1 and 3 clones, base-h5, stacked pool, ACS pool, ACS multispine) a frame that carries flags from before the draw comes out with flags that equal the rules on the drawn geography, and the line's receipt names the county and place rungs with matching counts. The module docstring, US_LOCAL_JURISDICTIONS.md and docs/us-location-v1.md now say this; they named a block-location draw that did not exist when the branch was written (review D1). The pool's static remaining-stage manifest still lists the place-rule flags as unavailable for every pool; its comment and the document say that this describes the default rule. Co-Authored-By: Claude Fable 5.2 --- .../us-local-jurisdiction-flags.added.md | 2 +- docs/us-location-v1.md | 2 + .../microcosm/build/us_local_jurisdictions.py | 24 ++- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 31 ++- .../build/us_runtime/acs_multispine.py | 25 ++- .../microcosm/build/us_runtime/base_pool.py | 32 +++- .../build/us_runtime/block_location.py | 13 ++ .../build/us_runtime/multispine_pool.py | 10 +- .../us/test_us_acs_block_location.py | 180 ++++++++++++++++++ .../engine_free/us/test_us_block_location.py | 128 +++++++++++++ .../test_us_multispine_pool_block_location.py | 136 +++++++++++-- ...test_us_puf_support_base_block_location.py | 121 +++++++++++- .../microcosm_build/us_block_location.py | 98 ++++++++++ tools/build_us_multispine_pool.py | 19 +- 14 files changed, 776 insertions(+), 45 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index ff41e99ba7..29f663bd15 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/docs/us-location-v1.md b/docs/us-location-v1.md index 844f74303a..a283889c4b 100644 --- a/docs/us-location-v1.md +++ b/docs/us-location-v1.md @@ -99,6 +99,8 @@ What each line does: - ACS households draw within their observed PUMA. Donors keep the block their base drew. That base must record `block_v1`, so each donor's block lies in its CPS source geography; staging refuses a legacy base before the ACS fetch, and refuses any donor without a block. - Finalize runs `us_block_location_gate` on the staged ladder. The targets' `--ladder` must be the PUMA ladder staging recorded. +Each line also derives the four input-only local-jurisdiction flags (`in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident`) from the county and place of the block it drew or kept, after the draw, and records that the block rungs decided them. `packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md` says where each line records it. + ## Invariants Each of these is a property test in `tests/engine_free/us/test_us_block_location.py` (Hypothesis over nested synthetic ladders) or `test_us_cps_source_geography.py`: diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index 3899068d14..5bba99fc45 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -25,12 +25,16 @@ ``10``/``77580``). Place codes are unique only within a state, so the state is part of the match. -A geography line derives the flags from the rungs it actually writes. The -block ladder (and the block-location draw) writes county and place from one -block, so every flag is derived. The PUMA ladder writes a county but no +A geography line derives the flags from the rungs it actually writes, once +that geography is final. The block ladder and the ``block_v1`` block-location +draw (``with_household_us_block_location``, microcosm#1047) each put a +household on one block, which fixes county and place, so every flag is +derived, after the block is assigned. The PUMA ladder writes a county but no place, so the place-rule flags are *unavailable* there: the line never writes them (any stale column is removed) and its receipt records them as -unavailable with the reason, rather than writing ``False``. +unavailable with the reason, rather than writing ``False``. The pooled ACS +line follows its location rule: the PUMA ladder's county rung under the +default ``legacy`` rule, the block rungs under ``block_v1``. An artifact built before the flags existed carries none, so a step that exports or recalibrates an existing artifact instead of running a geography @@ -89,7 +93,7 @@ JURISDICTION_RUNG_COUNTY = "county" JURISDICTION_RUNG_PLACE = "place" JURISDICTION_RUNGS = (JURISDICTION_RUNG_COUNTY, JURISDICTION_RUNG_PLACE) -#: What the block ladder and the block-location draw write. +#: What the block ladder and the ``block_v1`` block-location draw write. BLOCK_GEOGRAPHY_RUNGS = JURISDICTION_RUNGS #: What the PUMA ladder writes. PUMA_GEOGRAPHY_RUNGS = (JURISDICTION_RUNG_COUNTY,) @@ -508,10 +512,12 @@ def with_us_local_jurisdiction_flags( ) -> tuple[Frame, dict[str, Any]]: """Return ``frame`` with its local-jurisdiction flags and the receipt. - The one call every geography line makes once its county (and, where it - has one, place) is final: ``rungs`` is :data:`BLOCK_GEOGRAPHY_RUNGS` for - a block-anchored line and :data:`PUMA_GEOGRAPHY_RUNGS` for the PUMA - ladder. + For a geography line whose county (and, where it has one, place) is + final: ``rungs`` is :data:`BLOCK_GEOGRAPHY_RUNGS` for a block-anchored + line and :data:`PUMA_GEOGRAPHY_RUNGS` for the PUMA ladder. The ladders, + the block-location draw and the ACS pool hold their tables before they + build a frame, so they call :func:`apply_us_local_jurisdiction_flags` on + those instead. """ tables = {entity: frame.table(entity) for entity in frame.entities} diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index c4939c2df9..88e63e24ca 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -46,9 +46,6 @@ the new SHA-256 to pin. - **Block ladder** (`with_household_us_geography_ladder`): one block fixes county and place, so the line writes all four flags. -- **Block-location draw** (microcosm#1047): call - `with_us_local_jurisdiction_flags(frame, rungs=BLOCK_GEOGRAPHY_RUNGS)` once - `county_fips` and `place_fips` are final. - **PUMA ladder** (`with_household_us_puma_ladder`, the stacked pool): the ladder draws a county but no place. The line writes `in_denver` and the Philadelphia flag and never writes `in_yonkers` or `in_wilmington`; it also @@ -65,6 +62,34 @@ the new SHA-256 to pin. Missing, null or malformed geography raises; no line writes `False` for a household whose county or place it does not know. +### Under `--location-rule block_v1` + +The opt-in block-location rule (microcosm#1047, `docs/us-location-v1.md`) puts +every household on one drawn block and looks county and place up from it. The +default `legacy` rule is the list above, unchanged. Under `block_v1` every +line that draws derives all four flags with `BLOCK_GEOGRAPHY_RUNGS`, after the +draw, and overwrites any flag the frame carried before it: + +- **Base-h5 line and stacked pool** (`with_household_us_block_location`): the + draw writes the flags with the block's geography, as the block ladder does. + The base-h5 line records the receipt in its summary, at + `household_location.coverage.local_jurisdiction_flags`, and its + geography-ladder gate requires the household flags. The stacked pool + records it in its geography-assignment receipt, at + `summary.local_jurisdiction_flags`, and its PUMA-ladder gate requires + `in_denver`. +- **Pooled ACS line** (`with_optional_acs_spine`): ACS rows draw a block and + donors keep theirs, so `acs_pool_local_jurisdiction_rungs` returns the block + rungs and the pool re-derives all four flags for every row after the block + assignment. `build_optional_acs_multispine` records that receipt as + `provenance["local_jurisdiction_flags"]` and again inside + `provenance["geography_ladder"]`, whatever PUMA ladder staging also holds. + +The engine ABI lock's `unavailable_place_jurisdiction_input` rows describe the +default rule. The pool's remaining-stage manifest is static, so it still +lists `in_yonkers` and `in_wilmington` that way for a `block_v1` pool, which +writes them; the fallback those rows name does not apply to it. + ## Existing artifacts A base H5 built before this registry carries no flags. Two steps start from diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py b/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py index ae9b5d79f5..28c5783fc2 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/acs_multispine.py @@ -79,6 +79,7 @@ CURRENT_CONGRESSIONAL_DISTRICT_VINTAGE, ) from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, us_local_jurisdiction_flag_receipt, us_local_jurisdiction_flag_values, ) @@ -107,7 +108,9 @@ class AcsMultispineResult: receipt, or ``None`` when the caller kept those records. ``provenance["local_jurisdiction_flags"]`` records which local-jurisdiction flags the pool derived and which it left unavailable; without a PUMA - ladder that is every flag. + ladder that is every flag. A ``block_v1`` pool derives all four from each + row's block, and its ``provenance["geography_ladder"]`` carries the same + receipt. """ frame: Frame @@ -438,8 +441,12 @@ def build_optional_acs_multispine( pooled = with_optional_acs_spine(base, transferred_frame, **pool_options) del transferred_frame # The pool writes the flags its rungs decide and removes the rest; the - # receipt records both, with or without a PUMA ladder. - jurisdiction_rungs = acs_pool_local_jurisdiction_rungs(puma_ladder) + # receipt records both, with or without a PUMA ladder. The rungs are the + # pool's own: under block_v1 the block rungs, whatever PUMA ladder this + # function was also handed for its coverage summary. + jurisdiction_rungs = acs_pool_local_jurisdiction_rungs( + puma_ladder, location_rule=location_rule + ) local_jurisdiction_flags = us_local_jurisdiction_flag_receipt( us_local_jurisdiction_flag_values( pooled.table("household"), rungs=jurisdiction_rungs @@ -558,7 +565,10 @@ def _block_geography_provenance( :func:`~microcosm.build.us_runtime.puma_ladder.us_puma_ladder_assignment_summary` when a PUMA ladder is supplied) and states the block rule: every geography column is resolved from the drawn or preserved block, so no - sub-PUMA input stays unresolved. + sub-PUMA input stays unresolved. Its ``local_jurisdiction_flags`` is the + block rungs' receipt, the one the pool's rungs give; it replaces the + PUMA-ladder summary's, which would record the place-rule flags as + unavailable although a ``block_v1`` pool writes them. """ household = pooled.table("household") @@ -589,6 +599,13 @@ def _block_geography_provenance( "donor_geography": donor_geography, "resolved_model_inputs": columns, "unresolved_sub_puma_inputs": [], + "local_jurisdiction_flags": us_local_jurisdiction_flag_receipt( + us_local_jurisdiction_flag_values( + household, rungs=BLOCK_GEOGRAPHY_RUNGS + ), + rungs=BLOCK_GEOGRAPHY_RUNGS, + household_weights=pooled.weights_for("household").values, + ), } ) return _json_ready_mapping(geography) diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py index 8da9e365a3..e16a4914ec 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/base_pool.py @@ -28,6 +28,7 @@ county_fips_2023_from_tracts, ) from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, PUMA_GEOGRAPHY_RUNGS, apply_us_local_jurisdiction_flags, ) @@ -127,14 +128,22 @@ def acs_pool_local_jurisdiction_rungs( puma_ladder: UsPumaLadder | None, + *, + location_rule: str = US_LOCATION_RULE_LEGACY, ) -> tuple[str, ...]: """The local-jurisdiction rungs :func:`with_optional_acs_spine` supplies. - With a PUMA ladder every row has a final county, so the county-rule - flags are derived; without one the ACS rows have no county and no flag - is. A caller records the pool's receipt with these rungs. + Under the legacy location rule: with a PUMA ladder every row has a final + county, so the county-rule flags are derived; without one the ACS rows + have no county and no flag is. Under ``block_v1`` every pooled row sits + on one block (drawn for an ACS row, kept for a donor), which fixes its + county and place, so every flag is derived; that rule takes no PUMA + ladder. A caller records the pool's receipt with these rungs, passing + the same ``location_rule`` it gave the pool. """ + if location_rule == US_LOCATION_RULE_BLOCK_V1: + return BLOCK_GEOGRAPHY_RUNGS return PUMA_GEOGRAPHY_RUNGS if puma_ladder is not None else () @@ -188,10 +197,12 @@ def with_optional_acs_spine( With ``puma_ladder`` the county-rule flags are re-derived for every row from the final county and the place-rule flags are removed (ACS rows have no place); without it every flag is removed, since ACS rows then have no - county either. A flag column is never left half-null for the engine - default to fill. :func:`acs_pool_local_jurisdiction_rungs` names the rungs - used, so a caller can record which flags were derived and which were - left unavailable. + county either. Under ``block_v1`` (below) every row has a block, so all + four flags are re-derived for every row from the county and place of its + block, after the block assignment. A flag column is never left half-null + for the engine default to fill. :func:`acs_pool_local_jurisdiction_rungs` + names the rungs used, so a caller can record which flags were derived and + which were left unavailable. ``max_peak_bytes`` is a fail-fast bound on estimated frame-resident peak memory. Pass ``None`` to disable the preflight. The estimate includes both @@ -319,9 +330,14 @@ def with_optional_acs_spine( expected_congressional_district_vintage ), ) + # After the assignment above, whichever rule made it: the flags follow + # each row's final county and, under block_v1, the place of its block. tables.update( apply_us_local_jurisdiction_flags( - tables, rungs=acs_pool_local_jurisdiction_rungs(puma_ladder) + tables, + rungs=acs_pool_local_jurisdiction_rungs( + puma_ladder, location_rule=location_rule + ), )[0] ) if household_order is not None: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/block_location.py b/packages/microcosm-build/src/microcosm/build/us_runtime/block_location.py index e73ee956d5..da847c7418 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/block_location.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/block_location.py @@ -71,6 +71,10 @@ UsBlockLadder, load_us_block_ladder, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + apply_us_local_jurisdiction_flags, +) from microcosm.frame import Frame, Weights #: The rule id every build records when it locates households this way; also @@ -1255,6 +1259,12 @@ def with_household_us_block_location( such as an ACS ``puma`` (which the draw reproduces). ``state_fips`` is never rewritten; the draw asserts each block lies in it. The frame's metadata gains a :data:`US_BLOCK_LOCATION_METADATA_KEY` receipt. + + The drawn block fixes county and place together, so every registry + local-jurisdiction flag is then derived from them and written as an + engine input (person flags through ``person_household_id``), as the + block ladder does (microcosm#1453). A flag the frame already carried is + overwritten: it described the geography this draw replaced. """ household = frame.table("household") @@ -1291,6 +1301,9 @@ def with_household_us_block_location( raise AssertionError("internal error: cloned household order drifted.") for column in location_geography_columns(ladder): target[column] = table[column].to_numpy() + # After the draw, never before it: the flags follow the county and place + # of the block each household (or clone) just received. + tables, _ = apply_us_local_jurisdiction_flags(tables, rungs=BLOCK_GEOGRAPHY_RUNGS) for link_name in located.links: tables[link_name] = located.link(link_name).copy() location_receipt = { diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py b/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py index 203294aeba..adfeccfb0a 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/multispine_pool.py @@ -1566,9 +1566,13 @@ def surface_provision(variable: str) -> str: for entity, variables in _POOL_NATIVE_COMPLETE_OUTPUTS.items() for variable in variables } - # The stacked pool's geography comes from the PUMA ladder, which draws a - # county but no place: county-rule jurisdiction flags are derived with - # it, place-rule flags are never written (local_jurisdictions). + # Under the default legacy location rule the stacked pool's geography + # comes from the PUMA ladder, which draws a county but no place: + # county-rule jurisdiction flags are derived with it, place-rule flags + # are never written (local_jurisdictions). This manifest is static and + # describes that default. A block_v1 pool (microcosm#696) puts every + # household on a block and writes the place-rule flags too, so the + # fallback named below never applies to one. local_jurisdiction_inputs = { (item.entity, item.flag): item.rule in PUMA_GEOGRAPHY_RUNGS for item in packaged_us_local_jurisdiction_registry().jurisdictions diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py b/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py index da8571e4e7..01d7159288 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py @@ -22,6 +22,7 @@ import shlex from collections.abc import Mapping from pathlib import Path +from types import SimpleNamespace import numpy as np import pandas as pd @@ -35,6 +36,7 @@ ACS_POOL_DONOR_LOCATION_REFUSAL, ACS_POOL_LOCATION_CLONES_REFUSAL, DONOR_BLOCK_PRESERVED, + acs_pool_local_jurisdiction_rungs, preflight_pooled_ladder_geography, spine_column, with_optional_acs_spine, @@ -50,8 +52,12 @@ location_geography_columns, us_block_location_gate, ) +from microcosm.build.us_runtime.puma_ladder import UsPumaLadder from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights from test_support.microcosm_build.us_block_location import ( + assert_local_jurisdiction_flags_follow_geography, + expected_local_jurisdiction_flags, + local_jurisdiction_blocks, synthetic_blocks, write_location_ladder, ) @@ -80,6 +86,15 @@ def ladder_without_puma(tmp_path_factory: pytest.TempPathFactory) -> UsLocationL return load_us_location_ladder(path) +@pytest.fixture(scope="module") +def jurisdiction_ladder(tmp_path_factory: pytest.TempPathFactory) -> UsLocationLadder: + """A ladder carrying every local-jurisdiction geography and its decoys.""" + + path = tmp_path_factory.mktemp("ladder") / "jurisdictions.npz" + write_location_ladder(path, local_jurisdiction_blocks(3)) + return load_us_location_ladder(path) + + def _frame( household: pd.DataFrame, *, weights: np.ndarray, spine: str | None = None ) -> Frame: @@ -237,6 +252,96 @@ def test__block_v1__every_geography_derives_from_the_block_and_gate_passes( ).all() +# One donor on a block of each registry jurisdiction's county (Denver 08031, +# Philadelphia 42101, Yonkers' 36003, Wilmington's 10003), each place-code +# decoy's county (36047, 10001) and two plain counties. +_JURISDICTION_DONOR_COUNTIES = (8031, 8003, 42101, 42003, 36003, 36047, 10003, 10001) + + +def _jurisdiction_donor_base(ladder: UsLocationLadder) -> Frame: + """Donors on known blocks, carrying flags from before this pool. + + Every donor carries all four flags as ``True``, which is wrong for most + of them: the pool must derive the flags again from each row's final + block, never carry these. + """ + + geoids = [] + for county in _JURISDICTION_DONOR_COUNTIES: + in_county = ladder.block_geoid[ladder.block_geoid // 10**10 == county] + geoids.append(f"{int(in_county[0]):015d}") + n = len(geoids) + household = pd.DataFrame( + { + "household_id": np.arange(1, n + 1, dtype=np.int64), + "state_fips": [county // 1000 for county in _JURISDICTION_DONOR_COUNTIES], + "block_geoid": geoids, + "in_denver": True, + "in_yonkers": True, + "in_wilmington": True, + } + ) + household["puma"] = pd.Series([None] * n, dtype=object) + frame = _frame(household, weights=np.full(n, 50.0), spine="asec_puf") + tables = {entity: frame.table(entity).copy() for entity in frame.entities} + tables["person"]["pa_philadelphia_wage_tax_resident"] = True + return Frame( + tables, US_SCHEMA, {"household": frame.weights_for("household")}, frame.strata + ) + + +def test__block_v1__flags_follow_every_rows_final_block( + jurisdiction_ladder: UsLocationLadder, +) -> None: + """The pool derives all four flags after the block assignment (#1453). + + Under the legacy rule the pool derives the county-rule flags from the + PUMA ladder's county and removes the place-rule flags. A ``block_v1`` + pool takes no PUMA ladder; every row has a block, which fixes county and + place, so every flag is decided for every row. + """ + + ladder = jurisdiction_ladder + pooled = _pool(ladder, _jurisdiction_donor_base(ladder), _acs(ladder, n=16)) + household, person = pooled.table("household"), pooled.table("person") + assert us_block_location_gate(household, ladder).passed + assert_local_jurisdiction_flags_follow_geography(household, person) + + # The donors kept their blocks, so their flags are known exactly. + donors = household[spine_column("household")].eq("asec_puf") + assert household.loc[donors, "county_fips"].tolist() == [ + f"{county:05d}" for county in _JURISDICTION_DONOR_COUNTIES + ] + assert household.loc[donors, "in_denver"].tolist() == [True] + [False] * 7 + assert household.loc[donors, "in_yonkers"].tolist() == ( + [False] * 4 + [True] + [False] * 3 + ) + assert household.loc[donors, "in_wilmington"].tolist() == ( + [False] * 6 + [True, False] + ) + donor_people = person[spine_column("person")].eq("asec_puf") + assert person.loc[donor_people, "pa_philadelphia_wage_tax_resident"].tolist() == ( + [False, False, True] + [False] * 5 + ) + # The ACS rows, which arrived with no flag, are decided too. + assert (~donors).sum() == 16 + for flag in ("in_denver", "in_yonkers", "in_wilmington"): + assert household.loc[~donors, flag].notna().all() + + +def test__flag_rungs__follow_the_location_rule() -> None: + puma_ladder = _legacy_puma_ladder() + # Legacy (the default): the PUMA ladder's county rung, or nothing. + assert acs_pool_local_jurisdiction_rungs(puma_ladder) == ("county",) + assert acs_pool_local_jurisdiction_rungs(None) == () + assert acs_pool_local_jurisdiction_rungs(None, location_rule="legacy") == () + # block_v1: the block rungs, whatever PUMA ladder the caller also holds. + for held in (None, puma_ladder): + assert acs_pool_local_jurisdiction_rungs( + held, location_rule=US_LOCATION_RULE_BLOCK_V1 + ) == ("county", "place") + + @pytest.mark.parametrize("blocks", ["some", "none"]) def test__block_v1__refuses_a_donor_without_a_block( ladder: UsLocationLadder, blocks: str @@ -584,6 +689,76 @@ def fake_transfer(recipient, donor, **kwargs): assert us_block_location_gate(result.frame.table("household"), ladder).passed +def test__multispine__block_v1_records_the_block_rungs_flag_receipt( + monkeypatch: pytest.MonkeyPatch, jurisdiction_ladder: UsLocationLadder +) -> None: + """The receipt names the rungs the pool used, not the PUMA ladder's (#1453). + + Staging hands ``build_optional_acs_multispine`` its PUMA ladder under + ``block_v1`` too, for the coverage summary. That ladder must not pick the + flag rungs: the pool derived all four flags from each row's block. + """ + + ladder = jurisdiction_ladder + acs = _acs(ladder, n=16) + monkeypatch.setattr( + acs_multispine, + "build_acs_pums_unit_frame", + lambda source, *, chunksize: (acs, {"spine": ACS_2024_1YR_SPINE}), + ) + monkeypatch.setattr( + acs_multispine, + "map_acs_native_inputs", + lambda raw: type("Mapped", (), {"frame": raw, "native_inputs": {}})(), + ) + monkeypatch.setattr( + acs_multispine, + "transfer_acs_inputs", + lambda recipient, donor, **kwargs: type( + "Transfer", + (), + { + "frame": recipient, + "imputed_inputs": (), + "fit_records": (), + "deferred_inputs": (), + "resolved_donor_channel": "asec", + }, + )(), + ) + + result = acs_multispine.build_optional_acs_multispine( + _jurisdiction_donor_base(ladder), + object(), # type: ignore[arg-type] + location_rule=US_LOCATION_RULE_BLOCK_V1, + block_ladder=ladder, + location_seed=9, + donor_location_rule=US_LOCATION_RULE_BLOCK_V1, + puma_ladder=_puma_ladder_stub( + SimpleNamespace(UsPumaLadder=UsPumaLadder), ladder + ), + ) + + household = result.frame.table("household") + assert_local_jurisdiction_flags_follow_geography( + household, result.frame.table("person") + ) + receipt = result.provenance["local_jurisdiction_flags"] + assert receipt["rungs"] == ["county", "place"] + weights = result.frame.weights_for("household").values + for flag, values in expected_local_jurisdiction_flags(household).items(): + # One donor sits in each jurisdiction, so no count is zero. + assert values.sum() > 0, flag + assert receipt["flags"][flag]["status"] == "derived", flag + assert receipt["flags"][flag]["households_in_jurisdiction"] == values.sum() + assert receipt["flags"][flag]["weighted_households_in_jurisdiction"] == ( + pytest.approx(weights[values].sum()) + ) + # The geography record a staging summary keeps says the same. + assert result.provenance["geography_ladder"]["local_jurisdiction_flags"] == receipt + json.dumps(result.provenance, allow_nan=False) + + def test__multispine__refuses_invalid_location_options_before_loading( monkeypatch: pytest.MonkeyPatch, ladder: UsLocationLadder ) -> None: @@ -1025,6 +1200,11 @@ def test__legacy_tool__block_v1_main_records_rule_seed_gate_and_attributes( assert geography["block_ladder"]["sha256"] == ladder.sha256 assert geography["seed"] == 5 assert geography["location_rule"] == "block_v1" + # The summary's flag receipt names the block rungs, though staging also + # holds a PUMA ladder (microcosm#1453). + flags = geography["assignment"]["local_jurisdiction_flags"] + assert flags["rungs"] == ["county", "place"] + assert {entry["status"] for entry in flags["flags"].values()} == {"derived"} limitation = summary["reviewed_limitations"][2] assert limitation["id"] == "sub_puma_geographic_precision" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_block_location.py b/packages/microcosm-build/tests/engine_free/us/test_us_block_location.py index 305e0e53e0..40c4577437 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_block_location.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_block_location.py @@ -80,9 +80,16 @@ us_block_location_manifest, with_household_us_block_location, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + us_local_jurisdiction_flag_failures, +) from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights from test_support.microcosm_build.us_block_location import ( + assert_local_jurisdiction_flags_follow_geography, + expected_local_jurisdiction_flags, ladder_metadata, + local_jurisdiction_blocks, synthetic_blocks, write_location_ladder, ) @@ -892,6 +899,127 @@ def test_clone_frame_refuses_a_second_clone_pass() -> None: assert clone_frame_for_location(frame, 1) is frame +# -------------------------------------------------------------------------- +# Local-jurisdiction flags follow the drawn block (microcosm#1453) +# -------------------------------------------------------------------------- + +# (state, identified county or 0). Per state: a household identified in each +# registry jurisdiction's county, one in each place-code decoy's county, and +# one statewide draw. +_JURISDICTION_HOUSEHOLDS = ( + (8, 8031), + (8, 8003), + (8, 0), + (42, 42101), + (42, 42003), + (42, 0), + (36, 36003), + (36, 36047), + (36, 0), + (10, 10003), + (10, 10001), + (10, 0), +) + + +def _frame_located_before(rows) -> Frame: + """Households that an earlier rule located in Denver, flags and all. + + Every household carries Denver's county, Yonkers' place code and every + flag ``True``: what the frame would hold if its flags had been derived + before the block draw. + """ + + n = len(rows) + household_ids = np.arange(1, n + 1, dtype=np.int64) * 10 + person_household = np.repeat(household_ids, 2) + person_ids = np.arange(1, 2 * n + 1, dtype=np.int64) + tables = { + "person": pd.DataFrame( + { + "person_id": person_ids, + "person_household_id": person_household, + "person_tax_unit_id": person_household + 1, + "person_spm_unit_id": person_household + 2, + "person_family_id": person_household + 3, + "person_marital_unit_id": person_ids + 10**6, + "pa_philadelphia_wage_tax_resident": True, + } + ), + "household": pd.DataFrame( + { + "household_id": household_ids, + "state_fips": np.array([row[0] for row in rows], dtype=np.int64), + "county_fips": "08031", + "place_fips": "84000", + "in_denver": True, + "in_yonkers": True, + "in_wilmington": True, + } + ), + "tax_unit": pd.DataFrame({"tax_unit_id": household_ids + 1}), + "spm_unit": pd.DataFrame({"spm_unit_id": household_ids + 2}), + "family": pd.DataFrame({"family_id": household_ids + 3}), + "marital_unit": pd.DataFrame({"marital_unit_id": person_ids + 10**6}), + } + weights = {"household": Weights(np.linspace(1.0, 9.0, n), WeightKind.DESIGN)} + return Frame(tables, US_SCHEMA, weights, pd.Series(["s"] * (2 * n))) + + +@pytest.mark.parametrize("clones", [1, 3]) +def test_frame_location_writes_the_flags_its_drawn_block_decides(clones) -> None: + ladder = _load(local_jurisdiction_blocks(4)) + rows = _JURISDICTION_HOUSEHOLDS * 4 + frame = _frame_located_before(rows) + identified = np.array([row[1] for row in rows], dtype=np.int64) + + located, table = with_household_us_block_location( + frame, ladder, seed=17, clones=clones, county_fips=identified + ) + + household, person = located.table("household"), located.table("person") + assert us_block_location_gate(household, ladder).passed + # The draw moved the households: nothing stays in the stand-in geography. + np.testing.assert_array_equal( + household["county_fips"].to_numpy(), table["county_fips"].to_numpy() + ) + county = household["county_fips"].astype(str).to_numpy() + np.testing.assert_array_equal( + county[np.repeat(identified > 0, clones)], + [f"{value:05d}" for value in np.repeat(identified[identified > 0], clones)], + ) + # Each flag is its rule on the drawn block, for every household and + # person, whatever the frame said before. + assert_local_jurisdiction_flags_follow_geography(household, person) + assert ( + us_local_jurisdiction_flag_failures( + household, person=person, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + == [] + ) + # No flag passes by being constant: each is true for the households + # identified in its jurisdiction, and false behind its decoy. + expected = expected_local_jurisdiction_flags(household) + per_county = 4 * clones + assert expected["in_denver"][county == "08031"].all() + assert expected["pa_philadelphia_wage_tax_resident"][county == "42101"].all() + assert expected["in_yonkers"][county == "36003"].all() + assert expected["in_wilmington"][county == "10003"].all() + for code in ("08031", "42101", "36003", "10003", "36047", "10001"): + assert (county == code).sum() >= per_county, code + for flag, values in expected.items(): + assert 0 < values.sum() < len(values), flag + assert not household.loc[county == "10001", "in_yonkers"].any() + assert (household.loc[county == "10001", "place_fips"] == "84000").all() + assert not household.loc[county == "36047", "in_wilmington"].any() + assert (household.loc[county == "36047", "place_fips"] == "77580").all() + philadelphia = person["person_household_id"].isin( + household.loc[county == "42101", "household_id"] + ) + assert philadelphia.sum() == person["pa_philadelphia_wage_tax_resident"].sum() + assert person.loc[philadelphia, "pa_philadelphia_wage_tax_resident"].all() + + # -------------------------------------------------------------------------- # CPS ASEC county identification # -------------------------------------------------------------------------- diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_block_location.py b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_block_location.py index 7851f9323b..04bdc8c853 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_block_location.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_multispine_pool_block_location.py @@ -31,6 +31,10 @@ CURRENT_CONGRESSIONAL_DISTRICT_PREFIX, ) from microcosm.build.us_runtime.cps_source_geography import cps_source_geography +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + us_local_jurisdiction_flag_failures, +) from microcosm.build.us_runtime.support_provenance import ( support_channel_column, support_clone_index_column, @@ -38,6 +42,9 @@ ) from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights from test_support.microcosm_build.us_block_location import ( + assert_local_jurisdiction_flags_follow_geography, + expected_local_jurisdiction_flags, + local_jurisdiction_blocks, synthetic_blocks, write_location_ladder, ) @@ -105,10 +112,12 @@ def _crosswalk(ladder) -> pd.DataFrame: ) -def _stacked_frame(*, asec_source_year: int = _INCOME_YEAR) -> Frame: - n = len(_HOUSEHOLDS) +def _stacked_frame( + *, asec_source_year: int = _INCOME_YEAR, households=_HOUSEHOLDS +) -> Frame: + n = len(households) ids = np.arange(1, n + 1, dtype=np.int64) - channel = np.asarray([row[0] for row in _HOUSEHOLDS], dtype=object) + channel = np.asarray([row[0] for row in households], dtype=object) is_asec = channel == "asec" person = pd.DataFrame( { @@ -125,8 +134,8 @@ def _stacked_frame(*, asec_source_year: int = _INCOME_YEAR) -> Frame: household = pd.DataFrame( { "household_id": ids, - "state_fips": np.asarray([row[1] for row in _HOUSEHOLDS], dtype=np.int64), - "puma": pd.array([row[2] for row in _HOUSEHOLDS], dtype="string"), + "state_fips": np.asarray([row[1] for row in households], dtype=np.int64), + "puma": pd.array([row[2] for row in households], dtype="string"), support_channel_column("household"): channel, } ) @@ -144,7 +153,7 @@ def _stacked_frame(*, asec_source_year: int = _INCOME_YEAR) -> Frame: US_SCHEMA, { "household": Weights( - np.asarray([row[4] for row in _HOUSEHOLDS], dtype=np.float64), + np.asarray([row[4] for row in households], dtype=np.float64), WeightKind.IMPORTANCE, ) }, @@ -152,10 +161,10 @@ def _stacked_frame(*, asec_source_year: int = _INCOME_YEAR) -> Frame: ) -def _cps_household_geography() -> pd.DataFrame: +def _cps_household_geography(households=_HOUSEHOLDS) -> pd.DataFrame: rows = [ (900 + index + 1, state, gtco) - for index, (channel, state, _puma, gtco, _weight) in enumerate(_HOUSEHOLDS) + for index, (channel, state, _puma, gtco, _weight) in enumerate(households) if channel == "asec" ] return pd.DataFrame( @@ -179,12 +188,14 @@ def _contract(pool_tool: ModuleType, ladder, *, seed: int = 11) -> dict: ) -def _assign(pool_tool: ModuleType, ladder, *, seed: int = 11, frame=None): +def _assign( + pool_tool: ModuleType, ladder, *, seed: int = 11, frame=None, households=_HOUSEHOLDS +): return pool_tool._assign_stacked_household_block_location( - _stacked_frame() if frame is None else frame, + _stacked_frame(households=households) if frame is None else frame, ladder=ladder, crosswalk=_crosswalk(ladder), - cps_household_geography=_cps_household_geography(), + cps_household_geography=_cps_household_geography(households), contract=_contract(pool_tool, ladder, seed=seed), ) @@ -609,6 +620,109 @@ def test_block_draw_respects_each_households_source_geography( ) +def _jurisdiction_households(ladder) -> tuple[tuple, ...]: + """Stacked households over test_support's local_jurisdiction_blocks ladder. + + ASEC rows identified in each registry jurisdiction's county (Denver + 08031, Philadelphia 42101, Yonkers' 36003, Wilmington's 10003) and in + each place-code decoy's county (36047, 10001), unidentified ASEC rows in + Colorado and Pennsylvania, and one ACS row per observed PUMA outside New + York. The weights keep New York City (the 36047 row) inside the + PUMA-ladder gate's bounds: 4 of 10 in New York, under 6% of the total. + """ + + acs = tuple( + ("acs", int(puma) // 10**5, f"{int(puma):07d}", None, 12.0) + for puma in np.unique(ladder.puma).tolist() + if int(puma) // 10**5 != 36 + ) + return ( + ("asec", 36, None, 47, 4.0), + ("asec", 36, None, 3, 6.0), + ("asec", 8, None, 31, 12.0), + ("asec", 8, None, 0, 12.0), + ("asec", 42, None, 101, 12.0), + ("asec", 42, None, 0, 12.0), + ("asec", 10, None, 3, 12.0), + ("asec", 10, None, 1, 12.0), + *acs, + ) + + +def test_block_draw_derives_the_flags_from_the_drawn_block( + pool_tool: ModuleType, tmp_path: Path +) -> None: + """The flags follow the block this pool draws (microcosm#1453). + + The legacy PUMA ladder writes the county-rule flags with its county. The + block draw replaces that stage and fixes a place too, so it must write + all four flags, after the draw, and its receipt must name the block rungs. + """ + + ladder = load_us_location_ladder( + write_location_ladder(tmp_path / "ladder.npz", local_jurisdiction_blocks(3)) + ) + households = _jurisdiction_households(ladder) + frame = _stacked_frame(households=households) + # Flags from before the draw, wrong for most households: the draw must + # replace them, never carry them. + tables = {entity: frame.table(entity).copy() for entity in frame.entities} + for flag in ("in_denver", "in_yonkers", "in_wilmington"): + tables["household"][flag] = True + tables["person"]["pa_philadelphia_wage_tax_resident"] = True + frame = Frame( + tables, US_SCHEMA, {"household": frame.weights_for("household")}, frame.strata + ) + + assigned, receipt, _districts = _assign( + pool_tool, ladder, frame=frame, households=households + ) + + household, person = assigned.table("household"), assigned.table("person") + assert_local_jurisdiction_flags_follow_geography(household, person) + assert ( + us_local_jurisdiction_flag_failures( + household, person=person, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + == [] + ) + # The identified rows sit in their counties, so each flag is true + # somewhere and false somewhere, and each decoy is false. + county = household["county_fips"].astype(str) + assert list(county.iloc[[0, 1, 2, 4, 6, 7]]) == [ + "36047", + "36003", + "08031", + "42101", + "10003", + "10001", + ] + assert bool(household["in_denver"].iloc[2]) and not household["in_denver"].iloc[0] + assert bool(household["in_yonkers"].iloc[1]) and not household["in_yonkers"].iloc[7] + assert bool(household["in_wilmington"].iloc[6]) + assert not household["in_wilmington"].iloc[0] + assert bool(person["pa_philadelphia_wage_tax_resident"].iloc[4]) + assert not person["pa_philadelphia_wage_tax_resident"].iloc[2] + + # Both gates pass with the flags present, and the PUMA-ladder gate (which + # requires in_denver) reports no flag failure. + assert receipt["gate"]["passed"] is True + assert receipt["gate"]["gates"]["us_puma_ladder"]["failures"] == [] + # The receipt says the block rungs decided all four, with these counts. + flags = receipt["summary"]["local_jurisdiction_flags"] + assert flags["rungs"] == ["county", "place"] + expected = expected_local_jurisdiction_flags(household) + weights = assigned.weights_for("household").values + for flag, values in expected.items(): + assert 0 < values.sum() < len(values), flag + assert flags["flags"][flag]["status"] == "derived", flag + assert flags["flags"][flag]["households_in_jurisdiction"] == values.sum() + assert flags["flags"][flag]["weighted_households_in_jurisdiction"] == ( + pytest.approx(weights[values].sum()) + ) + json.dumps(receipt) + + def test_block_draw_is_deterministic_and_seeded(pool_tool: ModuleType, ladder) -> None: _frame_a, first, _ = _assign(pool_tool, ladder, seed=11) _frame_b, again, _ = _assign(pool_tool, ladder, seed=11) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_puf_support_base_block_location.py b/packages/microcosm-build/tests/engine_free/us/test_us_puf_support_base_block_location.py index 7c2b126676..c9fffa0229 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_puf_support_base_block_location.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_puf_support_base_block_location.py @@ -45,8 +45,15 @@ GEOGRAPHY_LADDER_ARTIFACT_SHA256_ATTR, GEOGRAPHY_LADDER_VINTAGES_ATTR, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + us_local_jurisdiction_flag_failures, +) from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights from test_support.microcosm_build.us_block_location import ( + assert_local_jurisdiction_flags_follow_geography, + expected_local_jurisdiction_flags, + local_jurisdiction_blocks, synthetic_blocks, write_location_ladder, ) @@ -79,6 +86,25 @@ # Frame households: every ASEC row once (the native copy), plus PUF-support # style copies of three rows that share their native row's source key. _COPIED_SOURCE_ROWS = (0, 3, 6) +# The same columns over test_support's local_jurisdiction_blocks ladder: an +# ASEC row identified in each registry jurisdiction's county (Denver 08031, +# Philadelphia 42101, Yonkers' 36003, Wilmington's 10003), one in each +# place-code decoy's county (36047, 10001) and one unidentified row each in +# Colorado, Pennsylvania and New York. +_JURISDICTION_ASEC_HOUSEHOLDS = ( + (2023, 11, 8, 31, 0), + (2023, 12, 8, 0, 0), + (2023, 13, 42, 101, 0), + (2023, 14, 42, 0, 0), + (2023, 15, 36, 3, 0), + (2023, 16, 36, 47, 0), + (2023, 17, 36, 0, 0), + (2023, 18, 10, 3, 0), + (2023, 19, 10, 1, 0), +) +# PUF-support style copies of the Denver, Philadelphia, Yonkers and +# Wilmington rows: each copy draws its own block in the same county. +_JURISDICTION_COPIED_SOURCE_ROWS = (0, 2, 4, 7) def _load_builder(): @@ -95,10 +121,10 @@ def builder(): return _load_builder() -def _write_asec_h5s(tmp_path: Path) -> dict[int, Path]: +def _write_asec_h5s(tmp_path: Path, households=_ASEC_HOUSEHOLDS) -> dict[int, Path]: paths: dict[int, Path] = {} - for year in sorted({row[0] for row in _ASEC_HOUSEHOLDS}): - rows = [row for row in _ASEC_HOUSEHOLDS if row[0] == year] + for year in sorted({row[0] for row in households}): + rows = [row for row in households if row[0] == year] household = pd.DataFrame( { "H_SEQ": [row[1] for row in rows], @@ -115,8 +141,10 @@ def _write_asec_h5s(tmp_path: Path) -> dict[int, Path]: return paths -def _located_source_frame() -> Frame: - rows = [*_ASEC_HOUSEHOLDS, *(_ASEC_HOUSEHOLDS[i] for i in _COPIED_SOURCE_ROWS)] +def _located_source_frame( + households=_ASEC_HOUSEHOLDS, copied=_COPIED_SOURCE_ROWS +) -> Frame: + rows = [*households, *(households[i] for i in copied)] n = len(rows) household_ids = np.arange(1, n + 1, dtype=np.int64) * 10 sizes = np.array([1 + (i % 2) for i in range(n)]) @@ -435,6 +463,89 @@ def test_block_v1_location_writes_consistent_geography_from_the_asec_row( pd.testing.assert_frame_equal(again.table("household"), household) +def test_block_v1_location_derives_the_flags_from_the_drawn_block( + builder, tmp_path: Path +) -> None: + """The flags follow the block this stage draws (microcosm#1453). + + The legacy block-ladder stage wrote all four flags with its geography; + ``block_v1`` replaces that stage, so its draw must write them too, after + the block is drawn, and the stage's receipt must name the block rungs. + """ + + args = _location_args(tmp_path) + args.block_ladder_artifact = write_location_ladder( + tmp_path / "jurisdictions.npz", local_jurisdiction_blocks(3) + ) + asec_dir = tmp_path / "jurisdiction_asec" + asec_dir.mkdir() + args.asec_h5 = [ + f"{year}={path}" + for year, path in sorted( + _write_asec_h5s(asec_dir, _JURISDICTION_ASEC_HOUSEHOLDS).items() + ) + ] + frame = _located_source_frame( + _JURISDICTION_ASEC_HOUSEHOLDS, _JURISDICTION_COPIED_SOURCE_ROWS + ) + # Flags from before the draw, all wrong for some household: the draw must + # replace them, never carry them. + tables = {entity: frame.table(entity).copy() for entity in frame.entities} + for flag in ("in_denver", "in_yonkers", "in_wilmington"): + tables["household"][flag] = True + tables["person"]["pa_philadelphia_wage_tax_resident"] = True + frame = Frame( + tables, + US_SCHEMA, + {"household": frame.weights_for("household")}, + frame.strata, + metadata=frame.metadata, + ) + + located, record = builder._block_v1_household_location(args, frame) + + household, person = located.table("household"), located.table("person") + ladder = load_us_location_ladder(args.block_ladder_artifact) + assert us_block_location_gate(household, ladder).passed + assert_local_jurisdiction_flags_follow_geography(household, person) + assert ( + us_local_jurisdiction_flag_failures( + household, person=person, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + == [] + ) + # Each identified row, and each copy of it, sits in its county, so each + # flag is true somewhere and false somewhere. + expected = expected_local_jurisdiction_flags(household) + assert expected["in_denver"].sum() >= 2 + assert expected["pa_philadelphia_wage_tax_resident"].sum() >= 2 + assert expected["in_yonkers"].sum() >= 2 + assert expected["in_wilmington"].sum() == 2 + county = household["county_fips"].astype(str) + assert not household.loc[county == "10001", "in_yonkers"].any() + assert not household.loc[county == "36047", "in_wilmington"].any() + assert (county == "10001").sum() == 1 and (county == "36047").sum() >= 1 + + # The legacy geography-ladder gate this stage also runs requires the + # flags; none of its failures on this small ladder is about one. + assert not [ + failure + for failure in record["geography_ladder_gate"]["failures"] + if any(flag in failure for flag in expected) + ] + # The receipt says the block rungs decided all four, with these counts. + receipt = record["coverage"]["local_jurisdiction_flags"] + assert receipt["rungs"] == ["county", "place"] + weights = located.weights_for("household").values + for flag, values in expected.items(): + assert receipt["flags"][flag]["status"] == "derived", flag + assert receipt["flags"][flag]["households_in_jurisdiction"] == values.sum() + assert receipt["flags"][flag]["weighted_households_in_jurisdiction"] == ( + pytest.approx(weights[values].sum()) + ) + json.dumps(record) + + def test_block_v1_location_gate_failure_aborts_unless_allowed( builder, tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: diff --git a/test_support/microcosm_build/us_block_location.py b/test_support/microcosm_build/us_block_location.py index 3ecd7e0f2f..6d93592400 100644 --- a/test_support/microcosm_build/us_block_location.py +++ b/test_support/microcosm_build/us_block_location.py @@ -90,6 +90,104 @@ def synthetic_blocks(seed: int = 0, *, states=(1, 2, 36)) -> dict[str, np.ndarra } +#: The states of :func:`local_jurisdiction_blocks`: Colorado, Delaware, New +#: York and Pennsylvania. +LOCAL_JURISDICTION_STATES = (8, 10, 36, 42) + + +def local_jurisdiction_blocks(seed: int = 0) -> dict[str, np.ndarray]: + """``synthetic_blocks`` over CO, DE, NY and PA with every geography the + local-jurisdiction registry names, and a decoy for each place code. + + The codes are written here, not read from the registry, so a test's + expectation does not come from the code under test: + + - Colorado's county 001 becomes 031 (Denver) and Pennsylvania's becomes + 101 (Philadelphia): the two county-rule flags; + - New York's county 003 is all place 84000 (Yonkers) and Delaware's + county 003 is all place 77580 (Wilmington): the two place-rule flags; + - place codes repeat across states, so Delaware's county 001 is all place + 84000 and New York's county 001 is all place 77580. Neither is Yonkers + or Wilmington. That New York county is renamed 047 (Kings), a New York + City county, which the PUMA-ladder gate's NYC checks need. + + Every other block keeps its synthetic place. Each state keeps at least a + county 003, so every jurisdiction has blocks at every seed. + """ + + arrays = synthetic_blocks(seed, states=LOCAL_JURISDICTION_STATES) + block = arrays["block_geoid"].astype(np.int64) + state = block // 10**13 + county = block // 10**10 % 1000 + renamed = block.copy() + for state_fips, old, new in ((8, 1, 31), (42, 1, 101), (36, 1, 47)): + renamed[(state == state_fips) & (county == old)] += (new - old) * 10**10 + place = arrays["place_fips"].copy() + for state_fips, county_code, place_code in ( + (36, 3, 84000), + (10, 3, 77580), + (10, 1, 84000), + (36, 1, 77580), + ): + place[(state == state_fips) & (county == county_code)] = place_code + order = np.argsort(renamed, kind="stable") + located = {name: values[order] for name, values in arrays.items()} + located["block_geoid"] = renamed[order] + located["place_fips"] = place[order] + return located + + +def expected_local_jurisdiction_flags(household) -> dict[str, np.ndarray]: + """Each registry flag for each household row, from the row's own + ``county_fips`` and ``place_fips``. + + The four rules are written out here (Denver is county 08031; Philadelphia + county 42101; Yonkers New York place 84000; Wilmington Delaware place + 77580), so a test compares the build's flags with an expectation the + registry and its module had no part in. The person flag + ``pa_philadelphia_wage_tax_resident`` is given per household; a test maps + it to persons itself. + """ + + county = household["county_fips"].astype(str).to_numpy() + place = household["place_fips"].astype(str).to_numpy() + state = np.array([value[:2] for value in county.tolist()]) + return { + "in_denver": county == "08031", + "pa_philadelphia_wage_tax_resident": county == "42101", + "in_yonkers": (state == "36") & (place == "84000"), + "in_wilmington": (state == "10") & (place == "77580"), + } + + +def assert_local_jurisdiction_flags_follow_geography(household, person) -> None: + """Every flag column equals :func:`expected_local_jurisdiction_flags`. + + All four must be present as boolean columns: the three household flags on + ``household`` and the Philadelphia flag on ``person``, each person taking + its household's value. + """ + + expected = expected_local_jurisdiction_flags(household) + for flag in ("in_denver", "in_yonkers", "in_wilmington"): + assert flag in household.columns, flag + assert household[flag].dtype == bool, (flag, household[flag].dtype) + np.testing.assert_array_equal( + household[flag].to_numpy(), expected[flag], err_msg=flag + ) + flag = "pa_philadelphia_wage_tax_resident" + assert flag in person.columns, flag + assert person[flag].dtype == bool, (flag, person[flag].dtype) + by_household = dict( + zip(household["household_id"].tolist(), expected[flag].tolist(), strict=True) + ) + np.testing.assert_array_equal( + person[flag].to_numpy(), + np.array([by_household[key] for key in person["person_household_id"].tolist()]), + err_msg=flag, + ) + + def write_location_ladder( path: Path, arrays: dict[str, np.ndarray] | None = None, diff --git a/tools/build_us_multispine_pool.py b/tools/build_us_multispine_pool.py index a43eb83ebe..5f962f7679 100644 --- a/tools/build_us_multispine_pool.py +++ b/tools/build_us_multispine_pool.py @@ -158,6 +158,11 @@ ACS_2022_RENT_ARTIFACT_SHA256, load_acs_2022_rent_donor, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + BLOCK_GEOGRAPHY_RUNGS, + us_local_jurisdiction_flag_receipt, + us_local_jurisdiction_flag_values, +) from microcosm.build.us_runtime.multispine_pool import ( POOL_CHECKPOINT_STAGE_ORDER, POOL_DERIVE_OPERATOR_ORDER, @@ -2588,6 +2593,8 @@ def _expected_block_location_contract_from( def _block_location_summary( household: pd.DataFrame, record: Mapping[str, object], + *, + weights: np.ndarray, ) -> dict[str, object]: return { "applied": True, @@ -2606,6 +2613,14 @@ def _block_location_summary( CONGRESSIONAL_DISTRICT_GEOID_COLUMN, ) }, + # The drawn block fixes county and place, so the draw writes every + # registry flag (microcosm#1453); the legacy summary records the same + # key with the PUMA ladder's county rung only. + "local_jurisdiction_flags": us_local_jurisdiction_flag_receipt( + us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS), + rungs=BLOCK_GEOGRAPHY_RUNGS, + household_weights=weights, + ), } @@ -3113,7 +3128,9 @@ def _assign_stacked_household_block_location( "positive_congressional_district_rows": len(values), "unique_congressional_district_values": int(len(np.unique(values))), }, - "summary": _block_location_summary(located, record), + "summary": _block_location_summary( + located, record, weights=assigned.weights_for("household").values + ), "household_location": record, "gate": gate_report.to_manifest(), } From e504a6d400ca5cabb44fc47f34e87bc194f9f75c Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 18:58:27 -0500 Subject: [PATCH 16/32] Scan the moved flags implementation with the runtime it serves (review M1) The local-jurisdiction flags moved out of us_runtime so the annual lane's gate imports no us_runtime module; us_runtime/local_jurisdictions.py re-exports them. test_us_spine_blindness.py scans us_runtime by glob and the pool tool's import graph by us_runtime imports, so after the move its source-spine-blindness scan, its frame-metadata scan and the pool tool's graph scan read only the re-export. The 900-line implementation, which the ladders and the pool run, was scanned by none. - A reviewed registry names each out-of-runtime implementation and the us_runtime module that re-exports it. The two glob scans read every us_runtime module and every registered implementation. - The pool tool's import graph follows a registered re-export into its implementation's imports, and the build-path scan reads the tool, the graph and the implementations behind it. The implementation is not a runtime module, so the pinned count stays 84. - A new test finds every us_runtime module that re-exports microcosm.build code (imports a name and lists it in __all__) and requires the registry to name exactly those, with each target present, outside us_runtime and among the scanned files. Moving more code behind a re-export, or dropping the entry, now fails instead of shrinking the scans silently. Mutation checks in a scratch clone, by direct calls of the tests: a source-spine read planted in the implementation fails both spine scans (and passes them with the test file as it was); a Frame rebuilt there without metadata fails the metadata scan; removing the registry entry, or adding an unregistered re-export, fails the registry test. Co-Authored-By: Claude Fable 5.2 --- .../engine_free/us/test_us_spine_blindness.py | 170 +++++++++++++++++- 1 file changed, 164 insertions(+), 6 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py index 63f1ebfa4e..7b8f85c130 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py @@ -71,6 +71,18 @@ _REPOSITORY_ROOT = _TEST_PATHS.repository _US_RUNTIME = _TEST_PATHS.package / "src" / "microcosm" / "build" / "us_runtime" _US_RUNTIME_IMPORT_PREFIX = "microcosm.build.us_runtime" +_BUILD_IMPORT_PREFIX = "microcosm.build" +#: Reviewed implementations that sit outside ``us_runtime`` although the +#: runtime runs them: the ``us_runtime`` module that re-exports each one, and +#: the ``microcosm.build`` module that holds its code. The local-jurisdiction +#: flags moved out so the annual static-aging lane can check its parent +#: without importing ``us_runtime`` (microcosm#1453), yet the geography +#: ladders and the pool still derive the flags through the re-export. Every +#: scan of ``us_runtime`` below therefore reads each implementation too, and +#: the pool tool's import graph follows each re-export into it. +_OUT_OF_RUNTIME_IMPLEMENTATIONS = ( + ("local_jurisdictions.py", "microcosm.build.us_local_jurisdictions"), +) _SPINE_BLIND_BUILD_TOOLS = (_REPOSITORY_ROOT / "tools" / "build_us_multispine_pool.py",) _REQUIRED_POOL_RUNTIME_MODULES = frozenset( { @@ -3334,11 +3346,88 @@ def _imported_us_runtime_modules(source: str) -> tuple[str, ...]: return tuple(sorted(imported)) +def _out_of_runtime_implementation_path(module: str) -> Path: + """The source file of a ``microcosm.build`` module named in dotted form.""" + + relative = module.removeprefix("microcosm.").replace(".", "/") + return _TEST_PATHS.package / "src" / "microcosm" / f"{relative}.py" + + +def _out_of_runtime_implementations( + runtime_names: set[str] | None = None, +) -> tuple[Path, ...]: + """Implementation files behind the registered re-exports. + + With ``runtime_names``, only those whose re-export is among them: the + implementations one import graph reaches. + """ + + return tuple( + _out_of_runtime_implementation_path(module) + for re_export, module in _OUT_OF_RUNTIME_IMPLEMENTATIONS + if runtime_names is None or re_export in runtime_names + ) + + +def _runtime_scan_paths() -> tuple[Path, ...]: + """Every ``us_runtime`` module and every out-of-runtime implementation.""" + + return (*sorted(_US_RUNTIME.glob("*.py")), *_out_of_runtime_implementations()) + + +def _re_exported_build_modules(source: str) -> tuple[str, ...]: + """``microcosm.build`` modules outside ``us_runtime`` that a module re-exports. + + A module re-exports another when it imports a name from it and lists that + name in a literal ``__all__``: its callers then run code that lives in + the other file. + """ + + tree = ast.parse(source) + exported: set[str] = set() + for node in tree.body: + if ( + isinstance(node, ast.Assign) + and any( + isinstance(target, ast.Name) and target.id == "__all__" + for target in node.targets + ) + and isinstance(node.value, (ast.List, ast.Tuple)) + ): + exported.update( + element.value + for element in node.value.elts + if isinstance(element, ast.Constant) and isinstance(element.value, str) + ) + modules: set[str] = set() + for node in tree.body: + if not isinstance(node, ast.ImportFrom) or node.module is None or node.level: + continue + module = node.module + if not module.startswith(f"{_BUILD_IMPORT_PREFIX}."): + continue + if module == _US_RUNTIME_IMPORT_PREFIX or module.startswith( + f"{_US_RUNTIME_IMPORT_PREFIX}." + ): + continue + if any((alias.asname or alias.name) in exported for alias in node.names): + modules.add(module) + return tuple(sorted(modules)) + + def _us_runtime_import_graph( root: Path, ) -> tuple[tuple[Path, ...], tuple[str, ...]]: - """Resolve the runtime portion of one tool's static import graph.""" + """Resolve the runtime portion of one tool's static import graph. + + A registered re-export is followed into its out-of-runtime + implementation, so a ``us_runtime`` module that only the implementation + imports is reached too. The implementation itself is not a runtime + module and is not returned; :func:`_out_of_runtime_implementations` + names it for the scans. + """ + implementations = dict(_OUT_OF_RUNTIME_IMPLEMENTATIONS) pending = list(_imported_us_runtime_modules(root.read_text())) visited: set[str] = set() missing: set[str] = set() @@ -3351,9 +3440,17 @@ def _us_runtime_import_graph( if not path.is_file(): missing.add(module_name) continue + sources = [path.read_text()] + if module_name in implementations: + sources.append( + _out_of_runtime_implementation_path( + implementations[module_name] + ).read_text() + ) pending.extend( imported - for imported in _imported_us_runtime_modules(path.read_text()) + for source in sources + for imported in _imported_us_runtime_modules(source) if imported not in visited ) return ( @@ -3435,12 +3532,65 @@ def test_runtime_classification_rejects_a_new_unreviewed_module() -> None: ) +def test_out_of_runtime_implementations_are_exactly_the_runtime_re_exports() -> None: + """Every implementation a runtime module re-exports is registered, so scanned. + + Moving code out of ``us_runtime`` behind a re-export would otherwise take + it out of every scan below without a failure: the scans would read the + re-export, which holds no code. The registry must name each re-export's + target, each target must exist, and each must be among the scanned files. + """ + + found = { + (path.name, module) + for path in sorted(_US_RUNTIME.glob("*.py")) + for module in _re_exported_build_modules(path.read_text()) + } + assert found == set(_OUT_OF_RUNTIME_IMPLEMENTATIONS), ( + "us_runtime modules re-export microcosm.build code that the registry " + "of out-of-runtime implementations does not name (or it names one " + f"that is gone): found={sorted(found)}, " + f"registered={sorted(_OUT_OF_RUNTIME_IMPLEMENTATIONS)}" + ) + scanned = set(_runtime_scan_paths()) + for re_export, module in _OUT_OF_RUNTIME_IMPLEMENTATIONS: + implementation = _out_of_runtime_implementation_path(module) + assert implementation.is_file(), f"{module} has no source file" + assert _US_RUNTIME not in implementation.parents, module + assert implementation in scanned, ( + f"{re_export} re-exports {module}, which no runtime scan reads" + ) + + +def test_re_export_detector_finds_a_new_out_of_runtime_implementation() -> None: + """Pin the detector: a re-export counts, a plain import does not.""" + + re_export = """ +from microcosm.build.us_moved_operator import moved_operator, helper as h +from microcosm.build.us_runtime.puf_support import support_channel_column +from microcosm.build.gates import GateResult + +__all__ = ["moved_operator", "local_operator"] + + +def local_operator(frame): + return GateResult, h +""" + assert _re_exported_build_modules(re_export) == ( + "microcosm.build.us_moved_operator", + ) + plain_import = re_export.replace('"moved_operator", ', "") + assert _re_exported_build_modules(plain_import) == () + aliased = re_export.replace('"moved_operator"', '"h"') + assert _re_exported_build_modules(aliased) == ("microcosm.build.us_moved_operator",) + + def test_us_runtime_frame_rebuilds_preserve_immutable_metadata() -> None: """A transformation carrying mass history must also carry stage receipts.""" offenders = { path.name: drops - for path in sorted(_US_RUNTIME.glob("*.py")) + for path in _runtime_scan_paths() if (drops := _frame_metadata_drops(path.read_text())) } assert not offenders, ( @@ -3471,7 +3621,7 @@ def test_runtime_population_operators_are_source_spine_blind() -> None: ) offenders: dict[str, tuple[str, ...]] = {} - for path in sorted(_US_RUNTIME.glob("*.py")): + for path in _runtime_scan_paths(): accesses = _non_owner_source_spine_accesses(path.name, path.read_text()) if accesses: offenders[path.name] = accesses @@ -3855,7 +4005,8 @@ def test_pool_build_tool_import_graph_is_source_spine_blind() -> None: # local_jurisdictions.py, which the PUMA ladder calls to write the # county-rule local-jurisdiction flags; it re-exports # microcosm.build.us_local_jurisdictions, which sits outside - # us_runtime and so outside this graph (#1453). + # us_runtime and so outside this count, but is scanned below with + # the modules of the graph (#1453). assert len(runtime_graph) == 84, ( f"{tool.name} must reach the pinned 84-module runtime graph; " f"reached {len(runtime_graph)}" @@ -3878,8 +4029,15 @@ def test_pool_build_tool_import_graph_is_source_spine_blind() -> None: f"{tool.name} reaches unclassified US runtime modules: {unclassified}" ) + # A re-export in the graph holds no code: scan the implementation + # behind it as part of the build path. + implementations = _out_of_runtime_implementations(runtime_names) + assert implementations == _out_of_runtime_implementations(), ( + f"{tool.name} no longer reaches a registered re-export; its " + f"implementation would go unscanned: reached={implementations}" + ) offenders: dict[str, tuple[str, ...]] = {} - for path in (tool, *runtime_graph): + for path in (tool, *runtime_graph, *implementations): reads = _non_owner_source_spine_accesses(path.name, path.read_text()) if reads: offenders[str(path.relative_to(_REPOSITORY_ROOT))] = reads From fb7f9efd0e9ee0c446038ac3d465c69538d11b9e Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 19:03:00 -0500 Subject: [PATCH 17/32] Pin what the gate-import test is cited for (review G-B1) test_us_annual_static_aging_gate_imports.py asserted that the annual lane's parent-flag check leaves microcosm.build.us_runtime unloaded. The documents cite it for more: that the check never asserts the engine ABI lock, and that it runs before any model work. us_runtime is only the lock assertion's usual carrier. microcosm.build.country_spec, which the package __init__ loads, imports spec_engine.engine_abi inside the take-up projection it compiles, so a check that called that projection would assert the lock with us_runtime still unloaded, and the test passed on exactly that mutant (the reviewer's M3). The fresh-interpreter probe now also reports the loaded modules at or under microcosm.build.spec_engine.engine_abi and policyengine_us, and the test asserts both lists are empty after the gate ran on a flagged and an unflagged parent. Mutation checks in a scratch clone: a call to country_spec.load_country_take_up_contract_projection("us") inside us_local_jurisdiction_artifact_receipt now fails the test on the engine_abi assertion alone; the progress log records the engine-side and re-export mutants. Co-Authored-By: Claude Fable 5.2 --- ...est_us_annual_static_aging_gate_imports.py | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py index ef8826ab54..c90f4ab221 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_gate_imports.py @@ -1,4 +1,4 @@ -"""The annual lane's parent-flag check never imports ``us_runtime``. +"""The annual lane's parent-flag check asserts no engine ABI lock. Importing any ``microcosm.build.us_runtime`` module runs that package's ``__init__``, which builds the spine-agreement registry; that loads the @@ -16,6 +16,13 @@ parent that carries its flags and on one that lacks them, leaves no ``microcosm.build.us_runtime`` module in ``sys.modules``. It must be a fresh interpreter: this test process has usually imported ``us_runtime`` already; +- the same run leaves ``microcosm.build.spec_engine.engine_abi`` unloaded. + That module holds the lock assertion, and ``us_runtime`` is only its usual + carrier: ``microcosm.build.country_spec``, which the package ``__init__`` + loads, imports it inside the take-up projection it compiles, so a check + that called that projection would assert the lock without ``us_runtime``; +- the same run leaves ``policyengine_us`` unloaded: the check comes before + any model work; - ``us_runtime.local_jurisdictions`` re-exports every public name of the module as the same object, so the geography lines that import it there see one implementation. @@ -91,6 +98,14 @@ class ReachedModelProvenance(Exception): pass +def loaded(package): + return sorted( + module + for module in sys.modules + if module == package or module.startswith(package + ".") + ) + + def reached(**kwargs): raise ReachedModelProvenance @@ -127,12 +142,9 @@ def reached(**kwargs): { "module": annual.__file__, "outcomes": outcomes, - "us_runtime_modules": sorted( - module - for module in sys.modules - if module == "microcosm.build.us_runtime" - or module.startswith("microcosm.build.us_runtime.") - ), + "us_runtime_modules": loaded("microcosm.build.us_runtime"), + "engine_abi_modules": loaded("microcosm.build.spec_engine.engine_abi"), + "policyengine_us_modules": loaded("policyengine_us"), } ) ) @@ -169,6 +181,10 @@ def test_the_annual_parent_check_leaves_us_runtime_unloaded(tmp_path) -> None: assert result["outcomes"]["flagged"] == "reached model provenance" assert "needs a parent that already carries" in result["outcomes"]["unflagged"] assert result["us_runtime_modules"] == [] + # The hazard itself, whatever carries it: the module that asserts the + # engine ABI lock never loaded, and neither did the engine. + assert result["engine_abi_modules"] == [] + assert result["policyengine_us_modules"] == [] def test_us_runtime_re_exports_the_same_objects() -> None: From 3774d648a530d1a989b714258511839912eacbdc Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 19:03:36 -0500 Subject: [PATCH 18/32] Pin the base and frozen flag assignments; say the third refusal (D2, nits) Review D2 (test only). test_builder_derives_flags_after_every_support_ reduction pinned that the export derivation's result is assigned, but not the base's or the frozen support's. A call whose return value is dropped would leave the unflagged frame in use for target materialization while its receipt says the flags were derived, and both such mutants passed. The test now requires each of the three calls that names a support to be the one assigned to its frame. Run against mutated copies of _main, the base and frozen return-discarded mutants now fail; both passed the test as it stood. Wording: - G-N1: docs/us-annual-static-aging.md, the annual module docstring and US_LOCAL_JURISDICTIONS.md name the third refusal: a parent that carries a flag its geography cannot decide. - G-N2: the re-export serves the us_runtime importers and three tools (the release builder, the registry verifier and now the pool tool), not only the geography lines. - D4: the changelog says the pooled ACS line writes the county-rule flags with its PUMA ladder; without one it writes none. - US_LOCAL_JURISDICTIONS.md names what the gate-import test now pins. Co-Authored-By: Claude Fable 5.2 --- .../us-local-jurisdiction-flags.added.md | 2 +- docs/us-annual-static-aging.md | 7 ++++--- .../microcosm/build/us_annual_static_aging.py | 5 +++-- .../microcosm/build/us_local_jurisdictions.py | 3 ++- .../build/us_runtime/US_LOCAL_JURISDICTIONS.md | 17 ++++++++++------- .../us/test_us_fiscal_refresh_builder.py | 15 +++++++++++++++ 6 files changed, 35 insertions(+), 14 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 29f663bd15..f6ab8e7275 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA and pooled ACS lines write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/docs/us-annual-static-aging.md b/docs/us-annual-static-aging.md index dee42591cb..82ba2d8e1d 100644 --- a/docs/us-annual-static-aging.md +++ b/docs/us-annual-static-aging.md @@ -56,9 +56,10 @@ local-jurisdiction flag its own geography decides (see `in_denver` and `pa_philadelphia_wage_tax_resident` when every household has a county, and also `in_yonkers` and `in_wilmington` when every household has a place and a block. The builder reads the parent first and refuses one that lacks -such a flag, or carries one that disagrees with its geography, before any model -or output work. Rebuild a parent that predates the flags before it seeds annual -files. +such a flag, carries one that disagrees with its geography, or carries one its +geography cannot decide (`in_yonkers` where some household has no block, say), +before any model or output work. Rebuild a parent that predates the flags before +it seeds annual files. The output directory must be new. A failed attempt retains its partial files and `build_status.json`; rerunning requires another directory. `annual_manifest.json` diff --git a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py index 4e9000045d..0101918dd2 100644 --- a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py +++ b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py @@ -4,8 +4,9 @@ held in memory at a time. The original H5 is copied byte for byte, and all later files retain its entity/column/row layout with an explicit ``_time_period``. No file adds a column, so the parent must already carry every local-jurisdiction -flag its own geography decides; the lane refuses a parent that lacks one before -any model work. +flag its own geography decides; the lane refuses a parent that lacks one, +carries one that disagrees with its geography, or carries one its geography +cannot decide, before any model work. Each projected year's H5 is ``microcosm_us_`` (key and file name); the base year, and the family, take the key of the base build's dataset (``base_dataset``, ``microcosm_us_`` unless given), so the diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index 5bba99fc45..8c6751bcd3 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -60,7 +60,8 @@ is installed. The annual static-aging lane checks its parent here before any model work, so through ``us_runtime`` it would refuse every parent under any policyengine-us other than the locked one. ``us_runtime.local_jurisdictions`` -re-exports these names for the geography lines. +re-exports these names for the ``us_runtime`` modules and the tools that +import them there. """ from __future__ import annotations diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index 88e63e24ca..491e969cfb 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -21,7 +21,8 @@ line writes. `microcosm/build/us_local_jurisdictions.py` pins its SHA-256. Both sit outside `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed; `us_runtime/local_jurisdictions.py` re-exports -the module's names for the geography lines. A county rule holds when +the module's names for the `us_runtime` importers and three tools. A county +rule holds when `county_fips` equals the registry county. A place rule holds when the first two digits of `county_fips` equal the registry state and `place_fips` equals the registry place code; place codes repeat across states, so the state is part of @@ -109,13 +110,15 @@ an existing artifact rather than a geography line, and both call A third step, the annual static-aging lane (`us_annual_static_aging`), keeps its parent's columns and base-year bytes, so it cannot write the flags. It calls `us_local_jurisdiction_artifact_receipt` instead, which refuses a parent that -lacks a flag its geography decides or carries one that disagrees with it, and -records the receipt as `base.local_jurisdiction_flags` in the candidate -manifest. A parent built before the flags existed therefore cannot seed annual -files until a rebuild adds them. The lane imports the helper from +lacks a flag its geography decides, carries one that disagrees with it, or +carries one its geography cannot decide, and records the receipt as +`base.local_jurisdiction_flags` in the candidate manifest. A parent built +before the flags existed therefore cannot seed annual files until a rebuild +adds them. The lane imports the helper from `microcosm.build.us_local_jurisdictions`, so the check loads no `us_runtime` -module and so never asserts the engine ABI lock -(`test_us_annual_static_aging_gate_imports.py`). +module, never loads the module that asserts the engine ABI lock +(`spec_engine.engine_abi`) and runs before `policyengine_us` is imported +(`test_us_annual_static_aging_gate_imports.py` pins all three). The helper reads the rungs from the artifact's own geography (`us_local_jurisdiction_rungs_present`): the county rung when `county_fips` is diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index 269ac4a4c4..450867ea6a 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2846,6 +2846,21 @@ def test_builder_derives_flags_after_every_support_reduction() -> None: assert base_load < base < selection < frozen < selection_report < mass_repair assert full_pool_export < l0_export < export_assignment < export < first_export_use assert first_export_use < write + # Each derivation's result is assigned back to the frame it derived. A + # call whose return value is dropped would leave the unflagged frame in + # use while its receipt says the flags were derived (review D2): the + # call that names each support is the assigned one. + derive = "_with_local_jurisdiction_flags(" + base_assignment = source.index(f"base_frame = {derive}") + frozen_assignment = source.index(f"base_frame = {derive}", base_assignment + 1) + assert source.count(f"base_frame = {derive}") == 2 + assert base_load < base_assignment < base < selection < frozen_assignment < frozen + for assignment, support, frame in ( + (base_assignment, base, "base_frame"), + (frozen_assignment, frozen, "base_frame"), + (export_assignment, export, "export_frame"), + ): + assert source.rfind(derive, 0, support) == assignment + len(f"{frame} = ") # Nothing reassigns the export frame after the derivation, and the # helper is the only caller of the derivation. assert source.rfind("export_frame = ") == export_assignment From 724b6eb88c4a0f70bb624294d419140a409fb9a1 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 19:30:35 -0500 Subject: [PATCH 19/32] Give the export-statement test the names the export derivation reads CI on bcb019488 failed test_us_post_export_scoring.py::test_main_has_no_calibrated_target_frame_at_the_export_write with NameError: name 'local_jurisdiction_flags' is not defined (run 43479440014, engine-free 3.13 and 3.14). That test executes _main's export and cleanup statements in a namespace it builds by hand. This branch put the export support's flag derivation among those statements, where it belongs: it must run before _without_calibrated_frames, which binds the export frame an exact-K outcome keeps. The derivation reads two names _main binds earlier, the receipts dict and the progress reporter, and the branch never gave them to the test. A miss of this branch, not a misplaced statement. The namespace now holds both. The fixture's households get a county, half of them Denver's, so the statements run the real derivation and it writes columns on a new frame. The write check asserts that the written frame carries in_denver as its county decides and no Philadelphia resident, and (as before) that it is the frame the cleanup keeps; the test then asserts the export receipt: county rung, nothing carried, a nonzero Denver count equal to the written column's. Co-Authored-By: Claude Fable 5.2 --- .../us/test_us_post_export_scoring.py | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py b/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py index 02e047a902..fa67c7308a 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py @@ -1319,11 +1319,15 @@ def test_main_has_no_calibrated_target_frame_at_the_export_write( from microcosm.calibrate import calibrate_l0_refit target_frame, targets = _small_calibration_problem() + # The export statements derive the local-jurisdiction flags on the export + # support (microcosm#1453). Every household here has a county, half of + # them Denver's, so that derivation writes real columns on a new frame. + households = target_frame.table("household").drop(columns="x") + households["county_fips"] = np.where( + households["household_id"] % 2 == 0, "08031", "06037" + ) base_frame = Frame( - { - "person": target_frame.table("person"), - "household": target_frame.table("household").drop(columns="x"), - }, + {"person": target_frame.table("person"), "household": households}, target_frame.schema, {"household": target_frame.weights_for("household")}, ) @@ -1379,7 +1383,14 @@ def test_main_has_no_calibrated_target_frame_at_the_export_write( def check_write(frame, path, *, period): writes.append(frame) - assert "x" not in frame.table("household") + written = frame.table("household") + assert "x" not in written + # The written support carries the flags its own geography decides, + # and it is the frame the cleanup below keeps for an exact-K outcome. + assert ( + written["in_denver"].tolist() == written["county_fips"].eq("08031").tolist() + ) + assert not frame.table("person")["pa_philadelphia_wage_tax_resident"].any() cleaned = namespace["result"] if not full_pool: assert cleaned.selection.frame is None @@ -1399,12 +1410,26 @@ def check_write(frame, path, *, period): "full_pool_calibration": full_pool, "release_engine": SimpleNamespace(write_dataset=check_write), "dataset_path": Path("fixture.h5"), + # Bound earlier in _main: the receipts of the base and frozen-support + # derivations, and the build's progress reporter. + "local_jurisdiction_flags": {}, + "telemetry": None, } module = ast.Module( body=[*statements[export_start : cleanup_end + 1], write], type_ignores=[] ) exec(compile(module, "
", "exec"), namespace) assert len(writes) == 1 + receipts = namespace["local_jurisdiction_flags"] + assert list(receipts) == ["export"] + receipt = receipts["export"] + assert receipt["rungs"] == ["county"] and receipt["carried_flags"] == [] + in_denver = receipt["flags"]["in_denver"] + assert in_denver["status"] == "derived" + assert in_denver["households_in_jurisdiction"] == int( + writes[0].table("household")["in_denver"].sum() + ) + assert in_denver["households_in_jurisdiction"] > 0 def test_scored_sha_is_bound_at_load_and_checked_by_the_manifest( From d8e1490dbee6954dbbcf201be9a136bf7d7264f4 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 13 Nov 2026 19:52:50 -0500 Subject: [PATCH 20/32] Recompute the spec-engine pins on main 68bbff774 with the block_v1 flags The merge of main 68bbff774 took main's values for every conflicted pin hunk, and the block_v1 change then edited attested modules, so the pins were stale by design until the tools ran. Each value below was written by its tool on this tree; none is hand-edited. tools/repin_us_spec_engine_contracts.py (two passes; the first writes a covered_item_count of 40 into test_spec_engine_coverage_tool.py and the second restores 41, so that file is unchanged): - inventory_coverage.py EXPECTED_HASHES seed_map adb7a1d9..., seed_protocol e3bd670e... - test_spec_engine_loader.py golden spec_sha256 cc830059... - engine_workflow test_us_multispine_pool_tool.py spec_sha256 1fe859c1..., equal to what generate_us_bundle_from_constants.py --check prints under policyengine-us 2.2.1 tools/spec_engine_coverage.py (two passes): docs/evidence/spec-engine/ us-f0-coverage.json, the same seed map, seed protocol and spec digests. ruff format restored double quotes on the three Python pin lines (the repinner writes repr()). Checked after the writes: the repinner's --legacy-only --check and --check, spec_engine_coverage.py --check, the bundle --check, and ci_test_plan.py verify all exit 0. No engine pin moves: the pool's remaining-stage manifest is still 6e70bc74... over 1,059 rows (repin_us_pool_engine_contracts.py --emit-json under policyengine-us 2.2.1), which is what multispine_pool.py, the engine ABI lock and its test pin. full_checkpoint (47d4474d...) and the stacked pool's code digest keep the values this branch already carried. Co-Authored-By: Claude Fable 5.2 --- docs/evidence/spec-engine/us-f0-coverage.json | 16 ++++++++-------- .../build/spec_engine/inventory_coverage.py | 4 ++-- .../shared/test_spec_engine_loader.py | 2 +- .../us/test_us_multispine_pool_tool.py | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 80a96ed70f..79d8fd3ad7 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1642,13 +1642,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "0c19b903a43b997886be6222045485954c96d6a624ce2ae3f83cadb4b22a7883", - "protocol_sha256": "15e6cad1f1b0082ffd5980095b4060827ed18786fae3076c97cf431c93a50e16" + "map_sha256": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", + "protocol_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4" }, "failures": [], "observed": { - "map_sha256": "0c19b903a43b997886be6222045485954c96d6a624ce2ae3f83cadb4b22a7883", - "protocol_sha256": "15e6cad1f1b0082ffd5980095b4060827ed18786fae3076c97cf431c93a50e16" + "map_sha256": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", + "protocol_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4" }, "status": "covered" }, @@ -1663,7 +1663,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "15e6cad1f1b0082ffd5980095b4060827ed18786fae3076c97cf431c93a50e16", + "implementation_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1684,7 +1684,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "15e6cad1f1b0082ffd5980095b4060827ed18786fae3076c97cf431c93a50e16", + "implementation_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", "protocol": "legacy-v1", "streams": [ "build_model", @@ -2585,7 +2585,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "98d583653d37fe58edcace1cf3e21a139b69ebe7d1c3dac6a58f08b2b5aab8cf" + "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28" } }, "report_schema_version": 3, @@ -2595,7 +2595,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "98d583653d37fe58edcace1cf3e21a139b69ebe7d1c3dac6a58f08b2b5aab8cf" + "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 854b83e600..9af499c9f8 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -386,8 +386,8 @@ # housing_inputs puts each ACS rent draw on its own household's head. # microcosm#1453 moves both again: geography_ladder and puma_ladder write # the local-jurisdiction flags. - "seed_map": "0c19b903a43b997886be6222045485954c96d6a624ce2ae3f83cadb4b22a7883", - "seed_protocol": "15e6cad1f1b0082ffd5980095b4060827ed18786fae3076c97cf431c93a50e16", + "seed_map": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", + "seed_protocol": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", "source_manifest": "dc3879886d2a69f20fb982a675d7fb322c0e4017afef6471be54b0ee3cbd2af6", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "565f0ceeadab69d3e96a886a00dd0305f7425fa3acde24d12ba48db2b37d5fc0", diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 954cb6e8ab..0fdda3c169 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -28,7 +28,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # microcosm#1453's local-jurisdiction flags move geography_ladder's and # puma_ladder's attested bytes. assert first.spec_sha256 == ( - "99f9b82ed263b57936d29d0a74076860e44bbec2c3e37c1075a5a570b31d6d29" + "cc8300596237644b744848c9cf7274dc36972a4eb615be37507adb4333248280" ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 1f520441ee..54be3fbe4e 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -356,7 +356,7 @@ def capture_equality(expected: object, actual: object) -> None: # The hierarchy value ranks move it through medicaid_take_up's # attested bytes. microcosm#1453's local-jurisdiction flags in # geography_ladder, puma_ladder and the pool move it. - "spec_sha256": "98d583653d37fe58edcace1cf3e21a139b69ebe7d1c3dac6a58f08b2b5aab8cf", + "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28", }, } From 21ec4d95ac935d2632ebc51e3c0bd1c606f76e59 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 09:38:31 -0500 Subject: [PATCH 21/32] Read no place rung beside a block outside its county (review round 1) A PUMA redraw through with_household_us_puma_ladder kept the block, tract, place, state-legislative-district and CBSA columns an earlier block line wrote, beside the county it had just redrawn. The rung inference then called the table block-anchored, and a re-derivation wrote in_yonkers on a Bronx household whose kept block was in Yonkers. - with_household_us_puma_ladder removes each column only a block decides before it draws (US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS and the per-plan district columns of a block_v1 draw). assign_us_puma_ladder keeps them: the pooled ACS line restores a block-line donor's own district and county after it. The stacked pool's input is operator-free, so its output is unchanged. - us_local_jurisdiction_rungs_present raises on a table in which any row's 15-digit block_geoid does not begin with the row's county_fips, naming the count and the first pairs, and the place rung of us_local_jurisdiction_flag_values raises the same way. So the L0/refit export, the release builder, the annual lane and both ladder gates stop on such a table. Every line writes county_fips as a 2020 county, Connecticut included, so no table a line writes is refused. - US_LOCAL_JURISDICTIONS.md and docs/us-annual-static-aging.md no longer say every parent that predates the flags needs a rebuild: one whose geography decides no flag (no county on some household) passes when it carries none. - The spine-blindness test pins that each registered re-export and implementation declares one literal, unannotated __all__, the only form its re-export detector reads. The spec-engine pins follow in the next commit. Co-Authored-By: Claude Fable 5.2 --- docs/us-annual-static-aging.md | 10 +- .../microcosm/build/us_local_jurisdictions.py | 108 ++- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 41 +- .../build/us_runtime/US_PUMA_LADDER.md | 6 + .../microcosm/build/us_runtime/puma_ladder.py | 39 +- ...est_us_annual_static_aging_parent_flags.py | 39 +- .../us/test_us_fiscal_refresh_builder.py | 40 + .../engine_free/us/test_us_l0_refit_export.py | 43 + .../us/test_us_local_jurisdictions.py | 847 +++++++++++++++++- .../engine_free/us/test_us_spine_blindness.py | 91 ++ 10 files changed, 1237 insertions(+), 27 deletions(-) diff --git a/docs/us-annual-static-aging.md b/docs/us-annual-static-aging.md index 82ba2d8e1d..1ee7a38175 100644 --- a/docs/us-annual-static-aging.md +++ b/docs/us-annual-static-aging.md @@ -58,8 +58,14 @@ county, and also `in_yonkers` and `in_wilmington` when every household has a place and a block. The builder reads the parent first and refuses one that lacks such a flag, carries one that disagrees with its geography, or carries one its geography cannot decide (`in_yonkers` where some household has no block, say), -before any model or output work. Rebuild a parent that predates the flags before -it seeds annual files. +before any model or output work. It also refuses a parent in which a +household's `block_geoid` does not begin with that household's `county_fips`: +the block was kept from before the county was redrawn, so the place beside it +cannot be trusted. A parent that predates the flags, in which every household +has a county, therefore needs a rebuild before it seeds annual files. A parent +with no `county_fips` column, or with a null county on some household, decides +no flag: the builder accepts it when it carries none, and its receipt records +no rung and no carried flag. The output directory must be new. A failed attempt retains its partial files and `build_status.json`; rerunning requires another directory. `annual_manifest.json` diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index 8c6751bcd3..f35e0b998f 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -32,16 +32,28 @@ derived, after the block is assigned. The PUMA ladder writes a county but no place, so the place-rule flags are *unavailable* there: the line never writes them (any stale column is removed) and its receipt records them as -unavailable with the reason, rather than writing ``False``. The pooled ACS -line follows its location rule: the PUMA ladder's county rung under the -default ``legacy`` rule, the block rungs under ``block_v1``. +unavailable with the reason, rather than writing ``False``. Its frame wrapper +(``with_household_us_puma_ladder``) redraws every household's county, so it +also removes each column an earlier block line wrote that only a block +decides (block, tract, place, state-legislative districts, CBSA): each would +describe the geography the redraw replaced. The pooled ACS line follows its +location rule: the PUMA ladder's county rung under the default ``legacy`` +rule, the block rungs under ``block_v1``. + +A 2020 block geoid begins with the five digits of its 2020 county, and every +line writes ``county_fips`` as a 2020 county (Connecticut's planning regions +go in ``county_fips_2023``). So the place rung is read only from a table in +which every row that carries a block has it inside the row's county: deriving +a place-rule flag from any other table raises, and so does reading the rungs +of one (:func:`us_local_jurisdiction_rungs_present`). An artifact built before the flags existed carries none, so a step that exports or recalibrates an existing artifact instead of running a geography line calls :func:`rederive_us_local_jurisdiction_flags`. It derives every -flag the artifact's own geography decides and refuses a carried flag that -disagrees with that geography. Both ladder gates fail a table that lacks a -flag its geography decides. +flag the artifact's own geography decides, refuses a carried flag that +disagrees with that geography, and refuses an artifact in which a +household's block lies outside its county. Both ladder gates fail a table +that lacks a flag its geography decides. The rungs belong to the whole household table: one row without a block withholds the place rung from every row. A step that removes rows (a @@ -374,6 +386,56 @@ def _holds_text_codes( return True +def _text_code(value: object, width: int) -> str | None: + """``value`` as a ``width``-digit text code, or ``None`` when it is not one.""" + + if isinstance(value, bytes): + value = value.decode("ascii", "replace") + if isinstance(value, str) and len(value) == width and value.isdigit(): + return value + return None + + +def _require_blocks_in_their_counties(household: pd.DataFrame) -> None: + """Refuse a table in which a row's block does not sit in the row's county. + + A 2020 block geoid begins with the five digits of its 2020 county, and + every geography line writes ``county_fips`` as that county (Connecticut + included: its planning regions go in ``county_fips_2023``). A row whose + 15-digit ``block_geoid`` begins otherwise kept its block from before its + county was redrawn, so its ``place_fips`` describes somewhere the + household no longer is, and no place rung can be read from the table. + + A row without a 15-digit text block carries no block (a pooled table's + ACS rows) and is not compared. A county that is not a 5-digit text code + is left to the derivation, which raises on it. + """ + + if "block_geoid" not in household or "county_fips" not in household: + return + outside = [ + (block, county) + for block, county in ( + (_text_code(block, 15), _text_code(county, 5)) + for block, county in zip( + household["block_geoid"].tolist(), + household["county_fips"].tolist(), + strict=True, + ) + ) + if block is not None and county is not None and block[:5] != county + ] + if outside: + raise ValueError( + "block_geoid must begin with the row's county_fips on every row that " + "carries a block to derive local jurisdiction flags from this " + f"table's own geography; {len(outside)}/{len(household)} household " + f"row(s) do not, e.g. {outside[:5]} (block_geoid, county_fips). A " + "block sits in one county, so such a row kept its block, and the " + "place that block decides, from before its county was redrawn." + ) + + def us_local_jurisdiction_rungs_present(household: pd.DataFrame) -> tuple[str, ...]: """The rungs a finished household table's own geography supplies. @@ -384,8 +446,14 @@ def us_local_jurisdiction_rungs_present(household: pd.DataFrame) -> tuple[str, . no block therefore supplies only the county rung, even where a writer has stored their missing place as an empty string. A malformed ``county_fips`` is not judged here; deriving the flags raises on it. + + A table in which any row's block lies outside that row's county supplies + no rung at all: this raises (:func:`_require_blocks_in_their_counties`). + Such a row kept a block from before its county was redrawn, and nothing + in the table says which of the two is the household's geography. """ + _require_blocks_in_their_counties(household) if "county_fips" not in household or household["county_fips"].isna().any(): return () block_anchored = ( @@ -412,7 +480,9 @@ def us_local_jurisdiction_flag_values( A flag whose rule is not in ``rungs`` is left out. Missing, null or malformed geography on a supplied rung raises: a household whose county or place is unknown cannot be decided, and writing ``False`` for it would be - a silent guess. + a silent guess. The place rung also raises when a row's ``block_geoid`` + lies outside the row's ``county_fips``: the place came with that block, + so it is not the place of the county the row now has. """ resolved = registry or packaged_us_local_jurisdiction_registry() @@ -430,11 +500,10 @@ def us_local_jurisdiction_flag_values( f"local-jurisdiction rung(s) {sorted(needed)}." ) county = _text_codes(household["county_fips"], column="county_fips", widths=(5,)) - place = ( - _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) - if JURISDICTION_RUNG_PLACE in needed - else None - ) + place = None + if JURISDICTION_RUNG_PLACE in needed: + place = _text_codes(household["place_fips"], column="place_fips", widths=(0, 5)) + _require_blocks_in_their_counties(household) flags: dict[str, np.ndarray] = {} for item in resolved.jurisdictions: if item.rule not in needed: @@ -560,6 +629,8 @@ def rederive_us_local_jurisdiction_flags( every row without a block makes the place-rule flags decidable on the rows it keeps. A flag the artifact already carries must agree with that geography, or this raises: re-deriving it would hide a corrupt artifact. + So does an artifact in which a household's block lies outside its + county, whichever flags it carries: its place cannot be trusted. An artifact that already carries exactly the flags its rungs decide, as boolean columns, comes back as the same object with the same receipt @@ -571,6 +642,9 @@ def rederive_us_local_jurisdiction_flags( resolved = registry or packaged_us_local_jurisdiction_registry() household = frame.table("household") + # First, so a block outside its county is reported as that, whether or + # not the artifact also carries a flag. + rungs = us_local_jurisdiction_rungs_present(household) failures = us_local_jurisdiction_flag_failures( household, person=frame.table("person"), registry=resolved ) @@ -580,7 +654,6 @@ def rederive_us_local_jurisdiction_flags( "its own geography: " + "; ".join(failures) ) carried = _carried_flags(frame, resolved) - rungs = us_local_jurisdiction_rungs_present(household) values = us_local_jurisdiction_flag_values( household, rungs=rungs, registry=resolved ) @@ -621,8 +694,9 @@ def us_local_jurisdiction_artifact_receipt( (:func:`us_local_jurisdiction_rungs_present`), each agreeing with that geography, and no flag its rungs cannot decide. Otherwise this raises: the engine would default a missing flag to ``False`` on every resident. - The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` - returns. + It also raises, before it reads a flag, on an artifact in which a + household's block lies outside its county. The receipt has the shape + :func:`rederive_us_local_jurisdiction_flags` returns. """ resolved = registry or packaged_us_local_jurisdiction_registry() @@ -749,7 +823,9 @@ def us_local_jurisdiction_flag_failures( A flag present must equal its rule applied to the table's own ``county_fips``/``place_fips``. A place-rule flag on a table with no - complete ``place_fips`` fails: nothing could have decided it. A flag + complete ``place_fips`` fails: nothing could have decided it. So does a + place-rule flag on a table in which a row's block lies outside the row's + county: that place belongs to the block, not to the county. A flag whose rule is in ``required_rungs`` must also be present: a gate whose line supplies that rung passes ``required_rungs``, so an artifact built before the flags existed fails rather than leaving the engine default on diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index 491e969cfb..e65db00a58 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -50,9 +50,17 @@ the new SHA-256 to pin. - **PUMA ladder** (`with_household_us_puma_ladder`, the stacked pool): the ladder draws a county but no place. The line writes `in_denver` and the Philadelphia flag and never writes `in_yonkers` or `in_wilmington`; it also - removes a stale column. The assignment summary records those two as - `unavailable`, and the engine ABI lock lists them as - `unavailable_place_jurisdiction_input`. + removes a stale column of either. The assignment summary records those two + as `unavailable`, and the engine ABI lock lists them as + `unavailable_place_jurisdiction_input`. The wrapper draws every household's + district and county again, so it first removes each column that only a + block decides, where an earlier block line left one: `block_geoid`, + `tract_geoid`, `place_fips`, `sldu`, `sldl`, `cbsa_code` and any + `congressional_district_geoid__` column. A kept block would lie + outside the new county, and its place would bring a place-rule flag back + on the next derivation. `assign_us_puma_ladder`, which the pooled ACS line + calls, keeps those columns: that line restores a block-line donor's own + district and county, so the donor's block still sits in its county. - **Pooled ACS line** (`with_optional_acs_spine`): donor rows arrive with block-line flags and ACS rows without. The pool re-derives the county-rule flags for every row from the final county and removes the place-rule flags. @@ -63,6 +71,14 @@ the new SHA-256 to pin. Missing, null or malformed geography raises; no line writes `False` for a household whose county or place it does not know. +A 2020 block geoid begins with the five digits of its 2020 county, and every +line writes `county_fips` as a 2020 county (in Connecticut too, whose planning +regions go in `county_fips_2023`). A place-rule flag is therefore derived only +from a table +in which every row that carries a 15-digit `block_geoid` has it inside the +row's `county_fips`. On any other table the derivation raises and names the +count and the first few (block, county) pairs. + ### Under `--location-rule block_v1` The opt-in block-location rule (microcosm#1047, `docs/us-location-v1.md`) puts @@ -114,7 +130,11 @@ lacks a flag its geography decides, carries one that disagrees with it, or carries one its geography cannot decide, and records the receipt as `base.local_jurisdiction_flags` in the candidate manifest. A parent built before the flags existed therefore cannot seed annual files until a rebuild -adds them. The lane imports the helper from +adds them, where its geography decides at least one flag: that is, where +every household has a `county_fips`. A parent with no `county_fips` column, +or with a null county on some household, decides no flag; the lane accepts +it when it carries none, and its receipt records no rung and no carried +flag. The lane imports the helper from `microcosm.build.us_local_jurisdictions`, so the check loads no `us_runtime` module, never loads the module that asserts the engine ABI lock (`spec_engine.engine_abi`) and runs before `policyengine_us` is imported @@ -128,6 +148,14 @@ therefore gets the county-rule flags only. A flag the artifact already carries must agree with its geography (household and person flags both), or the step fails. +The helper refuses an artifact in which any household's `block_geoid` does not +begin with that household's `county_fips`, whatever flags it carries and +whether or not every row has a block. Such a household kept its block from +before its county was redrawn, so the place beside the block is not the +county's, and nothing in the table says which of the two is right. All three +steps stop on such an artifact: the L0/refit export, the release builder and +the annual lane. + The rungs belong to the whole table, so removing rows can add one: a frozen support or L0 support that keeps only block-anchored donors decides `in_yonkers` and `in_wilmington` even though the pooled base did not. That is @@ -141,7 +169,10 @@ Both ladder gates fail: - a flag column that disagrees with its rule; - a null or non-boolean flag; -- a place-rule flag on a table with no complete `place_fips`; and +- a place-rule flag on a table with no complete `place_fips`; +- a place-rule flag on a table in which a row's block lies outside the row's + county (the block-ladder gate also fails that table on its own check of + `county_fips` against the block's first five digits); and - a missing flag that the line's own rung decides. The block-ladder gate requires `in_denver`, `in_yonkers` and `in_wilmington`; the PUMA-ladder gate requires `in_denver`. diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md index c15dd4fa96..da1dbdeea3 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_PUMA_LADDER.md @@ -30,6 +30,12 @@ The ladder also writes the county-rule local-jurisdiction flags (`in_denver`, `pa_philadelphia_wage_tax_resident`) from the drawn county. It has no place rung, so it never writes `in_yonkers` or `in_wilmington`, and its summary records them as unavailable ([US_LOCAL_JURISDICTIONS.md](US_LOCAL_JURISDICTIONS.md)). +`with_household_us_puma_ladder` draws every household's district and county +again, so it first removes each column that only a block decides, where an +earlier block line left one: `block_geoid`, `tract_geoid`, `place_fips`, +`sldu`, `sldl`, `cbsa_code` and any `congressional_district_geoid__` +column. `assign_us_puma_ladder` keeps them, because the pooled ACS line +restores a block-line donor's own district and county after it. ## Why one block pass diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py index a98dfdfc88..9b599b0ccb 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py @@ -46,7 +46,10 @@ ``pa_philadelphia_wage_tax_resident``) are derived from the drawn county. The ladder has no place rung, so the place-rule flags (``in_yonkers``, ``in_wilmington``) are unavailable: they are never written, and the summary -records why (:mod:`.local_jurisdictions`). +records why (:mod:`.local_jurisdictions`). The frame wrapper redraws every +household's county, so it also removes the block, tract, place, +state-legislative-district and CBSA columns an earlier block line left +(:data:`US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS`). """ from __future__ import annotations @@ -69,6 +72,7 @@ county_fips_2023_assignment_failures, ) from microcosm.build.us_runtime.geography_ladder import ( + US_GEOGRAPHY_LADDER_COLUMNS, US_NYC_COUNTY_FIPS, non_text_county_fips_failure, ) @@ -108,6 +112,22 @@ #: The finer tract rung, written only when ``assign_tract=True``. US_PUMA_LADDER_TRACT_COLUMN = "tract_geoid" +#: Household columns a block line writes that this ladder does not: the block +#: and what only a block decides (tract, place, state-legislative districts, +#: CBSA). :func:`with_household_us_puma_ladder` redraws every household's +#: district and county, so a kept block would belong to the county the redraw +#: replaced and the rest would describe that block; the wrapper removes them. +#: A tract comes back only when ``assign_tract`` draws one. +US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS = tuple( + column + for column in US_GEOGRAPHY_LADDER_COLUMNS + if column not in US_PUMA_LADDER_COLUMNS +) +#: Prefix of the per-plan district columns a ``block_v1`` draw looks up from +#: its block (``block_location.US_CD_PLAN_COLUMN_PREFIX``; a test pins the +#: equality). The wrapper removes those columns for the same reason. +US_PUMA_LADDER_BLOCK_PLAN_COLUMN_PREFIX = f"{CONGRESSIONAL_DISTRICT_GEOID_COLUMN}__" + US_PUMA_LADDER_SCHEMA_VERSION = 1 US_PUMA_LADDER_KIND = "us_puma_ladder" @@ -430,9 +450,24 @@ def with_household_us_puma_ladder( The county-rule local-jurisdiction flags are derived from the drawn county and written as engine inputs; the place-rule flags are left unwritten (any stale column is removed) because the ladder assigns no place. + + Every household's district and county are drawn again here, so a frame an + earlier block line located loses each column only its block decided + (:data:`US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS` and the per-plan district + columns) before the draw: none of them describes the county the household + now has. :func:`assign_us_puma_ladder` itself keeps them, for the pooled + ACS line, which restores a block-line donor's own district and county. """ tables = {entity: frame.table(entity).copy() for entity in frame.entities} + block_anchored = [ + column + for column in tables["household"].columns + if column in US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS + or str(column).startswith(US_PUMA_LADDER_BLOCK_PLAN_COLUMN_PREFIX) + ] + if block_anchored: + tables["household"] = tables["household"].drop(columns=block_anchored) tables["household"] = assign_us_puma_ladder( tables["household"], ladder, @@ -964,6 +999,8 @@ def _household_cd_state(values: Any) -> np.ndarray: __all__ = [ "PUMA_LADDER_ARTIFACT_SHA256_ATTR", "PUMA_LADDER_VINTAGES_ATTR", + "US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS", + "US_PUMA_LADDER_BLOCK_PLAN_COLUMN_PREFIX", "US_PUMA_LADDER_COLUMNS", "US_PUMA_LADDER_DERIVED_LAYERS", "US_PUMA_LADDER_KIND", diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py index 2f9b5948cf..cff7c768d1 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_annual_static_aging_parent_flags.py @@ -13,7 +13,9 @@ before the output directory exists; - a parent that carries exactly the flags its geography decides reaches the model provenance check, and its receipt lists those flags as carried; -- a parent with no county decides no flag, so it needs none. +- a parent with no county decides no flag, so it needs none; +- a parent in which a household's block lies outside that household's county + fails the same way, whatever flags it carries. """ from __future__ import annotations @@ -193,6 +195,41 @@ def test_parent_without_its_flags_is_refused_before_model_work( assert not inputs["output_dir"].exists() +@pytest.mark.parametrize( + "flags", + [_complete("block"), _complete("county"), {}], + ids=["with-every-flag", "with-the-county-flags", "without-flags"], +) +def test_parent_with_a_block_outside_its_county_is_refused_before_model_work( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + flags: dict[str, list[bool]], +) -> None: + # The Yonkers household's county becomes the Bronx while its block and + # place stay: what a county redraw that kept the block columns leaves. + # No place rung can be read from that parent, whatever flags it carries + # (microcosm#1453 review round 1), so the lane stops before model work. + tables = _tables(geography="block", flags=flags) + assert tables["household"].loc[0, "block_geoid"] == "361190001001000" + tables["household"].loc[0, "county_fips"] = "36005" + inputs = _inputs(tmp_path, tables) + monkeypatch.setattr( + annual, "_model_provenance", lambda **kwargs: pytest.fail("must refuse first") + ) + monkeypatch.setattr( + annual, "_runtime_provenance", lambda: pytest.fail("must refuse first") + ) + + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as error: + annual.build_annual_static_aging(**inputs) + + assert "1/5 household row(s) do not" in str(error.value) + assert "[('361190001001000', '36005')]" in str(error.value) + assert not inputs["output_dir"].exists() + + @pytest.mark.parametrize("geography", ["block", "county", "none"]) def test_parent_carrying_its_flags_reaches_model_work( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, geography: str diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index 450867ea6a..bde4b8928a 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2967,6 +2967,46 @@ def derive(frame, support): derive(exported, "selected") +def test_builder_refuses_a_support_whose_block_lies_outside_its_county() -> None: + # The microcosm#1453 review round 1 case: a donor whose county was + # redrawn (the Bronx) while its Yonkers block and place stayed, beside an + # ACS row with no block. Deriving from that table would write in_yonkers + # on a Bronx household once a selection drops the ACS row, so every + # support the builder derives on stops instead, and records nothing. + from test_support.microcosm_build.us_local_jurisdictions import us_frame + + builder = _load_builder_module() + stale = us_frame( + [ + { + "state_fips": 36, + "county_fips": "36005", + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + { + "state_fips": 8, + "county_fips": "08031", + "place_fips": None, + "block_geoid": None, + }, + ], + person_inputs=[[{}], [{}]], + ) + receipts: dict[str, object] = {} + + for support in builder.LOCAL_JURISDICTION_FLAG_SUPPORTS: + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as refused: + builder._with_local_jurisdiction_flags( + stale, support=support, receipts=receipts, telemetry=None + ) + assert "1/2 household row(s) do not" in str(refused.value) + assert "[('361190001001000', '36005')]" in str(refused.value) + assert receipts == {} + + def test_frozen_support_selection_is_followed_by_weeks_unemployed_regate() -> None: builder = _load_builder_module() source = Path(builder.__file__).read_text(encoding="utf-8") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py index 7010384b8f..b61cb6089f 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py @@ -1324,3 +1324,46 @@ def test_export_refuses_a_base_whose_carried_flag_disagrees_with_its_geography( require_geography_ladder=False, ) assert not output.exists() + + +@pytest.mark.parametrize("carried", [{}, {"in_yonkers": [False, True]}]) +def test_export_refuses_a_base_whose_block_lies_outside_its_county( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, + carried: dict[str, list[bool]], +) -> None: + # The kept household's county is the Bronx while its block and place are + # still Yonkers': what a PUMA redraw that kept the block columns would + # leave. Deriving from it would export in_yonkers on a Bronx household. + base_h5 = tmp_path / "base.h5" + base_h5.write_text("base") + output = tmp_path / "populace_us_2024.h5" + + monkeypatch.setattr( + l0_refit_export, + "load_us_frame", + lambda path: _frame_with_yonkers_household( + county_fips=["36061", "36005"], + county_fips_2023=["36061", "36005"], + **carried, + ), + ) + monkeypatch.setattr( + l0_refit_export, + "PolicyEngineUSEngine", + lambda: pytest.fail("a base with a stale block must not reach the writer"), + ) + + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as refused: + export_us_l0_refit_h5( + base_h5=base_h5, + weights_npz=_l0_refit_npz(tmp_path), + output_h5=output, + input_mass_relative_tolerance=1.0, + require_geography_ladder=False, + ) + assert "1/1 household row(s) do not" in str(refused.value) + assert "[('361190001001000', '36005')]" in str(refused.value) + assert not output.exists() diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index 1c6d35ac73..52366ff698 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -13,14 +13,21 @@ malformed geography raises instead of yielding ``False``; - deriving a selection of a derived support equals deriving the selected rows from scratch, and leaves every flag the kept rows' geography decides; -- deriving a support whose flags are already complete returns it unchanged. +- deriving a support whose flags are already complete returns it unchanged; +- after any sequence of geography lines and artifact steps, no place-rule or + county-rule flag is true on a household whose county lies outside the + flag's counties, and no line leaves a block outside its household's county; +- a table in which a row's block lies outside the row's county supplies no + rung: reading its rungs raises, so no place-rule flag is derived from it. """ from __future__ import annotations import hashlib import json +from functools import cache from pathlib import Path +from tempfile import TemporaryDirectory import numpy as np import pandas as pd @@ -46,19 +53,43 @@ us_local_jurisdiction_rungs_present, with_us_local_jurisdiction_flags, ) +from microcosm.build.us_runtime.base_pool import ( + ACS_2024_1YR_SPINE, + ASEC_PUF_SPINE, + spine_column, + with_optional_acs_spine, +) +from microcosm.build.us_runtime.block_location import ( + US_CD_PLAN_COLUMN_PREFIX, + attach_congressional_district_plans, + load_us_location_ladder, + location_geography_columns, + us_block_location_gate, + with_household_us_block_location, +) from microcosm.build.us_runtime.geography_ladder import ( + US_GEOGRAPHY_LADDER_COLUMNS, assign_us_geography_ladder, us_geography_ladder_assignment_summary, us_geography_ladder_gate, with_household_us_geography_ladder, ) from microcosm.build.us_runtime.puma_ladder import ( + US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS, + US_PUMA_LADDER_BLOCK_PLAN_COLUMN_PREFIX, + US_PUMA_LADDER_COLUMNS, + US_PUMA_LADDER_TRACT_COLUMN, UsPumaLadder, + assign_us_puma_ladder, us_puma_ladder_assignment_summary, us_puma_ladder_gate, with_household_us_puma_ladder, ) -from microcosm.frame import US_SCHEMA +from microcosm.frame import US_SCHEMA, Frame +from test_support.microcosm_build.us_block_location import ( + local_jurisdiction_blocks, + write_location_ladder, +) from test_support.microcosm_build.us_local_jurisdictions import ( FIXTURE_BLOCK_BY_NAME, FIXTURE_BLOCKS, @@ -1209,3 +1240,815 @@ def test_artifact_receipt_matches_the_rederived_receipt_on_a_complete_artifact() bare = us_local_jurisdiction_artifact_receipt(us_frame([{"state_fips": 36}])) assert bare["rungs"] == [] assert bare["carried_flags"] == [] + + +# --------------------------------------------------------------------------- # +# A block outside its household's county (review round 1 of microcosm#1453) +# --------------------------------------------------------------------------- # + +_PUMA_LADDER_METADATA = { + "schema_version": 1, + "kind": "us_puma_ladder", + "puma_vintage": "2020_puma", + "sampling_basis": "population", + "layers": { + "congressional_district": {"vintage": "119th_congress"}, + "county": {"vintage": "2020_census"}, + "tract": {"vintage": "2020_census"}, + }, +} +# Where the redraw ladder below puts each fixture state's households: a +# county that holds no registry jurisdiction. New York's is the Bronx. +_REDRAWN_COUNTY = { + 6: "06037", + 8: "08005", + 10: "10001", + 36: "36005", + 37: "37129", + 42: "42045", +} + + +def _redraw_puma_ladder() -> UsPumaLadder: + """One PUMA per fixture state, wholly inside :data:`_REDRAWN_COUNTY`.""" + + county = np.asarray( + sorted(int(code) for code in _REDRAWN_COUNTY.values()), dtype=np.int64 + ) + state = county // 1000 + puma = state * 10**5 + 200 + population = np.full(len(county), 100.0) + return UsPumaLadder( + puma=puma, + puma_population=population, + cd_overlap_puma=puma, + cd_overlap_cd=state * 100 + 1, + cd_overlap_population=population, + county_overlap_puma=puma, + county_overlap_county=county.astype(np.int32), + county_overlap_population=population, + tract_overlap_puma=puma, + tract_overlap_tract=county * 10**6 + 100, + tract_overlap_population=population, + metadata=_PUMA_LADDER_METADATA, + ) + + +def _puma_ladder_from_blocks(arrays: dict[str, np.ndarray]) -> UsPumaLadder: + """The PUMA ladder a block ladder implies. + + Block population summed by PUMA, and by (PUMA, district), (PUMA, county) + and (PUMA, tract), as ``assemble_us_puma_ladder`` builds the real one. + """ + + block = arrays["block_geoid"].astype(np.int64) + table = pd.DataFrame( + { + "puma": arrays["puma"].astype(np.int64), + "district": arrays["congressional_district_geoid"].astype(np.int64), + "county": block // 10**10, + "tract": block // 10**4, + "population": arrays["population"].astype(np.float64), + } + ) + + def overlap(layer: str) -> tuple[np.ndarray, np.ndarray, np.ndarray]: + grouped = table.groupby(["puma", layer], sort=True)["population"].sum() + return ( + grouped.index.get_level_values(0).to_numpy(np.int64), + grouped.index.get_level_values(1).to_numpy(np.int64), + grouped.to_numpy(np.float64), + ) + + anchor = table.groupby("puma", sort=True)["population"].sum() + district_puma, district, district_population = overlap("district") + county_puma, county, county_population = overlap("county") + tract_puma, tract, tract_population = overlap("tract") + return UsPumaLadder( + puma=anchor.index.to_numpy(np.int64), + puma_population=anchor.to_numpy(np.float64), + cd_overlap_puma=district_puma, + cd_overlap_cd=district, + cd_overlap_population=district_population, + county_overlap_puma=county_puma, + county_overlap_county=county.astype(np.int32), + county_overlap_population=county_population, + tract_overlap_puma=tract_puma, + tract_overlap_tract=tract, + tract_overlap_population=tract_population, + metadata=_PUMA_LADDER_METADATA, + ) + + +def _location_ladder(arrays: dict[str, np.ndarray]): + with TemporaryDirectory() as directory: + return load_us_location_ladder( + write_location_ladder(Path(directory) / "ladder.npz", arrays) + ) + + +def test_a_puma_redraw_cannot_bring_a_place_flag_back() -> None: + # The reviewer's sequence. A household on the Yonkers block is redrawn to + # the Bronx by the PUMA wrapper, and the result is then read as an + # artifact. At d8e1490db the redraw left the block and its place beside + # the new county, the table still looked block-anchored, and the + # re-derivation wrote in_yonkers True on a Bronx household. + frame = us_frame(households_on_blocks(["yonkers"]), person_inputs=[[{}]]) + + located = with_household_us_geography_ladder(frame, block_ladder(), seed=1) + placed = located.table("household") + assert placed[["county_fips", "block_geoid", "place_fips"]].iloc[0].tolist() == [ + "36119", + "361190001001000", + "84000", + ] + assert placed["in_yonkers"].tolist() == [True] + + redrawn = with_household_us_puma_ladder(located, _redraw_puma_ladder(), seed=1) + moved = redrawn.table("household") + assert moved["county_fips"].tolist() == ["36005"] + assert "block_geoid" not in moved and "place_fips" not in moved + assert "in_yonkers" not in moved + + rederived, receipt = rederive_us_local_jurisdiction_flags(redrawn) + household = rederived.table("household") + assert "in_yonkers" not in household + assert "in_wilmington" not in household + assert household["in_denver"].tolist() == [False] + assert receipt["rungs"] == ["county"] + assert receipt["flags"]["in_yonkers"]["status"] == JURISDICTION_FLAG_UNAVAILABLE + assert us_local_jurisdiction_artifact_receipt(rederived)["rungs"] == ["county"] + + +@pytest.mark.parametrize("assign_tract", [False, True]) +def test_a_puma_redraw_leaves_no_column_only_a_block_decides( + assign_tract: bool, +) -> None: + frame = us_frame( + [{**row, "tenure_type": "RENTED"} for row in households_on_blocks(_NAMES)], + person_inputs=[[{}, {}] for _ in _NAMES], + ) + located = with_household_us_geography_ladder(frame, block_ladder(), seed=3) + before = located.table("household").copy() + assert set(US_GEOGRAPHY_LADDER_COLUMNS) <= set(before.columns) + + redrawn = with_household_us_puma_ladder( + located, _redraw_puma_ladder(), seed=3, assign_tract=assign_tract + ) + after = redrawn.table("household") + + rewritten = set(US_PUMA_LADDER_COLUMNS) + if assign_tract: + rewritten.add(US_PUMA_LADDER_TRACT_COLUMN) + for column in US_GEOGRAPHY_LADDER_COLUMNS: + assert (column in after.columns) == (column in rewritten), column + assert set(US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS) == { + "block_geoid", + "tract_geoid", + "place_fips", + "sldu", + "sldl", + "cbsa_code", + } + # Only those columns and the place-rule flags went. + gone = set(before.columns) - set(after.columns) + assert gone == (set(US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS) - rewritten) | set( + PLACE_FLAGS + ) + assert after["household_id"].tolist() == before["household_id"].tolist() + assert after["tenure_type"].tolist() == before["tenure_type"].tolist() + # What the ladder wrote agrees with itself. + assert after["county_fips"].tolist() == [ + _REDRAWN_COUNTY[int(state)] for state in after["state_fips"] + ] + if assign_tract: + assert (after["tract_geoid"].str[:5] == after["county_fips"]).all() + assert us_local_jurisdiction_rungs_present(after) == PUMA_GEOGRAPHY_RUNGS + assert not after["in_denver"].any() + # The frame handed in keeps its block geography. + pd.testing.assert_frame_equal(located.table("household"), before) + + +@pytest.mark.parametrize("assign_tract", [False, True]) +def test_a_puma_redraw_of_a_block_v1_frame_leaves_no_block_lookup( + assign_tract: bool, +) -> None: + arrays = local_jurisdiction_blocks(4) + ladder = _location_ladder(arrays) + ladder = attach_congressional_district_plans( + ladder, + block_geoid=ladder.block_geoid, + plans={"117th_congress": ladder.block_geoid // 10**13 * 100 + 1}, + plan_sources={ + "117th_congress": {"vintage": "117th_congress", "source": "test plan"} + }, + ) + states = [8, 10, 36, 42] * 6 + frame = us_frame( + [{"state_fips": state} for state in states], + person_inputs=[[{}] for _ in states], + ) + located, _table = with_household_us_block_location(frame, ladder, seed=17) + before = located.table("household").copy() + columns = location_geography_columns(ladder) + plan_column = f"{US_CD_PLAN_COLUMN_PREFIX}117th_congress" + assert plan_column in columns and set(columns) <= set(before.columns) + assert us_block_location_gate(before, ladder).passed + + redrawn = with_household_us_puma_ladder( + located, + _puma_ladder_from_blocks(arrays), + seed=17, + assign_tract=assign_tract, + expected_congressional_district_vintage="119th_congress", + ) + after = redrawn.table("household") + + # Every column the draw looked up from its block is rewritten by the + # PUMA ladder or gone, the second plan's district included. + rewritten = set(US_PUMA_LADDER_COLUMNS) + if assign_tract: + rewritten.add(US_PUMA_LADDER_TRACT_COLUMN) + for column in columns: + assert (column in after.columns) == (column in rewritten), column + assert US_PUMA_LADDER_BLOCK_PLAN_COLUMN_PREFIX == US_CD_PLAN_COLUMN_PREFIX + assert plan_column not in after + # The draw's PUMA is a valid anchor, so the ladder keeps it. + assert after["puma"].tolist() == before["puma"].tolist() + for flag in PLACE_FLAGS: + assert flag not in after + gate = us_puma_ladder_gate( + after, + redrawn.weights_for("household").values, + assign_tract=assign_tract, + nyc_share_bounds=(0.0, 1.0), + nyc_share_of_new_york_bounds=(0.0, 1.0), + ) + assert gate.passed, gate.failures + rederived, receipt = rederive_us_local_jurisdiction_flags(redrawn) + assert rederived is redrawn + assert receipt["rungs"] == ["county"] + + +def test_the_puma_kernel_keeps_block_columns_and_the_result_is_refused() -> None: + # assign_us_puma_ladder serves the pooled ACS line, which restores a + # block-line donor's own county after it, so the kernel keeps every + # column. Used alone on block-located households it leaves each block + # beside a redrawn county, and nothing reads a rung from that table. + frame = us_frame(households_on_blocks(_NAMES)) + located = with_household_us_geography_ladder(frame, block_ladder(), seed=3) + + assigned = assign_us_puma_ladder( + located.table("household"), _redraw_puma_ladder(), seed=3 + ) + + assert set(US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS) <= set(assigned.columns) + moved = assigned["block_geoid"].str[:5] != assigned["county_fips"] + assert 0 < int(moved.sum()) < len(assigned) + with pytest.raises( + ValueError, match=f"{int(moved.sum())}/{len(assigned)} household row" + ): + us_local_jurisdiction_rungs_present(assigned) + + +@pytest.mark.parametrize( + ("columns", "count", "examples"), + [ + pytest.param( + {"county_fips": ["36005", "08031"]}, + "1/2", + "[('361190001001000', '36005')]", + id="another-county-of-the-state", + ), + pytest.param( + {"county_fips": ["36119", "08035"]}, + "1/2", + "[('080310001001000', '08035')]", + id="a-county-that-differs-in-its-last-digit", + ), + pytest.param( + {"county_fips": ["36005", "08005"]}, + "2/2", + "[('361190001001000', '36005'), ('080310001001000', '08005')]", + id="every-row", + ), + pytest.param( + { + "county_fips": ["36005", "08031"], + "place_fips": ["84000", None], + "block_geoid": ["361190001001000", None], + }, + "1/2", + "[('361190001001000', '36005')]", + id="a-pooled-table-whose-donor-block-is-stale", + ), + pytest.param( + {"county_fips": ["36005", None]}, + "1/2", + "[('361190001001000', '36005')]", + id="beside-a-row-without-a-county", + ), + pytest.param( + { + "county_fips": [b"36005", b"08031"], + "place_fips": [b"84000", b"20000"], + "block_geoid": [b"361190001001000", b"080310001001000"], + }, + "1/2", + "[('361190001001000', '36005')]", + id="bytes-from-an-h5-round-trip", + ), + ], +) +def test_rungs_present_refuses_a_block_outside_its_county( + columns, count: str, examples: str +) -> None: + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as refused: + us_local_jurisdiction_rungs_present(_block_table(**columns)) + + message = str(refused.value) + assert f"{count} household row(s) do not, e.g. {examples} " in message + assert "(block_geoid, county_fips)" in message + + +@pytest.mark.parametrize( + "block", + [None, "", "8031000100100", 80310001001000], + ids=["null", "empty", "thirteen-digits", "integer"], +) +def test_rungs_present_compares_only_rows_that_carry_a_text_block(block) -> None: + # The second row's county is not its (former) block's, but the row carries + # no 15-digit text block: nothing anchors a place there, and the table + # supplies the county rung as before. + table = _block_table( + county_fips=["36119", "08005"], block_geoid=["361190001001000", block] + ) + + assert us_local_jurisdiction_rungs_present(table) == PUMA_GEOGRAPHY_RUNGS + + +def _frame_with_a_stale_block(**flags: list[bool]): + """A Yonkers household whose county became the Bronx, block and place kept. + + What d8e1490db's PUMA wrapper returned, beside a Denver household that is + still on its block. + """ + + households: list[dict[str, object]] = [ + { + "state_fips": 36, + "county_fips": "36005", + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + { + "state_fips": 8, + "county_fips": "08031", + "place_fips": "20000", + "block_geoid": "080310001001000", + }, + ] + for flag, values in flags.items(): + for household, value in zip(households, values, strict=True): + household[flag] = value + return us_frame(households, person_inputs=[[{}], [{}]]) + + +@pytest.mark.parametrize( + "flags", + [ + {}, + {"in_yonkers": [True, False]}, + { + "in_denver": [False, True], + "in_wilmington": [False, False], + "in_yonkers": [True, False], + }, + ], + ids=["no-flag", "the-stale-place-flag", "every-household-flag"], +) +@pytest.mark.parametrize( + "step", + [rederive_us_local_jurisdiction_flags, us_local_jurisdiction_artifact_receipt], +) +def test_artifact_steps_refuse_a_block_outside_its_county(step, flags) -> None: + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as refused: + step(_frame_with_a_stale_block(**flags)) + + assert "1/2 household row(s) do not" in str(refused.value) + assert "[('361190001001000', '36005')]" in str(refused.value) + + +def test_no_place_flag_is_derived_beside_a_block_outside_its_county() -> None: + frame = _frame_with_a_stale_block() + household = frame.table("household") + tables = {"household": household, "person": frame.table("person")} + + with pytest.raises(ValueError, match="1/2 household row"): + us_local_jurisdiction_flag_values(household, rungs=BLOCK_GEOGRAPHY_RUNGS) + with pytest.raises(ValueError, match="1/2 household row"): + apply_us_local_jurisdiction_flags(tables, rungs=BLOCK_GEOGRAPHY_RUNGS) + with pytest.raises(ValueError, match="1/2 household row"): + with_us_local_jurisdiction_flags(frame, rungs=BLOCK_GEOGRAPHY_RUNGS) + # A line that has just drawn the county derives from that rung alone. + values = us_local_jurisdiction_flag_values(household, rungs=PUMA_GEOGRAPHY_RUNGS) + assert sorted(values) == ["in_denver", "pa_philadelphia_wage_tax_resident"] + assert values["in_denver"].tolist() == [False, True] + + +def test_both_ladder_gates_fail_a_place_flag_beside_a_block_outside_its_county() -> ( + None +): + household = _assigned_block_household().copy() + household["puma"] = [f"{int(state):02d}00200" for state in household["state_fips"]] + weights = np.ones(len(household)) + bounds = { + "nyc_share_bounds": (0.0, 1.0), + "nyc_share_of_new_york_bounds": (0.0, 1.0), + } + assert not [ + failure + for failure in us_puma_ladder_gate(household, weights, **bounds).failures + if failure.startswith("in_") + ] + yonkers = household["block_geoid"].eq("361190001001000") + assert household.loc[yonkers, "in_yonkers"].tolist() == [True] + # The county moves to the Bronx; the block, its place and the flag stay. + household.loc[yonkers, ["county_fips", "county_fips_2023"]] = "36005" + + failures = us_local_jurisdiction_flag_failures( + household, required_rungs=BLOCK_GEOGRAPHY_RUNGS + ) + puma_gate = us_puma_ladder_gate(household, weights, **bounds) + block_gate = us_geography_ladder_gate(household, weights, **bounds) + + assert [failure.split(":")[0] for failure in failures] == [ + "in_wilmington", + "in_yonkers", + ] + for failure in failures: + assert "present but its place rung cannot decide it" in failure + assert f"1/{len(household)} household row(s) do not" in failure + assert "[('361190001001000', '36005')]" in failure + assert failure in puma_gate.failures + assert failure in block_gate.failures + # The block-ladder gate also sees it without any flag. + assert ( + f"county_fips: 1/{len(household)} row(s) disagree with the block_geoid prefix" + in block_gate.failures + ) + + +# Three blocks of Fairfield County, Connecticut (2020 county 09001), each in +# a different 2022 planning region, in block order. +_CT_BLOCKS = ( + FixtureBlock("stamford", 90010201011000, 73000, 903, 10.0), + FixtureBlock("bridgeport", 90010701001000, 8000, 901, 30.0), + FixtureBlock("naugatuck_valley", 90011101001000, 0, 902, 20.0), +) +_CT_PLANNING_REGIONS = ["09190", "09120", "09140"] + + +def _with_spine(frame: Frame, spine: str) -> Frame: + tables = {entity: frame.table(entity).copy() for entity in frame.entities} + for entity, table in tables.items(): + table[spine_column(entity)] = spine + if "puma" not in tables["household"]: + tables["household"]["puma"] = pd.Series( + [None] * len(tables["household"]), dtype=object + ) + return Frame(tables, US_SCHEMA, {"household": frame.weights_for("household")}) + + +def test_connecticut_blocks_sit_in_their_county_fips_on_every_line() -> None: + # Connecticut is the one state whose county-equivalents changed after the + # 2020 blocks: a block there begins with its 2020 county (09001), and the + # planning region that replaced it (09190, say) goes in county_fips_2023. + # Every line writes the 2020 county into county_fips, so comparing a block + # with county_fips refuses no Connecticut table; comparing it with + # county_fips_2023 would refuse them all. + blocks = list(_CT_BLOCKS) + frame = us_frame( + households_on_blocks_for(blocks), person_inputs=[[{}] for _ in blocks] + ) + + # The block ladder. + located = with_household_us_geography_ladder(frame, block_ladder(blocks), seed=5) + household = located.table("household") + assert household["block_geoid"].tolist() == [ + f"{block.block_geoid:015d}" for block in blocks + ] + assert household["county_fips"].tolist() == ["09001"] * 3 + assert household["county_fips_2023"].tolist() == _CT_PLANNING_REGIONS + assert us_local_jurisdiction_rungs_present(household) == BLOCK_GEOGRAPHY_RUNGS + assert rederive_us_local_jurisdiction_flags(located)[0] is located + assert us_local_jurisdiction_artifact_receipt(located)["rungs"] == [ + "county", + "place", + ] + + # The block_v1 draw, each household within its county. + arrays = { + "block_geoid": np.asarray([b.block_geoid for b in blocks], dtype=np.int64), + "population": np.asarray([b.population for b in blocks], dtype=np.int64), + "congressional_district_geoid": np.asarray( + [b.congressional_district_geoid for b in blocks], dtype=np.int64 + ), + "puma": np.full(len(blocks), 900100, dtype=np.int64), + "sldu": np.full(len(blocks), "001", dtype="U3"), + "sldl": np.full(len(blocks), "001", dtype="U3"), + "place_fips": np.asarray([b.place_fips for b in blocks], dtype=np.int32), + "cbsa_code": np.zeros(len(blocks), dtype=np.int32), + } + ladder = _location_ladder(arrays) + drawn, _table = with_household_us_block_location( + frame, ladder, seed=5, county_fips=np.full(len(blocks), 9001) + ) + household = drawn.table("household") + assert us_block_location_gate(household, ladder).passed + assert household["county_fips"].tolist() == ["09001"] * 3 + assert set(household["county_fips_2023"]) <= set(_CT_PLANNING_REGIONS) + assert (household["county_fips_2023"] != household["county_fips"]).all() + assert us_local_jurisdiction_rungs_present(household) == BLOCK_GEOGRAPHY_RUNGS + assert rederive_us_local_jurisdiction_flags(drawn)[0] is drawn + + # The PUMA ladder, redrawing the block-located households. + puma_ladder = _puma_ladder_from_blocks(arrays) + redrawn = with_household_us_puma_ladder(drawn, puma_ladder, seed=5) + household = redrawn.table("household") + assert household["county_fips"].tolist() == ["09001"] * 3 + assert set(household["county_fips_2023"]) <= set(_CT_PLANNING_REGIONS) + assert not set(US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS) & set(household.columns) + assert us_local_jurisdiction_rungs_present(household) == PUMA_GEOGRAPHY_RUNGS + assert rederive_us_local_jurisdiction_flags(redrawn)[0] is redrawn + + # The pooled ACS line: block-line donors keep their blocks, ACS rows get + # the PUMA ladder's 2020 county and no block. + acs = us_frame([{"state_fips": 9, "puma": "0900100"} for _ in range(2)]) + pooled = with_optional_acs_spine( + _with_spine(located, ASEC_PUF_SPINE), + _with_spine(acs, ACS_2024_1YR_SPINE), + max_peak_bytes=None, + puma_ladder=puma_ladder, + geography_seed=5, + ) + household = pooled.table("household") + donor = household["block_geoid"].notna() + assert int(donor.sum()) == 3 and len(household) == 5 + assert household["county_fips"].tolist() == ["09001"] * 5 + assert ( + household.loc[donor, "block_geoid"].str[:5] + == household.loc[donor, "county_fips"] + ).all() + assert us_local_jurisdiction_rungs_present(household) == PUMA_GEOGRAPHY_RUNGS + assert rederive_us_local_jurisdiction_flags(pooled)[1]["rungs"] == ["county"] + + # A table that stored the planning region as county_fips is one no line + # writes, and its blocks do not begin with it. + regional = located.table("household").copy() + regional["county_fips"] = regional["county_fips_2023"] + with pytest.raises(ValueError, match="3/3 household row"): + us_local_jurisdiction_rungs_present(regional) + + +# --- Properties ------------------------------------------------------------- # + +_LADDER_SEEDS = (0, 3, 4) +_LINES = ( + "block_ladder", + "puma_ladder", + "puma_ladder_with_tract", + "block_v1", + "rederive", + "drop_flags", + "select", +) + + +@cache +def _jurisdiction_ladders(seed: int): + """The block, location and PUMA ladders of one synthetic geography. + + Also the counties each flag's jurisdiction has blocks in, read from the + ladder's own blocks with the four rules written out here. + """ + + arrays = local_jurisdiction_blocks(seed) + block = arrays["block_geoid"].astype(np.int64) + county = np.array([f"{value:05d}" for value in (block // 10**10).tolist()]) + state = block // 10**13 + place = arrays["place_fips"] + counties = { + "in_denver": {"08031"}, + "pa_philadelphia_wage_tax_resident": {"42101"}, + "in_yonkers": set(county[(state == 36) & (place == 84000)].tolist()), + "in_wilmington": set(county[(state == 10) & (place == 77580)].tolist()), + } + return arrays, _location_ladder(arrays), _puma_ladder_from_blocks(arrays), counties + + +def _without_any_flag(frame): + tables = {entity: frame.table(entity) for entity in frame.entities} + for entity in ("household", "person"): + tables[entity] = tables[entity].drop( + columns=[flag for flag in EXPECTED_RULES if flag in tables[entity]] + ) + return type(frame)( + tables, frame.schema, {"household": frame.weights_for("household")} + ) + + +def _apply_line(frame, line: str, seed: int, ladders): + _arrays, location, puma_ladder, _counties = ladders + if line == "block_ladder": + return with_household_us_geography_ladder(frame, location.blocks, seed=seed) + if line == "puma_ladder": + return with_household_us_puma_ladder(frame, puma_ladder, seed=seed) + if line == "puma_ladder_with_tract": + return with_household_us_puma_ladder( + frame, puma_ladder, seed=seed, assign_tract=True + ) + if line == "block_v1": + return with_household_us_block_location(frame, location, seed=seed)[0] + if line == "rederive": + return rederive_us_local_jurisdiction_flags(frame)[0] + if line == "drop_flags": + return _without_any_flag(frame) + assert line == "select" + return _select_households(frame, list(range(0, frame.n("household"), 2))) + + +def _assert_no_flag_or_block_outside_its_county(frame, counties) -> None: + household = frame.table("household") + if "county_fips" not in household: + assert not set(EXPECTED_RULES) & set(household.columns) + return + county_of = dict( + zip(household["household_id"], household["county_fips"], strict=True) + ) + for flag, allowed in counties.items(): + entity = "person" if flag in PERSON_FLAGS else "household" + table = frame.table(entity) + if flag not in table: + continue + members = ( + table[US_SCHEMA.membership_column("household")] + if (entity == "person") + else table["household_id"] + ) + flagged = {county_of[key] for key in members[table[flag].astype(bool)]} + assert flagged <= allowed, (flag, sorted(flagged)) + if "block_geoid" in household: + assert (household["block_geoid"].str[:5] == household["county_fips"]).all() + # Reading the rungs never refuses what the lines wrote, and the place + # rung is there exactly when the households sit on blocks. + rungs = us_local_jurisdiction_rungs_present(household) + assert rungs == ( + BLOCK_GEOGRAPHY_RUNGS if "block_geoid" in household else PUMA_GEOGRAPHY_RUNGS + ) + + +@st.composite +def _line_sequences(draw): + ladder_seed = draw(st.sampled_from(_LADDER_SEEDS)) + arrays = _jurisdiction_ladders(ladder_seed)[0] + districts = sorted(set(arrays["congressional_district_geoid"].tolist())) + households = draw(st.lists(st.sampled_from(districts), min_size=1, max_size=8)) + steps = draw( + st.lists( + st.tuples(st.sampled_from(_LINES), st.integers(0, 50)), + min_size=1, + max_size=6, + ) + ) + return ladder_seed, households, steps + + +@settings(max_examples=80, deadline=None) +@given(case=_line_sequences()) +def test_no_sequence_of_lines_leaves_a_flag_or_block_outside_its_county(case) -> None: + # Invariant: after any sequence of the geography lines (block ladder, PUMA + # ladder with or without a tract, block_v1 draw) and artifact steps + # (re-derivation, a pre-flag artifact, a selection), no flag is true on a + # household whose county holds none of the flag's jurisdiction, no + # household carries a block outside its county, and the artifact + # re-derivation of the result has the same two properties and carries + # every flag its geography decides. + ladder_seed, districts, steps = case + ladders = _jurisdiction_ladders(ladder_seed) + counties = ladders[3] + frame = us_frame( + [ + {"state_fips": district // 100, "congressional_district_geoid": district} + for district in districts + ], + person_inputs=[[{}, {}] for _ in districts], + ) + + for line, seed in steps: + frame = _apply_line(frame, line, seed, ladders) + household = frame.table("household") + if line.startswith("puma_ladder"): + kept = set(US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS) & set(household.columns) + assert kept == ( + {US_PUMA_LADDER_TRACT_COLUMN} + if line == "puma_ladder_with_tract" + else set() + ) + _assert_no_flag_or_block_outside_its_county(frame, counties) + derived, receipt = rederive_us_local_jurisdiction_flags(frame) + _assert_no_flag_or_block_outside_its_county(derived, counties) + complete = us_local_jurisdiction_artifact_receipt(derived) + assert complete["carried_flags"] == _derived_flags(receipt) + table = derived.table("household") + for flag in HOUSEHOLD_FLAGS: + decided = EXPECTED_RULES[flag][0] in receipt["rungs"] + assert (flag in table) == decided, flag + if decided: + places = ( + table["place_fips"] if "place_fips" in table else [""] * len(table) + ) + assert table[flag].tolist() == [ + _oracle(flag, county, place) + for county, place in zip(table["county_fips"], places, strict=True) + ] + + +# A block inside each county, so a row can carry its own county's block, +# another county's, or none. +_TABLE_BLOCKS = { + "08031": "080310001001000", + "08035": "080350001001000", + "10003": "100030001001000", + "36005": "360050001001000", + "36119": "361190001001000", +} +_TABLE_ROWS = st.tuples( + st.sampled_from(sorted(_TABLE_BLOCKS)), + st.one_of(st.none(), st.just(""), st.sampled_from(sorted(_TABLE_BLOCKS.values()))), + st.sampled_from([None, "", "84000", "77580", "20000"]), +) + + +@settings(max_examples=200, deadline=None) +@example(rows=[("36005", "361190001001000", "84000")]) +@example(rows=[("36119", "361190001001000", "84000"), ("08035", "080310001001000", "")]) +@given(rows=st.lists(_TABLE_ROWS, min_size=1, max_size=8)) +def test_rungs_are_never_read_from_a_table_with_a_block_outside_its_county( + rows, +) -> None: + # Invariant: for every household table, if any row carries a block that + # does not begin with the row's county, reading the rungs raises (and so + # do both artifact steps), naming how many rows; otherwise the rungs are + # the block rungs exactly when every row has a block and a place, and the + # place-rule flags the re-derivation writes are the rule on each row. + frame = us_frame( + [ + { + "state_fips": int(county[:2]), + "county_fips": county, + "block_geoid": block, + "place_fips": place, + } + for county, block, place in rows + ], + person_inputs=[[{}] for _ in rows], + ) + household = frame.table("household") + outside = [ + (block, county) + for county, block, _place in rows + if block and block[:5] != county + ] + + if outside: + for read in ( + lambda: us_local_jurisdiction_rungs_present(household), + lambda: rederive_us_local_jurisdiction_flags(frame), + lambda: us_local_jurisdiction_artifact_receipt(frame), + ): + with pytest.raises( + ValueError, match="block_geoid must begin with the row's county_fips" + ) as refused: + read() + assert f"{len(outside)}/{len(rows)} household row(s) do not" in str( + refused.value + ) + return + + anchored = all(block and place is not None for _county, block, place in rows) + expected = BLOCK_GEOGRAPHY_RUNGS if anchored else PUMA_GEOGRAPHY_RUNGS + assert us_local_jurisdiction_rungs_present(household) == expected + derived, receipt = rederive_us_local_jurisdiction_flags(frame) + assert receipt["rungs"] == list(expected) + table = derived.table("household") + for flag in PLACE_FLAGS: + assert (flag in table) == anchored + if anchored: + assert table[flag].tolist() == [ + _oracle(flag, county, place) for county, _block, place in rows + ] diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py index 7b8f85c130..8e7fcd4542 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_spine_blindness.py @@ -3585,6 +3585,97 @@ def local_operator(frame): assert _re_exported_build_modules(aliased) == ("microcosm.build.us_moved_operator",) +def _all_declarations(source: str) -> tuple[str, ...]: + """Each statement that binds or changes ``__all__``, in source order. + + ``literal`` is a top-level, unannotated assignment of a list or tuple of + string constants: the one form :func:`_re_exported_build_modules` reads. + Every other form is named for what hides it from that detector. + """ + + tree = ast.parse(source) + top_level = {id(node) for node in tree.body} + found: list[tuple[int, str]] = [] + for node in ast.walk(tree): + if isinstance(node, ast.Call): + target = node.func.value if isinstance(node.func, ast.Attribute) else None + if isinstance(target, ast.Name) and target.id == "__all__": + found.append((node.lineno, "mutated")) + continue + if isinstance(node, ast.Assign): + targets = node.targets + elif isinstance(node, (ast.AnnAssign, ast.AugAssign)): + targets = [node.target] + else: + continue + if not any( + isinstance(target, ast.Name) and target.id == "__all__" + for target in targets + ): + continue + if isinstance(node, ast.AnnAssign): + form = "annotated" + elif isinstance(node, ast.AugAssign): + form = "augmented" + elif id(node) not in top_level: + form = "nested" + elif isinstance(node.value, (ast.List, ast.Tuple)) and all( + isinstance(element, ast.Constant) and isinstance(element.value, str) + for element in node.value.elts + ): + form = "literal" + else: + form = "computed" + found.append((node.lineno, form)) + return tuple(form for _line, form in sorted(found)) + + +def test_registered_re_exports_declare_one_literal_unannotated_all() -> None: + """Pin the re-export detector's boundary for the modules it is used on. + + The detector reads a module's exports from a literal, unannotated, + top-level ``__all__``. Any other declaration hides a re-export from it, + and so hides the implementation from every scan. Each registered + re-export module, and each implementation behind one, must therefore + declare ``__all__`` in exactly that form, once. + """ + + paths = { + **{name: _US_RUNTIME / name for name, _ in _OUT_OF_RUNTIME_IMPLEMENTATIONS}, + **{ + module: _out_of_runtime_implementation_path(module) + for _, module in _OUT_OF_RUNTIME_IMPLEMENTATIONS + }, + } + declared = { + label: _all_declarations(path.read_text()) for label, path in paths.items() + } + assert declared == {label: ("literal",) for label in paths} + # The forms the detector does not read, each named, and one of them + # hiding a re-export from it. + literal = '__all__ = ["moved_operator"]\n' + assert _all_declarations(literal) == ("literal",) + assert _all_declarations('__all__: list[str] = ["a"]\n') == ("annotated",) + assert _all_declarations(literal + '__all__ += ["b"]\n') == ( + "literal", + "augmented", + ) + assert _all_declarations(literal + '__all__.append("b")\n') == ( + "literal", + "mutated", + ) + assert _all_declarations("__all__ = sorted(globals())\n") == ("computed",) + assert _all_declarations("if True:\n " + literal) == ("nested",) + assert _all_declarations("import os\n") == () + moved = "from microcosm.build.us_moved_operator import moved_operator\n" + assert _re_exported_build_modules(moved + literal) == ( + "microcosm.build.us_moved_operator", + ) + annotated = moved + '__all__: list[str] = ["moved_operator"]\n' + assert _re_exported_build_modules(annotated) == () + assert _re_exported_build_modules(moved) == () + + def test_us_runtime_frame_rebuilds_preserve_immutable_metadata() -> None: """A transformation carrying mass history must also carry stage receipts.""" From 6ed3ccd0ce74d16550a2a4b5d72ad3f548e9ff7b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 12:35:16 -0500 Subject: [PATCH 22/32] Recompute the spec-engine pins after the round-1 fix 21ec4d95a edited puma_ladder.py (a seed-attested module) and us_local_jurisdictions.py (in a binding-identity module set), so the pins were stale by design until the tools ran. Each value below was written by its tool on this tree; none is hand-edited. tools/repin_us_spec_engine_contracts.py (two passes; the first writes a covered_item_count of 40 into test_spec_engine_coverage_tool.py and the second restores 41, so that file is unchanged): - inventory_coverage.py EXPECTED_HASHES seed_map adb7a1d9... -> 307b79f2..., seed_protocol e3bd670e... -> 74a41eec... - test_spec_engine_loader.py golden spec_sha256 cc830059... -> d092ce03... - engine_workflow test_us_multispine_pool_tool.py spec_sha256 1fe859c1... -> 4cc1be3c... tools/spec_engine_coverage.py (two passes): docs/evidence/spec-engine/ us-f0-coverage.json, the same seed map, seed protocol and spec digests; 42394/42394 configuration fields, 41/41 inventory checks. ruff format restored double quotes on the three Python pin lines (the repinner writes repr()). Checked after the writes: the repinner's --legacy-only --check and --check and spec_engine_coverage.py --check exit 0. Co-Authored-By: Claude Opus 5.5 --- docs/evidence/spec-engine/us-f0-coverage.json | 16 ++++++++-------- .../build/spec_engine/inventory_coverage.py | 4 ++-- .../shared/test_spec_engine_loader.py | 2 +- .../us/test_us_multispine_pool_tool.py | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 79d8fd3ad7..86f8d510cb 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1642,13 +1642,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", - "protocol_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4" + "map_sha256": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", + "protocol_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb" }, "failures": [], "observed": { - "map_sha256": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", - "protocol_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4" + "map_sha256": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", + "protocol_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb" }, "status": "covered" }, @@ -1663,7 +1663,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", + "implementation_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1684,7 +1684,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", + "implementation_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", "protocol": "legacy-v1", "streams": [ "build_model", @@ -2585,7 +2585,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28" + "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f" } }, "report_schema_version": 3, @@ -2595,7 +2595,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28" + "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 9af499c9f8..3eef22642c 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -386,8 +386,8 @@ # housing_inputs puts each ACS rent draw on its own household's head. # microcosm#1453 moves both again: geography_ladder and puma_ladder write # the local-jurisdiction flags. - "seed_map": "adb7a1d916ab957b5fc70bb94974a6d6e144239335fb1c930e0d8762f6acd382", - "seed_protocol": "e3bd670e031fcbe454fd7d5e8d4f25b0a210b3f385a6aaa90af57921c4d531e4", + "seed_map": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", + "seed_protocol": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", "source_manifest": "dc3879886d2a69f20fb982a675d7fb322c0e4017afef6471be54b0ee3cbd2af6", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "565f0ceeadab69d3e96a886a00dd0305f7425fa3acde24d12ba48db2b37d5fc0", diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 0fdda3c169..5e06a3a50d 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -28,7 +28,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # microcosm#1453's local-jurisdiction flags move geography_ladder's and # puma_ladder's attested bytes. assert first.spec_sha256 == ( - "cc8300596237644b744848c9cf7274dc36972a4eb615be37507adb4333248280" + "d092ce03746f0cb33e28f8f9a0c0a7bbb2f18dda153d78b9a496bc77312798d5" ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index 54be3fbe4e..a0ab532eed 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -356,7 +356,7 @@ def capture_equality(expected: object, actual: object) -> None: # The hierarchy value ranks move it through medicaid_take_up's # attested bytes. microcosm#1453's local-jurisdiction flags in # geography_ladder, puma_ladder and the pool move it. - "spec_sha256": "1fe859c12c55070d3e3e07cf548f1f1ac0db277d76192e81ba1eb9fe9c483a28", + "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f", }, } From 4030c0142f42b632f73bc6a6e711e29ba53fadc3 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 14:27:53 -0500 Subject: [PATCH 23/32] Pin the reviewer's redraw sequence as examples of the line property test_no_sequence_of_lines_leaves_a_flag_or_block_outside_its_county now always runs two fixed sequences besides its generated ones: a block line, a PUMA redraw and the artifact re-derivation on New York households whose PUMAs span three counties (the review's sequence), and a block_v1 draw followed by a PUMA redraw with a tract and a pre-flag artifact. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_local_jurisdictions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index 52366ff698..269b50acfc 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -1929,6 +1929,22 @@ def _line_sequences(draw): @settings(max_examples=80, deadline=None) +# The reviewer's sequence on a geography whose New York PUMAs span three +# counties: a block line, a PUMA redraw, then the artifact re-derivation. +@example( + case=( + 3, + [3601, 3602, 3603, 3601, 3602, 3603], + [("block_ladder", 1), ("puma_ladder", 2), ("rederive", 0)], + ) +) +@example( + case=( + 3, + [3601, 3602, 3603, 4201, 4202, 800], + [("block_v1", 5), ("puma_ladder_with_tract", 6), ("drop_flags", 0)], + ) +) @given(case=_line_sequences()) def test_no_sequence_of_lines_leaves_a_flag_or_block_outside_its_county(case) -> None: # Invariant: after any sequence of the geography lines (block ladder, PUMA From 42c021bb4bfbffd0ac3729fd6d4b56cee8540e8b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 17:05:58 -0500 Subject: [PATCH 24/32] Keep the ACS block-gate test on the tool's gate and test the pool refusal The round-1 check that a block sits in its county now refuses a tampered pool inside build_optional_acs_multispine, when the pool's flag receipt reads the block rungs. test__legacy_tool__block_v1_gate_failure_is_hard tampered before its harness computed that provenance, so the check fired in the harness and the tool's own block-location gate was never reached. The harness now tampers after the provenance, so that test still exercises the gate, and a new test runs the real build on a pool whose first household's county is moved off its block and asserts the refusal's message, count and (block, county) pair. Also answers verify's wording findings: the PUMA-wrapper sentence in US_LOCAL_JURISDICTIONS.md no longer says a kept block always lies outside the new county or brings a flag back, a stray line break is reflowed, the two module docstrings name the per-plan congressional-district columns the wrapper also drops, and the annual lane's refusal prefix names a remedy that also covers a block outside its county (microcosm#1453, review round 1). Co-Authored-By: Claude Opus 5.5 --- .../microcosm/build/us_annual_static_aging.py | 4 +- .../microcosm/build/us_local_jurisdictions.py | 9 +- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 13 ++- .../microcosm/build/us_runtime/puma_ladder.py | 3 +- .../us/test_us_acs_block_location.py | 99 +++++++++++++++++-- 5 files changed, 105 insertions(+), 23 deletions(-) diff --git a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py index 0101918dd2..b6154dd65c 100644 --- a/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py +++ b/packages/microcosm-build/src/microcosm/build/us_annual_static_aging.py @@ -117,7 +117,9 @@ def _parent_local_jurisdiction_flags(frame: Frame) -> dict: raise ValueError( "The annual lane keeps its parent's columns and base-year bytes, so " "it needs a parent that already carries every local-jurisdiction " - "flag its own geography decides; rebuild the parent with the flags. " + "flag its own geography decides; rebuild the parent through a " + "geography line, which writes those flags and keeps every block " + "inside its county. " f"{error}" ) from error diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index f35e0b998f..60ef0b7024 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -35,10 +35,11 @@ unavailable with the reason, rather than writing ``False``. Its frame wrapper (``with_household_us_puma_ladder``) redraws every household's county, so it also removes each column an earlier block line wrote that only a block -decides (block, tract, place, state-legislative districts, CBSA): each would -describe the geography the redraw replaced. The pooled ACS line follows its -location rule: the PUMA ladder's county rung under the default ``legacy`` -rule, the block rungs under ``block_v1``. +decides (block, tract, place, state-legislative districts, CBSA, the +per-plan congressional districts): each would describe the geography the redraw +replaced. The pooled ACS line follows its location rule: the PUMA ladder's +county rung under the default ``legacy`` rule, the block rungs under +``block_v1``. A 2020 block geoid begins with the five digits of its 2020 county, and every line writes ``county_fips`` as a 2020 county (Connecticut's planning regions diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index e65db00a58..289f77ec1c 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -56,9 +56,9 @@ the new SHA-256 to pin. district and county again, so it first removes each column that only a block decides, where an earlier block line left one: `block_geoid`, `tract_geoid`, `place_fips`, `sldu`, `sldl`, `cbsa_code` and any - `congressional_district_geoid__` column. A kept block would lie - outside the new county, and its place would bring a place-rule flag back - on the next derivation. `assign_us_puma_ladder`, which the pooled ACS line + `congressional_district_geoid__` column. A kept block could lie + outside the new county, and the place beside it would no longer be the + household's. `assign_us_puma_ladder`, which the pooled ACS line calls, keeps those columns: that line restores a block-line donor's own district and county, so the donor's block still sits in its county. - **Pooled ACS line** (`with_optional_acs_spine`): donor rows arrive with @@ -74,10 +74,9 @@ household whose county or place it does not know. A 2020 block geoid begins with the five digits of its 2020 county, and every line writes `county_fips` as a 2020 county (in Connecticut too, whose planning regions go in `county_fips_2023`). A place-rule flag is therefore derived only -from a table -in which every row that carries a 15-digit `block_geoid` has it inside the -row's `county_fips`. On any other table the derivation raises and names the -count and the first few (block, county) pairs. +from a table in which every row that carries a 15-digit `block_geoid` has it +inside the row's `county_fips`. On any other table the derivation raises and +names the count and the first few (block, county) pairs. ### Under `--location-rule block_v1` diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py index 9b599b0ccb..29febc3b7e 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/puma_ladder.py @@ -49,7 +49,8 @@ records why (:mod:`.local_jurisdictions`). The frame wrapper redraws every household's county, so it also removes the block, tract, place, state-legislative-district and CBSA columns an earlier block line left -(:data:`US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS`). +(:data:`US_PUMA_LADDER_BLOCK_ANCHORED_COLUMNS`) and any per-plan +``congressional_district_geoid__`` column. """ from __future__ import annotations diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py b/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py index 01d7159288..9fa58425ee 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_acs_block_location.py @@ -197,6 +197,20 @@ def _record(pooled: Frame) -> dict: return _thaw(pooled.metadata[ACS_POOL_BLOCK_LOCATION_METADATA_KEY]) +def _with_first_county_outside_its_block(pooled: Frame) -> Frame: + """``pooled`` with its first household's county moved off its block.""" + + tables = {e: pooled.table(e).copy() for e in pooled.entities} + tables["household"].loc[0, "county_fips"] = "99999" + return Frame( + tables, + US_SCHEMA, + {"household": pooled.weights_for("household")}, + pooled.strata, + metadata=pooled.metadata, + ) + + def _block_index(ladder: UsLocationLadder, blocks: pd.Series) -> np.ndarray: return np.searchsorted(ladder.block_geoid, blocks.astype(np.int64).to_numpy()) @@ -759,6 +773,76 @@ def test__multispine__block_v1_records_the_block_rungs_flag_receipt( json.dumps(result.provenance, allow_nan=False) +def test__multispine__block_v1_refuses_a_pool_block_outside_its_county( + monkeypatch: pytest.MonkeyPatch, ladder: UsLocationLadder +) -> None: + """A pooled household whose block lies outside its county stops the build. + + The pool's flag receipt reads the place rung from the pool's own blocks, + so the build refuses such a pool before it writes any provenance + (microcosm#1453, review round 1). The tool's own block-location gate is + the second stop: test__legacy_tool__block_v1_gate_failure_is_hard. + """ + + acs = _acs(ladder) + real_pool = acs_multispine.with_optional_acs_spine + pooled: dict[str, Frame] = {} + + def tampered_pool(base, recipient, **options): + pooled["frame"] = _with_first_county_outside_its_block( + real_pool(base, recipient, **options) + ) + return pooled["frame"] + + monkeypatch.setattr(acs_multispine, "with_optional_acs_spine", tampered_pool) + monkeypatch.setattr( + acs_multispine, + "build_acs_pums_unit_frame", + lambda source, *, chunksize: (acs, {"spine": ACS_2024_1YR_SPINE}), + ) + monkeypatch.setattr( + acs_multispine, + "map_acs_native_inputs", + lambda raw: type("Mapped", (), {"frame": raw, "native_inputs": {}})(), + ) + monkeypatch.setattr( + acs_multispine, + "transfer_acs_inputs", + lambda recipient, donor, **kwargs: type( + "Transfer", + (), + { + "frame": recipient, + "imputed_inputs": (), + "fit_records": (), + "deferred_inputs": ( + "block_geoid", + "congressional_district_geoid", + "county_fips", + "tract_geoid", + ), + "resolved_donor_channel": "asec", + }, + )(), + ) + with pytest.raises(ValueError) as caught: + acs_multispine.build_optional_acs_multispine( + _donor_base(ladder), + object(), # type: ignore[arg-type] + location_rule=US_LOCATION_RULE_BLOCK_V1, + block_ladder=ladder, + location_seed=9, + donor_location_rule=US_LOCATION_RULE_BLOCK_V1, + ) + household = pooled["frame"].table("household") + block = str(household.loc[0, "block_geoid"]) + assert block[:5] != "99999" + message = str(caught.value) + assert "block_geoid must begin with the row's county_fips" in message + assert f"1/{len(household)} household row(s) do not" in message + assert f"('{block}', '99999')" in message + + def test__multispine__refuses_invalid_location_options_before_loading( monkeypatch: pytest.MonkeyPatch, ladder: UsLocationLadder ) -> None: @@ -967,16 +1051,6 @@ def _run_block_v1_main( max_peak_bytes=None, donor_location_rule=US_LOCATION_RULE_BLOCK_V1, ) - if tamper: - tables = {e: combined.table(e).copy() for e in combined.entities} - tables["household"].loc[0, "county_fips"] = "99999" - combined = Frame( - tables, - US_SCHEMA, - {"household": combined.weights_for("household")}, - combined.strata, - metadata=combined.metadata, - ) if puma_ladder is None: puma_ladder = _puma_ladder_stub(builder, ladder) donor_mode = _record(combined)["donor_blocks"]["mode"] @@ -1000,6 +1074,11 @@ def _run_block_v1_main( } ], } + if tamper: + # After the provenance, which refuses a block outside its county on + # its own (test__multispine__block_v1_refuses_a_pool_block_outside_its_county), + # so the tool's own block-location gate is what this run reaches. + combined = _with_first_county_outside_its_block(combined) base_h5 = tmp_path / "dense.h5" base_h5.write_bytes(b"dense-base") puma_ladder_path = tmp_path / "us_puma_ladder_2020.npz" From d7a90ecc913f3946d0d8093d101e86efbf2a846a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 17:06:13 -0500 Subject: [PATCH 25/32] Recompute the spec-engine pins after the round-1 repair puma_ladder.py is a seed-attested module, and its module docstring now names the per-plan congressional-district columns, so its attested bytes moved. Written by the tools, not by hand: tools/repin_us_spec_engine_contracts.py (seed_map, seed_protocol, the loader golden and the engine-workflow US spec_sha256) and tools/spec_engine_coverage.py (us-f0-coverage.json), in the order repinner, coverage, repinner, coverage; ruff format then normalized the repinner's quotes. Every --check exits 0, and under policyengine-us 2.2.1 generate_us_bundle_from_constants.py --check prints the new spec_sha256 (microcosm#1453, review round 1). Co-Authored-By: Claude Opus 5.5 --- docs/evidence/spec-engine/us-f0-coverage.json | 16 ++++++++-------- .../build/spec_engine/inventory_coverage.py | 4 ++-- .../shared/test_spec_engine_loader.py | 2 +- .../us/test_us_multispine_pool_tool.py | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index 86f8d510cb..9abb7a593d 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -1642,13 +1642,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", - "protocol_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb" + "map_sha256": "2b14547bbbd50b166f8000332b983864cc8b2e3247245f5717bbf183bc08eafe", + "protocol_sha256": "eb6a5a8793526f8f45b032895f79f8441b892bc69689824ef1581afac6112acf" }, "failures": [], "observed": { - "map_sha256": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", - "protocol_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb" + "map_sha256": "2b14547bbbd50b166f8000332b983864cc8b2e3247245f5717bbf183bc08eafe", + "protocol_sha256": "eb6a5a8793526f8f45b032895f79f8441b892bc69689824ef1581afac6112acf" }, "status": "covered" }, @@ -1663,7 +1663,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", + "implementation_sha256": "eb6a5a8793526f8f45b032895f79f8441b892bc69689824ef1581afac6112acf", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1684,7 +1684,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", + "implementation_sha256": "eb6a5a8793526f8f45b032895f79f8441b892bc69689824ef1581afac6112acf", "protocol": "legacy-v1", "streams": [ "build_model", @@ -2585,7 +2585,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f" + "spec_sha256": "86a80ffb6c3d84236ba45761663fb31be319fca5aa9c88bfd145abd161288fe9" } }, "report_schema_version": 3, @@ -2595,7 +2595,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f" + "spec_sha256": "86a80ffb6c3d84236ba45761663fb31be319fca5aa9c88bfd145abd161288fe9" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index 3eef22642c..32ed5c8347 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -386,8 +386,8 @@ # housing_inputs puts each ACS rent draw on its own household's head. # microcosm#1453 moves both again: geography_ladder and puma_ladder write # the local-jurisdiction flags. - "seed_map": "307b79f2cfe8fbb95627c2c24e02657a074e3b61685cefec019ce67f4826c9b6", - "seed_protocol": "74a41eecfbc493474453bb21c30de454790af3a1b50283e88f9eeefc93e25dbb", + "seed_map": "2b14547bbbd50b166f8000332b983864cc8b2e3247245f5717bbf183bc08eafe", + "seed_protocol": "eb6a5a8793526f8f45b032895f79f8441b892bc69689824ef1581afac6112acf", "source_manifest": "dc3879886d2a69f20fb982a675d7fb322c0e4017afef6471be54b0ee3cbd2af6", "take_up": "9522ce40f7dea569312dd7a7beb474e5a5afadd2f1e10cb5876534c3ef623d35", "tail": "565f0ceeadab69d3e96a886a00dd0305f7425fa3acde24d12ba48db2b37d5fc0", diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 5e06a3a50d..dfeb5f0c07 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -28,7 +28,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # microcosm#1453's local-jurisdiction flags move geography_ladder's and # puma_ladder's attested bytes. assert first.spec_sha256 == ( - "d092ce03746f0cb33e28f8f9a0c0a7bbb2f18dda153d78b9a496bc77312798d5" + "9a5e68ce9dbb0f33e5de8e7cd15b0f51b65159b858870ad4e2b65a08b771a4a4" ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index a0ab532eed..a10566a35c 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -356,7 +356,7 @@ def capture_equality(expected: object, actual: object) -> None: # The hierarchy value ranks move it through medicaid_take_up's # attested bytes. microcosm#1453's local-jurisdiction flags in # geography_ladder, puma_ladder and the pool move it. - "spec_sha256": "4cc1be3c48e86b549965c03164ab3dec22309384a2a0707b2810ccbd8524a22f", + "spec_sha256": "86a80ffb6c3d84236ba45761663fb31be319fca5aa9c88bfd145abd161288fe9", }, } From 77984c9158d8bcf0bac3a0c3957a7a88c18bb347 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 10:49:05 -0500 Subject: [PATCH 26/32] Keep the calibrated support's flags on the release export (review round 2) In a legacy ACS pool the block donors sit beside ACS rows with no block, so the base decides only the county-rule flags. When the L0 support drops every ACS row, its geography decides in_yonkers and in_wilmington too, and the export step derived them after selection and refit. That changed engine inputs the weights were fit to: a retained Wilmington itemizer gets the city's earned income tax, a larger SALT deduction and a lower federal income tax, while the refit and the fit gates still report the targets computed without the flag. Under policyengine-us 2.2.1 a Wilmington worker with $100,000 of wages and $20,000 of cash gifts owes $275 less 2026 federal income tax that way. The export step now writes nothing. us_local_jurisdiction_artifact_receipt takes rungs=, the rungs whose flags the artifact must carry (default its own, so the annual lane's parent check is unchanged). It refuses rungs the artifact's own geography does not supply and a carried flag beyond them, and records each flag its own rungs decide beyond them as unavailable, saying why. The builder's export calls it with the rungs of the last support derived before the targets were materialized (the frozen support, else the base) and returns the frame it was given, and it refuses an export with no earlier receipt. The base and frozen-support derivations are unchanged, so the targets still see every flag a frozen support decides. A build whose export rungs equal its calibrated support's returns the same frame object and the same receipt as before. That covers the full-pool path, a base or frozen support that already decides the place rung, and any L0 support that keeps one row without a block. In the hit case the release carries an ordinary pooled release's flags; its own geography still decides the place-rule flags, so the annual lane refuses it as a parent. Rematerializing and refitting on the L0 support would avoid that, at the cost of another engine pass and a second refit inside calibration. Tests: - test_builder_export_writes_no_input_its_targets_were_not_materialized_with: a Yonkers and a Wilmington block donor beside an ACS Denver row; the L0 weights keep the two donors. Every table of the export equals the kept rows of the base, the receipt holds the base's ["county"] rungs, and in_yonkers and in_wilmington read unavailable. It fails on 59d539e02. - Three module tests: a property test over pools and selections (a selection held to its support's rungs carries that support's flags, and its receipt equals the unheld one when no rung is added) and one test for each refusal. - The frozen/L0 test now draws the L0 support from the frozen support and checks the export refusal; the stale-block test starts each support from a clean base receipt; the post-export AST test and the diagnostics harness of test_main_writes_diagnostics_before_post_calibration_gate_failure derive or fake the base receipt as _main does. US_LOCAL_JURISDICTIONS.md, the module docstring and the changelog fragment describe the export. No pin moves: the repinner's --legacy-only --check and --check, spec_engine_coverage.py --check and ci_test_plan.py verify exit 0 (microcosm#1453, review round 2). Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- .../microcosm/build/us_local_jurisdictions.py | 48 ++++- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 25 ++- .../us/test_us_fiscal_refresh_builder.py | 176 +++++++++++++++--- .../us/test_us_local_jurisdictions.py | 79 ++++++++ .../us/test_us_post_export_scoring.py | 33 ++-- tools/build_us_fiscal_refresh_release.py | 65 +++++-- 7 files changed, 359 insertions(+), 69 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index f6ab8e7275..636db3ffe7 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection and on the export support, so a base built before this change, or a selection that keeps only block-anchored rows, no longer exports without them. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection, before it computes its targets, so a base built before this change, or a frozen support that keeps only block-anchored rows, no longer exports without them. The builder's export keeps the flags its targets were computed with: a place-rule flag that only the final L0 support decides is recorded as unavailable, not written, so the written dataset still gives the fitted targets. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index 60ef0b7024..a5dd72c404 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -59,11 +59,15 @@ The rungs belong to the whole household table: one row without a block withholds the place rung from every row. A step that removes rows (a frozen-support or L0 selection) can therefore make a place-rule flag -decidable, so it derives the flags again on the rows it keeps; deriving a -support whose flags are already complete returns it unchanged. A step that -must keep an artifact's columns and bytes, and so cannot write the flags, -calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses -an artifact that lacks a flag its geography decides. +decidable. A selection made before anything is computed from the flags +derives them again on the rows it keeps; deriving a support whose flags are +already complete returns it unchanged. A step that must keep an artifact's +columns and bytes, and so cannot write the flags, calls +:func:`us_local_jurisdiction_artifact_receipt` instead, which refuses an +artifact that lacks a flag its geography decides. A step whose inputs a +larger support fixed (the release builder's export, after its weights were +fit to targets computed on that support) passes that support's rungs, and +keeps exactly that support's flags. This module and its registry sit outside ``microcosm.build.us_runtime`` on purpose, and import only the standard library, numpy, pandas and @@ -684,6 +688,7 @@ def rederive_us_local_jurisdiction_flags( def us_local_jurisdiction_artifact_receipt( frame: Frame, *, + rungs: Collection[str] | None = None, registry: UsLocalJurisdictionRegistry | None = None, ) -> dict[str, Any]: """Require an artifact to carry its flags already, and return its receipt. @@ -698,11 +703,32 @@ def us_local_jurisdiction_artifact_receipt( It also raises, before it reads a flag, on an artifact in which a household's block lies outside its county. The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` returns. + + ``rungs`` is for a step whose inputs a larger support fixed: the release + builder's export keeps the rows its L0 selection chose from the support + its targets were computed on, and writing a flag only the kept rows + decide would change an input after the weights were fit. The artifact + must then carry exactly the flags of ``rungs``, which must be among its + own rungs, and the receipt records each flag its own geography decides + beyond them as unavailable, with that reason. """ resolved = registry or packaged_us_local_jurisdiction_registry() household = frame.table("household") - rungs = us_local_jurisdiction_rungs_present(household) + own_rungs = us_local_jurisdiction_rungs_present(household) + if rungs is None: + rungs = own_rungs + scope = f"this artifact's rungs {list(rungs)}" + else: + rungs = _normalized_rungs(rungs) + beyond = [rung for rung in rungs if rung not in own_rungs] + if beyond: + raise ValueError( + f"The artifact's own geography supplies the rungs {list(own_rungs)}, " + f"not {beyond}; it cannot be required to carry the flags of rungs it " + "does not decide." + ) + scope = f"the rungs {list(rungs)} its inputs were fixed on" failures = us_local_jurisdiction_flag_failures( household, person=frame.table("person"), @@ -714,7 +740,7 @@ def us_local_jurisdiction_artifact_receipt( ) carried = _carried_flags(frame, resolved) failures.extend( - f"{flag}: present, but this artifact's rungs {list(rungs)} do not decide it" + f"{flag}: present, but {scope} do not decide it" for flag in carried if flag not in values ) @@ -729,6 +755,14 @@ def us_local_jurisdiction_artifact_receipt( registry=resolved, household_weights=frame.weights_for("household").values, ) + for item in resolved.jurisdictions: + if item.rule in own_rungs and item.flag not in values: + receipt["flags"][item.flag]["reason"] = ( + f"this artifact's own geography (rungs {list(own_rungs)}) decides " + f"it, but its inputs were fixed on a support with the rungs " + f"{list(rungs)}, so the flag is not written and the engine default " + "(False) applies to every row" + ) receipt["carried_flags"] = carried return receipt diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index 289f77ec1c..ba78a80b2b 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -116,8 +116,10 @@ an existing artifact rather than a geography line, and both call support and records the receipt as `local_jurisdiction_flags` in its summary; and - the fiscal refresh release builder calls it on the loaded base or prepared - pool, again on the frozen support when a selection source reduces it, and - again on the export support after the L0 or full-pool weights attach. It + pool, and again on the frozen support when a selection source reduces it, + both before it materializes its targets. Its export support, the rows the L0 + or full-pool weights keep, is not derived again: it must carry exactly the + flags of the last support derived before it (see below). The builder records each receipt, keyed `base`, `frozen_support` and `export`, under `support_value_repairs.local_jurisdiction_flags` in the calibration diagnostics. @@ -157,10 +159,23 @@ the annual lane. The rungs belong to the whole table, so removing rows can add one: a frozen support or L0 support that keeps only block-anchored donors decides -`in_yonkers` and `in_wilmington` even though the pooled base did not. That is -why the builder derives the flags again after each step that removes rows. +`in_yonkers` and `in_wilmington` even though the pooled base did not. Frozen +selection comes before the builder materializes its targets, so the builder +derives the flags again on the frozen support, and the targets see them. Deriving a support that already carries exactly the flags it decides returns -the same frame, so these repeat calls copy no tables. +the same frame, so that call copies no tables. + +L0 selection comes after: the builder fits its weights to targets computed +from the calibrated support's flags, and its fit gates report those fitted +values. Writing `in_wilmington` on a retained Wilmington household at that +point would change its local tax, and through SALT an itemizer's federal +income tax, so the written H5 would no longer give the fitted targets. The +export step therefore writes nothing. It calls +`us_local_jurisdiction_artifact_receipt` with the calibrated support's rungs: +the export must carry exactly those flags, and the receipt records each flag +its own geography decides beyond them as unavailable, with that reason. Such a +release carries the flags of an ordinary pooled release. Its own geography +still decides the place-rule flags, so the annual lane refuses it as a parent. ## Gates diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index 651b12569f..b73dbe491a 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2819,9 +2819,10 @@ def test_cli_result_names_the_build_and_its_publication_commands( def test_builder_derives_flags_after_every_support_reduction() -> None: # The rungs belong to the whole household table, so a step that removes # rows can make the place-rule flags decidable (microcosm#1453 review r2). - # _main derives on the loaded base, again on the frozen support before - # anything materializes targets from it, and again on the export support - # before any export gate reads it or the release engine writes it to H5. + # _main derives on the loaded base and again on the frozen support before + # anything materializes targets from it, and records the export support's + # flags (the calibrated support's) before any export gate reads it or the + # release engine writes it to H5 (review round 2 of the adopted PR). import inspect builder = _load_builder_module() @@ -2873,9 +2874,13 @@ def test_builder_derives_flags_after_every_support_reduction() -> None: def test_builder_flags_follow_the_support_through_frozen_and_l0_selection() -> None: # The microcosm#1453 review r2 case, on real frames: a pooled base with a # Yonkers donor on a block and an ACS row with no block decides only the - # county-rule flags. A frozen support from a block-line release, or an L0 - # support without the ACS row, keeps only the donor, so in_yonkers becomes - # decidable; selection alone would export the donor without it. + # county-rule flags. A frozen support from a block-line release keeps only + # the donor, so in_yonkers becomes decidable; selection alone would + # export the donor without it. The frozen support comes before the + # targets are materialized, so it derives in_yonkers, and an L0 support + # drawn from it exports the flag the targets saw. (An L0 support that + # gains the place rung only after the fit keeps the calibrated flags: + # test_builder_export_writes_no_input_its_targets_were_not_materialized_with.) from microcosm.build.us_runtime.l0_refit_export import ( attach_l0_refit_entity_weights, ) @@ -2941,21 +2946,28 @@ def derive(frame, support): ] l0_support = attach_l0_refit_entity_weights( - base, + frozen, weight_entity="household", selected_entity_ids=np.asarray([1]), selected_weights=np.asarray([5.0]), reason="fixture L0 support", ) - assert "in_yonkers" not in l0_support.table("household") exported = derive(l0_support, "export") + # The export writes nothing: it carries the frozen support's flags. + assert exported is l0_support assert exported.table("household")["in_yonkers"].tolist() == [True] + assert receipts["export"]["rungs"] == ["county", "place"] assert receipts["export"]["flags"]["in_yonkers"]["status"] == "derived" assert receipts["export"]["flags"]["in_yonkers"][ "weighted_households_in_jurisdiction" ] == pytest.approx(5.0) - # A support whose flags are already complete comes back unchanged. assert derive(exported, "export") is exported + # The export keeps the flags of the last support derived before it, so + # with none derived it has nothing to keep and refuses. + with pytest.raises(ValueError, match="must be derived first"): + builder._with_local_jurisdiction_flags( + l0_support, support="export", receipts={}, telemetry=None + ) assert [name for name, _details in telemetry.stages] == [ "local_jurisdiction_flags_base", "local_jurisdiction_flags_frozen_support", @@ -2967,23 +2979,38 @@ def derive(frame, support): derive(exported, "selected") -def test_builder_refuses_a_support_whose_block_lies_outside_its_county() -> None: - # The microcosm#1453 review round 1 case: a donor whose county was - # redrawn (the Bronx) while its Yonkers block and place stayed, beside an - # ACS row with no block. Deriving from that table would write in_yonkers - # on a Bronx household once a selection drops the ACS row, so every - # support the builder derives on stops instead, and records nothing. +def test_builder_export_writes_no_input_its_targets_were_not_materialized_with() -> ( + None +): + # The microcosm#1453 review round 2 case. A legacy pool whose block-line + # donors sit beside ACS rows with no block decides only the county-rule + # flags, and _main materializes the targets from that support. An L0 + # support that keeps only the donors decides in_yonkers and in_wilmington; + # writing them on the export would change engine inputs after the refit + # (Wilmington's tax enters SALT and so federal income_tax), while the fit + # gates keep the values the refit used. The export therefore carries + # exactly the inputs of the rows it keeps, and its receipt says why the + # place-rule flags are not written. + from microcosm.build.us_runtime.l0_refit_export import ( + attach_l0_refit_entity_weights, + ) from test_support.microcosm_build.us_local_jurisdictions import us_frame builder = _load_builder_module() - stale = us_frame( + pooled = us_frame( [ { "state_fips": 36, - "county_fips": "36005", + "county_fips": "36119", "place_fips": "84000", "block_geoid": "361190001001000", }, + { + "state_fips": 10, + "county_fips": "10003", + "place_fips": "77580", + "block_geoid": "100030001001000", + }, { "state_fips": 8, "county_fips": "08031", @@ -2991,11 +3018,80 @@ def test_builder_refuses_a_support_whose_block_lies_outside_its_county() -> None "block_geoid": None, }, ], - person_inputs=[[{}], [{}]], + person_inputs=[[{}], [{}], [{}]], ) receipts: dict[str, object] = {} + calibrated = builder._with_local_jurisdiction_flags( + pooled, support="base", receipts=receipts, telemetry=None + ) + l0_support = attach_l0_refit_entity_weights( + calibrated, + weight_entity="household", + selected_entity_ids=np.asarray([1, 2]), + selected_weights=np.asarray([5.0, 7.0]), + reason="fixture L0 support without the ACS row", + ) + + exported = builder._with_local_jurisdiction_flags( + l0_support, support="export", receipts=receipts, telemetry=None + ) + + # Input parity: every table the export writes is the kept rows of the + # support the targets were materialized from, column for column. + for entity in l0_support.entities: + pd.testing.assert_frame_equal(exported.table(entity), l0_support.table(entity)) + receipt = receipts["export"] + assert receipt["rungs"] == ["county"] == receipts["base"]["rungs"] + for flag in ("in_wilmington", "in_yonkers"): + assert receipt["flags"][flag]["status"] == "unavailable" + assert "decides it" in receipt["flags"][flag]["reason"] + assert receipt["flags"]["in_denver"]["status"] == "derived" + assert receipt["carried_flags"] == [ + "in_denver", + "pa_philadelphia_wage_tax_resident", + ] + + +def test_builder_refuses_a_support_whose_block_lies_outside_its_county() -> None: + # The microcosm#1453 review round 1 case: a donor whose county was + # redrawn (the Bronx) while its Yonkers block and place stayed, beside an + # ACS row with no block. Deriving from that table would write in_yonkers + # on a Bronx household once a selection drops the ACS row, so every + # support the builder derives on stops instead, and records nothing. + from test_support.microcosm_build.us_local_jurisdictions import us_frame + + builder = _load_builder_module() + + def pool(donor_county: str): + return us_frame( + [ + { + "state_fips": 36, + "county_fips": donor_county, + "place_fips": "84000", + "block_geoid": "361190001001000", + }, + { + "state_fips": 8, + "county_fips": "08031", + "place_fips": None, + "block_geoid": None, + }, + ], + person_inputs=[[{}], [{}]], + ) + + stale = pool("36005") + # The export keeps the flags of a support derived before it, so each call + # starts from the receipt of the same pool with the donor in its block's + # county. + prior: dict[str, object] = {} + builder._with_local_jurisdiction_flags( + pool("36119"), support="base", receipts=prior, telemetry=None + ) for support in builder.LOCAL_JURISDICTION_FLAG_SUPPORTS: + receipts = dict(prior) with pytest.raises( ValueError, match="block_geoid must begin with the row's county_fips" ) as refused: @@ -3004,7 +3100,7 @@ def test_builder_refuses_a_support_whose_block_lies_outside_its_county() -> None ) assert "1/2 household row(s) do not" in str(refused.value) assert "[('361190001001000', '36005')]" in str(refused.value) - assert receipts == {} + assert receipts == prior def test_frozen_support_selection_is_followed_by_weeks_unemployed_regate() -> None: @@ -7888,25 +7984,40 @@ def fake_load_frame(path, *, expected_sha256=None): "carried_flags": [], "flags": {"in_yonkers": {"status": "derived"}}, } + local_jurisdiction_export_receipt = { + "rungs": ["county", "place"], + "carried_flags": ["in_yonkers"], + "flags": {"in_yonkers": {"status": "derived"}}, + } def fake_rederive_local_jurisdiction_flags(frame): captured["local_jurisdiction_frames"] = [ *captured.get("local_jurisdiction_frames", []), frame, ] - if isinstance(frame, FakeExportFrame): - # A new object, so the run can show that every export gate and - # the written H5 see the derived frame, not the L0 support. - derived = FakeExportFrame() - captured["local_jurisdiction_export_frame"] = derived - return derived, local_jurisdiction_receipt return frame, local_jurisdiction_receipt + def fake_local_jurisdiction_artifact_receipt(frame, *, rungs): + # The export support is checked, never rewritten: it must carry the + # flags of the support its targets were computed from. + captured["local_jurisdiction_frames"] = [ + *captured.get("local_jurisdiction_frames", []), + frame, + ] + captured["local_jurisdiction_export_frame"] = frame + captured["local_jurisdiction_export_rungs"] = list(rungs) + return local_jurisdiction_export_receipt + monkeypatch.setattr( builder, "rederive_us_local_jurisdiction_flags", fake_rederive_local_jurisdiction_flags, ) + monkeypatch.setattr( + builder, + "us_local_jurisdiction_artifact_receipt", + fake_local_jurisdiction_artifact_receipt, + ) if prepared_pool: def fake_load_pool(path, *, expected_manifest_sha256): @@ -9458,11 +9569,16 @@ def fake_release_gate_failures(*args, **kwargs): ), ) if terminal_mode != "stored_input_refused": - # The release engine writes the frame the export derivation returned. + # The release engine writes the export support the flag check + # was given, held to the base support's rungs: nothing rewrote it. assert ( captured["written_frame"] is (captured["local_jurisdiction_export_frame"]) ) + assert captured["local_jurisdiction_export_rungs"] == [ + "county", + "place", + ] return try: @@ -9810,15 +9926,17 @@ def fake_release_gate_failures(*args, **kwargs): "non_sch_d_capital_gains": cgd_repair_payload, "local_jurisdiction_flags": { "base": local_jurisdiction_receipt, - "export": local_jurisdiction_receipt, + "export": local_jurisdiction_export_receipt, }, } - # _main derives the flags on the loaded base (or prepared pool) and again - # on the export support; this harness selects no frozen support. + # _main derives the flags on the loaded base (or prepared pool) and + # checks the export support against the base's rungs; this harness + # selects no frozen support. assert [type(frame) for frame in captured["local_jurisdiction_frames"]] == [ FakeFrame, FakeExportFrame, ] + assert captured["local_jurisdiction_export_rungs"] == ["county", "place"] # The diagnostics carry a complete post-export scoring plan, never an # error record, so no plan line joins the terminal batch (#956). post_export_scoring = captured["diagnostics"]["post_export_scoring"] diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index 269b50acfc..491ce9067d 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -14,6 +14,9 @@ - deriving a selection of a derived support equals deriving the selected rows from scratch, and leaves every flag the kept rows' geography decides; - deriving a support whose flags are already complete returns it unchanged; +- a selection held to the rungs of the support it came from carries exactly + that support's flags, and each flag its own geography adds is recorded as + unavailable rather than written; - after any sequence of geography lines and artifact steps, no place-rule or county-rule flag is true on a household whose county lies outside the flag's counties, and no line leaves a block outside its household's county; @@ -1242,6 +1245,82 @@ def test_artifact_receipt_matches_the_rederived_receipt_on_a_complete_artifact() assert bare["carried_flags"] == [] +# --------------------------------------------------------------------------- # +# A selection held to the rungs of the support that fixed its inputs +# (review round 2 of the adopted microcosm#1453) +# --------------------------------------------------------------------------- # + + +@settings(max_examples=80, deadline=None) +@example( + case=([("block", "yonkers"), ("block", "wilmington"), ("acs", "08031")], [0, 1]) +) +@example(case=([("block", "yonkers"), ("acs", "08031")], [0, 1])) +@given(case=_pool_and_selection()) +def test_a_selection_held_to_its_supports_rungs_keeps_that_supports_flags( + case, +) -> None: + # Invariant: for every pooled support and every non-empty selection of its + # households, the selected rows of the derived support pass the artifact + # receipt held to the support's rungs. The receipt reads those rungs and + # derives the same flags, and each flag the selection's own geography + # adds is unavailable with the reason. The selection already carries + # exactly the support's flags, so a step that holds it to those rungs + # writes no input the support's targets were not computed with. When + # the selection adds no rung, the receipt is the unheld one. + rows, keep = case + derived, derived_receipt = rederive_us_local_jurisdiction_flags(_pooled_frame(rows)) + selected = _select_households(derived, keep) + + receipt = us_local_jurisdiction_artifact_receipt( + selected, rungs=derived_receipt["rungs"] + ) + + assert receipt["rungs"] == derived_receipt["rungs"] + assert _derived_flags(receipt) == _derived_flags(derived_receipt) + assert receipt["carried_flags"] == _derived_flags(derived_receipt) + own = rederive_us_local_jurisdiction_flags(selected)[1] + added = set(_derived_flags(own)) - set(_derived_flags(derived_receipt)) + assert bool(added) == (own["rungs"] != derived_receipt["rungs"]) + for flag in added: + entry = receipt["flags"][flag] + assert entry["status"] == JURISDICTION_FLAG_UNAVAILABLE + assert entry["reason"].startswith( + f"this artifact's own geography (rungs {own['rungs']}) decides it" + ) + if not added: + assert receipt == us_local_jurisdiction_artifact_receipt(selected) + + +def test_a_selection_cannot_be_held_to_rungs_its_geography_does_not_supply() -> None: + # The pool's ACS row has no block, so its geography supplies the county + # rung only, and the place rung's flags cannot be required of it. + derived, _receipt = rederive_us_local_jurisdiction_flags( + _pooled_frame([("block", "yonkers"), ("acs", "08031")]) + ) + + with pytest.raises( + ValueError, match=r"supplies the rungs \['county'\], not \['place'\]" + ): + us_local_jurisdiction_artifact_receipt(derived, rungs=BLOCK_GEOGRAPHY_RUNGS) + + +def test_a_selection_held_to_its_supports_rungs_refuses_a_flag_beyond_them() -> None: + derived, receipt = rederive_us_local_jurisdiction_flags( + _pooled_frame([("block", "yonkers"), ("block", "wilmington")]) + ) + assert receipt["rungs"] == list(BLOCK_GEOGRAPHY_RUNGS) + + with pytest.raises( + ValueError, + match=( + r"in_yonkers: present, but the rungs \['county'\] its inputs were " + r"fixed on do not decide it" + ), + ): + us_local_jurisdiction_artifact_receipt(derived, rungs=PUMA_GEOGRAPHY_RUNGS) + + # --------------------------------------------------------------------------- # # A block outside its household's county (review round 1 of microcosm#1453) # --------------------------------------------------------------------------- # diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py b/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py index fa67c7308a..fcd202edd1 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_post_export_scoring.py @@ -1319,17 +1319,24 @@ def test_main_has_no_calibrated_target_frame_at_the_export_write( from microcosm.calibrate import calibrate_l0_refit target_frame, targets = _small_calibration_problem() - # The export statements derive the local-jurisdiction flags on the export + # _main derives the local-jurisdiction flags on the base before it + # materializes targets, and the export statements keep them on the export # support (microcosm#1453). Every household here has a county, half of - # them Denver's, so that derivation writes real columns on a new frame. + # them Denver's, so the base derivation writes real columns. households = target_frame.table("household").drop(columns="x") households["county_fips"] = np.where( households["household_id"] % 2 == 0, "08031", "06037" ) - base_frame = Frame( - {"person": target_frame.table("person"), "household": households}, - target_frame.schema, - {"household": target_frame.weights_for("household")}, + local_jurisdiction_flags: dict[str, object] = {} + base_frame = builder._with_local_jurisdiction_flags( + Frame( + {"person": target_frame.table("person"), "household": households}, + target_frame.schema, + {"household": target_frame.weights_for("household")}, + ), + support="base", + receipts=local_jurisdiction_flags, + telemetry=None, ) if full_pool: result = calibrate(target_frame, targets, epochs=3, mass="conserve", seed=0) @@ -1385,8 +1392,8 @@ def check_write(frame, path, *, period): writes.append(frame) written = frame.table("household") assert "x" not in written - # The written support carries the flags its own geography decides, - # and it is the frame the cleanup below keeps for an exact-K outcome. + # The written support carries the base support's flags, and it is + # the frame the cleanup below keeps for an exact-K outcome. assert ( written["in_denver"].tolist() == written["county_fips"].eq("08031").tolist() ) @@ -1412,7 +1419,7 @@ def check_write(frame, path, *, period): "dataset_path": Path("fixture.h5"), # Bound earlier in _main: the receipts of the base and frozen-support # derivations, and the build's progress reporter. - "local_jurisdiction_flags": {}, + "local_jurisdiction_flags": local_jurisdiction_flags, "telemetry": None, } module = ast.Module( @@ -1421,9 +1428,13 @@ def check_write(frame, path, *, period): exec(compile(module, "
", "exec"), namespace) assert len(writes) == 1 receipts = namespace["local_jurisdiction_flags"] - assert list(receipts) == ["export"] + assert list(receipts) == ["base", "export"] receipt = receipts["export"] - assert receipt["rungs"] == ["county"] and receipt["carried_flags"] == [] + assert receipt["rungs"] == ["county"] == receipts["base"]["rungs"] + assert receipt["carried_flags"] == [ + "in_denver", + "pa_philadelphia_wage_tax_resident", + ] in_denver = receipt["flags"]["in_denver"] assert in_denver["status"] == "derived" assert in_denver["households_in_jurisdiction"] == int( diff --git a/tools/build_us_fiscal_refresh_release.py b/tools/build_us_fiscal_refresh_release.py index 4ed0ca2761..8aa50c8fef 100644 --- a/tools/build_us_fiscal_refresh_release.py +++ b/tools/build_us_fiscal_refresh_release.py @@ -308,6 +308,7 @@ ) from microcosm.build.us_runtime.local_jurisdictions import ( rederive_us_local_jurisdiction_flags, + us_local_jurisdiction_artifact_receipt, ) from microcosm.build.us_runtime.medicare_irmaa_holdout import ( medicare_irmaa_holdout_from_sim, @@ -7678,9 +7679,11 @@ def _with_l0_refit_weights(base_frame: Frame, result) -> Frame: ) -#: The supports ``_main`` derives local-jurisdiction flags on, in build order: -#: the loaded base (or prepared pool), the frozen support when a selection -#: source reduces it, and the export support the release engine writes to H5. +#: The supports ``_main`` records local-jurisdiction flags on, in build order: +#: the loaded base (or prepared pool) and the frozen support when a selection +#: source reduces it, each derived before the targets are materialized, and +#: the export support the release engine writes to H5, which keeps the flags +#: of the last support before it. LOCAL_JURISDICTION_FLAG_SUPPORTS = ("base", "frozen_support", "export") @@ -7691,18 +7694,29 @@ def _with_local_jurisdiction_flags( receipts: dict[str, object], telemetry: _BuildProgress | None, ) -> Frame: - """Derive the local-jurisdiction flags this support's geography decides. + """Record a support's local-jurisdiction flags: derived, or on export kept. The rungs belong to the whole household table (``us_local_jurisdiction_rungs_present``): a pooled base whose ACS rows carry no block decides only the county-rule flags. A step that removes - rows can make the place-rule flags decidable, as when frozen-support - selection or the final L0 support keeps only block-anchored donors, so - ``_main`` derives again after each such step and the written support - carries every flag its own geography decides. The derivation refuses a - carried flag that disagrees with the geography and returns a support - whose flags are already complete unchanged. ``receipts[support]`` - records each derivation for the calibration diagnostics. + rows can make the place-rule flags decidable. Frozen-support selection + comes before the targets are materialized, so ``_main`` derives again on + the frozen support and the targets see every flag it decides. The + derivation refuses a carried flag that disagrees with the geography and + returns a support whose flags are already complete unchanged. + + The export support comes after the fit: it is the final L0 support's rows + of the frame the targets were materialized from. When those rows all sit + on blocks, their geography decides in_yonkers and in_wilmington, but + writing them would change engine inputs after the weights were fit to + targets computed without them (Wilmington's tax enters SALT, and so an + itemizer's federal income tax), while the fit gates keep the fitted + values. So the export writes nothing. It must carry exactly the flags of + the calibrated support, the last support derived before it, and its + receipt records each flag its own geography decides beyond them as + unavailable (``us_local_jurisdiction_artifact_receipt`` with that + support's rungs). ``receipts[support]`` records each support for the + calibration diagnostics. """ if support not in LOCAL_JURISDICTION_FLAG_SUPPORTS: @@ -7710,7 +7724,23 @@ def _with_local_jurisdiction_flags( f"Unknown local-jurisdiction flag support {support!r}; expected one " f"of {LOCAL_JURISDICTION_FLAG_SUPPORTS}." ) - frame, receipt = rederive_us_local_jurisdiction_flags(frame) + if support == "export": + calibrated = [ + name + for name in LOCAL_JURISDICTION_FLAG_SUPPORTS + if name != "export" and name in receipts + ] + if not calibrated: + raise ValueError( + "The export support keeps the local-jurisdiction flags of the " + "support its targets were materialized from, so the base (and any " + "frozen support) must be derived first." + ) + receipt = us_local_jurisdiction_artifact_receipt( + frame, rungs=receipts[calibrated[-1]]["rungs"] + ) + else: + frame, receipt = rederive_us_local_jurisdiction_flags(frame) receipts[support] = receipt if telemetry is not None: telemetry.stage( @@ -13808,8 +13838,8 @@ def _main(argv: Sequence[str] | None = None) -> int | None: # and the engine would then default every Yonkers, Wilmington, Denver # and Philadelphia resident to False. Derive them from the base's own # geography, refusing a carried flag that disagrees with it. _main - # derives them again after frozen-support selection and on the export - # support. + # derives them again after frozen-support selection, before the targets + # are materialized; the export support keeps the flags the targets saw. local_jurisdiction_flags: dict[str, object] = {} base_frame = _with_local_jurisdiction_flags( base_frame, @@ -15979,8 +16009,11 @@ def _main(argv: Sequence[str] | None = None) -> int | None: ) else: export_frame = _with_l0_refit_weights(base_frame, result) - # The L0 support can drop every row without a block and so decide the - # place-rule flags; every later gate and the written H5 see this frame. + # The weights were fit to targets computed with the calibrated support's + # flags. An L0 support that drops every row without a block decides the + # place-rule flags too, but writing them now would change those inputs, so + # the export keeps the calibrated flags and records the others unavailable. + # Every later gate and the written H5 see this frame. export_frame = _with_local_jurisdiction_flags( export_frame, support="export", From db83dde89cddc5477b6320f5ac4dbb96953a4768 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 10:49:21 -0500 Subject: [PATCH 27/32] Test that a block-only L0 export keeps the income tax its weights were fit to An engine-scenario regression for review round 2 of microcosm#1453, under policyengine-us. The pool holds a Wilmington itemizer on a block ($100,000 of wages, $20,000 of cash gifts) beside a Denver ACS row with no block, so the base derivation decides only the county rung. The test runs the builder's own base and export steps around attach_l0_refit_entity_weights, which keeps only the Wilmington row, and materializes income_tax, salt_deduction and in_wilmington on both supports. The written support's values equal the pool's first row, the ones the refit used. So that the parity is not vacuous, it also materializes the kept row with its own flags derived again (what the export wrote before the fix): in_wilmington is True, the city's earned income tax is $1,250, the SALT deduction is larger and federal income tax is lower. Co-Authored-By: Claude Opus 5.5 --- ...test_us_local_jurisdiction_flags_engine.py | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py index 2b22b63ded..3970b18108 100644 --- a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py +++ b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py @@ -7,16 +7,29 @@ for the resident and zero (or at the nonresident rate) for the neighbour, and stripping the derived flags returns the resident to the neighbour's result, so the flags, not other geography, drive the difference. + +The release builder's export keeps the inputs its targets were computed from: +after a legacy pool becomes block-only through L0 selection, a retained +Wilmington itemizer's ``income_tax`` on the written support is the value the +refit used, though writing ``in_wilmington`` would lower it. """ from __future__ import annotations +import importlib.util + import numpy as np import pytest +from microcosm.build.us_local_jurisdictions import ( + rederive_us_local_jurisdiction_flags, +) from microcosm.build.us_runtime.geography_ladder import ( with_household_us_geography_ladder, ) +from microcosm.build.us_runtime.l0_refit_export import ( + attach_l0_refit_entity_weights, +) from microcosm.frame import Frame from microcosm.frame.adapters.policyengine_us import PolicyEngineUSEngine from test_support.microcosm_build.us_local_jurisdictions import ( @@ -24,6 +37,7 @@ households_on_blocks, us_frame, ) +from test_support.paths import paths_for PERIOD = 2026 FLAGS = { @@ -172,3 +186,93 @@ def test_philadelphia_wage_tax_uses_the_resident_rate_for_residents( assert without_flags["pa_philadelphia_wage_tax"][ ROW["philadelphia"] ] == pytest.approx(wages * nonresident_rate) + + +# A Wilmington worker who itemizes: the city's earned-income tax enters SALT, +# so in_wilmington moves this household's federal income tax. The ACS row has +# no block, as a legacy pool's ACS rows do. +WILMINGTON_ITEMIZER = { + **NO_INPUTS, + "employment_income": 100_000.0, + "charitable_cash_donations": 20_000.0, +} +ACS_RESIDENT = {**NO_INPUTS, "charitable_cash_donations": 0.0} +PARITY_OUTPUTS = ( + "income_tax", + "de_wilmington_earned_income_tax", + "salt_deduction", + "in_wilmington", +) + + +def _release_builder(): + path = ( + paths_for("microcosm-build").repository + / "tools" + / "build_us_fiscal_refresh_release.py" + ) + spec = importlib.util.spec_from_file_location( + "build_us_fiscal_refresh_release", path + ) + module = importlib.util.module_from_spec(spec) + assert spec.loader is not None + spec.loader.exec_module(module) + return module + + +def test_a_block_only_l0_export_keeps_the_income_tax_its_weights_were_fit_to( + engine, +) -> None: + # Review round 2 of the adopted microcosm#1453. The builder materializes + # its targets from the pool, whose ACS row withholds the place rung, and + # the refit fits the weights to those values. The L0 support keeps only + # the Wilmington donor, whose block decides in_wilmington; the export + # keeps the pool's flags, so the target the H5 carries is the one fitted. + builder = _release_builder() + pool = us_frame( + [ + { + "state_fips": 10, + "county_fips": "10003", + "place_fips": "77580", + "block_geoid": "100030001001000", + }, + { + "state_fips": 8, + "county_fips": "08031", + "place_fips": None, + "block_geoid": None, + }, + ], + person_inputs=[[WILMINGTON_ITEMIZER], [ACS_RESIDENT]], + ) + receipts: dict[str, object] = {} + calibrated = builder._with_local_jurisdiction_flags( + pool, support="base", receipts=receipts, telemetry=None + ) + kept = attach_l0_refit_entity_weights( + calibrated, + weight_entity="household", + selected_entity_ids=np.asarray([1]), + selected_weights=np.asarray([5.0]), + reason="L0 support without the ACS row", + ) + exported = builder._with_local_jurisdiction_flags( + kept, support="export", receipts=receipts, telemetry=None + ) + # What the export wrote before this fix: the kept row's own flags. + rewritten, _receipt = rederive_us_local_jurisdiction_flags(kept) + + fitted = dict(engine.materialize(calibrated, PARITY_OUTPUTS, PERIOD)) + written = dict(engine.materialize(exported, PARITY_OUTPUTS, PERIOD)) + flagged = dict(engine.materialize(rewritten, PARITY_OUTPUTS, PERIOD)) + + for output in ("income_tax", "salt_deduction", "in_wilmington"): + np.testing.assert_array_equal(written[output], fitted[output][:1]) + assert not written["in_wilmington"].any() + # The parity is not vacuous: the flag's own geography decides it, and + # writing it moves the fitted target. + assert flagged["in_wilmington"].tolist() == [True] + assert flagged["de_wilmington_earned_income_tax"][0] == pytest.approx(1_250.0) + assert flagged["salt_deduction"][0] > fitted["salt_deduction"][0] + assert flagged["income_tax"][0] < fitted["income_tax"][0] From 4a9859dbd74f0a12663868392b7cde668a2d513d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 16:13:37 -0500 Subject: [PATCH 28/32] Keep the fitted base's flags on the L0/refit export (review round 3) export_us_l0_refit_h5 derived the local-jurisdiction flags on the rows the saved weights keep. When those weights keep only the block-line rows of a pooled base whose ACS rows have no block, the kept rows decide in_yonkers and in_wilmington, so the export wrote inputs the weights were never fit with; the input-mass gate does not fail a column only the export carries. The export now derives the flags on the whole loaded base, the frame the weights were fit on, applies the weights, and holds the kept rows to the base's rungs through us_local_jurisdiction_artifact_receipt, the rule the release builder's export follows since round 2. A flag only the kept rows decide is recorded as unavailable, with the reason. The geography-ladder gate requires every flag a block decides, so by default it refuses that export, and the refusal now says which flags the export withholds and why. A base whose block lies outside its county is refused whichever rows the weights keep. Tests: two engine-free export tests (input parity with the fitted base on the reviewer's Wilmington case; the refusal's message) and an engine scenario test (the written H5 gives the income tax the weights were fit to; writing in_wilmington would lower it). Docs and the changelog fragment follow. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- .../microcosm/build/us_local_jurisdictions.py | 18 +-- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 24 +++- .../build/us_runtime/l0_refit_export.py | 59 +++++++- .../engine_free/us/test_us_l0_refit_export.py | 130 +++++++++++++++++- ...test_us_local_jurisdiction_flags_engine.py | 77 ++++++++++- 6 files changed, 288 insertions(+), 22 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 636db3ffe7..807fad03ad 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection, before it computes its targets, so a base built before this change, or a frozen support that keeps only block-anchored rows, no longer exports without them. The builder's export keeps the flags its targets were computed with: a place-rule flag that only the final L0 support decides is recorded as unavailable, not written, so the written dataset still gives the fitted targets. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection, before it computes its targets, so a base built before this change, or a frozen support that keeps only block-anchored rows, no longer exports without them. The builder's export keeps the flags its targets were computed with, and the L0/refit export keeps those of the base its saved weights were fit on: a flag that only the kept rows decide is recorded as unavailable, not written, so the written dataset still gives the values the weights were fit to. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index a5dd72c404..9d081b1868 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -65,9 +65,10 @@ columns and bytes, and so cannot write the flags, calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses an artifact that lacks a flag its geography decides. A step whose inputs a -larger support fixed (the release builder's export, after its weights were -fit to targets computed on that support) passes that support's rungs, and -keeps exactly that support's flags. +larger support fixed passes that support's rungs, and keeps exactly that +support's flags: the release builder's export, after its weights were fit to +targets computed on that support, and the L0/refit export, whose saved +weights were fit on the base it loads. This module and its registry sit outside ``microcosm.build.us_runtime`` on purpose, and import only the standard library, numpy, pandas and @@ -706,11 +707,12 @@ def us_local_jurisdiction_artifact_receipt( ``rungs`` is for a step whose inputs a larger support fixed: the release builder's export keeps the rows its L0 selection chose from the support - its targets were computed on, and writing a flag only the kept rows - decide would change an input after the weights were fit. The artifact - must then carry exactly the flags of ``rungs``, which must be among its - own rungs, and the receipt records each flag its own geography decides - beyond them as unavailable, with that reason. + its targets were computed on, and the L0/refit export keeps the rows its + saved weights chose from the base they were fit on. Writing a flag only + the kept rows decide would change an input after the weights were fit. + The artifact must then carry exactly the flags of ``rungs``, which must be + among its own rungs, and the receipt records each flag its own geography + decides beyond them as unavailable, with that reason. """ resolved = registry or packaged_us_local_jurisdiction_registry() diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index ba78a80b2b..83af067d62 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -112,9 +112,11 @@ A base H5 built before this registry carries no flags. Two steps start from an existing artifact rather than a geography line, and both call `rederive_us_local_jurisdiction_flags`: -- the L0/refit export (`export_us_l0_refit_h5`) calls it on the selected - support and records the receipt as `local_jurisdiction_flags` in its - summary; and +- the L0/refit export (`export_us_l0_refit_h5`) calls it on the loaded base, + before it applies the saved weights, and the rows the weights keep must + carry exactly the base's flags (see below). It records the export's receipt + as `local_jurisdiction_flags` in its summary, with the flags the base H5 + itself held as `carried_flags`; and - the fiscal refresh release builder calls it on the loaded base or prepared pool, and again on the frozen support when a selection source reduces it, both before it materializes its targets. Its export support, the rows the L0 @@ -155,7 +157,8 @@ whether or not every row has a block. Such a household kept its block from before its county was redrawn, so the place beside the block is not the county's, and nothing in the table says which of the two is right. All three steps stop on such an artifact: the L0/refit export, the release builder and -the annual lane. +the annual lane. The L0/refit export judges the whole loaded base, so it stops +even when the saved weights drop that household. The rungs belong to the whole table, so removing rows can add one: a frozen support or L0 support that keeps only block-anchored donors decides @@ -177,6 +180,19 @@ its own geography decides beyond them as unavailable, with that reason. Such a release carries the flags of an ordinary pooled release. Its own geography still decides the place-rule flags, so the annual lane refuses it as a parent. +The L0/refit export follows the same rule for the same reason: its saved +weights were fit elsewhere, on the base it loads. It derives the flags on that +base before it applies the weights, then calls +`us_local_jurisdiction_artifact_receipt` on the kept rows with the base's +rungs. When the weights keep only the block-anchored rows of a pooled base, +those rows decide `in_yonkers` and `in_wilmington`, but the export writes +neither and its receipt records both as unavailable, with that reason. The +geography-ladder gate requires every flag a block decides, so by default it +refuses that export, and the refusal names the two flags and says why the +export withholds them. With `--allow-geography-ladder-gate-failures` the export +writes the kept rows with the base's flags and records the gate failure in its +summary. + ## Gates Both ladder gates fail: diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py index 7873e034c8..c13955449e 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py @@ -81,7 +81,10 @@ us_line_32_carriers, ) from microcosm.build.us_runtime.local_jurisdictions import ( + JURISDICTION_FLAG_UNAVAILABLE, rederive_us_local_jurisdiction_flags, + us_local_jurisdiction_artifact_receipt, + us_local_jurisdiction_rungs_present, ) from microcosm.build.us_runtime.medicare_take_up import ( US_MEDICARE_TAKE_UP_NONCONSTANT_PERSON_COLUMNS, @@ -558,6 +561,27 @@ def copy_microcosm_root_attrs( return tuple(copied) +def _withheld_flags_note(frame: Frame, receipt: Mapping[str, Any]) -> list[str]: + """Say which flags the export withholds from rows whose geography decides them.""" + + own_rungs = us_local_jurisdiction_rungs_present(frame.table("household")) + withheld = sorted( + flag + for flag, entry in receipt["flags"].items() + if entry["status"] == JURISDICTION_FLAG_UNAVAILABLE + and entry["rule"] in own_rungs + ) + if not withheld: + return [] + return [ + "the export keeps the local-jurisdiction flags of the base its saved " + f"weights were fit on (rungs {receipt['rungs']}), so it does not write " + f"{', '.join(withheld)}, which only the selected households' own " + "geography decides: writing them would change inputs after the weights " + "were fit" + ] + + def export_us_l0_refit_h5( *, base_h5: str | Path, @@ -587,10 +611,20 @@ def export_us_l0_refit_h5( its calibrated weights (microcosm #275/#34): a release whose spine is inconsistent or whose NYC mass collapsed fails by default. - The local-jurisdiction flags are re-derived from the selected support's - own geography before the gate, so a base H5 built before the flags - existed exports them instead of leaving the engine default on every - resident; the summary records the receipt. + The local-jurisdiction flags are those of the base the saved weights were + fit on. The export derives them on the loaded base, from the whole base's + geography, before it applies the weights, so a base H5 built before the + flags existed exports them instead of leaving the engine default on every + resident. It writes no flag that only the selected rows' geography + decides: when the weights keep only the block-anchored rows of a pooled + base whose other rows have no block, those rows decide ``in_yonkers`` and + ``in_wilmington``, and writing either would change an input after the + weights were fit. The summary's receipt records such a flag as + unavailable, with the reason. The geography-ladder gate requires every + flag a block decides, so it refuses that export unless its failures are + allowed, and the refusal names the withheld flags. A base whose carried + flags disagree with its geography, or in which a household's block lies + outside its county, is refused whichever rows the weights keep. """ root_attrs_source = ( @@ -603,9 +637,15 @@ def export_us_l0_refit_h5( weight_key=weight_key, zero_weight_tolerance=zero_weight_tolerance, ) - export_frame, local_jurisdiction_flags = rederive_us_local_jurisdiction_flags( - attach_l0_refit_weights(base_frame, solution) + fitted_frame, fitted_flags = rederive_us_local_jurisdiction_flags(base_frame) + export_frame = attach_l0_refit_weights(fitted_frame, solution) + # The kept rows carry exactly the base's flags; this checks that and + # records each flag only their own geography decides as unavailable. + local_jurisdiction_flags = us_local_jurisdiction_artifact_receipt( + export_frame, rungs=fitted_flags["rungs"] ) + # The receipt has always recorded the flags the base H5 itself held. + local_jurisdiction_flags["carried_flags"] = fitted_flags["carried_flags"] if require_source_columns: assert_required_us_release_source_columns(export_frame) geography_ladder_gate = us_geography_ladder_gate( @@ -615,7 +655,12 @@ def export_us_l0_refit_h5( if require_geography_ladder and not geography_ladder_gate.passed: raise ValueError( "US L0/refit release export failed the geography-ladder gate: " - + "; ".join(geography_ladder_gate.failures) + + "; ".join( + [ + *geography_ladder_gate.failures, + *_withheld_flags_note(export_frame, local_jurisdiction_flags), + ] + ) ) reference_frame = ( load_us_frame(reference_h5) if reference_h5 is not None else base_frame diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py index b61cb6089f..db0d5faf22 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py @@ -15,6 +15,9 @@ export_us_l0_refit_h5, load_l0_refit_npz, ) +from microcosm.build.us_runtime.local_jurisdictions import ( + rederive_us_local_jurisdiction_flags, +) from microcosm.frame import US_SCHEMA, Frame, WeightKind, Weights @@ -1364,6 +1367,131 @@ def test_export_refuses_a_base_whose_block_lies_outside_its_county( input_mass_relative_tolerance=1.0, require_geography_ladder=False, ) - assert "1/1 household row(s) do not" in str(refused.value) + # The export judges the base its weights were fit on, both households. + assert "1/2 household row(s) do not" in str(refused.value) assert "[('361190001001000', '36005')]" in str(refused.value) assert not output.exists() + + +def _frame_with_a_wilmington_donor_beside_an_acs_row() -> Frame: + """Two New Castle County households: a block-line donor and an ACS row. + + Household 20 sits on a Wilmington block. Household 10 has a county but no + block, tract or place, as a legacy pool's ACS rows have, so the table's + own geography decides only the county-rule flags. + """ + + frame = _us_frame() + household = frame.table("household").copy() + household["state_fips"] = np.asarray([10, 10], dtype="int64") + household["congressional_district_geoid"] = np.asarray([1000, 1000], dtype="int64") + household["block_geoid"] = [None, "100030001001000"] + household["tract_geoid"] = [None, "10003000100"] + household["county_fips"] = ["10003", "10003"] + household["county_fips_2023"] = ["10003", "10003"] + household["place_fips"] = [None, "77580"] + household["sldu"] = [None, "001"] + household["sldl"] = [None, "001"] + household["cbsa_code"] = ["37980", "37980"] + tables = {entity: frame.table(entity) for entity in frame.entities} + tables["household"] = household + return Frame(tables, frame.schema, {"household": frame.weights_for("household")}) + + +def _export_the_wilmington_donor( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path, **options: object +) -> tuple[dict[str, object], dict[str, Frame]]: + base_h5 = tmp_path / "base.h5" + base_h5.write_text("base") + written: dict[str, Frame] = {} + monkeypatch.setattr( + l0_refit_export, + "load_us_frame", + lambda path: _frame_with_a_wilmington_donor_beside_an_acs_row(), + ) + monkeypatch.setattr( + l0_refit_export, "copy_microcosm_root_attrs", lambda source, destination: () + ) + + class FakeEngine: + def write_dataset(self, bundle, path, period): + written["bundle"] = bundle + Path(path).write_text("sentinel") + + monkeypatch.setattr(l0_refit_export, "PolicyEngineUSEngine", FakeEngine) + # The saved weights keep household 20, the Wilmington donor, only. + summary = export_us_l0_refit_h5( + base_h5=base_h5, + weights_npz=_l0_refit_npz(tmp_path), + output_h5=tmp_path / "populace_us_2024.h5", + input_mass_relative_tolerance=1.0, + **options, + ) + return summary, written + + +def test_export_writes_no_flag_the_base_its_weights_were_fit_on_did_not_decide( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + # Review round 3 of the adopted microcosm#1453. The saved weights were fit + # on the loaded base, whose ACS row withholds the place rung, and keep + # only the Wilmington donor. The donor's own block decides in_wilmington, + # and writing it would change the donor's local tax, and through SALT an + # itemizer's federal income tax, after the fit. So the export writes the + # base's flags on the rows it keeps, and records the place-rule flags as + # unavailable, with the reason. + summary, written = _export_the_wilmington_donor( + monkeypatch, + tmp_path, + # Two households cannot satisfy national NYC-share bounds. + require_geography_ladder=False, + ) + + # Input parity with the frame the weights were fit on: each written table + # is the kept row of the loaded base with the flags its own geography + # decides, column for column. + fitted, fitted_receipt = rederive_us_local_jurisdiction_flags( + _frame_with_a_wilmington_donor_beside_an_acs_row() + ) + kept = fitted.select(fitted.table("person")["person_household_id"].eq(20)) + for entity in kept.entities: + pd.testing.assert_frame_equal( + written["bundle"].table(entity), kept.table(entity) + ) + assert "in_wilmington" not in written["bundle"].table("household") + receipt = summary["local_jurisdiction_flags"] + assert receipt["rungs"] == ["county"] == fitted_receipt["rungs"] + for flag in ("in_wilmington", "in_yonkers"): + assert receipt["flags"][flag]["status"] == "unavailable" + assert receipt["flags"][flag]["reason"].startswith( + "this artifact's own geography (rungs ['county', 'place']) decides " + "it, but its inputs were fixed on a support with the rungs ['county']" + ) + assert receipt["flags"]["in_denver"]["status"] == "derived" + # The flags the loaded base held: none. + assert receipt["carried_flags"] == [] + # The input-mass gate does not fail a column only the export carries, so + # it would not have caught a written flag either. + assert summary["input_mass_parity"]["passed"] is True + + +def test_export_says_which_flags_it_withholds_when_the_geography_gate_refuses( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + # The kept donor sits on a block, so the geography-ladder gate requires + # every flag the block decides, and the export withholds the two its + # base did not decide. The gate refuses by default, and the refusal says + # why those flags are absent. + with pytest.raises(ValueError, match="failed the geography-ladder gate") as refused: + _export_the_wilmington_donor(monkeypatch, tmp_path) + + message = str(refused.value) + assert "in_wilmington: absent, but this table's place rung decides it" in message + assert ( + "the export keeps the local-jurisdiction flags of the base its saved " + "weights were fit on (rungs ['county']), so it does not write " + "in_wilmington, in_yonkers" in message + ) + assert not (tmp_path / "populace_us_2024.h5").exists() diff --git a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py index 3970b18108..e8fb80e2a0 100644 --- a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py +++ b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py @@ -11,12 +11,15 @@ The release builder's export keeps the inputs its targets were computed from: after a legacy pool becomes block-only through L0 selection, a retained Wilmington itemizer's ``income_tax`` on the written support is the value the -refit used, though writing ``in_wilmington`` would lower it. +refit used, though writing ``in_wilmington`` would lower it. The standalone +L0/refit export keeps the inputs of the base its saved weights were fit on in +the same way. """ from __future__ import annotations import importlib.util +from pathlib import Path import numpy as np import pytest @@ -24,6 +27,7 @@ from microcosm.build.us_local_jurisdictions import ( rederive_us_local_jurisdiction_flags, ) +from microcosm.build.us_runtime import l0_refit_export from microcosm.build.us_runtime.geography_ladder import ( with_household_us_geography_ladder, ) @@ -276,3 +280,74 @@ def test_a_block_only_l0_export_keeps_the_income_tax_its_weights_were_fit_to( assert flagged["de_wilmington_earned_income_tax"][0] == pytest.approx(1_250.0) assert flagged["salt_deduction"][0] > fitted["salt_deduction"][0] assert flagged["income_tax"][0] < fitted["income_tax"][0] + + +def test_a_block_only_saved_weight_export_keeps_the_income_tax_they_were_fit_to( + engine, monkeypatch, tmp_path +) -> None: + # Review round 3 of the adopted microcosm#1453: the standalone export + # (export_us_l0_refit_h5). Two New Castle County itemizers with the same + # wages and gifts, a Wilmington donor on a block and an ACS row with no + # block, so the base decides no place-rule flag. Saved weights fit on + # that base keep only the donor. The export writes the base's inputs, so + # the H5 gives the income tax the weights were fit to. + pool = us_frame( + [ + { + "state_fips": 10, + "county_fips": "10003", + "place_fips": "77580", + "block_geoid": "100030001001000", + }, + { + "state_fips": 10, + "county_fips": "10003", + "place_fips": None, + "block_geoid": None, + }, + ], + person_inputs=[[WILMINGTON_ITEMIZER], [WILMINGTON_ITEMIZER]], + ) + weights_npz = tmp_path / "weights.npz" + np.savez_compressed(weights_npz, weights=np.asarray([2.0, 0.0])) + base_h5 = tmp_path / "base.h5" + base_h5.write_text("base") + captured: dict[str, Frame] = {} + + class CapturingWriter: + def write_dataset(self, frame, path, period): + captured["frame"] = frame + Path(path).write_text("sentinel") + + monkeypatch.setattr(l0_refit_export, "load_us_frame", lambda path: pool) + monkeypatch.setattr( + l0_refit_export, "copy_microcosm_root_attrs", lambda source, destination: () + ) + monkeypatch.setattr(l0_refit_export, "PolicyEngineUSEngine", CapturingWriter) + + summary = l0_refit_export.export_us_l0_refit_h5( + base_h5=base_h5, + weights_npz=weights_npz, + output_h5=tmp_path / "populace_us_2026.h5", + require_source_columns=False, + # Two households cannot satisfy national NYC-share bounds. + require_geography_ladder=False, + ) + fitted_on, _receipt = rederive_us_local_jurisdiction_flags(pool) + # What the export wrote before this fix: the kept row's own flags. + rewritten, _receipt = rederive_us_local_jurisdiction_flags(captured["frame"]) + + fitted = dict(engine.materialize(fitted_on, PARITY_OUTPUTS, PERIOD)) + written = dict(engine.materialize(captured["frame"], PARITY_OUTPUTS, PERIOD)) + flagged = dict(engine.materialize(rewritten, PARITY_OUTPUTS, PERIOD)) + + # The input-mass gate passes either way: a column only the export + # carries is not a failure. + assert summary["input_mass_parity"]["passed"] is True + for output in ("income_tax", "salt_deduction", "in_wilmington"): + np.testing.assert_array_equal(written[output], fitted[output][:1]) + assert not written["in_wilmington"].any() + assert flagged["in_wilmington"].tolist() == [True] + assert flagged["de_wilmington_earned_income_tax"][0] == pytest.approx(1_250.0) + assert flagged["salt_deduction"][0] > fitted["salt_deduction"][0] + assert flagged["income_tax"][0] < fitted["income_tax"][0] From 46ea7d760afb294e6c04311ef911f7b41ad8ef24 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 16:19:51 -0500 Subject: [PATCH 29/32] Draw supports with no rung in the held-selection property (review round 3) Every pool the held-selection property drew had a county on every row, so the support always supplied the county rung and the only flags a selection could add were the place-rule ones. A mutant that gave the special withheld reason to place-rule flags only passed the property. The property's strategy now adds, in half its draws, one or two rows with a state and no county, place or block, so the support can supply no rung and a selection can widen to the county rung or to both. A new explicit example and a named test take a Wilmington donor from a pool whose other row has no county: all four flags are unavailable, each with the reason that the kept row's own geography decides it. The other two properties that share the strategy draw as before. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_local_jurisdictions.py | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py index 491ce9067d..a5aadba32b 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_local_jurisdictions.py @@ -1045,6 +1045,12 @@ def test_rederiving_without_a_county_writes_no_flag() -> None: st.tuples(st.just("block"), st.sampled_from(_NAMES)), st.tuples(st.just("acs"), st.sampled_from(_ACS_COUNTIES)), ) +# A row with a state and no county, place or block. A support that holds one +# supplies no rung, so a selection that drops it can gain both. +_STATES_WITHOUT_A_COUNTY = ("08", "36", "42", "10", "06") +_ROWS_WITHOUT_A_COUNTY = st.tuples( + st.just("state"), st.sampled_from(_STATES_WITHOUT_A_COUNTY) +) def _pooled_household(row: tuple[str, str]) -> dict[str, object]: @@ -1057,6 +1063,13 @@ def _pooled_household(row: tuple[str, str]) -> dict[str, object]: "place_fips": "" if block.place_fips == 0 else f"{block.place_fips:05d}", "block_geoid": f"{block.block_geoid:015d}", } + if kind == "state": + return { + "state_fips": int(value), + "county_fips": None, + "place_fips": None, + "block_geoid": None, + } return { "state_fips": int(value[:2]), "county_fips": value, @@ -1081,8 +1094,13 @@ def _select_households(frame, positions: list[int]): @st.composite -def _pool_and_selection(draw) -> tuple[list[tuple[str, str]], list[int]]: +def _pool_and_selection( + draw, *, rows_without_a_county: bool = False +) -> tuple[list[tuple[str, str]], list[int]]: rows = draw(st.lists(_POOLED_ROWS, min_size=1, max_size=10)) + if rows_without_a_county and draw(st.booleans()): + extra = draw(st.lists(_ROWS_WITHOUT_A_COUNTY, min_size=1, max_size=2)) + rows = draw(st.permutations(rows + extra)) keep = draw(st.sets(st.integers(0, len(rows) - 1), min_size=1)) return rows, sorted(keep) @@ -1256,7 +1274,8 @@ def test_artifact_receipt_matches_the_rederived_receipt_on_a_complete_artifact() case=([("block", "yonkers"), ("block", "wilmington"), ("acs", "08031")], [0, 1]) ) @example(case=([("block", "yonkers"), ("acs", "08031")], [0, 1])) -@given(case=_pool_and_selection()) +@example(case=([("block", "wilmington"), ("state", "10")], [0])) +@given(case=_pool_and_selection(rows_without_a_county=True)) def test_a_selection_held_to_its_supports_rungs_keeps_that_supports_flags( case, ) -> None: @@ -1267,7 +1286,9 @@ def test_a_selection_held_to_its_supports_rungs_keeps_that_supports_flags( # adds is unavailable with the reason. The selection already carries # exactly the support's flags, so a step that holds it to those rungs # writes no input the support's targets were not computed with. When - # the selection adds no rung, the receipt is the unheld one. + # the selection adds no rung, the receipt is the unheld one. A support + # with a row that has no county supplies no rung, so the flags a + # selection adds can be county-rule flags as well as place-rule ones. rows, keep = case derived, derived_receipt = rederive_us_local_jurisdiction_flags(_pooled_frame(rows)) selected = _select_households(derived, keep) @@ -1292,6 +1313,35 @@ def test_a_selection_held_to_its_supports_rungs_keeps_that_supports_flags( assert receipt == us_local_jurisdiction_artifact_receipt(selected) +def test_a_selection_held_to_a_support_with_no_rung_says_why_for_every_flag() -> None: + # Review round 3 of the adopted microcosm#1453. The pool's second row has + # a state and no county, so the support supplies no rung and decides no + # flag. The kept Wilmington donor's own block decides all four, the + # county-rule flags too, so each of the four is unavailable with the + # reason that its own geography decides it, not that no rung exists. + derived, derived_receipt = rederive_us_local_jurisdiction_flags( + _pooled_frame([("block", "wilmington"), ("state", "10")]) + ) + assert derived_receipt["rungs"] == [] + selected = _select_households(derived, [0]) + own = rederive_us_local_jurisdiction_flags(selected)[1] + assert own["rungs"] == list(BLOCK_GEOGRAPHY_RUNGS) + + receipt = us_local_jurisdiction_artifact_receipt(selected, rungs=[]) + + assert receipt["rungs"] == [] + assert receipt["carried_flags"] == [] + assert sorted(receipt["flags"]) == sorted(EXPECTED_RULES) + for flag in EXPECTED_RULES: + assert receipt["flags"][flag]["status"] == JURISDICTION_FLAG_UNAVAILABLE + assert receipt["flags"][flag]["reason"] == ( + "this artifact's own geography (rungs ['county', 'place']) decides " + "it, but its inputs were fixed on a support with the rungs [], so " + "the flag is not written and the engine default (False) applies to " + "every row" + ) + + def test_a_selection_cannot_be_held_to_rungs_its_geography_does_not_supply() -> None: # The pool's ACS row has no block, so its geography supplies the county # rung only, and the place rung's flags cannot be required of it. From 68effae8218a424f3f9529ace3446eabc3fa7888 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 16:22:09 -0500 Subject: [PATCH 30/32] Say what the release export does with the flags in its telemetry (review round 3) Since round 2 the release builder's export stage derives nothing: it keeps the local-jurisdiction flags of the support the targets were materialized from and checks them against the export support's geography. Its telemetry message still said "Derived local-jurisdiction flags from the export support's geography." The export stage now says it kept and checked the flags of the base or frozen support; the base and frozen-support stages keep their message. The structured fields (rungs, carried flags, each flag's status) are unchanged. The support-sequence builder test now reads each stage's message. Co-Authored-By: Claude Opus 5.5 --- .../us/test_us_fiscal_refresh_builder.py | 9 +++++++++ tools/build_us_fiscal_refresh_release.py | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py index b73dbe491a..86eccf4f73 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_refresh_builder.py @@ -2975,6 +2975,15 @@ def derive(frame, support): "local_jurisdiction_flags_export", ] assert telemetry.stages[1][1]["rungs"] == ["county", "place"] + # The export's message says what it does: it keeps and checks the flags + # of the support the targets were materialized from (review round 3). + messages = [details["message"] for _name, details in telemetry.stages] + assert messages[1].startswith("Derived local-jurisdiction flags") + for message in messages[2:]: + assert message.startswith( + "Kept the local-jurisdiction flags of the frozen support, which the " + "targets were materialized from" + ) with pytest.raises(ValueError, match="Unknown local-jurisdiction flag support"): derive(exported, "selected") diff --git a/tools/build_us_fiscal_refresh_release.py b/tools/build_us_fiscal_refresh_release.py index 8aa50c8fef..ea0085dd6a 100644 --- a/tools/build_us_fiscal_refresh_release.py +++ b/tools/build_us_fiscal_refresh_release.py @@ -7739,16 +7739,22 @@ def _with_local_jurisdiction_flags( receipt = us_local_jurisdiction_artifact_receipt( frame, rungs=receipts[calibrated[-1]]["rungs"] ) + message = ( + "Kept the local-jurisdiction flags of the " + f"{calibrated[-1].replace('_', ' ')}, which the targets were " + "materialized from, on the export support and checked them against " + "its geography." + ) else: frame, receipt = rederive_us_local_jurisdiction_flags(frame) + message = ( + f"Derived local-jurisdiction flags from the {support} support's geography." + ) receipts[support] = receipt if telemetry is not None: telemetry.stage( f"local_jurisdiction_flags_{support}", - message=( - f"Derived local-jurisdiction flags from the {support} support's " - "geography." - ), + message=message, rungs=receipt["rungs"], carried_flags=receipt["carried_flags"], flag_status={ From 87a03db124aa5110033ba7303a941f40d33afac3 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 18:08:48 -0500 Subject: [PATCH 31/32] Scope the exports' flag promise to the rows their weights keep (review round 4) The changelog said the L0/refit export's written dataset still gives the values its saved weights were fit to. On a base that carries no flags it does not: the export derives the flags the whole base decides, and a fit that read that H5 unchanged saw False. On a base whose households all sit on blocks, a Wilmington itemizer gains in_wilmington, and its 2026 federal income tax trails the value the fit computed by $275. The changelog now claims what both exports enforce: neither writes a flag that only the rows its weights keep decide. The export's docstring and US_LOCAL_JURISDICTIONS.md drop the same broader claim and say that on a base that predates the flags, the derived flags can change a value the fit computed. No code changes. Co-Authored-By: Claude Opus 5.5 --- .../us-local-jurisdiction-flags.added.md | 2 +- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 27 ++++++++++-------- .../build/us_runtime/l0_refit_export.py | 28 ++++++++++--------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/changelog.d/us-local-jurisdiction-flags.added.md b/changelog.d/us-local-jurisdiction-flags.added.md index 807fad03ad..ec522f8680 100644 --- a/changelog.d/us-local-jurisdiction-flags.added.md +++ b/changelog.d/us-local-jurisdiction-flags.added.md @@ -1 +1 @@ -Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection, before it computes its targets, so a base built before this change, or a frozen support that keeps only block-anchored rows, no longer exports without them. The builder's export keeps the flags its targets were computed with, and the L0/refit export keeps those of the base its saved weights were fit on: a flag that only the kept rows decide is recorded as unavailable, not written, so the written dataset still gives the values the weights were fit to. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. +Derive the policyengine-us input-only local flags `in_denver`, `in_yonkers`, `in_wilmington` and `pa_philadelphia_wage_tax_resident` from household geography through a SHA-pinned registry checked against the 2020 Gazetteer, P.L. 94-171 counts and the block ladder. The block-ladder line writes all four; the PUMA line, and the pooled ACS line with its PUMA ladder, write the county-rule flags and record the place-rule flags (Yonkers, Wilmington) as unavailable instead of writing `False`. Under the opt-in `--location-rule block_v1`, every line that draws a block derives all four from that block's county and place, after the draw. The L0/refit export and the fiscal refresh release builder re-derive the flags from an existing base's own geography, and the builder derives them again after frozen-support selection, before it computes its targets, so a base built before this change, or a frozen support that keeps only block-anchored rows, no longer exports without them. On export, the builder keeps the flags it computed its targets with, and the L0/refit export writes those its whole base's geography decides. Neither export writes a flag that only the rows its weights keep decide, and each records such a flag as unavailable. Both ladder gates now fail a table that lacks a flag its geography decides. The annual static-aging lane, which keeps its parent's columns and base-year bytes, now refuses a parent that lacks or contradicts a flag its geography decides, before any model work, and records the parent's flag receipt in the candidate manifest. The registry and its module live in `microcosm.build.us_local_jurisdictions`, outside `us_runtime` (which re-exports them), so that check never imports `us_runtime`, whose package import asserts the engine ABI lock wherever policyengine-us is installed. diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index 83af067d62..a7fa081c22 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -180,18 +180,21 @@ its own geography decides beyond them as unavailable, with that reason. Such a release carries the flags of an ordinary pooled release. Its own geography still decides the place-rule flags, so the annual lane refuses it as a parent. -The L0/refit export follows the same rule for the same reason: its saved -weights were fit elsewhere, on the base it loads. It derives the flags on that -base before it applies the weights, then calls -`us_local_jurisdiction_artifact_receipt` on the kept rows with the base's -rungs. When the weights keep only the block-anchored rows of a pooled base, -those rows decide `in_yonkers` and `in_wilmington`, but the export writes -neither and its receipt records both as unavailable, with that reason. The -geography-ladder gate requires every flag a block decides, so by default it -refuses that export, and the refusal names the two flags and says why the -export withholds them. With `--allow-geography-ladder-gate-failures` the export -writes the kept rows with the base's flags and records the gate failure in its -summary. +The L0/refit export follows the same rule. Its saved weights come from a fit +on the base it loads, so the export writes no flag that only the rows those +weights keep decide. It derives the flags on that whole base before it applies +the weights, then calls `us_local_jurisdiction_artifact_receipt` on the kept +rows with the base's rungs. A base H5 that predates the flags carries none, +and a fit that reads it unchanged sees the engine default, `False`. On such a +base the flags the export derives can change a value the fit computed, such +as a Wilmington itemizer's federal income tax. When the weights keep only the +block-anchored rows of a pooled base, those rows decide `in_yonkers` and +`in_wilmington`, but the export writes neither and its receipt records both as +unavailable, with that reason. The geography-ladder gate requires every flag a +block decides, so by default it refuses that export, and the refusal names the +two flags and says why the export withholds them. With +`--allow-geography-ladder-gate-failures` the export writes the kept rows with +the base's flags and records the gate failure in its summary. ## Gates diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py index c13955449e..11e19ab270 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py @@ -611,20 +611,22 @@ def export_us_l0_refit_h5( its calibrated weights (microcosm #275/#34): a release whose spine is inconsistent or whose NYC mass collapsed fails by default. - The local-jurisdiction flags are those of the base the saved weights were - fit on. The export derives them on the loaded base, from the whole base's - geography, before it applies the weights, so a base H5 built before the - flags existed exports them instead of leaving the engine default on every - resident. It writes no flag that only the selected rows' geography - decides: when the weights keep only the block-anchored rows of a pooled + The export writes the local-jurisdiction flags that the whole loaded + base's geography decides, and derives them before it applies the weights. + It therefore writes them for a base H5 that predates the flags, instead + of leaving the engine default on every resident. A fit that reads such an + H5 unchanged sees that default, so the written flags can change a value + the fit computed, such as a Wilmington itemizer's federal income tax. The + export writes no flag that only the selected rows' geography decides. For + example, when the weights keep only the block-anchored rows of a pooled base whose other rows have no block, those rows decide ``in_yonkers`` and - ``in_wilmington``, and writing either would change an input after the - weights were fit. The summary's receipt records such a flag as - unavailable, with the reason. The geography-ladder gate requires every - flag a block decides, so it refuses that export unless its failures are - allowed, and the refusal names the withheld flags. A base whose carried - flags disagree with its geography, or in which a household's block lies - outside its county, is refused whichever rows the weights keep. + ``in_wilmington``. Writing either would change an input after the fit. + The summary's receipt records such a flag as unavailable, with the + reason. The geography-ladder gate requires every flag a block decides, so + it refuses that export unless its failures are allowed, and the refusal + names the withheld flags. A base whose carried flags disagree with its + geography, or in which a household's block lies outside its county, is + refused whichever rows the weights keep. """ root_attrs_source = ( From 59e14835e62396b4f699d15eb479e2372c28e1f7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 18:34:36 -0500 Subject: [PATCH 32/32] Say what the L0/refit export checks of its saved weights (review round 4) The round-4 verify found three sentences that still told the reader the L0/refit export's saved weights come from a fit on the base it loads. `load_l0_refit_npz` checks that pairing by household count alone. On a base that carries no flags, the export writes the flags the whole base's geography decides, which a fit on the stored base never read. - F1: the engine scenario module docstring now says the export withholds `in_wilmington` when the rows its saved weights keep decide it and the base it loads does not. - F2: the geography-gate refusal note says the export writes only the flags its whole base's geography decides; the pinned test string follows. - F3: US_LOCAL_JURISDICTIONS.md says the export assumes that a fit on the base it loads produced its saved weights, and that `load_l0_refit_npz` checks that assumption by household count alone. - The two `us_local_jurisdictions.py` docstrings that stated the same pairing as fact now say the L0/refit export assumes it. Co-Authored-By: Claude Opus 5.5 --- .../microcosm/build/us_local_jurisdictions.py | 22 ++++++++++--------- .../us_runtime/US_LOCAL_JURISDICTIONS.md | 7 +++--- .../build/us_runtime/l0_refit_export.py | 7 +++--- .../engine_free/us/test_us_l0_refit_export.py | 7 +++--- ...test_us_local_jurisdiction_flags_engine.py | 4 ++-- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py index 9d081b1868..062d8a6ded 100644 --- a/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py +++ b/packages/microcosm-build/src/microcosm/build/us_local_jurisdictions.py @@ -65,10 +65,11 @@ columns and bytes, and so cannot write the flags, calls :func:`us_local_jurisdiction_artifact_receipt` instead, which refuses an artifact that lacks a flag its geography decides. A step whose inputs a -larger support fixed passes that support's rungs, and keeps exactly that -support's flags: the release builder's export, after its weights were fit to -targets computed on that support, and the L0/refit export, whose saved -weights were fit on the base it loads. +larger support fixed passes that support's rungs, and carries the flags those +rungs decide and no others. The release builder's export passes the rungs of +the support it computed its targets on. The L0/refit export passes the rungs +of the whole base it loads, and assumes that a fit on that base produced its +saved weights. This module and its registry sit outside ``microcosm.build.us_runtime`` on purpose, and import only the standard library, numpy, pandas and @@ -705,12 +706,13 @@ def us_local_jurisdiction_artifact_receipt( household's block lies outside its county. The receipt has the shape :func:`rederive_us_local_jurisdiction_flags` returns. - ``rungs`` is for a step whose inputs a larger support fixed: the release - builder's export keeps the rows its L0 selection chose from the support - its targets were computed on, and the L0/refit export keeps the rows its - saved weights chose from the base they were fit on. Writing a flag only - the kept rows decide would change an input after the weights were fit. - The artifact must then carry exactly the flags of ``rungs``, which must be + A step whose inputs a larger support fixed passes that support's + ``rungs``. The release builder's export keeps the rows its L0 selection + chose from the support it computed its targets on. The L0/refit export + keeps the rows its saved weights chose from the base it loads, and + assumes that a fit on that base produced those weights. Writing a flag + only the kept rows decide would change an input after the fit. The + artifact must then carry exactly the flags of ``rungs``, which must be among its own rungs, and the receipt records each flag its own geography decides beyond them as unavailable, with that reason. """ diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md index a7fa081c22..2cefea47d3 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/US_LOCAL_JURISDICTIONS.md @@ -180,9 +180,10 @@ its own geography decides beyond them as unavailable, with that reason. Such a release carries the flags of an ordinary pooled release. Its own geography still decides the place-rule flags, so the annual lane refuses it as a parent. -The L0/refit export follows the same rule. Its saved weights come from a fit -on the base it loads, so the export writes no flag that only the rows those -weights keep decide. It derives the flags on that whole base before it applies +The L0/refit export follows the same rule. It assumes that a fit on the base it +loads produced its saved weights, so it writes no flag that only the rows those +weights keep decide. `load_l0_refit_npz` checks that assumption by household +count alone. The export derives the flags on that whole base before it applies the weights, then calls `us_local_jurisdiction_artifact_receipt` on the kept rows with the base's rungs. A base H5 that predates the flags carries none, and a fit that reads it unchanged sees the engine default, `False`. On such a diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py index 11e19ab270..d512c69886 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/l0_refit_export.py @@ -574,11 +574,10 @@ def _withheld_flags_note(frame: Frame, receipt: Mapping[str, Any]) -> list[str]: if not withheld: return [] return [ - "the export keeps the local-jurisdiction flags of the base its saved " - f"weights were fit on (rungs {receipt['rungs']}), so it does not write " + "the export writes only the local-jurisdiction flags its whole base's " + f"geography decides (rungs {receipt['rungs']}), so it does not write " f"{', '.join(withheld)}, which only the selected households' own " - "geography decides: writing them would change inputs after the weights " - "were fit" + "geography decides" ] diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py index db0d5faf22..91026e7ec8 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_l0_refit_export.py @@ -1490,8 +1490,9 @@ def test_export_says_which_flags_it_withholds_when_the_geography_gate_refuses( message = str(refused.value) assert "in_wilmington: absent, but this table's place rung decides it" in message assert ( - "the export keeps the local-jurisdiction flags of the base its saved " - "weights were fit on (rungs ['county']), so it does not write " - "in_wilmington, in_yonkers" in message + "the export writes only the local-jurisdiction flags its whole base's " + "geography decides (rungs ['county']), so it does not write " + "in_wilmington, in_yonkers, which only the selected households' own " + "geography decides" in message ) assert not (tmp_path / "populace_us_2024.h5").exists() diff --git a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py index e8fb80e2a0..d8d24f314d 100644 --- a/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py +++ b/packages/microcosm-build/tests/engine_scenario/us/test_us_local_jurisdiction_flags_engine.py @@ -12,8 +12,8 @@ after a legacy pool becomes block-only through L0 selection, a retained Wilmington itemizer's ``income_tax`` on the written support is the value the refit used, though writing ``in_wilmington`` would lower it. The standalone -L0/refit export keeps the inputs of the base its saved weights were fit on in -the same way. +L0/refit export likewise withholds ``in_wilmington`` when the rows its saved +weights keep decide it and the base it loads does not. """ from __future__ import annotations