feat: MassHealth member detail demographics, wait for name/plan before PDF

- Extract gender, address (street/city/state/zip) and home phone from the
  MassHealth Member Detail page and save to the patient; phone is only
  filled when the patient has none
- Shared extract_eligibility_row polls up to 30s until the matching results
  row has both name and plan before the PDF is printed (AngularJS fills cell
  text after the rows appear); used by all three MH eligibility workers
- Fall back to the Member Detail heading for the name when the results table
  never filled it in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 15:53:34 -04:00
co-authored by Claude Opus 5.5
parent 13be6e97d5
commit ebc5fba2c9
8 changed files with 219 additions and 232 deletions
@@ -12,6 +12,7 @@ import {
callPythonSync,
splitName,
createOrUpdatePatientByInsuranceId,
memberDetailDemographics,
} from "./_shared";
export interface EligibilityHistoryProcessorInput {
@@ -103,6 +104,7 @@ export async function runEligibilityHistoryProcessor(
const updates: any = { status: newStatus };
if (seleniumInsurance) updates.insuranceProvider = seleniumInsurance;
Object.assign(updates, memberDetailDemographics(seleniumResult, patient.phone));
await storage.updatePatient(patient.id, updates);
outputResult.patientUpdateStatus = `Patient status updated to ${newStatus}`;