fix: DDMA eligibility worker — extract name from row, pass DOB from input, wait for page load
- Extract patient name from search results row instead of failing on detail page - Return dateOfBirth from input data (no need to scrape from webpage) - Wait for search page to fully load before provider dropdown selection - Add 3s wait after search results appear for row content to render - Backend: fallback to update existing patient DOB instead of creating duplicate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,8 +117,14 @@ export async function createOrUpdatePatientByInsuranceId(options: {
|
||||
// Primary lookup: exact insuranceId + DOB match
|
||||
patient = await storage.getPatientByInsuranceIdAndDob(normalizedId, dobDate);
|
||||
console.log(`[createOrUpdatePatient] id+DOB lookup: ${patient ? `found id=${patient.id}` : "not found"}`);
|
||||
// Do NOT fall back to insuranceId-only lookup — another record with that ID
|
||||
// is a different family member and must not be overwritten.
|
||||
if (!patient) {
|
||||
// Fallback: patient exists but has no DOB yet — update rather than duplicate
|
||||
const byIdOnly = await storage.getPatientByInsuranceId(normalizedId);
|
||||
if (byIdOnly && !byIdOnly.dateOfBirth) {
|
||||
patient = byIdOnly;
|
||||
console.log(`[createOrUpdatePatient] id-only fallback (no DOB on record): found id=${patient.id}`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No DOB supplied — fall back to insuranceId-only (legacy / non-family plans)
|
||||
patient = await storage.getPatientByInsuranceId(normalizedId);
|
||||
|
||||
Reference in New Issue
Block a user