diff --git a/apps/Backend/src/ai/cdt-lookup.ts b/apps/Backend/src/ai/cdt-lookup.ts index a76ecc4b..e862acc1 100644 --- a/apps/Backend/src/ai/cdt-lookup.ts +++ b/apps/Backend/src/ai/cdt-lookup.ts @@ -317,10 +317,15 @@ function parseMultiPaCode(input: string): CdtMatch[] | null { // Extract all tooth numbers from the full input string const toothMatches = [...input.matchAll(/#\s*(\d{1,2})\b/g)]; - const teeth: string[] = toothMatches + let teeth: string[] = toothMatches .map((tm) => tm[1]!) .filter((t) => { const n = parseInt(t, 10); return n >= 1 && n <= 32; }); + // "2PA" with no tooth numbers given defaults to #8 (D0220) and #24 (D0230) + if (count === 2 && teeth.length === 0) { + teeth = ["8", "24"]; + } + const d0220 = ALL_CODES.find((r) => r["Procedure Code"] === "D0220"); const d0230 = ALL_CODES.find((r) => r["Procedure Code"] === "D0230"); diff --git a/apps/Frontend/src/pages/claims-page.tsx b/apps/Frontend/src/pages/claims-page.tsx index 0f208e60..fca13944 100755 --- a/apps/Frontend/src/pages/claims-page.tsx +++ b/apps/Frontend/src/pages/claims-page.tsx @@ -156,7 +156,7 @@ export default function ClaimsPage() { if (jobResult.pdfFileId) { advanceAiClaimQueue(); const advancedToNext = advanceChatbotClaimQueue(); - if (!advancedToNext) { + if (!advancedToNext && !chatbotAutoSubmitSiteKey) { setPreviewPdfId(jobResult.pdfFileId); setPreviewFallbackFilename(jobResult.pdfFilename ?? `cca_claim_${jobResult.claimNumber ?? "unknown"}.pdf`); setPreviewOpen(true); @@ -992,8 +992,9 @@ export default function ClaimsPage() { } // Pop up the final PDF so the user doesn't need to navigate to Documents - // (skip if we're about to navigate to the next queued patient's claim) - if (result.pdfFileId && !advancedToNext) { + // (skip if we're about to navigate to the next queued patient's claim, + // or if this claim was submitted via the AI chat column) + if (result.pdfFileId && !advancedToNext && !chatbotAutoSubmitSiteKey) { setPreviewPdfId(result.pdfFileId); setPreviewFallbackFilename(result.fileName ?? null); setPreviewOpen(true);