canopy-medicaid Data Model
For a contributor, maintainer or compliance reviewer reading the Medicaid schema: the tables below are the schema in effect after the migrations listed at the end, applied in order — magi_household_snapshots and express_lane_evaluations no longer exist. Only the constraints named CHECK, UNIQUE or EXCLUDE are enforced by the database; the other value sets quoted (pathway, status, …) are the service’s or the canopy-overpayments crate’s own vocabulary. Endpoint detail is on the canopy-medicaid API page; the shared event_outbox / event_inbox pair is described once on the data-models index. Source: migrations/.
Tables
| Table | Purpose |
|---|---|
|
One row per Medicaid/CHIP application from canopy-eligibility: |
|
MAGI income per budget-group member: gross and monthly-normalised amounts, |
|
Non-MAGI (ABD) factors: |
|
Federal Tax Information (IRS Pub 1075 / IRC §6103(l)(21)); every read is wrapped in FTI audit logging. Only items (l)(21) names (#2238): |
|
Federal Data Services Hub outcomes only (raw hub traffic stays in canopy-verification, ADR-004): |
|
HIPAA minimum-necessary clinical outcomes: |
|
Per-individual outcome for each COA the cascade evaluated: |
|
CHIP child enrollment: |
|
HIPP cost-effectiveness: |
|
One signed determination per member (ADR-035): |
|
The immutable ADR-028 input snapshot, one per member determination (each income, asset and expense leaf carries the fact's provenance when the caller sent one, #884): |
|
Per-determination DEK store for crypto-shred (ADR-036): |
|
Audit trail of the CMD cascade, one row per (person, evaluated COA): |
|
Transitional Medical Assistance opened by the |
|
Change-in-circumstance lifecycle rows: |
|
Durable Express Lane consent written by the |
|
The current ELE flag per child: |
|
Append-only, SHA-256 hash-chained log of every ELE grant / extend / renew / lapse / revoke: |
|
A source-program approval that arrived before consent, parked for replay by the consent subscriber: |
|
The Pub 1075 §4 access log (identical DDL to canopy-tanf’s): |
|
|
|
The canonical claim table shared by the three program services that stamp it (canopy-snap, canopy-tanf, canopy-medicaid) ( |
|
Repayment schedules per claim: FK |
|
Append-only recoupment events: FK |
|
Append-only principal corrections: FK |
|
canopy-eligibility’s verdict on each of this service’s determinations, one row per |
|
Each person’s reported hours of one qualifying activity over one period, the input to the section 1115 adult demonstration’s qualifying-activity condition, written by |
|
Each person’s cooperation in obtaining medical support or pursuing liable third parties (42 CFR 435.610(a)), as a worker found it, written by |
|
The shared MQ pair; columns, indexes, parking and retention are on the data-models index. |
chain-v2 substrate (withdrawn and dormant, ADR-014 Amendment 6)
Installed by 20260910000000_chain_v2_substrate.sql (#1246) — the fti-family copy: canopy-medicaid is a chain SOURCE; the anchor store and verification state live only in canopy_security (canopy-security Data Model). Dormant: chain-v2 is withdrawn (ADR-041; ADR-014 Amendment 12), the #1279 cutover with it, and #1304 retires the substrate.
| Table | Purpose |
|---|---|
|
The shared registry substrate (identical DDL to the canopy-security copy): instance history, active pointer, fenced epochs ( |
|
The FTI family’s strict-from-row-one event store. |
Views: chain_status_v, fti_hashed_preimage_v, fti_hashed_preimage_archive_v (the preimage views expose id since 20261010000000; SELECT granted to canopy_chain_verify). Functions: chain_head_lock, chain_append_rows_fti (SECURITY DEFINER — the only append path for the canopy_medicaid_app runtime role), chain_epoch_activate, chain_archive_prefix_fti, chain_purge_prefix_fti. Every object is owned by the NOLOGIN role canopy_chain_owner_medicaid. Contract: ADR-014 Amendment 6.
Relationships
medicaid_determinations.previous_determination_id is a self-reference by convention (unique where set), not a FOREIGN KEY.
Cross-service identifiers (ADR-001 boundary)
Every REFERENCES in the database is drawn above; nothing crosses to another service. Application-level only: household_id / person_id / applicant_person_id / tax_filer_person_id / spouse_person_id / child_person_id and the dependents_person_ids / pregnant_member_ids / ssi_recipient_ids arrays → canopy-persons; application_id on medicaid_applications and ele_consents → canopy-applications; ele_*.source_determination_id / source_application_id → canopy-snap / canopy-tanf; overpayment_claims.determination_id → usually this service’s medicaid_determinations, unconstrained for back-rebill flows; redaction_keys.subject_id → medicaid_determinations.id by convention. medicaid_cooperation_findings.recorded_by is the recording worker’s canopy subject (canopy-identity’s id for the worker, the delegation’s sub), stored as an opaque TEXT. tanf_tma_coverage, ele_consents, ele_status, ele_grant_events and ele_deferred_approvals deliberately carry no FK to medicaid_applications: they are written by cross-program subscribers and may precede any Medicaid application of record.
Retention
canopy-medicaid is the most data-class-dense service in the system. It holds:
-
FTI (IRS Publication 1075) in
fti_tax_data, per ADR-004 Amendment 8. The table holds IRS return information, and its reads are audited under purpose codes citing 26 USC 6103(l)(21), the §6103 paragraph that names titles XIX and XXI. (l)(21)(A) discloses from the IRS to HHS, (B) lets HHS give a State agency any inconsistency, and ©(ii) limits a State agency’s use to eligibility. No statute or regulation delivers the values themselves to a State agency. The agency receives them from HHS through the CMS Data Services Hub under the CMS–IRS computer matching agreement, as IRS Publication 1075 §2.C.11.6 describes (ADR-004 Amendment 12, #2936). The table holds only the items (l)(21) names (#2238, ADR-004 Amendment 11). No table here holds data from Medicaid’s 26 USC 6103(l)(7) route, the IEVS SSA-held earnings and IRS unearned income of (l)(7)(D)(ii). FTI audit access is logged tofti_audit_logper Pub 1075 §4; minimum 7-year retention applies per Pub 1075 AU-11 (ADR-004 Amendment 2), with rows aging intofti_audit_log_archiveand the ADR-014 hash chain extending across the boundary.fti_audit_log.purpose_codestores the purpose code (MEDICAID_ELIG,MEDICAID_MAGI,CHIP_ELIG), never the IRC citation, so no stored row carries the supersededIRC 6103(l)(12)(A). -
HIPAA-scoped PHI in
clinical_assessments. Minimum-necessary standard enforced at the schema level — only the eligibility-relevant outcome is stored; no clinical narrative, diagnosis, or treatment plan. HIPAA 45 CFR 164.530(j) requires 6-year retention of compliance documentation; Medicaid claim records per 42 CFR 431.17 require 3-year minimum from claim closure. -
FDSH data in
fdsh_results. Retained per the CMS data-use-agreement schedule.
The longest applicable floor governs. Archive moves and FTI-expiry purges are operator-driven; ADR-016 forbids destructive migrations.
Indexes
-
idx_medicaid_applications_application,idx_medicaid_applications_household,idx_medicaid_applications_status -
idx_magi_income_application,idx_magi_income_person;idx_non_magi_factors_application,idx_non_magi_factors_person;idx_fti_tax_data_application,idx_fti_tax_data_person;idx_fdsh_results_application,idx_fdsh_results_person;idx_clinical_assessments_application -
idx_medicaid_categories_application,idx_medicaid_categories_person,idx_medicaid_categories_coa;idx_chip_applications_medicaid,idx_chip_applications_child;idx_pathways_hipp_application -
idx_medicaid_determinations_application,idx_medicaid_determinations_person,idx_medicaid_determinations_status;idx_medicaid_determinations_determined_at_id—(determined_at DESC, id DESC), the keyset list (#1195);idx_medicaid_determinations_person_program_latest—(household_id, person_id, program, determined_at DESC, id DESC), the per-(person, program) prior and newest reads (#2942; it replacedidx_medicaid_determinations_person_latest);medicaid_determinations_operation_subject_uq— unique(operation_id, person_id) WHERE operation_id IS NOT NULL(#2673);medicaid_determinations_supersession_uq— unique(previous_determination_id) WHERE previous_determination_id IS NOT NULL;idx_medicaid_determinations_household_det_id—(household_id, determined_at DESC, id DESC)(#1244) -
idx_determination_snapshots_as_of—(as_of) -
idx_redaction_keys_subject—(subject_kind, subject_id);uq_redaction_keys_live_subject— unique(subject_kind, subject_id) WHERE shredded_at IS NULL -
idx_cmd_cascade_application,idx_cmd_cascade_person -
idx_tma_coverage_household,idx_tma_coverage_person;idx_tma_coverage_status—(status) WHERE status = 'active' -
idx_medicaid_cmd_events_household;idx_medicaid_cmd_events_unresolved—(ingested_at) WHERE state IN ('received','requested')(replacedidx_medicaid_cmd_events_unprocessed) -
idx_medicaid_cooperation_findings_person—(person_id, kind, effective_date DESC, created_at DESC): a person’s newest-first list and the status-on-a-date read per kind (#3189) -
idx_medicaid_demonstration_activity_reports_person—(person_id, effective_date DESC, created_at DESC): a person’s newest-first list and the per-person read of the reports effective by a date (#3203) -
ele_consents_active_per_person— unique(household_id, person_id) WHERE revoked_at IS NULL;ele_consents_household_idx,ele_consents_application_idx -
ele_status_active_per_child— unique(child_person_id) WHERE current_status = 'active';ele_status_household_idx;ele_status_renewal_due_idx—(expires_at, id) WHERE current_status = 'active';ele_status_aged_out_idx—(child_date_of_birth, id) WHERE current_status = 'active' -
ele_grant_events_child_idx—(child_person_id, occurred_at DESC);ele_grant_events_household_idx—(household_id, occurred_at DESC);ele_grant_events_chain_order_idx—(occurred_at, id) -
ele_deferred_approvals_active_uq— unique(household_id, source_program) WHERE processed_at IS NULL;ele_deferred_approvals_household_idx—(household_id) WHERE processed_at IS NULL -
idx_fti_audit_accessed_at,idx_fti_audit_accessed_by,idx_fti_audit_purpose_code;idx_fti_audit_created_at— the ADR-014 §9 in-lock predecessor lookup and verify walk (#1197);idx_fti_audit_event_hash,idx_fti_audit_archive_event_hash -
overpayment_claims_status;overpayment_claims_keyset—(created_at DESC, id DESC);overpayment_claims_assessment_once— unique(assessment_id) WHERE assessment_id IS NOT NULL;overpayment_claims_source_event_once— unique(source_event_id) WHERE source_event_id IS NOT NULL;overpayment_claims_by_appeal—(appeal_id) WHERE appeal_id IS NOT NULL -
repayment_plans_by_claim,recoupment_ledger_by_claim,claim_adjustments_by_claim -
chain-v2:
chain_epochs_one_open_v2— unique(chain_instance_id) WHERE state IN ('installing','active');fti_audit_log_v2_shard_seq_idx—(chain_instance_id, chain_epoch, shard_id, chain_seq);fti_audit_log_v2_accessed_at_idx;fti_audit_log_archive_v2_id_uq -
event_outbox_*,event_inbox_unprocessed_idx,idx_event_inbox_parked— the generated partial indexes, described on the data-models index
Migration files
-
20260326000001_create_fti_audit_log.sql—fti_audit_log+fti_audit_log_archive -
20260407000000_create_medicaid_tables.sql—medicaid_applications,magi_income,non_magi_factors,fti_tax_data,fdsh_results,clinical_assessments,medicaid_eligible_categories,chip_applications,peachcare_premium_schedule,pathways_qualifying_activities,pathways_hipp_referrals,medicaid_determinations,cmd_cascade_log, andmagi_household_snapshots(since dropped) -
20260413000000_create_tanf_tma_coverage.sql—tanf_tma_coverage -
20260417000000_create_express_lane_evaluations.sql—express_lane_evaluations(since dropped) -
20260425000000_add_fti_audit_hash_chain.sql—previous_hash/event_hashon the audit log and archive (ADR-014) -
20260508000000_create_event_outbox.sql— generated (index page) -
20260510000001_create_overpayments.sql—overpayment_claims,repayment_plans,recoupment_ledger -
20260512000000_create_medicaid_cmd_events.sql—medicaid_cmd_events(#448) -
20260516000000_create_event_inbox.sql— generated (index page) -
20260518004851_event_outbox_lease_columns.sql— generated (index page) -
20260605000000_create_ele_consents.sql—ele_consents -
20260605000001_create_ele_status.sql—ele_status -
20260605000002_create_ele_grant_events.sql—ele_grant_events -
20260606000000_drop_express_lane_evaluations.sql— dropsexpress_lane_evaluations(andidx_ele_householdwith it) -
20260606010000_fti_audit_append_only_guard.sql— the statement-level append-only guard on the audit log and archive (#624) -
20260624000000_create_determination_snapshots.sql—medicaid_determinations.snapshot_hash,determination_snapshots, its append-only trigger (#685, ADR-028) -
20260624140000_create_redaction_keys.sql—redaction_keysand its one-way guard triggers (ADR-036) -
20260630000000_drop_magi_household_snapshots.sql— dropsmagi_household_snapshots(#883) -
20260701000000_create_ele_deferred_approvals.sql—ele_deferred_approvals(#649) -
20260713000000_event_outbox_hold.sql— generated (index page) -
20260720000000_event_inbox_parking.sql— generated (index page) -
20260727000000_claim_provenance_adjustments.sql— claim provenance columns, the void path,claim_adjustments(#1104; canonical copy incrates/canopy-overpayments/migrations/) -
20260803000000_event_outbox_v7_pk_default.sql— generated (index page) -
20260806000000_v7_pk_defaults.sql— drops the id defaults ontanf_tma_coverage,medicaid_cmd_eventsand the fourele_*tables (#1173) -
20260807000000_overpayments_v7_pk_defaults.sql— drops the id defaults on the four overpayment tables (#1173) -
20260810000000_snapshot_hash_not_null.sql— setssnapshot_hash NOT NULL(#911) -
20260811000000_fti_audit_created_at_idx.sql—idx_fti_audit_created_at(#1197) -
20260815000000_event_outbox_claim_order_idx.sql— generated (index page) -
20260817000000_medicaid_determinations_list_keyset_idx.sql—idx_medicaid_determinations_determined_at_id(#1195) -
20260830000000_ele_sweep_claims.sql— theele_statussweep triple;ele_status_renewal_due_idxrebuilt as(expires_at, id);ele_status_aged_out_idx(#1219) -
20260902000000_overpayment_claims_keyset_idx.sql—overpayment_claims_keyset(#1222) -
20260904000000_event_outbox_parking.sql— generated (index page) -
20260910000000_chain_v2_substrate.sql— the dormant chain-v2ftisubstrate: roles, seven tables, three views, five functions (#1246) -
20261010000000_fti_preimage_id.sql— the preimage views gainid;fti_audit_log_archive_v2_id_uq; SELECT grant tocanopy_chain_verify(#1205, #1206) -
20261126000000_medicaid_determinations_trigger.sql—triggerwith its CHECK,previous_determination_id,idx_medicaid_determinations_person_latest,medicaid_determinations_supersession_uq(#1505) -
20261127000000_cmd_events_lifecycle.sql—medicaid_cmd_eventslifecycle columns;idx_medicaid_cmd_events_unresolvedreplaces_unprocessed(#1506) -
20261201000000_medicaid_determinations_household_idx.sql—idx_medicaid_determinations_household_det_id(#1244) -
20261208000002_redaction_keys_live_subject_uq.sql— tombstones superseded live DEKs, thenuq_redaction_keys_live_subject(#1458) -
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) -
20270111000001_determination_status_check.sql— deletes any row outsideapproved / denied / sanctioned(the deleted requeue’srequeued/dismissedamong them) with its snapshot, inside thecanopy.snapshot_maintenancewindow, then addsmedicaid_determinations_status_verdict(#628) -
20270113000000_ele_consents_actor.sql—ele_consents.consent_recorded_bybecomesTEXT(DROP NOT NULL) +consent_recorded_by_service; a guard aborts namingcargo xtask dev restarton a consent recorded under the applicant’s ownPersonId(the retired service-path fallback) or a nil subject; thenck_ele_consents_recorded_by_named(= 1, VALID) (#1008) -
20270113000001_overpayment_discovered_by_actor.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_discovered_by_actor.sql):overpayment_claims.discovered_bybecomesTEXT+discovered_by_service; a guard aborts namingcargo xtask dev restarton any existing claim (none states a provable actor of a known class: NULL, nil, a body-supplied subject, or a service account’s subject indistinguishable from a worker’s); thenoverpayment_claims_discovered_by_one_actor(= 1, VALID) (#1008) -
20270113000002_ele_grant_events_actor.sql—ele_grant_events.actor_idis renamedactorand becomesTEXT+actor_service;ele_consents.revoked_bybecomesTEXT; a guard aborts namingcargo xtask dev restarton any existingele_grant_eventsrow (hashed unframed, so the framed chain cannot verify or carry it over) or a nilrevoked_by; thenck_ele_grant_events_actor_named(= 1, VALID) (#1008) -
20270117000000_redaction_keys_created_at_no_default.sql— drops theredaction_keys.created_atdefault: the shared canopy-db store bindscreated_at(the determination’s decision instant) andshredded_at(the redaction’s) from its caller, so an insert that names nocreated_atnow fails instead of taking the database clock (#2475) -
20270118000000_overpayment_stamps_no_default.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_stamps_no_default.sql): drops thenow()defaults ofoverpayment_claims.created_at/updated_at,repayment_plans.created_at/updated_at,recoupment_ledger.occurred_atandclaim_adjustments.created_at— the shared store binds every stamp from the writing request’s decision clock, so an insert that names no stamp now fails instead of taking the database clock (#2576) -
20270411000000_overpayment_claim_period.sql— the canonical stamp (crates/canopy-overpayments/migrations/canonical_claim_period.sql):overpayment_claims.period_first_month/period_last_month, nullable, withoverpayment_claims_period_whole_months(#3567) -
20270205000000_fti_tax_data_l21_items.sql— #2238:fti_tax_datadropswages_salaries_tips,self_employment_income,social_security_benefits,tax_exempt_interestandforeign_earned_income: the first three named by neither IRC 6103(l)(21)(A) nor 26 CFR 301.6103(l)(21)-1, the last two named only inside (a)(1)'s single aggregate. A guard refuses to drop a column holding a value. -
20270206000000_medicaid_determinations_program.sql— #2942:medicaid_determinations.program(medicaid/chip, CHECKmedicaid_determinations_program_ck;DEFAULT 'medicaid'backfills every earlier row and is an expand step #2673 drops);idx_medicaid_determinations_person_program_latestreplacesidx_medicaid_determinations_person_latest -
20270207000000_medicaid_determinations_operation.sql— #2673: drops the default ofprogram(the contract step of #2942’s expand);operation_id+signed_payloadwithmedicaid_determinations_operation_signed_ck;medicaid_determinations_operation_subject_uq -
20270209000000_decision_stamps_no_default.sql— drops the defaults of every stamp the service’s production INSERTs bind themselves:medicaid_applications.received_at/created_at/updated_at,medicaid_eligible_categories.created_at,medicaid_determinations.determined_at/created_at,cmd_cascade_log.evaluated_at/created_at,determination_snapshots.created_at,tanf_tma_coverage.created_at/updated_at,medicaid_cmd_events.ingested_at/created_atandele_grant_events.occurred_at(aclock_timestamp()default; the store binds the wall-clock instant it reads under the chain lock). An insert that names no stamp now fails instead of taking the database clock, andcargo xtask migrations-lintrefuses a new clock default (#2589) -
20270215000000_determination_verdicts.sql— thedetermination_verdictstable and itsverdictCHECK (#2322) -
20270310000000_medicaid_cooperation_findings.sql— themedicaid_cooperation_findingstable, itskindandstatusCHECKs andidx_medicaid_cooperation_findings_person(#3189) -
20270315000000_demonstration_activity_reports.sql— dropspathways_qualifying_activities(and its index); creates themedicaid_demonstration_activity_reportstable, itshours, period andverificationCHECKs andidx_medicaid_demonstration_activity_reports_person(#3203) -
20270322000000_ele_tier_chip.sql— #3423: the Express Lane tier above Medicaid becomeschip. Replacesele_status_eligibility_tier_checkandele_grant_events_eligibility_tier_checkwithIN ('medicaid','chip')and rewritesele_statusrows in place.ele_grant_eventshashes the tier into its chain, so its rows cannot be rewritten: the migration raises, naming the reset and re-seed (cargo xtask dev restart), when the table holds a row at the retired tier -
20270324000000_determination_status_withheld.sql— ADR-052: replacesmedicaid_determinations_status_verdictso the list also admitswithheld; no row is rewritten. -
20270327000000_tma_prior_coverage_end_date.sql— #3447: renamestanf_tma_coverage.tanf_termination_datetoprior_coverage_end_date; values unchanged -
20270328000000_drop_premium_schedule.sql— #3425: dropspeachcare_premium_schedule, which nothing wrote or read
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.