feat: select DDMA provider by NPI settings instead of always first
Pass the user's primary NPI provider name through the eligibility and claim routes so the Selenium workers click the matching option in the DDMA member-search provider dropdown (data-testid=member-search_provider_select-btn) rather than always falling back to the first entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,7 @@ class AutomationDDMAClaimSubmit:
|
||||
self.lastName = claim.get("lastName", "") or last_name
|
||||
self.serviceLines = claim.get("serviceLines", []) or []
|
||||
self.claimFiles = claim.get("claimFiles", []) or []
|
||||
self.providerName = claim.get("providerName", "") or raw.get("providerName", "")
|
||||
|
||||
self.download_dir = get_browser_manager().download_dir
|
||||
|
||||
@@ -247,6 +248,58 @@ class AutomationDDMAClaimSubmit:
|
||||
print(f"[DDMA Claim login] Exception: {e}")
|
||||
return f"ERROR:LOGIN FAILED: {e}"
|
||||
|
||||
def _select_provider_dropdown(self):
|
||||
"""
|
||||
Click the provider dropdown on the member search page and select the option
|
||||
matching self.providerName (case-insensitive). Falls back to the first option.
|
||||
The button data-testid is 'member-search_provider_select-btn'.
|
||||
"""
|
||||
try:
|
||||
short_wait = WebDriverWait(self.driver, 5)
|
||||
try:
|
||||
provider_btn = short_wait.until(
|
||||
EC.element_to_be_clickable(
|
||||
(By.XPATH, '//button[@data-testid="member-search_provider_select-btn"]')
|
||||
)
|
||||
)
|
||||
except TimeoutException:
|
||||
print("[DDMA Claim step1] No provider dropdown found — skipping")
|
||||
return
|
||||
|
||||
provider_btn.click()
|
||||
time.sleep(0.5)
|
||||
|
||||
try:
|
||||
WebDriverWait(self.driver, 5).until(
|
||||
EC.presence_of_element_located((By.XPATH, "//*[@role='option']"))
|
||||
)
|
||||
except TimeoutException:
|
||||
print("[DDMA Claim step1] Provider listbox did not open")
|
||||
return
|
||||
|
||||
options = self.driver.find_elements(By.XPATH, "//*[@role='option']")
|
||||
print(f"[DDMA Claim step1] Provider options: {[o.text.strip() for o in options]}")
|
||||
|
||||
target = (self.providerName or "").strip().lower()
|
||||
selected = False
|
||||
|
||||
if target:
|
||||
for opt in options:
|
||||
if target in opt.text.lower():
|
||||
opt.click()
|
||||
print(f"[DDMA Claim step1] Selected provider: '{opt.text.strip()}'")
|
||||
selected = True
|
||||
break
|
||||
|
||||
if not selected and options:
|
||||
options[0].click()
|
||||
print(f"[DDMA Claim step1] No match for '{self.providerName}', selected first: '{options[0].text.strip()}'")
|
||||
|
||||
time.sleep(0.3)
|
||||
|
||||
except Exception as e:
|
||||
print(f"[DDMA Claim step1] Provider selection error (non-fatal): {e}")
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Step 1 — Navigate directly to /members then search patient #
|
||||
# (same as eligibility — bypasses onboarding date/location screen) #
|
||||
@@ -266,6 +319,9 @@ class AutomationDDMAClaimSubmit:
|
||||
print(f"[DDMA Claim step1] Current URL: {self.driver.current_url}")
|
||||
print(f"[DDMA Claim step1] Waiting for member search input...")
|
||||
|
||||
# Select provider from dropdown based on NPI settings
|
||||
self._select_provider_dropdown()
|
||||
|
||||
# Fill Member ID
|
||||
if self.memberId:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user