From cb49298b662965c598956c514bd1d84e175eeff0 Mon Sep 17 00:00:00 2001 From: Gitead Date: Mon, 29 Jun 2026 00:02:26 -0400 Subject: [PATCH] fix: teach AI to recognize recement and fix missing service date in column claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add "recement" example to LLM classifier so it spreads across multiple teeth (recement #5, #3 → two D2920 entries). Add "today" to the AI column claim message so the LLM sets appointmentDate instead of asking "Which service date?" Co-Authored-By: Claude Sonnet 4.6 --- apps/Backend/src/ai/internal-chat-graph.ts | 2 ++ apps/Frontend/src/pages/appointments-page.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/Backend/src/ai/internal-chat-graph.ts b/apps/Backend/src/ai/internal-chat-graph.ts index a88d4a6c..30bc6375 100644 --- a/apps/Backend/src/ai/internal-chat-graph.ts +++ b/apps/Backend/src/ai/internal-chat-graph.ts @@ -157,6 +157,8 @@ Rules: e.g. "crown #3, #5, #12" → ["crown #3", "crown #5", "crown #12"] e.g. "extraction #1, 16, 17, 32" → ["extraction #1", "extraction #16", "extraction #17", "extraction #32"] e.g. "rct #23, 24, 25" → ["rct #23", "rct #24", "rct #25"] + e.g. "recement #5, #3" → ["recement #5", "recement #3"] + "recement" / "re-cement" / "re cement" means re-cementing a crown (D2920) — always spread across each tooth number "post/core" is the same as "post core" — a combined post and core procedure - For RCT/root canal with a tooth number, preserve the tooth# in the entry: e.g. "rct #29", "#14 root canal", "rct #6", "#20 rct" — keep the #number with the procedure so the correct code can be selected diff --git a/apps/Frontend/src/pages/appointments-page.tsx b/apps/Frontend/src/pages/appointments-page.tsx index fce29085..d779cc09 100755 --- a/apps/Frontend/src/pages/appointments-page.tsx +++ b/apps/Frontend/src/pages/appointments-page.tsx @@ -1531,7 +1531,7 @@ export default function AppointmentsPage() { setAiClaimCurrentData(null); try { const res = await apiRequest("POST", "/api/ai/internal-chat", { - message: `claim ${apt.notes} for ${apt.patientName}`, + message: `claim ${apt.notes} for ${apt.patientName} today`, clientDate: aptDate, }); const data = await res.json();