fix: BCBS MA eligibility — name extraction, tab switching, DOB input, button color

- Extract patient first/last name from Patient Information DOM section
  (scoped to avoid duplicate Subscriber Information column values)
- Switch to latest tab at start of step2 (Eligibility Identifier opens in new tab)
- DOB: double-click + ActionChains.send_keys (no pyperclip, avoids Chrome crash)
- BCBS MA button changed to variant="default" to match nearby buttons
- Backend processor uses extracted names from selenium result

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-06-01 01:18:20 -04:00
parent e644d21cee
commit 87d7ce9ed9
3 changed files with 62 additions and 33 deletions

View File

@@ -53,32 +53,15 @@ async function processBcbsMaResult(
let createdPdfFileId: number | null = null;
try {
// Resolve patient name
const rawName =
typeof seleniumResult?.patientName === "string" ? seleniumResult.patientName.trim() : null;
let firstName: string;
let lastName: string;
if (rawName) {
if (rawName.includes(",")) {
const [last, ...firstParts] = rawName.split(",").map((s: string) => s.trim());
lastName = last || formLastName || "";
firstName = firstParts.join(" ").trim() || formFirstName || "";
} else {
const parsed = splitName(rawName);
if (!parsed.lastName) {
lastName = parsed.firstName || formLastName || "";
firstName = formFirstName || "";
} else {
firstName = parsed.firstName || formFirstName || "";
lastName = parsed.lastName || formLastName || "";
}
}
} else {
firstName = formFirstName ?? "";
lastName = formLastName ?? "";
}
// Prefer names extracted from the BCBS MA results page (Demographic Information section)
const firstName: string =
(typeof seleniumResult?.firstName === "string" && seleniumResult.firstName.trim())
? seleniumResult.firstName.trim()
: (formFirstName ?? "");
const lastName: string =
(typeof seleniumResult?.lastName === "string" && seleniumResult.lastName.trim())
? seleniumResult.lastName.trim()
: (formLastName ?? "");
await createOrUpdatePatientByInsuranceId({ insuranceId, firstName, lastName, dob: formDob, userId });