fix: DDMA eligibility worker — extract name from row, pass DOB from input, wait for page load
- Extract patient name from search results row instead of failing on detail page - Return dateOfBirth from input data (no need to scrape from webpage) - Wait for search page to fully load before provider dropdown selection - Add 3s wait after search results appear for row content to render - Backend: fallback to update existing patient DOB instead of creating duplicate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -342,6 +342,12 @@ class AutomationDeltaDentalMAEligibilityCheck:
|
||||
fields.append(f"DOB: {self.dateOfBirth}")
|
||||
print(f"[DDMA step1] Starting search with: {', '.join(fields)}")
|
||||
|
||||
# Wait for the search page to be fully loaded before interacting
|
||||
wait.until(EC.presence_of_element_located(
|
||||
(By.XPATH, '//input[@placeholder="Search by member ID"]')
|
||||
))
|
||||
time.sleep(1)
|
||||
|
||||
# Select provider from dropdown based on NPI settings
|
||||
self._select_provider_dropdown()
|
||||
|
||||
@@ -408,6 +414,7 @@ class AutomationDeltaDentalMAEligibilityCheck:
|
||||
EC.presence_of_element_located((By.XPATH, '//div[@data-testid="member-search-result-no-results"]')),
|
||||
)
|
||||
)
|
||||
time.sleep(3)
|
||||
except TimeoutException:
|
||||
pass # proceed and let step2 handle missing results
|
||||
|
||||
@@ -447,7 +454,7 @@ class AutomationDeltaDentalMAEligibilityCheck:
|
||||
foundMemberId = self.memberId or ""
|
||||
patientName = ""
|
||||
|
||||
# Extract eligibility status and member ID from search results row
|
||||
# Extract patient name from search results row
|
||||
try:
|
||||
first_row = self.driver.find_element(By.XPATH, "(//tbody//tr)[1]")
|
||||
row_text = first_row.text.strip()
|
||||
@@ -456,9 +463,11 @@ class AutomationDeltaDentalMAEligibilityCheck:
|
||||
lines = row_text.split('\n') if row_text else []
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if line and re.match(r'^[A-Z0-9]{5,}$', line) and not line.startswith('DOB'):
|
||||
foundMemberId = line
|
||||
print(f"[DDMA step2] Extracted Member ID: {foundMemberId}")
|
||||
if not line:
|
||||
continue
|
||||
if re.match(r"^[A-Za-z\s\-']{2,60}$", line):
|
||||
patientName = line
|
||||
print(f"[DDMA step2] Extracted patient name from row: '{patientName}'")
|
||||
break
|
||||
except Exception as e:
|
||||
print(f"[DDMA step2] Error reading first row: {e}")
|
||||
@@ -657,6 +666,7 @@ class AutomationDeltaDentalMAEligibilityCheck:
|
||||
"pdf_path": pdf_path, # explicit pdf_path
|
||||
"patientName": patientName,
|
||||
"memberId": foundMemberId,
|
||||
"dateOfBirth": self.dateOfBirth,
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user