Census data is cached per adapter instance so concurrent calls
(e.g. fetchPatientAdmissions + fetchPatientCareTeam in Promise.all)
share a single API request instead of each making their own. The cache
is scoped to the adapter instance — one per queue job — and naturally
resets between sync cycles.
Differences from legacy:
DB access goes through v2 repo singletons (patientsRepo,
patientAdmissionsRepo) rather than per-request Supabase clients.
Errors are typed (IntegrationConfigError / PatientConfigError)
instead of bare Error so the manager can surface them cleanly.
Insurance records carry payor_name only; the manager resolves
payor_name → payor_id in bulk before insert.
fetchIntegrationFacilities throws IntegrationConfigError when
the configured realm isn't present in Sunwave (legacy returned
{ facility: null }).
Adapter for syncing data from Sunwave EMR to v2.
Census data is cached per adapter instance so concurrent calls (e.g. fetchPatientAdmissions + fetchPatientCareTeam in Promise.all) share a single API request instead of each making their own. The cache is scoped to the adapter instance — one per queue job — and naturally resets between sync cycles.
Differences from legacy:
patientsRepo,patientAdmissionsRepo) rather than per-request Supabase clients.IntegrationConfigError/PatientConfigError) instead of bareErrorso the manager can surface them cleanly.payor_nameonly; the manager resolvespayor_name → payor_idin bulk before insert.fetchIntegrationFacilitiesthrowsIntegrationConfigErrorwhen the configured realm isn't present in Sunwave (legacy returned{ facility: null }).