canopy-caps Data Model
On this page
Cross-link: canopy-caps API Reference · Source: migrations/
Tables
| Table | Purpose |
|---|---|
|
CAPS application intake records. One row per (application, child) pair. Carries the child’s age + special-needs flag, household size, optional |
|
Signed eligibility determinations per child. Carries the three CAPS gate flags ( |
|
Immutable determination input snapshots (T2-4). One row per child determination (PK = FK |
|
Per-value DEK store for crypto-shred redaction. One row per per-determination DEK: |
|
Provider authorization rows. One row per (determination, provider) — a single determination can spawn multiple authorizations over time (current |
|
Provider registry. |
|
Per-service transactional outbox (ADR-018), schema single-sourced in |
|
Per-service consumer inbox (#433 / ADR-018 amendment). |
Cross-service FKs (ADR-001 boundary)
Per ADR-001, canopy-caps holds no Postgres-level foreign keys to other services. The intra-database FKs are caps_authorizations.{determination_id,provider_id} and determination_snapshots.determination_id → caps_determinations(id). The columns marked FK → canopy-persons / FK → canopy-applications above are application-level foreign keys: canopy-caps trusts the orchestrator (canopy-eligibility) to supply real IDs but does not enforce existence in canopy_caps. This is the program-isolation contract; cross-service consistency is the orchestrator’s responsibility, not the program DB’s.
Retention
CAPS does not handle FTI or PHI; no Pub 1075 / HIPAA retention floor applies. Operational retention is governed by 45 CFR 98.65 (CCDF record retention — minimum 3 years for state administrative records). caps_determinations and caps_authorizations are retained indefinitely in the production system; archive moves are operator-driven, not migration-driven.
Indexes
-
idx_caps_applications_{app,household,child}— per-FK lookups -
idx_caps_applications_provider(partial,WHERE provider_id IS NOT NULL) — provider rollups across applications (#396) -
idx_caps_determinations_{application,household,child,status,effective}— list endpoints -
idx_determination_snapshots_as_of— input-snapshot lookup by evaluation date (ADR-028) -
idx_caps_authorizations_{determination,child,provider,status}— authorization-tab queries on the worker portal -
idx_caps_providers_active(partial,WHERE status='active') — default/v1/providerslisting -
idx_caps_providers_code— unique-key support forprovider_code -
event_outbox_*— the three generated partial outbox indexes (drainer hot path, lease-aware claim, ADR-039 held-skip); documented once in the data-models index -
event_inbox_unprocessed_idx(partial,WHERE processed_at IS NULL) — replay / janitor hot path
Migration files
-
20260413000000_create_caps_tables.sql— original schema (caps_applications, caps_determinations, caps_authorizations) -
20260508000000_create_event_outbox.sql+20260518004851_event_outbox_lease_columns.sql+20260713000000_event_outbox_hold.sql— the generated ADR-039 single-sourced outbox migrations (cargo xtask outbox-migrations --write); documented once in the data-models index -
20260512000001_add_caps_providers.sql— #396 provider registry; drops pre-1.0 TEXT provider_id columns and re-adds them as UUID FKs -
20260516000000_create_event_inbox.sql— #433 consumer-side inbox (ADR-018 amendment) -
20260622000000_create_determination_snapshots.sql—caps_determinations.snapshot_hashcolumn + the immutabledetermination_snapshotstable + its append-only trigger (T2-4 #685; ADR-028) -
20260624140000_create_redaction_keys.sql— the per-serviceredaction_keystable + its one-way-tombstone trigger (T2-6 #687, ADR-036)
All migrations are forward-only per ADR-016.