📖 Story
Practo · Doctor Registry Reconciliation
Tuesday afternoon at Practo's Data Platform team. A compliance audit flagged that the doctors table and the appointments table have drifted apart after a messy migration last quarter, and leadership wants a single reconciled view before the auditors show up on Friday. Some doctors — like Dr. Sanjay Gupta, who just onboarded — genuinely have zero appointments yet, and that's not a bug, it's just a brand-new profile. A handful of appointment rows reference a doctor_id that doesn't exist anywhere in the doctors table anymore, which is exactly the kind of orphaned reference the audit is worried about. And separately, a couple of walk-in appointment requests were logged with doctor_id left NULL on purpose, because the patient hadn't been assigned a doctor yet when the front desk created the booking — that NULL is legitimate business data, not corruption, and it needs to be told apart from the orphaned numeric IDs.