feat: chatbot CDT lookup — SRP quad, 4-digit auto-prefix, quad field to Selenium
- parseSrpCode: recognize "D4341 UL" / "4341 LR" etc., store quadrant in quad field - matchOne: auto-prefix D for 4-digit inputs like "0120" → D0120 - LLM prompt: keep SRP code and quadrant together as one procedureName entry - CdtMatch / CdtResult: add quad field, thread through matchedCodes action data - claim-form.tsx: include quad in chatbot_claim_prefill type and spread to service line - selenium_claimSubmitWorker.py: pass quad to fill_service_line, select quadrant dropdown by index (UR=1, UL=2, LL=3, LR=4) matching MassHealth form structure Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1176,11 +1176,19 @@ class AutomationMassHealthClaimsLogin:
|
||||
"message": f"PDF + Screenshot failed: {ss_error}",
|
||||
}
|
||||
|
||||
def fill_service_line(self, row_number=1, procedure_code="", tooth_number="", tooth_surface="", quadrant="Upper Right", arch="Entire Oral Cavity", auth_number="AUTH123456", billed_amount=""):
|
||||
# Map quadrant abbreviations to MassHealth dropdown visible text
|
||||
QUAD_LABEL = {
|
||||
"UL": "Upper Left",
|
||||
"UR": "Upper Right",
|
||||
"LL": "Lower Left",
|
||||
"LR": "Lower Right",
|
||||
}
|
||||
|
||||
def fill_service_line(self, row_number=1, procedure_code="", tooth_number="", tooth_surface="", quadrant="", arch="Entire Oral Cavity", auth_number="AUTH123456", billed_amount=""):
|
||||
wait = WebDriverWait(self.driver, 30)
|
||||
|
||||
try:
|
||||
print(f"DEBUG: Filling service line {row_number} - Procedure: {procedure_code}, Tooth: {tooth_number}, Surface: {tooth_surface}, Amount: {billed_amount}")
|
||||
print(f"DEBUG: Filling service line {row_number} - Procedure: {procedure_code}, Tooth: {tooth_number}, Surface: {tooth_surface}, Quadrant: {quadrant}, Amount: {billed_amount}")
|
||||
|
||||
# Fill Procedure Code - find the specific row's procedure input
|
||||
if procedure_code:
|
||||
@@ -1261,20 +1269,23 @@ class AutomationMassHealthClaimsLogin:
|
||||
else:
|
||||
print(f"DEBUG: No tooth surface provided for row {row_number}, skipping")
|
||||
|
||||
# COMMENTED OUT: Quadrant - not needed per user requirement
|
||||
# Will be handled later for specific procedure codes that require it
|
||||
# quadrant_dropdowns = wait.until(
|
||||
# EC.presence_of_all_elements_located(
|
||||
# (By.XPATH, "//select[@ng-model='serviceLine.quadrant']")
|
||||
# )
|
||||
# )
|
||||
# if len(quadrant_dropdowns) < row_number:
|
||||
# raise Exception(f"Only {len(quadrant_dropdowns)} quadrant dropdowns found, but need row {row_number}")
|
||||
# quadrant_dropdown = quadrant_dropdowns[row_number - 1]
|
||||
# time.sleep(1)
|
||||
# select_quadrant = Select(quadrant_dropdown)
|
||||
# select_quadrant.select_by_visible_text(quadrant)
|
||||
# time.sleep(2)
|
||||
# Fill Quadrant - only if provided (D4341/D4342 SRP codes)
|
||||
# Dropdown index: 1=Upper Right, 2=Upper Left, 3=Lower Left, 4=Lower Right
|
||||
quad_index = {"UR": 1, "UL": 2, "LL": 3, "LR": 4}.get((quadrant or "").upper())
|
||||
if quad_index is not None:
|
||||
print(f"DEBUG: Selecting quadrant '{quadrant}' (index {quad_index}) for row {row_number}")
|
||||
quadrant_dropdowns = wait.until(
|
||||
EC.presence_of_all_elements_located(
|
||||
(By.XPATH, "//select[@ng-model='serviceLine.quadrant']")
|
||||
)
|
||||
)
|
||||
if len(quadrant_dropdowns) < row_number:
|
||||
raise Exception(f"Only {len(quadrant_dropdowns)} quadrant dropdowns found, but need row {row_number}")
|
||||
select_quadrant = Select(quadrant_dropdowns[row_number - 1])
|
||||
select_quadrant.select_by_index(quad_index)
|
||||
time.sleep(1)
|
||||
else:
|
||||
print(f"DEBUG: No quadrant provided for row {row_number}, skipping")
|
||||
|
||||
# COMMENTED OUT: Arch - not needed per user requirement
|
||||
# Will be handled later for specific procedure codes that require it
|
||||
@@ -1402,6 +1413,7 @@ class AutomationMassHealthClaimsLogin:
|
||||
procedure_code=service_line.get("procedureCode", ""),
|
||||
tooth_number=service_line.get("toothNumber", ""),
|
||||
tooth_surface=service_line.get("toothSurface", ""),
|
||||
quadrant=service_line.get("quad", ""),
|
||||
billed_amount=service_line.get("totalBilled", "")
|
||||
)
|
||||
else:
|
||||
@@ -1409,12 +1421,13 @@ class AutomationMassHealthClaimsLogin:
|
||||
plus_result = self.click_plus_button()
|
||||
if plus_result != "Success":
|
||||
return {"status": "error", "message": plus_result}
|
||||
|
||||
|
||||
service_result = self.fill_service_line(
|
||||
row_number=row_num,
|
||||
procedure_code=service_line.get("procedureCode", ""),
|
||||
tooth_number=service_line.get("toothNumber", ""),
|
||||
tooth_surface=service_line.get("toothSurface", ""),
|
||||
quadrant=service_line.get("quad", ""),
|
||||
billed_amount=service_line.get("totalBilled", "")
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user