fix: allow chatbot auto-scheduling when eligibility status is UNKNOWN

Only block appointment creation on explicit INACTIVE status, since
scrapes for some plan types (e.g. MassHealth Child Medicaid) can land
on UNKNOWN without actually finding an ineligible record.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-01 20:39:57 -04:00
co-authored by Claude Sonnet 5
parent 116889dd4e
commit b860fd213f
@@ -842,12 +842,13 @@ export default function InsuranceStatusPage() {
const patient = await lookupRes.json();
if (!patient?.id) return;
// The eligibility check that just ran saved the result to patient.status — only book
// the appointment when insurance came back ACTIVE.
if (patient.status !== "ACTIVE") {
// The eligibility check that just ran saved the result to patient.status — only skip
// booking when insurance came back explicitly INACTIVE. ACTIVE and UNKNOWN (e.g. a
// scrape that couldn't confirm status but didn't find an ineligible record) still book.
if (patient.status === "INACTIVE") {
toast({
title: "No appointment created",
description: `${patient.firstName ?? ""} ${patient.lastName ?? ""} insurance is ${patient.status === "INACTIVE" ? "inactive" : "not active"} — please add manually if needed.`.trim(),
description: `${patient.firstName ?? ""} ${patient.lastName ?? ""} insurance is inactive — please add manually if needed.`.trim(),
variant: "destructive",
});
return;