canopy-appeals Data Model
Cross-link: canopy-appeals API Reference · Source: migrations/
Tables
| Table | Purpose |
|---|---|
|
Fair-hearing request rows under 7 CFR 273.15. One row per hearing request. Carries the requestor ( |
|
#1099: household-requested postponements of the 60-day decision SOP. One append-only row per postponement ( |
|
Per-appeal event log. One row per state transition or operator note tied to an appeal — request received, hearing scheduled, hearing held, decision rendered, etc. Carries |
|
The continued-benefits overpayment assessment as a recorded entity — replaces the |
|
Per-issuance itemization under an assessment. |
|
The #1105 worker’s queue (live since #1105), on the #1091 |
|
Intentional Program Violation case file under 7 CFR 273.16. One row per IPV referral. Carries the subject ( |
|
Per-IPV-case event log. One row per state transition or operator note tied to an IPV case. Carries |
|
The generated ADR-018 / ADR-039 outbox and the generated consumer inbox (parked-state columns included), single-sourced in |
|
The fleet-wide idempotent-POST cache (#434 / #1463), created outside this service’s |
|
Wall-clock window fence for the service’s daily scheduler tick(s) ( |
Relationships
Intra-database foreign keys only (relationship-only; columns live in the Tables list):
assessment_work.assessment_id points at cb_assessments without a FK (migration 20260727000000_cb_assessment_schema.sql); ipv_cases and appeal_requests are unrelated tables that share only the program vocabulary.
Cross-service FKs (ADR-001 boundary)
Per ADR-001, canopy-appeals holds no Postgres-level foreign keys to other services. Every UUID the schema holds that is not one of the intra-database FKs above is an application-level reference canopy-appeals trusts the upstream service to supply and never enforces in canopy_appeals: household and person ids (canopy-persons), application_id (canopy-applications), the contested-record union determination_id / administrative_denial_id / rep_disqualification_id (the program service / canopy-applications, #1652), notice_id (canopy-notices), adverse_action_id, enrollment_id and issuance_id (canopy-enrollment), liable_person_id, and overpayment_claim_id (the program service’s overpayment table). Worker identities are not UUIDs at all (#1008): hearing_officer_id and the subject half of each actor pair are TEXT OIDC subjects issued by the IdP, and the _service half names a service principal.
Retention
Retention floors (eCFR, checked 2026-09-16): continued-benefits records under 7 CFR 273.15(k) and IPV / ADH records under 7 CFR 273.16 are due-process artifacts with no archival ceiling. Operational retention is the maximum of (a) no less than 3 years from the month of origin of each record (7 CFR 272.1(f)), (b) the disqualification end date plus 3 years for IPV cases, and (c) any pending appeal or civil-rights proceeding referencing the row. Rows are not deleted in production; archive moves are operator-driven, never migration-driven (ADR-016). The FTI audit hash chain (ADR-014) does not apply — canopy-appeals stores no FTI. State series: Georgia Archives, DHS retention schedule (agency 144), series 1973-0344 "Fair Hearing Case Record Files", 3 years, for the hearing rows, and series 1973-0358A "Public Assistance and Food Stamp Suspected Fraud Closed Case Files", 3 years after determination that case is closed, uncollectible, or paid in full, for the IPV / ADH rows — https://www.georgiaarchives.org/records/agencyprint/144 (checked 2026-09-18). The hearing series does not exceed the federal 3-year floor, so 7 CFR 272.1(f) governs the hearing rows; the fraud series runs from case closure or collection rather than from the month of origin, so whichever of it and the federal window ends later governs an IPV row.
Indexes
-
idx_appeals_household— household-scoped appeal lookup -
idx_appeals_status(partial,(status, decision_due_date) WHERE status IN ('pending','scheduled')) — the 60-day decision-clock work queue (7 CFR 273.15(c)(1); #1099) -
idx_appeals_determination— appeals-by-determination lookup (notice cross-link) -
idx_appeals_adverse_action(partial,WHERE adverse_action_id IS NOT NULL) — the per-action appeal lookup (#1098) -
idx_appeals_pending_stay(partial,(created_at) WHERE cb_election = 'pending_stay' AND active) — the stay-receipt reconciliation scan (#1098) -
idx_appeals_administrative_denial(partial,WHERE administrative_denial_id IS NOT NULL) — the admin-arm lookup of the contested union (#1652) -
idx_appeal_timeline_appeal— per-appeal timeline scan,(appeal_id, event_date) -
idx_appeal_postponements_appeal— per-appeal postponement list (#1099) -
idx_ipv_cases_person— person-scoped IPV history -
idx_ipv_cases_household— household-scoped IPV lookup -
idx_ipv_cases_status(partial,WHERE active = true) — active-case work queue -
idx_ipv_timeline_case— per-IPV-case timeline scan,(ipv_case_id, occurred_at) -
idx_cb_assessments_one_active_per_appeal(UNIQUE partial,(appeal_id) WHERE status <> 'void') — one active assessment per appeal; supersession = void + successor (#1104) -
idx_cb_assessments_household(partial,WHERE status <> 'void') — household-scoped active assessments -
idx_cb_assessments_action— assessments by adverse action -
idx_cb_assessments_unacked(partial,(updated_at) WHERE status = 'computed') — the acknowledgment scanner’s grace-window sweep (#1105) -
idx_cb_assessments_action_verify(partial,(action_verified_at ASC NULLS FIRST) WHERE status <> 'void') — the dead-action sweep’s progressing cursor (#1224) -
idx_cb_assessments_reemit(partial,(claim_reemitted_at ASC NULLS FIRST) WHERE status = 'computed') — the acknowledgment sweep’s progressing cursor (#1224) -
idx_cb_lines_billable_once(UNIQUE partial,(issuance_id) WHERE disposition = 'billed') — the billable-once backstop: an issuance is billable once across all assessments -
idx_cb_lines_assessment— per-assessment line list; the table also carriesUNIQUE (assessment_id, issuance_id) -
idx_assessment_work_due(partial,(due_at) WHERE status = 'pending') — the worker’s claim scan -
idx_assessment_work_terminal(partial,(status, updated_at) WHERE status <> 'pending') — the pruning scan;appeal_idis also UNIQUE -
generated
event_outbox_*/event_inbox_*indexes — described once in the data-models index
Migration files
The eight event_outbox / event_inbox files (20260508000000, 20260516000000, 20260518004851, 20260713000000, 20260720000000, 20260803000000, 20260815000000, 20260904000000) are generated copies of crates/canopy-mq/outbox-migrations/ (cargo xtask outbox-migrations --write, parity-gated by --check); they are described once in the data-models index. The remaining files, in timestamp order:
-
20260401000000_create_appeals_tables.sql— fair-hearing schema (appeal_requests withcontinued_benefits_eligibleGENERATED STORED column, appeal_timeline_events; status + determination indexes) -
20260402000000_create_ipv_tables.sql— IPV / ADH schema (ipv_cases, ipv_timeline_events; status + allegation CHECK constraints) -
20260725000000_action_bound_filing.sql— #1098:adverse_action_id, the Chart B2cb_*election block, the GENERATEDcontinued_benefits_eligiblereplaced by a plain backfilled column, theprogramCHECK, and the pending-stay / per-action indexes -
20260726000000_decision_withdrawal_lifecycle.sql— #1099: decision signed/received dates + actor, the typed decision vocabulary (legacy values mapped, unknowns quarantined indecision_legacy/legacy_unmapped), 7 CFR 273.15(j) dismissal fields, the withdrawal lifecycle columns, the cessation record, theappeal_postponementstable, and the 60-day due-date recompute for open rows -
20260727000000_cb_assessment_schema.sql— #1104: thecb_assessments/cb_assessment_lines/assessment_workentity trio — recorded-cessation windows, the billable-once partial unique, post-cessation itemization, the one-active-per-appeal partial unique, and the UNIQUE-per-appeal work queue -
20260728000000_assessment_worker_cutover.sql— #1105:withdrawal_finalizedjoins both cessation-reason CHECK vocabularies (a liable withdrawal disposition records a cessation), plus the acknowledgment scanner’sidx_cb_assessments_unackedpartial index -
20260811000000_final_appeal_continuation.sql— #1132: the final-appeal block onappeal_requests(decision_federal_policy_issue,final_appeal_filed_date/final_appeal_actor/final_appeal_continuation,final_appeal_decision∈{affirmed, reversed}+ its received date / actor);final_decisionjoins both cessation-reason CHECKs andfinal_decision_cessationjoins theassessment_work.trigger_kindCHECK -
20260821000000_restayed_receipt_status.sql— #1263:restayedjoins thecb_stay_link_statusCHECK (stayed/restayed/released/vetoed) — the final-appeal stay era -
20260903000000_cb_assessment_sweep_cursors.sql— #1224 (ADR-001 Amendment 1 §B6-iii): the per-sweep progressing cursors (action_verified_at,claim_reemitted_at) + their NULLS FIRST partial indexes; transactionalCREATE INDEX(notCONCURRENTLY— the sqlx migrator’s advisory lock deadlocks againstCONCURRENTLY's snapshot wait) -
20260905000000_create_scheduler_runs.sql— the generated #1211 window-fence table (single-sourced incrates/canopy-db/scheduler-migrations/); documented once in the data-models index -
20260906000000_appeal_contested_union.sql— the #1652 contested three-arm union:determination_idnullable,administrative_denial_id+rep_disqualification_idcolumns, the exactly-one and admin-arm-has-application CHECKs, the admin-arm partial index -
20270113000000_actor_subjects.sql— #1008:hearing_officer_idtoTEXT;ipv_cases.referred_by(NOT NULL dropped),appeal_timeline_events.recorded_byandipv_timeline_events.recorded_bytoTEXTplus a_servicecolumn each and the three= 1actor-pair CHECKs. Its guard refuses a database holding a timeline row with no recorded actor (every pre-#1008 timeline writer passed NULL) or a nil-UUID subject — the remedy is the reset it names,cargo xtask dev restart, never a backfill -
20270307002444_ipv_referral_qc_origin.sql— #2444: the nullableipv_cases.discovered_in_qc_review, with no default and no backfill, so a referral from before it stays unrecorded -
20270330000000_appeal_wic_termination_arm.sql— #3387: the fourth contested armappeal_requests.wic_termination_id(the exactly-one CHECK replaced to count it);wic_hold_state(heldorreleased: the appeal's hold in canopy-wic as its last receipt reported it, NULL when it never held);wic_hold_command(releaseorcancel) andwic_hold_command_at, the command the appeal still owes canopy-wic and since when, set together (appeal_requests_wic_hold_command_at_check) and cleared by the receipt;appeal_requests_wic_hold_arm_check(only the WIC arm holds or owes); and the partial indexidx_appeals_wic_hold_command_owed, the hold retry's queue
All migrations are forward-only per ADR-016.