💬 Discussion no comments on technical yet comments don't trigger digest emails (mentions do)
Mention: @email@domain for a person,
@role:designer for everyone with that role,
or @all for everyone watching this module.
Markdown supported in the body.
No comments on the technical spec yet. Be the first.
Treatment Pipeline Manager – Technical Specification
1. Module Purpose & Scope (Authoritative)
Treatment Pipeline Manager is Primoro's governed operational engine and single system of record for dental sales and treatment conversion. It controls how enquiries enter the organisation, manages intent qualification and triage, enforces booking eligibility, and drives timely follow-up through SLAs and next-actions. It prevents leakage, duplication, and unsafe automation across all intake channels.
It governs:
- Leads — new patient or new treatment enquiries not yet fully qualified for booking
- Opportunities — qualified treatment intent associated with a known patient
- Pipeline Stacks and Stage Templates — the governed operational views and progression rules that route records through the conversion journey
- BookingEligibility — the authoritative field that controls whether booking is permitted; enforced across all channels
It explicitly does not:
- Send messages, hold conversations, or render conversation UX (Communication Hub, AI Concierge, Aiden)
- Perform voice interactions or web chat UX (AI Concierge)
- Manage appointment diaries or slot selection (Appointment Manager)
- Execute marketing campaigns (Campaign Manager)
- Act as a patient portal
- Execute tasks or reminders (Task Manager)
- Exercise clinical judgement or diagnosis
2. Ownership & Responsibilities
2.1 Treatment Pipeline Manager IS Responsible For
- Creating and maintaining Lead and Opportunity records as governed digital artefacts
- Controlling pipeline stages, stacks, and progression rules
- Holding
TriageStatusandBookingEligibilityas authoritative fields that no other module may override - Declaring required next actions and SLA expectations per Stack
- Emitting auditable operational and segmentation events to downstream modules
- Acting as the sole source of truth for whether booking is permitted on any given record
- Exposing a governed intake endpoint for AI Concierge to create or link Leads
2.2 Treatment Pipeline Manager IS NOT Responsible For
- Conversation rendering or message delivery — owned by Communication Hub, AI Concierge, and Aiden
- Voice call or web chat UX — owned by AI Concierge
- Task execution or reminder delivery — owned by Task Manager
- Diary availability or appointment slot selection — owned by Appointment Manager
- Marketing campaign execution — owned by Campaign Manager
- Clinical judgement or diagnosis — out of scope for the platform
- Autonomous AI decisions — AI surfaces remain strictly advisory
3. Core Objects (Normative)
3.1 Lead (Canonical Artefact)
A Lead is a governed digital artefact representing a new enquiry that has not yet been fully qualified for booking.
Characteristics:
- May originate from website conversation (Aiden), voice call (AI Concierge), form, or campaign
- Exists independently of a confirmed Patient record
- Is owned by Treatment Pipeline Manager until converted or exited
Minimum required fields:
LeadIDSourceChannel— enum:Website,Voice,Form,Campaign,OtherStackPipelineStageTriageStatusBookingEligibility— boolean; alwaysfalseat intakeConversationThreadID— indexed reference to Communication Hub threadOwnerRole/OwnerUserCreatedAtAuditTrail(immutable)
Rules:
- A Lead MUST always have exactly one current stage.
- A Lead MUST NOT be booked unless
BookingEligibilityis explicitly set totrueby Treatment Pipeline Manager. - A Lead MUST reference exactly one
ConversationThreadIDowned by Communication Hub. Treatment Pipeline Manager MUST store this as a reference and read-only summary only; it MUST NOT replicate or own the full conversation record, which is held exclusively by Communication Hub.
3.2 Opportunity (Canonical Artefact)
An Opportunity is a governed digital artefact representing qualified treatment intent for an existing or newly registered patient.
Characteristics:
- References exactly one Patient record
- Represents a specific treatment intent
- Is the canonical object for conversion and value tracking
Minimum required fields:
OpportunityIDPatientIDStackPipelineStageBookingEligibility— booleanEstimatedValue— read-onlyConversationThreadID— indexed reference to Communication Hub threadOwnerRole/OwnerUserCreatedAtAuditTrail(immutable)
Rules:
- A Patient may have multiple Opportunities over time, but only one active Opportunity per treatment intent.
- Opportunities MUST NOT be auto-created by AI channels (Aiden or AI Concierge).
- An Opportunity MUST reference exactly one
ConversationThreadID; when a Lead is converted to an Opportunity, the existingConversationThreadIDMUST be carried forward so the unified timeline is unbroken. As with Leads, Treatment Pipeline Manager MUST store this as a reference and read-only summary only; it MUST NOT replicate or own the full conversation record, which is held exclusively by Communication Hub.
3.3 Lead and Opportunity State Machine (Authoritative)
States (applicable to both object types unless noted):
- New Enquiry
- Awaiting Triage
- Qualified – Not Ready
- Booking Permitted
- Booked
- Converted
- Lost / Closed
Rules:
- Stages enforce ordering and guardrails; no record may skip a required stage.
- All stage transitions are auditable and time-stamped in the
AuditTrail. - AI surfaces (Aiden, AI Concierge) MAY recommend stage transitions but MUST NOT execute them.
- A record that has reached Booking Permitted, Booked, Converted, or Lost / Closed MUST NOT be returned to New Enquiry or Awaiting Triage.
BookingEligibilityMUST be set totrueby Treatment Pipeline Manager before any record may advance to Booking Permitted.- Emergency Stack records MUST follow the same state machine but are additionally constrained by the 72-hour maximum lifetime defined in §4.3.
3.3.1 Smart Treatment Proposal Integration
An Opportunity MAY be linked to one or more Smart Treatment Proposals via a LinkedOpportunityID held on the Proposal record.
Proposal state machine. Smart Treatment Proposals operates the following authoritative state machine for each Proposal record:
| State | Description |
|---|---|
| Draft | Proposal created but not yet shared with the patient |
| Presented | Proposal delivered to the patient |
| Explained & Acknowledged | Patient has confirmed they have reviewed and understood the proposal |
| Accepted | Patient has formally accepted the proposal |
| Declined | Patient has declined the proposal |
| Expired | Proposal passed its validity window without a patient decision |
Treatment Pipeline Manager integrates at the Accepted transition only. Intermediate transitions (Draft → Presented, Presented → Explained & Acknowledged) do not trigger pipeline state changes and MUST be ignored by Treatment Pipeline Manager.
Finance application rule. A patient submitting or being assessed for a finance application MUST NOT cause the Proposal to advance to Accepted. Finance application activity is handled within Smart Treatment Proposals and does not constitute acceptance for the purposes of this integration. Treatment Pipeline Manager MUST NOT treat any finance-related event as a proxy for ProposalAccepted.
Event handling. When a linked Proposal transitions to Accepted, Smart Treatment Proposals MUST emit a ProposalAccepted event carrying the LinkedOpportunityID. Treatment Pipeline Manager MUST handle this event as follows:
- If the Opportunity's current
PipelineStageis earlier than Booking Permitted, the pipeline MUST evaluate whether the acceptance satisfies outstanding triage artefacts for the Stack and, if so, setBookingEligibility = trueand advance the stage to Booking Permitted. - If
BookingEligibilityis alreadytrue, the event MUST advance the stage to Converted. - The stage transition triggered by a
ProposalAcceptedevent MUST be recorded in theAuditTrailwithTrigger = ProposalAcceptedand the originatingProposalID.
No other module may infer or simulate this transition. Treatment Pipeline Manager is the sole authority for acting on the accepted-proposal signal.
4. Pipeline, Stacks & Stage Templates
4.1 Stacks (Authoritative)
A Stack is a governed operational view over the pipeline, optimised for a specific treatment intent. Each Stack defines:
- Whether it accepts Leads, Opportunities, or both
- Required triage artefacts that must be satisfied before
BookingEligibilitymay be set totrue - SLA thresholds for next-action cadence
- Eligibility rules specific to the treatment type
Example Stacks (non-exhaustive):
- Emergency – New Patient
- New Patient – Free Consultation
- Invisalign – New Patient
- Existing Patient – Treatment Acceptance
Stack definitions are configurable by practice administrators via the Admin Control Plane; the list above is illustrative, not exhaustive.
4.2 Stage Templates
Pipeline stages are derived from Stack-level Stage Templates. The canonical stage sequence is defined in §3.3. Rules:
- Stage transitions enforce ordering and guardrails as declared in the Stage Template for the assigned Stack.
- Stage transitions are auditable.
- AI surfaces MAY recommend transitions; only authorised staff roles may execute them.
4.3 Emergency Stack Contract
Emergency Stacks:
- Have a maximum record lifetime of 72 hours.
- Enforce aggressive SLA thresholds.
- Exclude all marketing and nurture activity; no segmentation events associated with nurture eligibility may be emitted for Emergency Stack records.
5. Source of Truth – Qualification & Booking (Normative)
Booking is permitted only when one of the following is true:
Lead.BookingEligibility = trueOpportunity.BookingEligibility = true
BookingEligibility:
- Is owned and set exclusively by Treatment Pipeline Manager.
- Is derived from completed triage and staff review; it MUST NOT be inferred from conversation content, AI output, or any upstream signal.
- MUST be enforced by Appointment Manager and all channels before any booking action is taken.
No upstream system — including AI Concierge or Aiden — may bypass, override, or infer eligibility. Appointment Manager MUST query Treatment Pipeline Manager for the current BookingEligibility value and MUST NOT cache or assume it.
6. Delivery Surfaces & Access (Authoritative)
6.1 Web Portal
Treatment Pipeline Manager surfaces in the staff web portal as a pipeline view, presenting Leads and Opportunities grouped by Stack and stage, with filtering by SLA status, owner, and booking eligibility. Staff may advance stages, update triage artefacts, and set BookingEligibility from this surface.
6.2 Tablet App
On the in-practice tablet, Treatment Pipeline Manager surfaces as a triage and booking readiness dashboard, allowing front-desk staff to review incoming Leads, confirm triage completeness, and hand off to Appointment Manager when eligibility is confirmed.
6.3 Patient Mobile App
Treatment Pipeline Manager has no direct patient-facing surface. Patients interact via Aiden (website) or AI Concierge (voice); all pipeline records are created and managed by staff or governed AI intake channels on the patient's behalf.
6.4 Engagement Signals
Treatment Pipeline Manager emits the following signals for staff visibility and analytics:
- Stage transition events (consumed by Task Manager for follow-up generation and by Audit & Compliance for the immutable log)
- Segmentation events (consumed by Campaign Manager — see §8.1 for the full contract)
BookingEligibilitychange events (consumed by Appointment Manager and Communication Hub)
7. AI Boundaries (Non-Negotiable)
Module does embed AI surfaces indirectly: Aiden and AI Concierge are governed AI channels that interact with Treatment Pipeline Manager via declared integration contracts. The following boundaries apply to all AI surfaces operating against this module.
AI MAY:
- Ask triage questions defined by the Stack and summarise responses into the Lead or Opportunity record
- Recommend pipeline stage transitions for staff review and approval
- Inform a caller or website visitor that booking is permitted, once
BookingEligibility = truehas been confirmed by querying Treatment Pipeline Manager - Provide high-level guidance to existing patients (Aiden, website channel only)
- Summarise Lead or Opportunity activity for staff review
AI MAY NOT:
- Create Opportunities directly; only Leads may be created via AI intake
- Set
BookingEligibilityto any value - Execute stage transitions
- Complete triage on behalf of a staff member
- Generate or simulate segmentation events
- Bypass governance, audit, or access checks
- Make commitments on behalf of the practice
- Replace required clinical judgement
- Create a second Lead for a
ConversationThreadIDthat already has an active Lead within the same call session
8. Audit & Compliance
8.1 Audit Events
The system MUST log, with actor identity and UTC timestamp, the following events:
- All Lead and Opportunity creation events, including
SourceChanneland assignedStack - All stage transitions, including trigger mechanism (staff action,
ProposalAcceptedevent, system rule) - All
BookingEligibilitychanges, including the staff actor who authorised the change - All booking attempts against a Lead or Opportunity, whether permitted or rejected
- All
ProposalAcceptedevents received from Smart Treatment Proposals and the resulting pipeline action - All segmentation events emitted to Campaign Manager (see §8.2)
- All AI involvement markers — which AI channel supplied data, what was suggested, and whether it was accepted or rejected by a staff member
- All intake endpoint calls from AI Concierge, including request payload summary and response
- All cross-module events emitted or consumed
8.2 Segmentation Event Contract (Authoritative)
Treatment Pipeline Manager is the authoritative emitter of all segmentation events consumed by Campaign Manager. Campaign Manager MUST NOT subscribe to any pipeline signal not listed here. The full structure, timing, and payload of each event are defined in this section; Campaign Manager MUST rely solely on this contract and MUST NOT infer pipeline state from any other source.
| Event Name | Trigger Condition | Minimum Payload Fields |
|---|---|---|
LeadBecameCold |
A Lead has had no qualifying activity for the Stack-defined inactivity threshold | LeadID, Stack, SourceChannel, InactiveSinceDateUTC, ConversationThreadID |
LeadNurtureEligible |
A Lead has been triaged and assessed as not yet ready to book but suitable for nurture communications | LeadID, Stack, TreatmentInterest, TriageOutcome, ConversationThreadID |
OpportunityLost |
An Opportunity has been moved to the Lost / Closed stage | OpportunityID, PatientID, Stack, LostReason, EstimatedValue, ConversationThreadID |
OpportunityDeferred |
An Opportunity has been explicitly deferred by a staff member with a future review date | OpportunityID, PatientID, Stack, ReviewDateUTC, ConversationThreadID |
OpportunityWonWithFuturePotential |
An Opportunity has been Converted but triage or clinical notes indicate further treatment interest exists | OpportunityID, PatientID, Stack, FutureTreatmentInterest, ConversationThreadID |
Rules:
- Treatment Pipeline Manager MUST emit each event atomically at the point of the triggering state transition; deferred or batched emission is not permitted.
- Each event MUST include a monotonic
EventTimestampUTCand a uniqueEventIDto support idempotent consumption. - Campaign Manager MUST treat these events as read-only signals; it MUST NOT write back to the pipeline in response.
- No AI channel may generate or simulate a segmentation event.
- Emergency Stack records are excluded from nurture-related segmentation events (
LeadNurtureEligible,LeadBecameCold) per §4.3.
8.3 Compliance Requirements
Audit logs MUST be immutable and exportable for inspection. Audit logs MUST be forwarded to the Audit & Compliance module in real time; Treatment Pipeline Manager MUST NOT be the system of record for audit logs — it is the emitter only.
All patient-bound data held in Lead and Opportunity records is subject to GDPR data subject rights. Treatment Pipeline Manager MUST honour deletion and export requests coordinated through the platform's data governance process; the specific retention periods are an open question — see §15.
9. Access Control
Role assignments are governed by Access Manager. Treatment Pipeline Manager enforces the following permissions:
| Action | Permitted Roles |
|---|---|
| Create Lead (staff) | Front Desk, Treatment Coordinator, Practice Manager, Admin |
| Create Lead (system, via governed intake endpoint) | AI Concierge (service account) |
| Read Lead / Opportunity | Front Desk, Treatment Coordinator, Practice Manager, Admin |
| Update triage artefacts | Treatment Coordinator, Practice Manager |
Set BookingEligibility = true |
Treatment Coordinator, Practice Manager |
| Advance pipeline stage | Treatment Coordinator, Practice Manager |
| Close / Lost record | Treatment Coordinator, Practice Manager, Admin |
| Configure Stacks and Stage Templates | Practice Manager, Admin |
| Export audit log | Admin |
Role names above use the canonical names from Access Manager; any deviation requires an Access Manager spec change, not a Treatment Pipeline Manager change.
MFA is required for any action that sets BookingEligibility = true or closes a record, if the platform's MFA policy is enabled at the practice level.
10. Integration Contracts
10.1 Inbound (Treatment Pipeline Manager consumes from)
| From Module | What | Contract |
|---|---|---|
| Aiden | Lead creation requests from website conversational intake | Async; Aiden calls governed intake contract |
| AI Concierge | Lead creation and linking requests from voice channel | Sync; AI Concierge calls governed intake endpoint (see §10.3) |
| Communication Hub | ConversationThreadID issued at first contact |
Sync reference at Lead / Opportunity creation |
| Smart Treatment Proposals | ProposalAccepted event carrying LinkedOpportunityID |
Async event (see §3.3.1) |
| Campaign Manager | (none — Campaign Manager is read-only consumer of pipeline events) | — |
10.2 Outbound (Treatment Pipeline Manager emits to)
| To Module | What | Contract |
|---|---|---|
| Communication Hub | ConversationThreadID referenced in all events; stage-change notifications for patient-facing messaging |
Event |
| Appointment Manager | BookingEligibility change events; BookingEligibility read queries answered |
Sync query + async event |
| Campaign Manager | Segmentation events (§8.2) — atomic, event-per-state-transition, with EventID and EventTimestampUTC; Campaign Manager consumes these as read-only signals and MUST NOT write back |
Async event |
| Task Manager | Next-action and SLA breach triggers for staff follow-up | Async event |
| Audit & Compliance | All audit events listed in §8.1 | Async, real-time |
10.3 AI Concierge Intake Endpoint Contract (Authoritative)
Treatment Pipeline Manager owns and exposes a governed intake endpoint that AI Concierge MUST call to create or link a Lead. This endpoint is the single, authoritative mechanism by which AI Concierge creates or links Lead records; no alternative pathway exists and no duplication is permitted.
Deduplication guarantee. Treatment Pipeline Manager MUST enforce that exactly one active Lead exists per ConversationThreadID within a given call session. If AI Concierge calls the endpoint with a ConversationThreadID for which an active Lead already exists in the same session, Treatment Pipeline Manager MUST return the existing Lead record and MUST NOT create a new one. AI Concierge MUST use the returned LeadID for all subsequent references to that enquiry within the same call.
Request — minimum required fields supplied by AI Concierge:
| Field | Type | Notes |
|---|---|---|
SourceChannel |
enum | MUST be Voice |
CallerIntent |
string | Free-text summary captured by AI Concierge |
UrgencySignal |
enum | Emergency, Urgent, Routine, Unknown |
CallerIdentity |
object | Phone number and any matched PatientID; null if unmatched |
TriageSummary |
string (nullable) | Partial triage responses collected during the call |
ConversationThreadID |
string | The Communication Hub thread ID for this call |
Response — fields Treatment Pipeline Manager MUST return:
| Field | Type | Notes |
|---|---|---|
LeadID |
string | ID of the newly created or matched Lead |
Stack |
string | Stack to which the Lead has been assigned |
PipelineStage |
string | Current stage of the Lead |
BookingEligibility |
boolean | Always false at intake; AI Concierge MUST NOT act on any other value without re-querying |
NextActionRequired |
string (nullable) | Instruction for AI Concierge (e.g. "Advise caller a callback is scheduled") |
Treatment Pipeline Manager MUST reject any attempt to create a second Lead for the same ConversationThreadID within the same call session and instead return the existing Lead record.
10.4 Unified Conversation Thread Contract
Each Lead and each Opportunity MUST reference exactly one ConversationThreadID owned by Communication Hub. That thread is created at first contact (enquiry intake) and persists as a single, continuous timeline across all channels — WhatsApp, SMS, email, web forms, proposal delivery, and follow-ups — through to conversion or closure.
Treatment Pipeline Manager:
- MUST store the
ConversationThreadIDas an indexed property on every Lead and Opportunity record. - MUST store only a reference and read-only summary against this field; it MUST NOT replicate or hold the full conversation record, which is owned exclusively by Communication Hub.
- MUST supply the
ConversationThreadIDin all operational and segmentation events it emits, so that downstream modules can correlate communications without querying the pipeline directly. - MUST NOT create or manage conversation threads; Communication Hub is the sole authority for thread lifecycle.
Where a Lead is converted into an Opportunity, the existing ConversationThreadID MUST be carried forward to the resulting Opportunity record so that the unified timeline is unbroken.
10.5 PMS Boundary
(No content captured in original — needs definition.)
11. Integration Summary
- Communication Hub — inbound
ConversationThreadIDreference at creation; outbound stage-change and notification events; thread lifecycle authority; Treatment Pipeline Manager holds references and read-only summaries only - AI Concierge — inbound governed Lead intake via sync endpoint; voice triage summaries; deduplication enforced per
ConversationThreadIDwithin each call session - Aiden — inbound Lead creation from website conversational intake
- Appointment Manager — outbound
BookingEligibilityevents; Appointment Manager enforces eligibility before booking - Campaign Manager — outbound segmentation events (read-only, full contract in §8.2); Campaign Manager MUST NOT write back to pipeline
- Task Manager — outbound next-action and SLA breach triggers for staff follow-up
- Smart Treatment Proposals — inbound
ProposalAcceptedevents (Proposal state machine: Draft → Presented → Explained & Acknowledged → Accepted / Declined / Expired); Treatment Pipeline Manager acts on Accepted transitions only to advance Opportunity stage - Audit & Compliance — outbound immutable audit event stream
- Access Manager — RBAC enforcement for all create / read / update / approve / close actions
12. Explicit Non-Goals
- Marketing campaign execution — owned by Campaign Manager; Treatment Pipeline Manager supplies segmentation signals only.
- Patient self-service portal — out of scope; Aiden provides guided website intake only.
- Autonomous clinical decisions — no AI surface may make or record a clinical decision via this module.
- Voice call handling infrastructure — owned by AI Concierge; Treatment Pipeline Manager receives the output of calls, not the calls themselves.
- Task reminder delivery — owned by Task Manager; Treatment Pipeline Manager declares next-action requirements and emits events; it does not execute reminders.
- Appointment slot management — owned by Appointment Manager; Treatment Pipeline Manager declares booking eligibility only.
- Conversation thread ownership — owned by Communication Hub; Treatment Pipeline Manager holds references and read-only summaries only.
13. Versioning & Governance
This specification is owned by: (role — needs definition).
Changes to this spec require:
- Review by the Post-MVP module owner
- Impact analysis across all declared related modules (see /propose)
- Version bump (patch / minor / major) according to the change classification
14. Build Contract (Engineering & QA)
14.1 Canonical Data Model
(Detailed schema not captured in original — needs definition by engineering. The following fields are normative minimums derived from §3.)
leads
leads (
lead_id UUID PRIMARY KEY,
source_channel ENUM('Website','Voice','Form','Campaign','Other') NOT NULL,
stack VARCHAR NOT NULL,
pipeline_stage VARCHAR NOT NULL,
triage_status VARCHAR,
booking_eligibility BOOLEAN NOT NULL DEFAULT false,
conversation_thread_id VARCHAR NOT NULL,
owner_role VARCHAR,
owner_user_id UUID,
created_at TIMESTAMPTZ NOT NULL,
audit_trail JSONB NOT NULL -- immutable append-only log
)
opportunities
opportunities (
opportunity_id UUID PRIMARY KEY,
patient_id UUID NOT NULL,
stack VARCHAR NOT NULL,
pipeline_stage VARCHAR NOT NULL,
booking_eligibility BOOLEAN NOT NULL DEFAULT false,
estimated_value NUMERIC, -- read-only; set by treatment valuation logic
conversation_thread_id VARCHAR NOT NULL,
owner_role VARCHAR,
owner_user_id UUID,
created_at TIMESTAMPTZ NOT NULL,
audit_trail JSONB NOT NULL -- immutable append-only log
)
These are normative minimum schemas. Engineering may add columns but MUST NOT remove or rename any column listed here without a major version bump to this spec.
14.2 Core Behaviour Rules
Numbered testable behavioural rules:
- A Lead MUST be created with
booking_eligibility = false; the intake endpoint MUST reject any request that suppliesbooking_eligibility = true. - A Lead or Opportunity MUST NOT advance to Booking Permitted stage unless
booking_eligibility = truehas been explicitly set by an authorised staff action. BookingEligibilityMUST only be settable by Treatment Pipeline Manager via an authorised staff action; no AI channel, no Campaign Manager, no Appointment Manager write may alter it.- The intake endpoint MUST return the existing Lead record — not create a new one — when a request arrives with a
ConversationThreadIDthat already has an active Lead within the same call session. - A
ProposalAcceptedevent received from Smart Treatment Proposals MUST trigger the stage and eligibility logic defined in §3.3.1 within the same transaction; it MUST NOT be processed asynchronously in a way that leaves the Opportunity in an intermediate inconsistent state. - All stage transitions MUST be recorded in the
AuditTrailwith actor identity, UTC timestamp, and trigger mechanism before the transition is committed. - Emergency Stack records MUST be flagged for escalation or closure within 72 hours of creation; the system MUST emit a Task Manager trigger when the 72-hour threshold is approached.
- Each segmentation event listed in §8.2 MUST be emitted atomically at the point of the triggering state transition; it MUST carry a unique
EventIDand monotonicEventTimestampUTC. - A
ConversationThreadIDMUST be stored as an indexed field on every Lead and Opportunity; queries filtering byConversationThreadIDMUST use this index. - AI Concierge's service account MUST NOT be permitted to create Opportunities via any endpoint; attempts MUST be rejected with an explicit error.
- A finance application submission or assessment event from Smart Treatment Proposals MUST NOT be treated as a
ProposalAcceptedsignal; Treatment Pipeline Manager MUST only advance Opportunity state in response to an explicitProposalAcceptedevent withTrigger = ProposalAccepted. - Treatment Pipeline Manager MUST NOT store a replica of any Communication Hub conversation record; the
conversation_thread_idcolumn is a reference only, and any summary stored alongside it MUST be read-only and derived from a governed query to Communication Hub.
14.3 Configuration Surfaces
| Configuration | Configurable By | Surface |
|---|---|---|
| Stack definitions (triage artefacts, SLA thresholds, eligibility rules) | Practice Manager, Admin | Admin Control Plane |
| Stage Template ordering per Stack | Practice Manager, Admin | Admin Control Plane |
| Emergency Stack inactivity threshold (72-hour rule) | Practice Manager | Admin Control Plane |
Stack-level inactivity threshold (for LeadBecameCold) |
Practice Manager | Admin Control Plane |
| MFA enforcement for eligibility changes | Admin | Admin Control Plane |
| Owner role assignment defaults per Stack | Practice Manager | Admin Control Plane |
14.4 Filtering & Views
The staff UI MUST support the following standard filters and saved views:
- Filter by Stack
- Filter by
PipelineStage - Filter by
BookingEligibility(true / false) - Filter by owner (role or individual user)
- Filter by
SourceChannel - Filter by SLA status (on track / at risk / breached)
- Saved views: "Booking Ready" (all records with
BookingEligibility = truenot yet at Booked stage), "Emergency" (all open Emergency Stack records), "My Pipeline" (records owned by the current user)
14.5 Module Extension Map
- Additional Stacks may be added via Admin Control Plane without schema changes.
- Additional segmentation events may be added to §8.2 as a minor version bump; Campaign Manager must opt in to new event types explicitly.
- The intake endpoint contract (§10.3) may be extended with additional optional request fields as a minor version bump; required field additions are a major version bump.
- Smart Treatment Proposals integration (§3.3.1) is the first example of a third-party canonical event driving pipeline state; the same pattern may be extended to other proposal or consent modules without breaking this contract, provided they follow the
ProposalAcceptedevent shape and the six-state Proposal state machine described in §3.3.1.
14.6 Acceptance Criteria
The build of Treatment Pipeline Manager is complete when:
- [ ] All canonical objects (Lead, Opportunity) can be created, read, and updated through the API with the minimum required fields enforced
- [ ] State machine transitions enforce all rules in §3.3 (including Emergency Stack 72-hour constraint)
- [ ]
BookingEligibilitycannot be set by any AI channel, Campaign Manager, or Appointment Manager — negative tests pass - [ ] The intake endpoint correctly deduplicates Leads by
ConversationThreadIDwithin the same call session - [ ] The
ProposalAcceptedevent handler correctly advances Opportunity stage and eligibility per §3.3.1 — both branches tested; finance application events are confirmed not to trigger advancement (negative test) - [ ] All segmentation events in §8.2 are emitted atomically with
EventIDandEventTimestampUTC - [ ] All integrations in §10 are wired and tested end-to-end
- [ ] AI boundaries in §7 are enforced — negative tests pass for all prohibited actions
- [ ] Audit log captures every event in §8.1 with actor, timestamp, and trigger
- [ ] Access control is enforced per §9 — role-based negative tests pass
- [ ] All non-functional requirements in §15 are met
- [ ]
conversation_thread_idis confirmed to store a reference only; no conversation record replication is present — verified by data model review
15. Non-Functional Requirements
The following NFRs scaffold the production-readiness bar for this module. Specific targets are to be confirmed with engineering during the build phase.
- Performance: The intake endpoint (§10.3) MUST respond within 2 seconds under normal load. Pipeline stage transition writes MUST complete within 1 second. Read queries for
BookingEligibilityby Appointment Manager MUST be served from an indexed path. - Reliability: Treatment Pipeline Manager MUST be available whenever AI Concierge or Aiden is accepting inbound enquiries. Segmentation event emission MUST be retried with exponential backoff on downstream failure; the pipeline record state MUST NOT be rolled back if an event emission fails after the state transition has committed.
- Scalability: The module MUST support multi-site, multi-practice tenancy. Stack and Stage Template configurations MUST be isolated per practice.
ConversationThreadIDindexing MUST remain performant as Lead and Opportunity volume scales. - Security: All patient-bound data MUST be encrypted at rest and in transit. The AI Concierge service account MUST be a scoped service credential with no broader write permissions than the intake endpoint requires. Secrets (service credentials) MUST be managed via the platform's secrets management facility, not hardcoded.
- Privacy: Lead and Opportunity records containing patient-identifiable data are subject to GDPR. The module MUST support data subject export and deletion requests coordinated through the platform's data governance process. Retention periods are an open question — see §16.
- Observability: The module MUST export metrics for pipeline throughput (Leads and Opportunities created per period), stage transition latency,
BookingEligibilityconversion rate per Stack, segmentation event emission success/failure rate, and intake endpoint error rate. Structured logs MUST includeLeadID/OpportunityID,Stack, andSourceChannelas indexed fields for tracing. - Accessibility: Staff-facing UI surfaces MUST meet WCAG 2.1 AA.
16. Open Questions
Outstanding decisions before this spec can be promoted from
drafttopublished.
- Retention periods: What are the data retention periods for Lead and Opportunity records containing patient-identifiable data? This determines GDPR deletion scheduling and archive policy. (Implicit in §11 audit/compliance content — no decision captured.)
- PMS boundary: What does the Practice Management System own versus Treatment Pipeline Manager, and what is the integration contract at that boundary? (Acknowledged as a boundary in the original but left undefined — §10.5.)
- Spec ownership role: Which named role owns this specification and has authority to approve version bumps? (Left as a placeholder in §13.)
- Stack-level inactivity thresholds: What are the default inactivity thresholds (in hours/days) that trigger the
LeadBecameColdsegmentation event for each Stack? Are these configurable at practice level or set centrally? (Referenced in §8.2 as "Stack-defined inactivity threshold" but no values or configuration authority specified.) EstimatedValuederivation: How isEstimatedValueon an Opportunity calculated or set, and which module is authoritative for that value? The original marks it read-only but does not define its source. (Implicit in §3.2.)- Aiden intake endpoint contract: The spec defines the AI Concierge intake endpoint in detail (§10.3) but does not define an equivalent governed intake contract for Aiden (website). Should Aiden use the same endpoint with a different
SourceChannelvalue, or is a separate contract required? (Implicit gap between §6 and §10.3.)