feat: add multi_claim intent for different procedures per patient + fix batch claim PDF race

- Add multi_claim intent so AI correctly handles "claim X for patient A and Y for patient B"
  instead of applying all procedures to all patients (batch_claim)
- Each patient carries their own matchedCodes in the queue
- Fix batch claim PDF race condition: chatbot queue no longer advances in closeClaim(),
  instead advances after selenium PDF is downloaded (matching column claim behavior)
- Align United SCO eligibility worker with claim worker: only fill subscriber ID + DOB,
  use treatmentLocation by ID instead of arrow-wrapper click

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-29 01:08:41 -04:00
parent cb49298b66
commit cdda91f2b4
5 changed files with 324 additions and 96 deletions

View File

@@ -423,19 +423,19 @@ class AutomationUnitedSCOEligibilityCheck:
def step1(self):
"""
Navigate to Eligibility page and fill the Patient Information form.
Workflow based on actual DOM testing:
Workflow:
1. Navigate directly to eligibility page
2. Fill First Name (id='firstName_Back'), Last Name (id='lastName_Back'), DOB (id='dateOfBirth_Back')
2. Fill Subscriber ID and DOB
3. Select Payer: "UnitedHealthcare Massachusetts" from ng-select dropdown
4. Click Continue
5. Handle Practitioner & Location page - click paymentGroupId dropdown, select Summit Dental Care
5. Handle Practitioner & Location page - select Treatment Location and Billing Entity
6. Click Continue again
"""
from selenium.webdriver.common.action_chains import ActionChains
try:
print(f"[UnitedSCO step1] Starting eligibility search for: {self.firstName} {self.lastName}, DOB: {self.dateOfBirth}")
print(f"[UnitedSCO step1] Starting eligibility search for: memberId={self.memberId}, DOB: {self.dateOfBirth}")
# Navigate directly to eligibility page
print("[UnitedSCO step1] Navigating to eligibility page...")
@@ -644,23 +644,34 @@ class AutomationUnitedSCOEligibilityCheck:
print("[UnitedSCO step1] Selecting Treatment Location...")
location_selected = False
try:
location_ng = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.XPATH,
"//label[@for='treatmentLocation']/following-sibling::ng-select | "
"//label[@for='treatmentLocation']/..//ng-select"
))
)
# Center in viewport so panel opens downward instead of upward
self.driver.execute_script("arguments[0].scrollIntoView({block:'center'});", location_ng)
arrow = location_ng.find_element(By.CSS_SELECTOR, ".ng-arrow-wrapper")
arrow.click()
first_option = WebDriverWait(self.driver, 5).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, ".ng-dropdown-panel .ng-option"))
)
option_text = first_option.text.strip()
first_option.click()
print(f"[UnitedSCO step1] Selected Treatment Location: {option_text}")
location_selected = True
location_input = self.driver.find_element(By.ID, "treatmentLocation")
if location_input.is_displayed():
self.driver.execute_script("arguments[0].scrollIntoView({block:'center'});", location_input)
location_input.click()
print("[UnitedSCO step1] Clicked Treatment Location dropdown")
time.sleep(1)
try:
summit_option = WebDriverWait(self.driver, 5).until(
EC.element_to_be_clickable((By.XPATH,
"//ng-dropdown-panel//div[contains(@class,'ng-option') and contains(.,'Summit Dental Care')]"
))
)
summit_option.click()
print("[UnitedSCO step1] Selected Treatment Location: Summit Dental Care")
location_selected = True
except TimeoutException:
try:
first_option = self.driver.find_element(By.XPATH,
"//ng-dropdown-panel//div[contains(@class,'ng-option')]"
)
option_text = first_option.text.strip()
first_option.click()
print(f"[UnitedSCO step1] Selected Treatment Location (fallback): {option_text}")
location_selected = True
except Exception:
print("[UnitedSCO step1] No options available in Treatment Location dropdown")
ActionChains(self.driver).send_keys(Keys.ESCAPE).perform()
time.sleep(1)
except Exception as e:
print(f"[UnitedSCO step1] Treatment Location selection failed: {e}")