specs/ce/specs/CE-29-lead-to-patient-conversion-pipeline.mdStatus: ✅ Complete
Last Updated: 2026-03-28
Events
ce_lead_converted_to_patient
Payload (IDs only — no PHI):
ce_lead_converted_to_resident
Same payload schema as above. Subscribers: RH-01 (admission), PM-39 (waitlist), Analytics.
ce_lead_converted (deprecated)
Legacy event maintained for backward compatibility with CE-17 consumers. Same payload. New consumers should use the granular events above.
Audit Table: ce_lead_conversions
Pattern: INSERT-only (no UPDATE/DELETE policies). Immutable audit trail.
Permissions
Mapped to:
org_admin, platform_admin
Idempotency Rules
- Each conversion generates a unique
correlation_idin format{lead_id}_to_{conversion_type}_{timestamp}. Thecorrelation_idis created once per user intent and must be reused unchanged across retries or double-submits — it is not regenerated on each attempt. - For
lead_to_both, two audit records are inserted (one per type) with distinct correlation IDs - Downstream subscribers (PM-01, RH-01) MUST check
correlation_idbefore creating entities - Duplicate delivery with same
correlation_idreturns success without creating a second record (enforced by UNIQUE constraint on(organization_id, lead_id, conversion_type, correlation_id))
References
- Full Spec:
specs/ce/specs/CE-29-lead-to-patient-conversion-pipeline.md - Integration Doc:
docs/architecture/integrations/CE-29-LEAD-CONVERSION-INTEGRATION.md - Event Contracts:
docs/architecture/integrations/EVENT_CONTRACTS.md - CE-17 (deprecated):
specs/ce/specs/CE-17-ce-rh-admission-handoff.md