Skip to main content
Spec: specs/ce/specs/CE-29-lead-to-patient-conversion-pipeline.md
Status: ✅ 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

  1. Each conversion generates a unique correlation_id in format {lead_id}_to_{conversion_type}_{timestamp}. The correlation_id is created once per user intent and must be reused unchanged across retries or double-submits — it is not regenerated on each attempt.
  2. For lead_to_both, two audit records are inserted (one per type) with distinct correlation IDs
  3. Downstream subscribers (PM-01, RH-01) MUST check correlation_id before creating entities
  4. Duplicate delivery with same correlation_id returns 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