Skip to content

PSID job-crosswalk registries for 1968 to 2023 (CE2a) - #616

Draft
MaxGhenis wants to merge 2 commits into
masterfrom
ir/ce2a-20261106
Draft

MaxGhenis wants to merge 2 commits into
masterfrom
ir/ce2a-20261106

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

CE2a registers the PSID family-file variables that describe each head's, spouse's and family's jobs and residence, for all 43 interview waves from 1968 through 2023: annual through 1997, then odd years. For each wave, the registry records six items: government level, employee or self-employed status, incorporation, industry, occupation and state of residence. Each row carries its exact setup label and columns, its printed value codes and the disposition of each code. The registries hold metadata only, and PSID use follows the project's data-access record.

What it adds

  • Registry (populace_dynamics.data.psid_job_crosswalk_registry). The module pins each wave's SPSS setup and codebook by SHA-256 and checks every row's label and columns against the setup before a reader consumes any record. It gives each printed code exactly one disposition, raises on a code nobody verified, and keeps a government level only when the code's source text states it. Its closed schema has no frequency, count or percentage field.
  • Reader (populace_dynamics.data.psid_job_crosswalk). The reader takes fixed-width records that its caller supplies, returns each registered token's bytes unchanged, and leaves value meanings to the registry's separate adjudicator. It attaches people to family items only through an explicit mapping, and it never finds or opens a family data file. This PR runs it on invented records only.
  • Fact evidence (populace_dynamics.data.psid_job_crosswalk_evidence). For every wave and every fact in its FIELD_PURPOSES table, the module names the registered items and substantive codes that establish the fact, and leaves every other fact awaiting_ce2. Missing, not-applicable, not-asked, ambiguous and unverified codes never establish a fact, and a printed industry or occupation category identifies only that category.
  • Data (data/external/psid_job_crosswalk_v1/). One registry per wave, fact_evidence.json, and differential.json. The differential compares the registries with six earlier field-evidence files in data/external/psid_codebook_field_evidence/ and with the modern job-context extraction specs in data/external/psid_modern_job_context_raw_extraction_specs_v1.json.

Evidence

  • The differential finds 2,721 overlapping rows. The modern waves agree on every label, column, role and slot. The earlier waves differ on 86 labels, in whitespace and wording, and on no variable or column, and the differential keeps both sides of each difference with both source paths.
  • The validators rebuild the fact table and the differential from the pinned registries and refuse a fabricated, missing or extra entry.
  • The registries leave these source questions open:
    • the state codebooks refer to separate PSID and FIPS code lists, so postal codes wait until we capture and pin those lists;
    • finer service facts wait for the detailed Census industry and occupation listings that the codebooks refer to;
    • the 1974 broad occupation codes need clarification, so the registry keeps the printed domain and reads no finer evidence into it;
    • the extra-job labels that contradict each other in 1994 and 1995 keep named alternatives for their job slots until CE3, the next covered-earnings build, attaches each job;
    • broad railroad, religious, school and agriculture groups can't establish a finer statutory fact.

Invariants

Examples and Hypothesis properties on invented records and metadata check these invariants:

  • every token has end − start + 1 bytes, returned without trimming, decoding or numeric coercion;
  • every printed code has exactly one disposition, and an unverified code raises;
  • a government meaning never adds a level that the code's source text lacks;
  • each source family contributes each registered row once, and repeated calls or reordered inputs return the same result;
  • a duplicate family, slot, row or person attachment refuses, and so does an unknown wave, an unknown or absent item, or an unpinned setup;
  • only a named item with a substantive, supported code establishes a fact.

Tests

The PR adds 335 tests in five modules: 161 unit, 45 artifact and 129 integration_psid. The integration module reads only staged PSID setup files, runs invented records at the verified columns, and skips when it finds no staged setups. Each of 37 small changes that break one invariant in the new source makes its named test fail (mutation results). Black and Ruff pass on all eight changed Python files.

Status

This PR stays a draft until:

  • the three new source paths join the seal tuple, and the new tests join tests/tier_counts.json, in a commit at the next tier-count slot (until then the tier-count check fails);
  • an independent review approves it.

axiom: n/a: PSID metadata registries; no RuleSpec or statute encoding

🤖 Generated with Claude Code

Add job-crosswalk registries for all 43 staged PSID waves, 1968 to 2023,
with an exact-byte reader, a separate adjudication, the evidence table
CE3 reads, and a differential against the predecessor registries. The
registries hold setup-file labels, columns and code meanings, and their
schemas carry no frequencies.

The differential finds no difference in modern waves and 86 label
differences in earlier waves, with no variable or column difference, and
keeps every pair without changing either predecessor artifact.

The metadata tests read PSID setup files only, in the integration_psid
tier, and skip when the files are absent. No existing tracked file,
tier file or seal changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
social-security-model Ready Ready Preview Nov 29, 2026 1:21pm UTC

Request Review

Two host mutants survived: disabling the unknown-item guard or the
duplicate-person guard still refused, through a later check with a
different message, and the tests matched either message or none. The
unknown-item case now matches "unknown requested item", the absent-item
cases "absent from this wave", and the shared head and spouse ID case
"ambiguous family or role".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

The build's mutation runner makes 37 small changes to the three new source files, one at a time, and runs the named test for each. Each change breaks one invariant, and the named test catches it by failing.

In the first run, 35 named tests caught their change. Two let the change through, because the code still refused by another route and the test accepted that refusal:

  • when the runner removed the unknown-item check, the reader refused an unknown item as absent from the wave, and the test matched any message about a requested item;
  • when it removed the duplicate-person check, a later check refused a head and spouse who share one ID, and the test accepted any refusal.

af30b02 makes each test check the refusal reason it covers. On that commit both tests catch their change, so all 37 do.

This branch was successfully deployed

1 active deployment
Preview — af30b028 Deployed Nov 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant