Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
c2bc06f
test: declare capital gains tail stratum support
MaxGhenis Aug 9, 2026
9f184a0
fix: declare capital gains tail stratum support
MaxGhenis Aug 9, 2026
54d2dee
fix: bind tail support into stacked authority
MaxGhenis Aug 9, 2026
054fb63
docs: start issue 653 progress journal
MaxGhenis Aug 10, 2026
d6bba48
docs: record issue 653 mechanism audit
MaxGhenis Aug 10, 2026
021c9ba
test: declare late producer DAG doctrine
MaxGhenis Aug 10, 2026
63a3451
feat: add deterministic late producer DAG
MaxGhenis Aug 10, 2026
2f4962f
fix: make qualified tuition an upstream DAG input
MaxGhenis Aug 10, 2026
442d1d3
feat: declare canonical late producer registry
MaxGhenis Aug 10, 2026
3d21624
refactor: expose single late source producers
MaxGhenis Aug 10, 2026
897c1a1
fix: gate every declared late producer input
MaxGhenis Aug 10, 2026
923ae9a
feat: execute the complete late producer DAG
MaxGhenis Aug 10, 2026
4394649
docs: publish the complete late producer DAG
MaxGhenis Aug 10, 2026
170cd6a
test: register the late DAG with spine blindness
MaxGhenis Aug 10, 2026
cacfce2
test: record complete issue 653 verification
MaxGhenis Aug 10, 2026
e9b7fef
docs: record final late DAG audit gaps
MaxGhenis Aug 10, 2026
12d0dcf
test: expose remaining late input contract gaps
MaxGhenis Aug 10, 2026
6540cd7
fix: align late input contracts with strict callbacks
MaxGhenis Aug 10, 2026
f015c7a
test: distinguish absent from invalid late inputs
MaxGhenis Aug 10, 2026
540eef7
fix: refuse invalid late inputs without absence escape
MaxGhenis Aug 10, 2026
39eca77
fix: require exact late readiness surfaces
MaxGhenis Aug 10, 2026
8ba01d3
test: require explicit late source finalizer node
MaxGhenis Aug 10, 2026
a74671d
feat: declare the late source finalizer producer
MaxGhenis Aug 10, 2026
24187a4
test: expose undeclared transfer provenance inputs
MaxGhenis Aug 10, 2026
5f1da5a
fix: bind complete late validation inputs
MaxGhenis Aug 10, 2026
54724ab
docs: refresh microcosm 653 progress
MaxGhenis Aug 10, 2026
54e225b
test: require content-bound late DAG receipts
MaxGhenis Aug 10, 2026
256393c
feat: bind late DAG receipts to frame content
MaxGhenis Aug 10, 2026
f6423c5
feat: carry late DAG authority in checkpoints
MaxGhenis Aug 10, 2026
b78a3d7
feat: version late transition receipt doctrine
MaxGhenis Aug 10, 2026
d3b94db
test: require H5 late transition authority
MaxGhenis Aug 10, 2026
82a833e
feat: propagate late DAG transition authority
MaxGhenis Aug 10, 2026
b50c62d
fix: bind H5 loads to late transition authority
MaxGhenis Aug 10, 2026
db24a1c
docs: publish complete late dependency DAG
MaxGhenis Aug 10, 2026
81d2737
test: bind tool fixtures to late DAG authority
MaxGhenis Aug 10, 2026
e9e41ed
docs: record late authority completion
MaxGhenis Aug 10, 2026
dae623c
test: reject insufficient producer coverage
MaxGhenis Aug 10, 2026
72ff1c2
fix: validate producer output scope coverage
MaxGhenis Aug 10, 2026
4fd94a3
feat: declare late external producer inputs
MaxGhenis Aug 10, 2026
ff39cef
test: require complete late external inputs
MaxGhenis Aug 10, 2026
95a642f
refactor: name late external resource inputs
MaxGhenis Aug 10, 2026
fb9f9f5
test: preserve legacy H5 envelope compatibility
MaxGhenis Aug 10, 2026
f8071de
fix: preserve legacy pool manifest loading
MaxGhenis Aug 10, 2026
3b893ef
fix: hash late-stage tables canonically
MaxGhenis Aug 10, 2026
2978bb5
test: require bound late external resources
MaxGhenis Aug 10, 2026
d89b6a4
fix: isolate legacy pool envelope identity
MaxGhenis Aug 10, 2026
abe968a
fix: bind late producer external resources
MaxGhenis Aug 10, 2026
3f098ce
fix: authenticate late primary QRF inputs
MaxGhenis Aug 10, 2026
64580a4
test: reject forged late resource evidence
MaxGhenis Aug 10, 2026
470b0fe
docs: bind late external resource doctrine
MaxGhenis Aug 10, 2026
830b0ce
test: bind H5 late resource fixtures
MaxGhenis Aug 10, 2026
0d3c412
fix: declare late source execution controls
MaxGhenis Aug 10, 2026
57e58c4
fix: declare ACS earnings universe producer
MaxGhenis Aug 10, 2026
f908fe1
fix: reconcile late producer readiness evidence
MaxGhenis Aug 10, 2026
025a0a6
fix: preserve and fence legacy pool envelope
MaxGhenis Aug 10, 2026
f508324
docs: publish final late producer graph
MaxGhenis Aug 10, 2026
356eb88
docs: clarify late zero and version doctrine
MaxGhenis Aug 10, 2026
ea06328
test: preserve exact-k legacy pool fixture
MaxGhenis Aug 10, 2026
47ec32e
style: order late producer imports
MaxGhenis Aug 10, 2026
2a3c907
test: expose late DAG integrity gaps
MaxGhenis Aug 10, 2026
6c28949
fix: complete ACS universe input binding
MaxGhenis Aug 10, 2026
4e5c300
fix: reconcile late execution receipts
MaxGhenis Aug 10, 2026
579ec87
fix: require positive legacy pool identity
MaxGhenis Aug 10, 2026
0bfbf55
test: bind remaining late callback controls
MaxGhenis Aug 10, 2026
326c113
fix: bind source callback and finalizer inputs
MaxGhenis Aug 10, 2026
f5f0400
fix: bind primary and transfer callback inputs
MaxGhenis Aug 10, 2026
6ca065a
fix: bind complete late runtime semantics
MaxGhenis Aug 10, 2026
3f4b896
test: prove stale late resources block resume
MaxGhenis Aug 10, 2026
f13dfaa
fix: bind source output families explicitly
MaxGhenis Aug 10, 2026
d390fe7
docs: publish complete late dependency contract
MaxGhenis Aug 10, 2026
f1a5994
docs: record final verification matrix
MaxGhenis Aug 10, 2026
a9fc7d1
docs: finalize issue 653 handoff
MaxGhenis Aug 10, 2026
5dee5a8
docs: start final 652 653 QA ledger
MaxGhenis Aug 10, 2026
a1b1f48
docs: record final 652 653 QA evidence
MaxGhenis Aug 10, 2026
27b07c7
docs: restore root journals after final QA
MaxGhenis Aug 10, 2026
0033d89
docs: start round 8 cross-origin audit ledger
MaxGhenis Aug 11, 2026
0aa7a98
docs: record round 8 mechanism adjudication
MaxGhenis Aug 11, 2026
d172da1
fix: scope origin-exclusive late inputs
MaxGhenis Aug 11, 2026
87ac3ea
test: enforce cross-origin late input scopes
MaxGhenis Aug 11, 2026
d9e6991
docs: record round 8 proof matrix
MaxGhenis Aug 11, 2026
14de14c
docs: mark round 8 ready for smoke
MaxGhenis Aug 11, 2026
c478747
docs: start round 9 dtype audit
MaxGhenis Aug 11, 2026
082756b
docs: adjudicate round 9 dtype mechanism
MaxGhenis Aug 11, 2026
0cbcda7
test: expose primary PUF boolean materialization
MaxGhenis Aug 11, 2026
3af99c9
fix: preserve canonical late boolean dtypes
MaxGhenis Aug 11, 2026
5f3713b
docs: record round 9 focused proofs
MaxGhenis Aug 11, 2026
f06e007
test: require canonical adult-care boolean dtype
MaxGhenis Aug 11, 2026
1a67689
fix: weight monetary allocations from boolean incidence
MaxGhenis Aug 11, 2026
6a77f66
fix: validate boolean allocation bases by family
MaxGhenis Aug 11, 2026
6ed74f6
docs: record round 9 final proof
MaxGhenis Aug 11, 2026
1abb425
Keep root journals out of the PR (base state)
MaxGhenis Aug 11, 2026
0e6cfae
Retrigger CI
MaxGhenis Aug 12, 2026
2dae7fa
docs: start round 10 overlap ownership audit
MaxGhenis Aug 12, 2026
261f521
docs: adjudicate round 10 overlap mechanism
MaxGhenis Aug 12, 2026
f0c5ce8
test: declare late overlap ownership
MaxGhenis Aug 12, 2026
9ef8216
feat: bind late overlap ownership
MaxGhenis Aug 12, 2026
4d1adef
fix: preserve source-owned tail overlap bytes
MaxGhenis Aug 12, 2026
ae3c12d
docs: record round 10 implementation
MaxGhenis Aug 12, 2026
1e87513
docs: record late overlap ownership
MaxGhenis Aug 12, 2026
4742872
test: bind education overlap no-op at runtime
MaxGhenis Aug 12, 2026
fbc55cb
test: pin certified overlap owner matrix
MaxGhenis Aug 12, 2026
3439bf2
test: exhaust late callback overlap surface
MaxGhenis Aug 12, 2026
a816f96
test: classify late ownership provenance
MaxGhenis Aug 12, 2026
dbac19a
fix: fail closed on overlap passthrough omission
MaxGhenis Aug 12, 2026
740a2df
docs: close round 10 review
MaxGhenis Aug 12, 2026
0afc7bd
docs: record round 10 proof
MaxGhenis Aug 12, 2026
22e4b62
docs: restore root progress baseline
MaxGhenis Aug 12, 2026
cd4faa3
Merge remote-tracking branch 'origin/main' into tail-stratum-support-652
MaxGhenis Aug 12, 2026
21b59fa
docs: start round 11 checkpoint dtype audit
MaxGhenis Aug 12, 2026
d25cdd8
docs: record round 11 checkpoint audit
MaxGhenis Aug 12, 2026
7c6428e
test: specify nullable boolean checkpoints
MaxGhenis Aug 12, 2026
f7d5400
test: harden checkpoint compatibility matrix
MaxGhenis Aug 12, 2026
d1d0657
fix: serialize nullable boolean checkpoints losslessly
MaxGhenis Aug 12, 2026
89dc446
docs: record round 11 focused proof
MaxGhenis Aug 12, 2026
725d932
docs: record exact issue 583 proof
MaxGhenis Aug 12, 2026
292a2b1
docs: record full workspace proof
MaxGhenis Aug 12, 2026
2d0aa1f
docs: record UK checkpoint compatibility proof
MaxGhenis Aug 12, 2026
1815b8a
docs: record round 11 verdict prediction
MaxGhenis Aug 12, 2026
a16459e
fix: reject empty nullable checkpoint masks
MaxGhenis Aug 12, 2026
bb2b349
docs: finalize round 11 proof
MaxGhenis Aug 12, 2026
8ba5527
Keep root journals at base state
MaxGhenis Aug 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/652-capital-gains-tail-thin-strata.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Declare capital-gains tail support per filing status: require one eligible unique single-tax-unit PUF-detail recipient household per selected q99.5 donor, skip a thin status as a whole with a named and counted `insufficient_support` receipt, and reject altered receipts at terminal gates. Preserve byte-exact attachment for adequate statuses and unchanged full-scale output. Replace the fixed post-clone source-then-transfer sequence with an import-validated 38-producer/71-edge dependency DAG whose readiness fence derives the byte-stable order, separates missing inputs from invalid finite numerics, rejects named cycles and unfilled inputs, transfers PUF SSTB income before adult care and tuition before education, and makes the ACS earnings-universe producer, all sixteen source producers, and their once-only finalizer explicit. Content-hash every declared input alternative, reconciled readiness row, output, callback receipt, execution row, and entry/output frame; anchor the signed chain in immutable frame metadata and carry its independent authority through version-9 stacked authority, outer stacked materializer v10, version-6 stacked pool checkpoints, and schema-7 pool manifests and consumers while preserving the retiring legacy schema-4/materializer-3 bytes and rejecting stacked-envelope downgrade attempts. Bind the primary donor bytes, routed QRF bank and sidecar, exact optional allocation/passthrough reads, worker controls, once-resolved tail spec/SOI assets and gates, all nineteen transfer predictor/codec/model configurations and bank identities, all sixteen source runtime configurations—including packaged `SourceStageSpec` identities for the fifteen manifest-backed callbacks—finalizer doctrine, and the ACS universe runtime rule/config through exact kind-specific schema-v1/v2/v3 resource evidence in late-registry schema v14/receipt schema v3. Bind every virtual-resource resolution mode into the outer checkpoint identity, prove current checkpoint discovery succeeds and stale resource semantics fail, require adult-care transfer's tax-unit role before dispatch, keep Schedule-D ownership in the whole-pool derive rather than bounded transfer side effects, and reject shallow, forged, stale, identityless, runtime-drifted, or cross-producer absence resources before their callbacks. Scope ACS-only `TYPEHUGQ` readiness and structural output coverage to ACS-origin rows, keep the 1,688 ASEC-origin structural nulls untouched, reject any ACS-side null, and retire whole-pool `RELSHIPP`, `TEN`, and `H_TENURE` transfer fallbacks in favor of canonical dual-origin predictors. Preserve all canonical late-stage boolean outputs as nullable booleans at primary-PUF and source-merge materialization seams, fail closed on numeric or object family drift across every registry-declared late write, and retain boolean dtype through per-stratum tail cloning. Serialize pandas nullable booleans through conditional frame-checkpoint schema v3 as canonical NumPy-bool values plus an explicit lossless null mask only when absences exist, restore the logical nullable family on load, reject malformed or downgraded encodings, and retain byte-identical schema-v2 generic, UK, and legacy artifacts when no nullable boolean is present. Declare the exact final owner for every origin and clone role of qualified tuition, traditional IRA contributions, and self-employed pension contributions in a content-addressed 18-row receipt bound into late-registry schema v15 and the tail manifest; prove education is byte-exact consume-only, mirror the two source-owned ASEC retirement values from clone 1 to clone 2 by assembly-unique source ID, and reject any unregistered recipient-owned or tail-owned dual-write intersection without weakening the terminal preservation guard.
698 changes: 661 additions & 37 deletions docs/us-multispine-operator-ordering.md

