> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Intake Funnel Analytics & Reporting — Integration Documentation

> Spec: PM-41 Status: ✅ Complete — All 4 Phases (2026-03-29) Last Updated: 2026-03-29

**Spec:** [PM-41](../../../specs/pm/specs/PM-41-intake-funnel-analytics-reporting.md)
**Status:** ✅ Complete — All 4 Phases (2026-03-29)
**Last Updated:** 2026-03-29

***

## Overview

PM-41 adds PM-owned analytics tables (`pm_analytics_*`), funnel aggregates, risk scores, and dashboard/API surfaces. **Persistence** for immutable logs is via **database triggers** (or equivalent synchronous paths) on CE/PM source tables; **FW-16** is used for realtime UI subscriptions and downstream notifications (e.g. PM-42), not as the sole write path for logs (see spec Clarifications).

***

## Platform Integration Pattern

* **Inbound:** CE-28 screening completion, PM-38 appointments, PM-39 waitlist lifecycle — materialized into `pm_analytics_*_log` tables.
* **Outbound:** Aggregates and risk events consumed by **PM-42** (coordinator workbench); compliance CSV exports may be referenced by **GR** attestation workflows.
* **Tenant isolation:** All tables `organization_id` + RLS; dashboard gated by `pm.intake_funnel.view`.

***

## Event & Data Contracts

| Direction            | Name                                                                                            | Purpose                                                                                       |
| -------------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| Inbound (conceptual) | `ce_screening_completed`, `pm_appointment_created`, `pm_appointment_confirmed`, waitlist events | Drive analytics log inserts; exact payloads align with CE-28 / PM-38 / PM-39 integration docs |
| Outbound             | `pm_funnel_update`, `pm_high_risk_appointment`                                                  | Downstream dashboards (PM-42); realtime via FW-16                                             |

Payload shapes: see `EVENT_CONTRACTS.md` and [CE-28 Integration](./intake-screening-integration.md), [CE-29 Integration](./lead-conversion-integration.md) as applicable.

***

## API / Edge Surface

* Funnel and exports: **Supabase RPC or Edge Function** with JWT + org validation; logical shape `GET /api/analytics/pm-41/funnel` in spec maps to implementation-time route naming.

***

## Related Documents

* [CROSS\_CORE\_INTEGRATIONS.md](./CROSS_CORE_INTEGRATIONS.md) — integration matrix
* [CONTRACT\_VALIDATION\_CHECKLIST.md](./CONTRACT_VALIDATION_CHECKLIST.md)
