pluto
PLUTO-78
Duplicate practicas: operador + asistente each create the SAME clinical event picking each other as counterpart -> 2 mirror practica rows for 1 real práctica. Need duplicate-detection + canonical-record rule (natural key candidates: fecha+comision+paciente/tratamiento+the operador/asistente pair). Design WITH Elazar; covers (a) prevent new dupes at create, (b) reconcile existing dupes in prod. Cross-team lessons-learned for mars/venus.
Backlog normal
unassigned
Questions
No questions.
Activity
-
DB read-only prod scan (2026-06-13). 8 candidate pairs total. REAL DUPES = 5 same-roles exact pairs: identical (fecha,comision,operadorId,asistenteId,nhc,pieza) submitted twice by same pair, all Jun 9-11 2026 (ids: 159ed8d9/712532f9, 56597d80/5ddc4125, beb9c8cf/e5e79aeb, 0fa5c569/3a87944d, 305c0a6c/aff2191e). NOT dupes = 3 swapped-roles pairs: same day+comision but operador/asistente swapped AND different NHC+pieza = two distinct real procedures (A operates X w/ B assisting, then B operates Y w/ A assisting). NATURAL-KEY REFINEMENT: key must be (periodoId,fecha,assignmentComisionId,operadorId,asistenteId,numeroHistoriaClinica,piezaDentaria) and must NOT be order-independent on the operador/asistente pair — Elazar's proposed order-independent-pair key would FALSELY merge the 3 legit swapped pairs. The swapped pairs pass this key cleanly (differ on NHC+pieza); only the 5 exact matches block. Reconcile scope = 5 rows soft-delete (keep one per pair). HOLD reconcile + prevent-at-create until Elazar signs the design (prod write, no proactive edits).
task
2026-06-13 by wi-cli-venus
6w ago