feat: fix DDMA eligibility — patient list, name extraction, PDF page, OTP session

- Filter patient list by userId so each user sees only their own patients
- Sort patients by updatedAt DESC so recently checked patients appear first
- Add updatedAt field to Patient model (DB migration via raw SQL + db:generate)
- Fix DDMA name extraction: read from detail page "Name:" label, not search
  results row text which included appended dates
- Fix PDF capture: use driver.get() instead of click() to avoid race condition
  that was saving the search results page instead of the patient detail page
- Strip trailing bare dates from extracted names (e.g. "Rodriguez 04/27/2026")
- Handle "Last, First" comma format and single-word last names in splitName
- Normalize insuranceId consistently in createOrUpdatePatientByInsuranceId
- Fix OTP persistent session: stop clearing LocalStorage/IndexedDB on startup
  (these hold the DDMA device trust token that skips OTP on subsequent logins)
- Increase post-navigation wait time for full page render before PDF generation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-05-01 21:40:04 -04:00
parent 24bbaed6ab
commit e26ebf7fd5
213 changed files with 1698 additions and 1425 deletions

View File

@@ -1,6 +1,7 @@
import * as z from 'zod';
import { Prisma } from '../../../generated/prisma';
import Decimal from 'decimal.js';
import type { Prisma } from '../../../generated/prisma';
import Decimal from "decimal.js";
export declare const PaymentUncheckedUpdateManyInputObjectSchema: z.ZodType<Prisma.PaymentUncheckedUpdateManyInput>;
export declare const PaymentUncheckedUpdateManyInputObjectZodSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLazy<z.ZodType<Prisma.IntFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.IntFieldUpdateOperationsInput>>]>>;
@@ -8,10 +9,10 @@ export declare const PaymentUncheckedUpdateManyInputObjectZodSchema: z.ZodObject
patientId: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLazy<z.ZodType<Prisma.IntFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.IntFieldUpdateOperationsInput>>]>>;
userId: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLazy<z.ZodType<Prisma.IntFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.IntFieldUpdateOperationsInput>>]>>;
updatedById: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLazy<z.ZodType<Prisma.NullableIntFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.NullableIntFieldUpdateOperationsInput>>]>>>;
totalBilled: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Prisma.Decimal, z.ZodTypeDef, Prisma.Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalPaid: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Prisma.Decimal, z.ZodTypeDef, Prisma.Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalAdjusted: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Prisma.Decimal, z.ZodTypeDef, Prisma.Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalDue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Prisma.Decimal, z.ZodTypeDef, Prisma.Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalBilled: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalPaid: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalAdjusted: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
totalDue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<Decimal, z.ZodTypeDef, Decimal>, z.ZodType<import("../../../generated/prisma/runtime/client").DecimalJsLike, z.ZodTypeDef, import("../../../generated/prisma/runtime/client").DecimalJsLike>]>, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal, string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal>, z.ZodLazy<z.ZodType<Prisma.DecimalFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.DecimalFieldUpdateOperationsInput>>]>>;
status: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["PENDING", "PARTIALLY_PAID", "PAID", "OVERPAID", "DENIED", "VOID"]>, z.ZodLazy<z.ZodType<Prisma.EnumPaymentStatusFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.EnumPaymentStatusFieldUpdateOperationsInput>>]>>;
notes: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLazy<z.ZodType<Prisma.NullableStringFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.NullableStringFieldUpdateOperationsInput>>]>>>;
icn: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLazy<z.ZodType<Prisma.NullableStringFieldUpdateOperationsInput, z.ZodTypeDef, Prisma.NullableStringFieldUpdateOperationsInput>>]>>>;
@@ -25,10 +26,10 @@ export declare const PaymentUncheckedUpdateManyInputObjectZodSchema: z.ZodObject
patientId?: number | Prisma.IntFieldUpdateOperationsInput | undefined;
notes?: string | Prisma.NullableStringFieldUpdateOperationsInput | null | undefined;
claimId?: number | Prisma.NullableIntFieldUpdateOperationsInput | null | undefined;
totalBilled?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalPaid?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalAdjusted?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalDue?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalBilled?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalPaid?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalAdjusted?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalDue?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
icn?: string | Prisma.NullableStringFieldUpdateOperationsInput | null | undefined;
updatedAt?: Date | Prisma.DateTimeFieldUpdateOperationsInput | undefined;
updatedById?: number | Prisma.NullableIntFieldUpdateOperationsInput | null | undefined;
@@ -40,10 +41,10 @@ export declare const PaymentUncheckedUpdateManyInputObjectZodSchema: z.ZodObject
patientId?: number | Prisma.IntFieldUpdateOperationsInput | undefined;
notes?: string | Prisma.NullableStringFieldUpdateOperationsInput | null | undefined;
claimId?: number | Prisma.NullableIntFieldUpdateOperationsInput | null | undefined;
totalBilled?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalPaid?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalAdjusted?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalDue?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Prisma.Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalBilled?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalPaid?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalAdjusted?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
totalDue?: string | number | import("../../../generated/prisma/runtime/client").DecimalJsLike | Decimal | Decimal | Prisma.DecimalFieldUpdateOperationsInput | undefined;
icn?: string | Prisma.NullableStringFieldUpdateOperationsInput | null | undefined;
updatedAt?: Date | Prisma.DateTimeFieldUpdateOperationsInput | undefined;
updatedById?: number | Prisma.NullableIntFieldUpdateOperationsInput | null | undefined;