fix: default tooth # for 2PA and skip PDF popup for AI chat claims

- 2PA with no explicit tooth numbers now defaults to D0220 #8 / D0230 #24
- Claims submitted via the AI chat column no longer auto-open the PDF preview modal

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-05 15:52:31 -04:00
co-authored by Claude Sonnet 5
parent d35efe7366
commit fd2d1e6aba
2 changed files with 10 additions and 4 deletions
+6 -1
View File
@@ -317,10 +317,15 @@ function parseMultiPaCode(input: string): CdtMatch[] | null {
// Extract all tooth numbers from the full input string // Extract all tooth numbers from the full input string
const toothMatches = [...input.matchAll(/#\s*(\d{1,2})\b/g)]; const toothMatches = [...input.matchAll(/#\s*(\d{1,2})\b/g)];
const teeth: string[] = toothMatches let teeth: string[] = toothMatches
.map((tm) => tm[1]!) .map((tm) => tm[1]!)
.filter((t) => { const n = parseInt(t, 10); return n >= 1 && n <= 32; }); .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 d0220 = ALL_CODES.find((r) => r["Procedure Code"] === "D0220");
const d0230 = ALL_CODES.find((r) => r["Procedure Code"] === "D0230"); const d0230 = ALL_CODES.find((r) => r["Procedure Code"] === "D0230");
+4 -3
View File
@@ -156,7 +156,7 @@ export default function ClaimsPage() {
if (jobResult.pdfFileId) { if (jobResult.pdfFileId) {
advanceAiClaimQueue(); advanceAiClaimQueue();
const advancedToNext = advanceChatbotClaimQueue(); const advancedToNext = advanceChatbotClaimQueue();
if (!advancedToNext) { if (!advancedToNext && !chatbotAutoSubmitSiteKey) {
setPreviewPdfId(jobResult.pdfFileId); setPreviewPdfId(jobResult.pdfFileId);
setPreviewFallbackFilename(jobResult.pdfFilename ?? `cca_claim_${jobResult.claimNumber ?? "unknown"}.pdf`); setPreviewFallbackFilename(jobResult.pdfFilename ?? `cca_claim_${jobResult.claimNumber ?? "unknown"}.pdf`);
setPreviewOpen(true); 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 // 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) // (skip if we're about to navigate to the next queued patient's claim,
if (result.pdfFileId && !advancedToNext) { // or if this claim was submitted via the AI chat column)
if (result.pdfFileId && !advancedToNext && !chatbotAutoSubmitSiteKey) {
setPreviewPdfId(result.pdfFileId); setPreviewPdfId(result.pdfFileId);
setPreviewFallbackFilename(result.fileName ?? null); setPreviewFallbackFilename(result.fileName ?? null);
setPreviewOpen(true); setPreviewOpen(true);