feat: teach AI classifier to recognize "comp" and tooth surface notation

Add "comp" as alias for composite in CDT lookup. Update classifier
prompt with explicit examples for "claim comp #8 ml for lisa today"
and dental surface letter definitions (M/D/L/F/B/O/V/I) so the LLM
correctly treats #tooth+surfaces as composite fillings, not insurance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 20:55:41 -04:00
co-authored by Claude Sonnet 4.6
parent fc3e8c0e25
commit c9d08028a9
8 changed files with 519 additions and 92 deletions
@@ -87,6 +87,51 @@ router.get(
}
);
/**
* GET /api/payments-reports/patients-with-zero-balances
* Returns patients fully paid (balance <= 0) within the date/provider filter.
*/
router.get(
"/patients-with-zero-balances",
async (req: Request, res: Response): Promise<any> => {
try {
const limit = Math.max(
1,
Math.min(200, parseInt(String(req.query.limit || "25"), 10))
);
const cursor =
typeof req.query.cursor === "string" ? String(req.query.cursor) : null;
const from = req.query.from ? new Date(String(req.query.from)) : undefined;
const to = req.query.to ? new Date(String(req.query.to)) : undefined;
if (req.query.from && isNaN(from?.getTime() ?? NaN))
return res.status(400).json({ message: "Invalid 'from' date" });
if (req.query.to && isNaN(to?.getTime() ?? NaN))
return res.status(400).json({ message: "Invalid 'to' date" });
const npiProviderId = req.query.npiProviderId
? Number(req.query.npiProviderId)
: null;
const data = await storage.getPatientsWithZeroBalance(
limit,
cursor,
from,
to,
npiProviderId
);
res.json(data);
} catch (err: any) {
console.error(
"GET /api/payments-reports/patients-with-zero-balances error:",
err?.message ?? err,
err?.stack
);
res.status(500).json({ message: "Failed to fetch zero-balance patients" });
}
}
);
/**
* GET /api/payments-reports/by-doctor/balances
* Query params: