Bug #794
openFertility: quick-register partner dialog skips duplicate-patient guard, can orphan a patient record
0%
Description
Follow-up from #712 (Fertility couple-level partner linking), found during that work's final code review (2026-11-10) and deliberately NOT fixed there to avoid a risky late design change.
Summary
PartnerSearchOrCreateDialog (nuvita-opd, shared by the registration screen's "Partner" section and the Fertility tab's Link control) has a "Register new" option that quick-creates a brand-new patient on submit. Two problems:
- It skips the platform's existing duplicate-patient guard/match-candidate check that the main registration flow runs - so the same real person can end up registered twice, as two separate patient records with two separate MRNs, if staff don't search first.
- When used from the registration screen's own Partner section, the quick-created partner patient is created immediately on dialog submit - before the main patient being registered is actually saved. If that main registration is then abandoned or fails validation, the quick-created partner patient is left behind as an orphan record (never linked to anyone, but with a real MRN).
Impact
Data-quality/compliance risk in a regulated system - duplicate or orphaned patient records with real MRNs, requiring manual cleanup, and risking clinical confusion if staff later work from the wrong duplicate.
Suggested fix (either, needs a product/design call)
- Run the same duplicate-match check the main registration flow uses before quick-creating a partner, surfacing candidates for staff to pick from instead; and/or
- Defer the partner's creation until the main patient's registration has actually committed (mirroring how the LINK itself is already deferred in this flow), rather than creating it eagerly on dialog submit.
Reference
#712 (the feature this gap was found during). File: nuvita-opd/apps/portal/src/components/patients/PartnerSearchOrCreateDialog.tsx.