canopy-persons Data Model
For a contributor or privacy reviewer reading the persons schema: the tables below are the schema in effect after the migrations listed at the end, applied in order — the legacy household_members, addresses, income, assets and expenses tables no longer exist. Endpoint detail (the …/claims write surface, the as-of reads, the redact routes) is on the canopy-persons API page; the design is ADR-027 (valid-time facts) and ADR-036 (sealing). The shared event_outbox / event_inbox pair is described once on the data-models index. Source: migrations/.
Tables
| Table | Purpose |
|---|---|
|
One row per natural person. Plaintext demographics: |
|
Household identity: |
|
Valid-time, append-only version corpus for income facts. Every version row carries |
|
Same shape as |
|
Same shape; value columns |
|
Same shape; value columns |
|
Same shape plus |
|
Household homelessness periods (#3144): |
|
Parent–child facts (#3047): the same provenance shape ( |
|
Pregnancy facts (#3143): the |
|
The ADR-036 DEK store: |
|
Generation gate of the applicant-finalize saga (ADR-038): PK |
|
Transactional idempotency receipt of the same saga: PK |
|
The shared MQ pair; columns, indexes, parking and retention are on the data-models index. |
Extensions the migrations install: btree_gist (the UUID-equality half of the EXCLUDE constraints) and pg_trgm (the name search indexes).
Relationships
redaction_keys is joined by convention (subject_kind, subject_id), not by a FOREIGN KEY, so a tombstone outlives the row it protected.
Cross-service identifiers (ADR-001 boundary)
canopy-persons sits at the bottom of the dependency graph: every program service holds application-level references into it (person_id, household_id) and it holds none out. Every REFERENCES in this schema is intra-database (the person_id / household_id FKs above, pregnancy_versions.person_id among them, the two parent_child_versions person FKs, and the finalize pair); callers pass ids over HTTP and canopy-persons resolves them.
Retention
canopy-persons holds PII (names, sealed DOB and SSN, sealed street addresses) and, since #3143, health information: pregnancy facts, whose expected delivery date, fetus count and waiver of the WIC family-size increase are sealed under each fact’s DEK (ADR-036) and shredded through the pregnancy kind of the fact redaction route. It holds no FTI. Retention is operator-driven and indefinite by default. Removal of PII is crypto-shred, not deletion: the SSN, the DOB, each fact’s value and its provenance blob sit under per-subject DEKs in redaction_keys, and the redact routes on the API page tombstone the DEK in one transaction with the audit event — the ciphertext stays where it is and is permanently unreadable (ADR-036). kek_version records which KEK wrapped each DEK, so a KEK rotation is a re-wrap of wrapped_dek, never a re-encryption of the sealed values. Soft-deletion (active = false) keeps rows for audit and late-arriving cross-program references.
Indexes
-
idx_persons_name—(last_name, first_name);idx_persons_active— partialWHERE active = true -
idx_persons_first_name_trgm,idx_persons_last_name_trgm— GINgin_trgm_ops, partialWHERE active = true(#1209): index-driven infixILIKEname search -
idx_income_versions_fact,idx_asset_versions_fact,idx_expense_versions_fact,idx_address_versions_fact,idx_household_member_versions_fact—(fact_id) -
idx_income_versions_person_current,idx_asset_versions_person_current,idx_expense_versions_person_current,idx_address_versions_person_current,idx_household_member_versions_person_current—(person_id) WHERE superseded_at IS NULL, the as-of read hot path -
idx_household_member_versions_household_current—(household_id) WHERE superseded_at IS NULL, the as-of household read -
idx_household_homelessness_versions_fact—(fact_id);idx_household_homelessness_versions_household_current—(household_id) WHERE superseded_at IS NULL, the household’s homelessness read (#3144) -
idx_parent_child_versions_fact—(fact_id);idx_parent_child_versions_parent_currentandidx_parent_child_versions_child_current—(parent_person_id)and(child_person_id) WHERE superseded_at IS NULL, one per end of the as-of bulk read (#3047) -
idx_pregnancy_versions_fact—(fact_id);idx_pregnancy_versions_person_current—(person_id) WHERE superseded_at IS NULL, the as-of read (#3143) -
income_versions_pending_proposals_idx—(person_id, origin) WHERE claim_status = 'proposed' AND superseded_at IS NULL, the pending held-accept lookups (#2546) -
the seven
*_no_overlapEXCLUDE constraints — GiST, one per version table -
every
*_no_overlapEXCLUDE constraint — GiST, one per version table -
idx_redaction_keys_subject—(subject_kind, subject_id);uq_redaction_keys_live_subject— unique(subject_kind, subject_id) WHERE shredded_at IS NULL -
event_outbox_*,event_inbox_unprocessed_idx,idx_event_inbox_parked— the generated partial indexes, described on the data-models index
Migration files
-
20260326000000_create_persons_tables.sql—persons,households, and the legacyhousehold_members,addresses,income,assets,expenses(all five since dropped) -
20260402000000_add_constraints.sql— non-negative CHECKs and a unique active-membership index on the legacy tables (gone with them) -
20260406000000_add_disability_status.sql—persons.disability_status -
20260508000000_create_event_outbox.sql— generated (index page) -
20260516000000_create_event_inbox.sql— generated (index page) -
20260518004851_event_outbox_lease_columns.sql— generated (index page) -
20260604000000_create_fact_version_tables.sql—btree_gist;income_versions,asset_versions,expense_versionswith their EXCLUDE constraints and indexes; the one-timebackfill_fact_versions_v1()(#671) -
20260618000000_drop_legacy_fact_tables.sql— dropsincome,assets,expensesand the backfill function (#672) -
20260623000000_create_address_versions.sql—address_versions+backfill_address_versions_v1()(#683) -
20260624000000_create_household_member_versions.sql—household_member_versions+backfill_household_member_versions_v1()(#683) -
20260625000000_drop_legacy_address_household_member_tables.sql— dropsaddresses,household_membersand both backfill functions (#890) -
20260625120000_create_redaction_keys.sql—redaction_keysand its one-way guard triggers (ADR-036) -
20260625130000_seal_fact_value_columns.sql—amount,employer_name,value,description,line_1,line_2re-created as sealedJSONB; the numeric CHECKs dropped -
20260625140000_seal_persons_pii.sql—ssn_encryptedre-created as sealedJSONB;date_of_birthreplaced bydate_of_birth_sealed JSONB NOT NULL -
20260630120000_address_type_enum.sql— theaddress_typeenum;address_versions.address_typeconverted (#892) -
20260713000000_event_outbox_hold.sql— generated (index page) -
20260714000000_create_finalize_operation_generations.sql— ADR-038 generation gate (#1047) -
20260714000001_create_finalize_receipts.sql— ADR-038 receipts (#1047) -
20260720000000_event_inbox_parking.sql— generated (index page) -
20260803000000_event_outbox_v7_pk_default.sql— generated (index page) -
20260815000000_event_outbox_claim_order_idx.sql— generated (index page) -
20260819000000_persons_name_trgm_gin.sql—pg_trgm; the two trigram indexes (#1209) -
20260904000000_event_outbox_parking.sql— generated (index page) -
20261208000008_redaction_keys_live_subject_uq.sql— tombstones superseded live DEKs, thenuq_redaction_keys_live_subject(#1606) -
20261208000009_add_medicare_part_a_basis.sql—persons.medicare_part_a_basis(#1514) -
20261209000000_seal_proposed_value.sql—proposed_valuereplaced byproposed_value_sealed JSONBon all five version tables (#1615) -
20261224000000_redaction_keys_rewrap_guard.sql—canopy_redaction_keys_one_way_guard()admits the KEK rewrap (wrapped_dekreplaced +kek_versionstrictly increased on a live row) beside the shred (#2113) -
20270117000000_redaction_keys_created_at_no_default.sql— drops theredaction_keys.created_atdefault:ensure_fact_dekbindscreated_atfrom its caller (the instant its write stamps the sealed row with), so an insert that names nocreated_atnow fails instead of taking the database clock (#2582) -
20270117000001_households_stamps_no_default.sql— drops thehouseholds.created_at/updated_atdefaults: the store binds both on create and a finalize compensation bindsupdated_aton deactivation, all from the application clock, so an insert that names no stamp now fails instead of taking the database clock (#2587) -
20270117000002_persons_stamps_no_default.sql— drops thepersons.created_at/updated_atdefaults: the store binds both on create andupdated_aton update, soft delete and compensation, all from the application clock, so an insert that names no stamp now fails instead of taking the database clock (#2587) -
20270123000000_income_pending_proposals_index.sql—income_versions_pending_proposals_idx, the partial index over pending held IEVS accepts (#2546) -
20270217000000_create_parent_child_versions.sql—parent_child_versions, its CHECKs, its pair EXCLUDE and its three indexes (#3047) -
20270303000000_create_pregnancy_versions.sql—pregnancy_versions, its range CHECK, its per-person EXCLUDE and its two indexes (#3143) -
20270304000000_create_household_homelessness_versions.sql—household_homelessness_versions, its window CHECK, its household EXCLUDE and its two indexes (#3144) -
20270326000000_address_type_substitute.sql— thesubstitutevalue of theaddress_typeenum (#3439) -
20270403000000_address_versions_residential_county.sql— the CHECKaddress_versions_residential_county, added validated; a database holding a residential row with no county fails it and is re-seeded (#3376)
The eight generated files are byte-identical copies of crates/canopy-mq/outbox-migrations/ (the data-models index). All migrations are forward-only per ADR-016.
20261209000000_seal_proposed_value.sql says "ADR-004 §2025(e) keeps the raw IEVS figure snap-local". The statute half of that cite is superseded: 7 USC §2025(e) is the SSN section, and the restriction that keeps an IEVS-received figure to the program that received it is Social Security Act §1137, 42 USC §1320b-7(a)(5) — ADR-004 Amendment 6 (#2129). What the header describes is unchanged: ADR-004 sites the IEVS class in canopy-snap, so canopy-persons carries source = ievs provenance and never the figure (the ievs_accept_writes_verified_version_with_ievs_source_and_no_figure integration test). An applied migration is immutable, so the header text stands as written.