fix: reliability fixes for UHC SCO and CMSP eligibility checks
- unitedSCOEligibilityProcessor: overwrite patient's stored insuranceId when
the eligibility page reports a different (updated) Member ID than the one
searched with.
- CMSP worker: add AngularJS late-binding retry to results-table extraction
(ported from the MH worker's a0417653 fix), since every patient now routes
through this worker for the accumulator check.
- cmspEligibilityHistoryRemainingProcessor: stop forcing patient status to
UNKNOWN when extraction fails; a failed run landing after a successful one
was clobbering a correct ACTIVE/INACTIVE status.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,11 +101,16 @@ export async function runCmspEligibilityHistoryRemainingProcessor(
|
||||
}
|
||||
|
||||
if (patient && patient.id !== undefined) {
|
||||
let newStatus = "UNKNOWN";
|
||||
// eligibility is null when extraction found no matching row (e.g. the
|
||||
// AngularJS grid didn't finish rendering in time). Leave status untouched
|
||||
// in that case rather than forcing UNKNOWN, so a failed run can't clobber
|
||||
// a correct ACTIVE/INACTIVE status set by another (e.g. concurrent) run.
|
||||
let newStatus: string | null = null;
|
||||
if (seleniumResult.eligibility === "Y") newStatus = "ACTIVE";
|
||||
else if (seleniumResult.eligibility === "N") newStatus = "INACTIVE";
|
||||
|
||||
const updates: any = { status: newStatus };
|
||||
const updates: any = {};
|
||||
if (newStatus) updates.status = newStatus;
|
||||
if (seleniumInsurance) updates.insuranceProvider = seleniumInsurance;
|
||||
|
||||
const remainingBenefit = seleniumResult.remaining_amount?.trim() || null;
|
||||
@@ -118,8 +123,12 @@ export async function runCmspEligibilityHistoryRemainingProcessor(
|
||||
updates.thirdPartyInsurance = seleniumResult.third_party_insurance?.trim() || null;
|
||||
}
|
||||
|
||||
await storage.updatePatient(patient.id, updates);
|
||||
outputResult.patientUpdateStatus = `Patient status updated to ${newStatus}`;
|
||||
if (Object.keys(updates).length > 0) {
|
||||
await storage.updatePatient(patient.id, updates);
|
||||
}
|
||||
outputResult.patientUpdateStatus = newStatus
|
||||
? `Patient status updated to ${newStatus}`
|
||||
: "Eligibility unknown — status not changed";
|
||||
outputResult.remainingBenefit = remainingBenefit;
|
||||
outputResult.thirdPartyInsurance = updates.thirdPartyInsurance ?? null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user