feat: MassHealth service history extraction, shown in Patient Details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 08:38:13 -05:00
co-authored by Claude Opus 5.5
parent 1ee3b0cfc9
commit 33bea3822c
172 changed files with 4044 additions and 127 deletions
@@ -128,6 +128,17 @@ export async function runCmspEligibilityHistoryRemainingProcessor(
if (Object.keys(updates).length > 0) {
await storage.updatePatient(patient.id, updates);
}
// Only replace when rows came back — an empty read may just mean the portal
// was slow, and shouldn't wipe history saved by an earlier check.
if (Array.isArray(seleniumResult.service_history) && seleniumResult.service_history.length > 0) {
try {
await storage.replacePatientServiceHistory(patient.id, seleniumResult.service_history);
} catch (e: any) {
console.error("[cmspProcessor] saving service history failed:", e.message);
}
}
outputResult.patientUpdateStatus = newStatus
? `Patient status updated to ${newStatus}`
: "Eligibility unknown — status not changed";