Large diffs are not rendered by default.

167 changes: 159 additions & 8 deletions packages/microcosm-build/src/microcosm/build/frame_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
"write_frame_checkpoint",
]

FRAME_CHECKPOINT_SCHEMA_VERSION = 2
FRAME_CHECKPOINT_SCHEMA_VERSION = 3
_LEGACY_FRAME_CHECKPOINT_SCHEMA_VERSION = 2
_SUPPORTED_FRAME_CHECKPOINT_SCHEMA_VERSIONS = frozenset(
{_LEGACY_FRAME_CHECKPOINT_SCHEMA_VERSION, FRAME_CHECKPOINT_SCHEMA_VERSION}
)

_ARTIFACT_KIND = "populace_frame_checkpoint"
_ROOT = "_populace_frame_checkpoint"
Expand All @@ -50,6 +54,7 @@
_ENCODING_DATETIME = "datetime64"
_ENCODING_TIMEDELTA = "timedelta64"
_ENCODING_OBJECT = "object_scalars_v1"
_ENCODING_NULLABLE_BOOLEAN = "nullable_boolean_v1"

_TAG_NONE = 0
_TAG_PD_NA = 1
Expand Down Expand Up @@ -339,10 +344,26 @@ def _checkpoint_metadata(
}
)

strata_spec = _series_spec(frame.strata, label="strata")
uses_nullable_boolean = any(
column.get("encoding") == _ENCODING_NULLABLE_BOOLEAN
for table in table_specs
for column in table["columns"]
) or any(
table["index"].get("encoding") == _ENCODING_NULLABLE_BOOLEAN
for table in table_specs
)
uses_nullable_boolean = uses_nullable_boolean or (
strata_spec.get("encoding") == _ENCODING_NULLABLE_BOOLEAN
)
schema = frame.schema
return {
"artifact_kind": _ARTIFACT_KIND,
"schema_version": FRAME_CHECKPOINT_SCHEMA_VERSION,
"schema_version": (
FRAME_CHECKPOINT_SCHEMA_VERSION
if uses_nullable_boolean
else _LEGACY_FRAME_CHECKPOINT_SCHEMA_VERSION
),
"schema": {
"person_entity": schema.person_entity,
"group_entities": list(schema.group_entities),
Expand All @@ -368,7 +389,7 @@ def _checkpoint_metadata(
if "household" in frame.weighted_entities
else None
),
"strata": _series_spec(frame.strata, label="strata"),
"strata": strata_spec,
"mass_log": [_mass_change_payload(record) for record in frame.mass_log],
"external_metadata": external_metadata,
}
Expand All @@ -380,7 +401,7 @@ def _frame_tables(frame: Frame) -> tuple[tuple[str, pd.DataFrame], ...]:
return (*entities, *links)


def _series_spec(series: pd.Series, *, label: str) -> dict[str, str]:
def _series_spec(series: pd.Series, *, label: str) -> dict[str, object]:
dtype = series.dtype
if isinstance(dtype, pd.CategoricalDtype):
raise TypeError(
Expand All @@ -392,6 +413,12 @@ def _series_spec(series: pd.Series, *, label: str) -> dict[str, str]:
f"Frame checkpoint does not support timezone-aware dtype for {label!r}; "
"convert it to timezone-naive datetime64 first."
)
if isinstance(dtype, pd.BooleanDtype):
return {
"dtype": "boolean",
"encoding": _ENCODING_NULLABLE_BOOLEAN,
"has_null_mask": bool(series.isna().any()),
}
if isinstance(dtype, pd.api.extensions.ExtensionDtype) and not isinstance(
dtype, pd.StringDtype
):
Expand Down Expand Up @@ -523,6 +550,17 @@ def _write_series(group: Any, series: pd.Series, spec: Mapping[str, object]) ->
_write_numpy_dataset(group, "offsets", offsets)
_write_bytes_dataset(group, "payload", payload)
return
if encoding == _ENCODING_NULLABLE_BOOLEAN:
values = series.to_numpy(
dtype=np.bool_,
na_value=False,
copy=False,
)
_write_numpy_dataset(group, "values", values)
if spec.get("has_null_mask") is True:
null_mask = series.isna().to_numpy(dtype=np.uint8, copy=False)
_write_numpy_dataset(group, "null_mask", null_mask)
return
raise RuntimeError(f"Unknown checkpoint series encoding {encoding!r}.")


Expand Down Expand Up @@ -552,6 +590,57 @@ def _read_series(
payload = _read_bytes_dataset(group, "payload", path)
values = _decode_object_values(offsets, payload, path=path, label=label)
series = pd.Series(values, dtype=restore_dtype, copy=False)
elif encoding == _ENCODING_NULLABLE_BOOLEAN:
if dtype != "boolean":
raise ValueError(
f"Frame checkpoint {path} {label!r} nullable boolean encoding "
f"has declared dtype {dtype!r}, not 'boolean'."
)
has_null_mask = spec.get("has_null_mask")
if type(has_null_mask) is not bool:
raise ValueError(
f"Frame checkpoint {path} {label!r} nullable boolean "
"has_null_mask must be a boolean."
)
values = _read_numpy_dataset(group, "values", path)
if values.ndim != 1 or values.dtype != np.dtype(np.bool_):
raise ValueError(
f"Frame checkpoint {path} {label!r} nullable boolean values "
"must be a one-dimensional bool array."
)
if has_null_mask:
if "null_mask" not in group:
raise ValueError(
f"Frame checkpoint {path} {label!r} is missing its null mask."
)
null_mask = _read_numpy_dataset(group, "null_mask", path)
if (
null_mask.ndim != 1
or null_mask.dtype != np.dtype(np.uint8)
or len(null_mask) != len(values)
or ((null_mask != 0) & (null_mask != 1)).any()
or not null_mask.any()
):
raise ValueError(
f"Frame checkpoint {path} {label!r} null mask must be a "
"one-dimensional uint8 0/1 array aligned to its values."
)
mask = null_mask.astype(np.bool_, copy=False)
if values[mask].any():
raise ValueError(
f"Frame checkpoint {path} {label!r} null mask covers "
"noncanonical true storage bits."
)
else:
if "null_mask" in group:
raise ValueError(
f"Frame checkpoint {path} {label!r} has an unexpected null mask."
)
mask = np.zeros(len(values), dtype=np.bool_)
series = pd.Series(
pd.arrays.BooleanArray(values, mask, copy=False),
copy=False,
)
else:
raise ValueError(
f"Frame checkpoint {path} has unknown encoding {encoding!r} for {label!r}."
Expand All @@ -574,7 +663,7 @@ def _read_series(

def _declared_dtype(
spec: Mapping[str, Any], *, path: Path, label: str
) -> str | pd.StringDtype:
) -> str | pd.BooleanDtype | pd.StringDtype:
"""The concrete dtype a spec restores to, environment-independently.

String dtypes resolve through the recorded storage and NA marker — the
Expand All @@ -586,6 +675,8 @@ def _declared_dtype(
verified in produced, and it is the build's canonical string policy.
"""
dtype = _require_string(spec, "dtype", label=label)
if dtype == "boolean":
return pd.BooleanDtype()
if dtype not in ("str", "string"):
return dtype
storage = spec.get("string_storage", "python")
Expand All @@ -605,7 +696,12 @@ def _declared_dtype(
)


def _dtype_matches(actual: Any, expected: str | pd.StringDtype) -> bool:
def _dtype_matches(
actual: Any,
expected: str | pd.BooleanDtype | pd.StringDtype,
) -> bool:
if isinstance(expected, pd.BooleanDtype):
return actual == expected
if isinstance(expected, pd.StringDtype):
return actual == expected and getattr(actual, "storage", None) == (
expected.storage
Expand Down Expand Up @@ -737,14 +833,69 @@ def _read_metadata(root: Any, path: Path) -> dict[str, Any]:
f"{metadata.get('artifact_kind')!r}."
)
version = metadata.get("schema_version")
if version != FRAME_CHECKPOINT_SCHEMA_VERSION:
if version not in _SUPPORTED_FRAME_CHECKPOINT_SCHEMA_VERSIONS:
raise ValueError(
f"Frame checkpoint {path} schema version is {version!r}; expected "
f"{FRAME_CHECKPOINT_SCHEMA_VERSION}."
f"one of {sorted(_SUPPORTED_FRAME_CHECKPOINT_SCHEMA_VERSIONS)}."
)
nullable_spec_count = 0
for label, spec in _checkpoint_series_specs(metadata):
dtype = spec.get("dtype")
encoding = spec.get("encoding")
declares_nullable = dtype == "boolean"
uses_nullable_encoding = encoding == _ENCODING_NULLABLE_BOOLEAN
if version == _LEGACY_FRAME_CHECKPOINT_SCHEMA_VERSION and (
declares_nullable or uses_nullable_encoding
):
raise ValueError(
f"Frame checkpoint {path} schema version 2 cannot carry nullable "
f"boolean spec {label!r}."
)
if version == FRAME_CHECKPOINT_SCHEMA_VERSION and (
declares_nullable != uses_nullable_encoding
):
raise ValueError(
f"Frame checkpoint {path} schema version 3 nullable boolean spec "
f"{label!r} must pair declared dtype 'boolean' with encoding "
f"{_ENCODING_NULLABLE_BOOLEAN!r}."
)
if uses_nullable_encoding:
nullable_spec_count += 1
if type(spec.get("has_null_mask")) is not bool:
raise ValueError(
f"Frame checkpoint {path} {label!r} nullable boolean "
"has_null_mask must be a boolean."
)
if version == FRAME_CHECKPOINT_SCHEMA_VERSION and nullable_spec_count == 0:
raise ValueError(
f"Frame checkpoint {path} schema version 3 requires at least one "
"nullable boolean spec."
)
return metadata


def _checkpoint_series_specs(
metadata: Mapping[str, Any],
) -> tuple[tuple[str, dict[str, Any]], ...]:
"""Return every serialized series spec for version-policy validation."""

specs: list[tuple[str, dict[str, Any]]] = []
for table_index, raw_table in enumerate(_require_list(metadata, "tables")):
table = _require_dict(raw_table, f"tables[{table_index}]")
name = table.get("name", f"tables[{table_index}]")
index = _require_dict(table.get("index"), f"tables[{table_index}].index")
if index.get("kind") == "values":
specs.append((f"{name}.index", index))
for column_index, raw_column in enumerate(_require_list(table, "columns")):
column = _require_dict(
raw_column,
f"tables[{table_index}].columns[{column_index}]",
)
specs.append((f"{name}.{column.get('name', column_index)}", column))
specs.append(("strata", _require_dict(metadata.get("strata"), "strata")))
return tuple(specs)


def _schema_from_metadata(metadata: Mapping[str, Any]) -> EntitySchema:
raw_schema = _require_dict(metadata.get("schema"), "schema")
person_entity = _require_string(raw_schema, "person_entity", label="schema")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
US_AOTC_ELIGIBILITY_OUTPUT_COLUMNS,
US_EDUCATION_INPUTS_NONCONSTANT_PERSON_COLUMNS,
US_EDUCATION_INPUTS_OUTPUT_COLUMNS,
US_EDUCATION_INPUTS_OWNED_OUTPUT_COLUMNS,
US_EDUCATION_INPUTS_REQUIRED_SOURCE_COLUMNS,
US_EDUCATION_INPUTS_STAGE_NAME,
derive_us_education_inputs_from_manifest,
Expand Down Expand Up @@ -540,13 +541,17 @@
PUF_CAPITAL_GAINS_TAIL_QUANTILE,
PUF_CAPITAL_GAINS_TAIL_STAGE_NAME,
PUF_CAPITAL_GAINS_TAIL_SUPPORT_CHANNEL,
PUF_CAPITAL_GAINS_TAIL_SUPPORT_CONTRACT_VERSION,
PUF_CAPITAL_GAINS_TAIL_TAX_UNIT_COLUMNS,
PUF_CAPITAL_GAINS_TAIL_TRANSFER_WEIGHT_COLUMN,
assert_puf_capital_gains_tail_survives_selection,
puf_capital_gains_tail_concentration_gate,
puf_capital_gains_tail_support_contract_identity,
puf_capital_gains_tail_terminal_support_receipt,
select_puf_capital_gains_tail_donors,
transfer_puf_capital_gains_tail,
validate_puf_capital_gains_tail_manifest,
validate_puf_capital_gains_tail_terminal_support_receipt,
write_puf_capital_gains_tail_manifest,
)
from microcosm.build.us_runtime.puf_donor_io import load_puf_tax_unit_donor
Expand Down Expand Up @@ -1448,6 +1453,7 @@
"US_AOTC_ELIGIBILITY_OUTPUT_COLUMNS",
"US_EDUCATION_INPUTS_NONCONSTANT_PERSON_COLUMNS",
"US_EDUCATION_INPUTS_OUTPUT_COLUMNS",
"US_EDUCATION_INPUTS_OWNED_OUTPUT_COLUMNS",
"ASEC_EDUCATION_ASSISTANCE_ARCHIVES",
"ASEC_EDUCATION_ASSISTANCE_INCOME_YEARS",
"fetch_asec_education_assistance_source",
Expand Down Expand Up @@ -1811,6 +1817,7 @@
"PUF_CAPITAL_GAINS_TAIL_POSITIVE_MASS_FIVE_X_TARGET",
"PUF_CAPITAL_GAINS_TAIL_QUANTILE",
"PUF_CAPITAL_GAINS_TAIL_STAGE_NAME",
"PUF_CAPITAL_GAINS_TAIL_SUPPORT_CONTRACT_VERSION",
"PUF_CAPITAL_GAINS_TAIL_SUPPORT_CHANNEL",
"PUF_CAPITAL_GAINS_TAIL_TAX_UNIT_COLUMNS",
"PUF_CAPITAL_GAINS_TAIL_TRANSFER_WEIGHT_COLUMN",
Expand Down Expand Up @@ -1865,6 +1872,8 @@
"load_asec_h5_tables",
"out_of_sample_reform_specs",
"puf_capital_gains_tail_concentration_gate",
"puf_capital_gains_tail_support_contract_identity",
"puf_capital_gains_tail_terminal_support_receipt",
"puf_tax_unit_donor_from_arrays",
"pool_asec_sources",
"prepare_us_puf_tax_detail_chain_inputs",
Expand Down Expand Up @@ -1950,6 +1959,7 @@
"puf_processed_capital_gains_stage",
"puf_raw_e01000_stage",
"validate_puf_capital_gains_tail_manifest",
"validate_puf_capital_gains_tail_terminal_support_receipt",
"validation_only_family_ids",
"translate_congressional_district_facts_to_current_vintage",
"with_household_congressional_districts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def resolve_acs_pums_earnings_universe(
person,
column=column,
raw_source_column=source_column,
scope=scope,
scope=acs_scope,
)
if raw_source_present
else None
Expand Down
Loading
Loading