feat: secondary insurance; SCO primary + MassHealth secondary rule; United SCO service history

- Patient: new secondaryInsuranceProvider / secondaryInsuranceId (form section,
  Patient Details, merge fill)
- MassHealth check on an SCO patient (Tufts SCO / United SCO primary), matched by
  MassHealth ID on file as secondary or by the single SCO patient with the same DOB
  (name must share a word when the portal returns one): MassHealth saved as secondary,
  primary plan/ID/status unchanged, MassHealth history not imported, PDF still saved
  to Eligibility documents. Prevents the name+DOB fallback from overwriting the SCO ID
- United SCO check: a MassHealth patient moved to United SCO keeps the old
  MassHealth ID as secondary; reads Dental Hub Service History and saves it
- Service history saves drop duplicate identical lines
- Chatbot: bare 100… member ID + DOB with no patient/insurance defaults to MassHealth

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-06 00:22:22 -05:00
co-authored by Claude Opus 5.5
parent 919d59f3da
commit de33325b03
105 changed files with 841 additions and 92 deletions
@@ -12,6 +12,7 @@ import re
import base64
from unitedsco_browser_manager import get_browser_manager
from dentalhub_service_history import read_service_history
class AutomationUnitedSCOEligibilityCheck:
def __init__(self, data):
@@ -1135,6 +1136,15 @@ class AutomationUnitedSCOEligibilityCheck:
print(f"[UnitedSCO step2] PDF saved: {pdf_path}")
# 4) Service History (button next to "Eligibility") — never fails the check
service_history = []
try:
service_history = read_service_history(
self.driver, os.path.join(self.download_dir, "debug_service_history")
)
except Exception as e:
print(f"[UnitedSCO step2] Service history read failed: {e}")
# Hide browser window after completion
self._hide_browser()
@@ -1146,7 +1156,8 @@ class AutomationUnitedSCOEligibilityCheck:
"ss_path": pdf_path,
"pdf_path": pdf_path,
"patientName": patientName,
"memberId": foundMemberId
"memberId": foundMemberId,
"service_history": service_history,
}
except Exception as e: