feat(ddma eligibility - name now fetched by selenium

This commit is contained in:
2025-12-15 23:35:44 +05:30
parent 587749144b
commit d14f25656d
2 changed files with 21 additions and 3 deletions

View File

@@ -143,9 +143,18 @@ async function handleDdmaCompletedJob(
throw new Error("Missing memberId for ddma job");
}
// 2) Create or update patient
// 2) Create or update patient (with name from selenium result if available)
const patientNameFromResult =
typeof seleniumResult?.patientName === "string"
? seleniumResult.patientName.trim()
: null;
const { firstName, lastName } = splitName(patientNameFromResult);
await createOrUpdatePatientByInsuranceId({
insuranceId,
firstName,
lastName,
dob: insuranceEligibilityData.dateOfBirth,
userId: job.userId,
});

View File

@@ -169,6 +169,15 @@ class AutomationDeltaDentalMAEligibilityCheck:
eligibilityText = status_link.text.strip().lower()
# 2) finding patient name.
patient_name_div = wait.until(EC.presence_of_element_located((
By.XPATH,
'//div[@class="flex flex-row w-full items-center"]'
)))
patientName = patient_name_div.text.strip().lower()
try:
WebDriverWait(self.driver, 30).until(
@@ -220,9 +229,9 @@ class AutomationDeltaDentalMAEligibilityCheck:
output = {
"status": "success",
"eligibility": eligibilityText,
"ss_path": screenshot_path
"ss_path": screenshot_path,
"patientName":patientName
}
print(output)
return output
except Exception as e:
print("ERROR in step2:", e)