Files
DentalManagementMH05/packages/db/shared/schemas/findFirstAiSettings.schema.ts
Gitead c71624f7e7 feat: enhance new-patient AI chat flow with full scheduling and eligibility
- Add 3-message intro (self-intro → empathetic ack → new/existing question) via single TwiML response to guarantee delivery order
- Detect reschedule intent from first message; look up existing appointment date
- New patient flow: ask insurance type → MassHealth consent → member ID + DOB → Selenium eligibility check
- Post-eligibility: active → ask appointment date/time with office-hours validation; inactive → ask other insurance or collect contact info
- Date/time collection mirrors reschedule flow: check office day open, ask time, validate against office hours
- Auto-create appointment in schedule for known patients on confirmation; use first available staff member
- Add openPhoneReply toggle (Settings → AI Chat) to respond to any number at any time
- Add 5-minute inactivity timeout: reset conversation to initial stage and clear pending state
- Normalize MassHealth DOB to zero-padded MM/DD/YYYY before Selenium submission
- Expand isExistingPatient classifier to recognize "old patient", "old", "previous", "prior"
- Existing patient confirmation message now acknowledges patient type before asking about insurance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 00:00:56 -04:00

32 lines
2.8 KiB
TypeScript

import type { Prisma } from '../../generated/prisma';
import * as z from 'zod';
import { AiSettingsIncludeObjectSchema as AiSettingsIncludeObjectSchema } from './objects/AiSettingsInclude.schema';
import { AiSettingsOrderByWithRelationInputObjectSchema as AiSettingsOrderByWithRelationInputObjectSchema } from './objects/AiSettingsOrderByWithRelationInput.schema';
import { AiSettingsWhereInputObjectSchema as AiSettingsWhereInputObjectSchema } from './objects/AiSettingsWhereInput.schema';
import { AiSettingsWhereUniqueInputObjectSchema as AiSettingsWhereUniqueInputObjectSchema } from './objects/AiSettingsWhereUniqueInput.schema';
import { AiSettingsScalarFieldEnumSchema } from './enums/AiSettingsScalarFieldEnum.schema';
// Select schema needs to be in file to prevent circular imports
//------------------------------------------------------
export const AiSettingsFindFirstSelectSchema: z.ZodType<Prisma.AiSettingsSelect> = z.object({
id: z.boolean().optional(),
userId: z.boolean().optional(),
apiKey: z.boolean().optional(),
afterHoursEnabled: z.boolean().optional(),
openPhoneReply: z.boolean().optional(),
user: z.boolean().optional()
}).strict() as unknown as z.ZodType<Prisma.AiSettingsSelect>;
export const AiSettingsFindFirstSelectZodSchema = z.object({
id: z.boolean().optional(),
userId: z.boolean().optional(),
apiKey: z.boolean().optional(),
afterHoursEnabled: z.boolean().optional(),
openPhoneReply: z.boolean().optional(),
user: z.boolean().optional()
}).strict();
export const AiSettingsFindFirstSchema: z.ZodType<Prisma.AiSettingsFindFirstArgs> = z.object({ select: AiSettingsFindFirstSelectSchema.optional(), include: z.lazy(() => AiSettingsIncludeObjectSchema.optional()), orderBy: z.union([AiSettingsOrderByWithRelationInputObjectSchema, AiSettingsOrderByWithRelationInputObjectSchema.array()]).optional(), where: AiSettingsWhereInputObjectSchema.optional(), cursor: AiSettingsWhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.union([AiSettingsScalarFieldEnumSchema, AiSettingsScalarFieldEnumSchema.array()]).optional() }).strict() as unknown as z.ZodType<Prisma.AiSettingsFindFirstArgs>;
export const AiSettingsFindFirstZodSchema = z.object({ select: AiSettingsFindFirstSelectSchema.optional(), include: z.lazy(() => AiSettingsIncludeObjectSchema.optional()), orderBy: z.union([AiSettingsOrderByWithRelationInputObjectSchema, AiSettingsOrderByWithRelationInputObjectSchema.array()]).optional(), where: AiSettingsWhereInputObjectSchema.optional(), cursor: AiSettingsWhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.union([AiSettingsScalarFieldEnumSchema, AiSettingsScalarFieldEnumSchema.array()]).optional() }).strict();