feat: Check Preauth from claim details, Tufts SCO approval PDF, all-folder appointment picker
- Same patient may be booked at the same time in different columns (appointment + preauth) - New preauths save service lines and attachments so the details view shows them - Claim/Preauth Details: renamed, Check Preauth button picks the worker from the claim's insurance (MassHealth, United SCO, Tufts SCO, CCA); OTP popup survives closing the window, window closes after a successful check - Tufts SCO Check Preauth: searches Submitted by pre-auth number, saves the detail page PDF to the patient's new Approval folder (PdfTitleKey PREAUTH_APPROVAL migration) - Appointment attachment picker lists files from all of the patient's folders Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,10 @@ from selenium_preAuthWorker import AutomationMassHealthPreAuth
|
||||
from selenium_MHSinglePaymentCheckWorker import AutomationMassHealthSinglePaymentCheck
|
||||
from selenium_MHBatchPaymentCheckWorker import AutomationMassHealthBatchPaymentCheck
|
||||
from selenium_Altus_eligibilityCheckWorker import AutomationAltusEligibilityCheck
|
||||
from selenium_MH_preAuthCheckWorker import AutomationMassHealthPreAuthCheck
|
||||
from selenium_UnitedSCO_preAuthCheckWorker import AutomationUnitedSCOPreAuthCheck
|
||||
from selenium_TuftsSCO_preAuthCheckWorker import AutomationTuftsSCOPreAuthCheck
|
||||
from selenium_CCA_preAuthCheckWorker import AutomationCCAPreAuthCheck
|
||||
import os
|
||||
import time
|
||||
import helpers_ddma_eligibility as hddma
|
||||
@@ -1253,6 +1257,93 @@ async def cca_preauth(request: Request):
|
||||
return {"status": "started", "session_id": sid}
|
||||
|
||||
|
||||
# ── Check PreAuth (MH, United SCO, Tufts SCO, CCA) ──────────────────────────
|
||||
# Same flow as each insurer's eligibility check, run with its own preauth-check worker.
|
||||
# United SCO / Tufts SCO / CCA share the eligibility session stores, so /session/{sid}/status
|
||||
# and /submit-otp already cover them.
|
||||
|
||||
@app.post("/mh-preauth-check")
|
||||
async def mh_preauth_check(request: Request):
|
||||
global active_jobs, waiting_jobs
|
||||
data = await request.json()
|
||||
|
||||
async with lock:
|
||||
waiting_jobs += 1
|
||||
|
||||
async with semaphore:
|
||||
async with lock:
|
||||
waiting_jobs -= 1
|
||||
active_jobs += 1
|
||||
try:
|
||||
bot = AutomationMassHealthPreAuthCheck(data)
|
||||
result = bot.main_workflow("https://provider.masshealth-dental.org/mh_provider_login")
|
||||
|
||||
if result.get("status") != "success":
|
||||
return {"status": "error", "message": result.get("message")}
|
||||
return result
|
||||
except Exception as e:
|
||||
return {"status": "error", "message": str(e)}
|
||||
finally:
|
||||
async with lock:
|
||||
active_jobs -= 1
|
||||
|
||||
|
||||
async def _preauth_check_wrapper(start_run, sid: str, data: dict, url: str, worker_cls):
|
||||
"""Background worker for a Check PreAuth session — acquires semaphore, updates counters."""
|
||||
global active_jobs, waiting_jobs
|
||||
async with semaphore:
|
||||
async with lock:
|
||||
waiting_jobs -= 1
|
||||
active_jobs += 1
|
||||
try:
|
||||
await start_run(sid, data, url, worker_cls=worker_cls)
|
||||
finally:
|
||||
async with lock:
|
||||
active_jobs -= 1
|
||||
|
||||
|
||||
async def _start_preauth_check(request: Request, helper, start_run, session_type: str, url: str, worker_cls):
|
||||
global waiting_jobs
|
||||
|
||||
body = await request.json()
|
||||
data = body.get("data", {})
|
||||
|
||||
sid = helper.make_session_entry()
|
||||
helper.sessions[sid]["type"] = session_type
|
||||
helper.sessions[sid]["last_activity"] = time.time()
|
||||
|
||||
async with lock:
|
||||
waiting_jobs += 1
|
||||
|
||||
asyncio.create_task(_preauth_check_wrapper(start_run, sid, data, url, worker_cls))
|
||||
|
||||
return {"status": "started", "session_id": sid}
|
||||
|
||||
|
||||
@app.post("/unitedsco-preauth-check")
|
||||
async def unitedsco_preauth_check(request: Request):
|
||||
return await _start_preauth_check(
|
||||
request, hunitedsco, hunitedsco.start_unitedsco_run, "unitedsco_preauth_check",
|
||||
"https://app.dentalhub.com/app/login", AutomationUnitedSCOPreAuthCheck,
|
||||
)
|
||||
|
||||
|
||||
@app.post("/tuftssco-preauth-check")
|
||||
async def tuftssco_preauth_check(request: Request):
|
||||
return await _start_preauth_check(
|
||||
request, hdentaquest, hdentaquest.start_dentaquest_run, "tuftssco_preauth_check",
|
||||
"https://providers.dentaquest.com/", AutomationTuftsSCOPreAuthCheck,
|
||||
)
|
||||
|
||||
|
||||
@app.post("/cca-preauth-check")
|
||||
async def cca_preauth_check(request: Request):
|
||||
return await _start_preauth_check(
|
||||
request, hcca, hcca.start_cca_run, "cca_preauth_check",
|
||||
"https://pwp.sciondental.com/PWP/Landing", AutomationCCAPreAuthCheck,
|
||||
)
|
||||
|
||||
|
||||
@app.post("/submit-otp")
|
||||
async def submit_otp(request: Request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user