- New CoverageFlag enum: SUPPLY_LAPSED, VISIT_REQUIRED, TRANSFER_PENDING, RENEWAL_CRITICAL/ELEVATED/SOON, RESUPPLY_READY, ACTIVE - Doc state machine: 5-item payer-dependent status per patient (SWO, Visit, PECOS, PA, Diagnosis) with cascade chain - Confirm Visit endpoint: staff enters prescriber-confirmed date, persisted in Supabase confirmed_visits table, survives all future CSV imports - Supabase migration: 001_add_confirmed_visits.sql (run manually in SQL editor) - Frontend: Badge rebuilt for 8 flags, DocStatusBar 5-dot display, ConfirmVisitModal, expandable WorklistTable rows - Legal: LOI, NDA, BAA drafts at pitch/legal/ for Nixon Law Group review - Compliance docs: privacy policy, incident response, data handling - CSV generator: market_data.json + PA/NJ generator scripts - 15/15 tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
930 B
SQL
19 lines
930 B
SQL
-- Migration 001: Add confirmed_visits table
|
|
-- Run in Supabase SQL Editor: Dashboard > SQL Editor > New query
|
|
-- Safe to run multiple times.
|
|
|
|
create table if not exists confirmed_visits (
|
|
id uuid primary key default uuid_generate_v4(),
|
|
org_id uuid not null references organizations(id) on delete cascade,
|
|
patient_id_hash text not null, -- SHA-256 of patient_id — no raw PHI
|
|
confirmed_date date not null,
|
|
confirmed_by text, -- staff identifier (not PHI — just a label)
|
|
created_at timestamptz not null default now(),
|
|
updated_at timestamptz not null default now(),
|
|
unique(org_id, patient_id_hash)
|
|
);
|
|
|
|
create index if not exists idx_confirmed_visits_org on confirmed_visits(org_id);
|
|
create index if not exists idx_confirmed_visits_hash on confirmed_visits(patient_id_hash);
|
|
|
|
alter table confirmed_visits enable row level security;
|