fix: extract tooth number and surface from #NN notation for all DDMA procedures

Added extractToothSurface() helper that parses "#NN [SURFACES]" from any
procedure input (tooth 1-32, surface letters O/M/D/B/L/F/I/V). Applied to
all lookup paths so any procedure with #14 or #29 OB carries toothNumber and
toothSurface through to the DDMA Selenium worker.

Also propagate toothNumber/toothSurface in matchedCodes and chatbot_claim_prefill
so the claim-form prefill sets these fields on the service lines before auto-submit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-06-06 23:31:22 -04:00
parent 905e236166
commit d02e8c8dcb
3 changed files with 39 additions and 12 deletions

View File

@@ -496,7 +496,7 @@ export function ClaimForm({
if (!raw) return;
try {
const { codes, serviceDate } = JSON.parse(raw) as {
codes: { code: string; description: string }[];
codes: { code: string; description: string; toothNumber?: string; toothSurface?: string }[];
serviceDate?: string;
};
sessionStorage.removeItem("chatbot_claim_prefill");
@@ -515,7 +515,13 @@ export function ClaimForm({
const updatedLines = [...prev.serviceLines];
codes.forEach((c, i) => {
if (i < updatedLines.length) {
updatedLines[i] = { ...updatedLines[i]!, procedureCode: c.code, procedureDate: date };
updatedLines[i] = {
...updatedLines[i]!,
procedureCode: c.code,
procedureDate: date,
...(c.toothNumber ? { toothNumber: c.toothNumber } : {}),
...(c.toothSurface ? { toothSurface: c.toothSurface } : {}),
};
}
});
return { ...prev, serviceLines: updatedLines };