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.
Version: 1.0.0
Created: 2026-01-23
Status: π Specification
Overview
This document defines the integration contract between CE-05 (Pipeline & Reporting) and PF-12 (Reports System). CE-05 creates report definitions in PF-12 for scheduled report generation and export functionality.
Integration Pattern
Pattern: Platform Integration Layer (Pattern 1)
Direction: CE-05 β PF-12 (CE-05 is the consumer)
βββββββββββββββββββ βββββββββββββββββββ
β CE-05 ββββββΆβ PF-12 β
β Pipeline Report β β Reports System β
βββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ
β Report Defns β β execute-report β
β (pf_reports) β β Edge Function β
βββββββββββββββββββ βββββββββββββββββββ
Report Definitions
Lead Pipeline Report
| Field | Value |
|---|
report_key | ce_lead_pipeline |
name | Lead Pipeline Report |
description | Lead counts by stage, conversion rates, and average time to convert |
module | ce |
sql_query | SELECT * FROM ce_lead_pipeline_metrics WHERE organization_id = :organization_id |
parameters | { "date_from": "date", "date_to": "date", "assigned_to": "uuid?" } |
formats | ["csv", "pdf"] |
permission_key | ce.pipeline.export |
Partner Scorecard Report
| Field | Value |
|---|
report_key | ce_partner_scorecard |
name | Partner Scorecard Report |
description | Partner performance metrics with success rates and trends |
module | ce |
sql_query | SELECT * FROM ce_partner_scorecard WHERE organization_id = :organization_id |
parameters | { "date_from": "date", "date_to": "date", "partner_type": "string?" } |
formats | ["csv", "pdf"] |
permission_key | ce.scorecard.export |
Call Analytics Report
| Field | Value |
|---|
report_key | ce_call_analytics |
name | Call Analytics Report |
description | Call volume, disposition breakdown, and recording coverage |
module | ce |
sql_query | SELECT * FROM ce_call_analytics WHERE organization_id = :organization_id |
parameters | { "date_from": "date", "date_to": "date", "user_id": "uuid?", "direction": "string?" } |
formats | ["csv", "pdf"] |
permission_key | ce.analytics.export |
Activity Analytics Report
| Field | Value |
|---|
report_key | ce_activity_analytics |
name | Activity Analytics Report |
description | Activity counts by type and subject, follow-up rates |
module | ce |
sql_query | SELECT * FROM ce_activity_analytics WHERE organization_id = :organization_id |
parameters | { "date_from": "date", "date_to": "date", "activity_type": "string?", "subject_type": "string?" } |
formats | ["csv", "pdf"] |
permission_key | ce.analytics.export |
Scheduled Reports
Default Schedules
| Report | Frequency | Recipients | Time |
|---|
| Lead Pipeline | Daily | Program Directors | 06:00 UTC |
| Partner Scorecard | Weekly | Business Dev Directors | Monday 08:00 UTC |
| Call Analytics | Weekly | Supervisors | Monday 08:00 UTC |
| Activity Analytics | Weekly | Program Directors | Monday 08:00 UTC |
PHI/PII Protection
- Secure Storage: Reports generated to access-controlled storage referenced by
pf_report_schedules
- Notification Only: Email via PF-10 contains secure portal link only, no PHI/PII
- Auto-Expiry: Generated reports auto-expire after 30 days
- Audit Logging: All report access logged to
pf_audit_logs
Role-Based Recipients
Recipients pulled from user roles, not hardcoded:
- Program Director β Lead Pipeline, Activity Analytics
- Business Development Director β Partner Scorecard
- Supervisor β Call Analytics
API Contract
Export Report (Synchronous)
import { ReportService } from '@/platform/reports';
// CE-05 components call PF-12 for export
const exportReport = async (params: {
reportKey: 'ce_lead_pipeline' | 'ce_partner_scorecard' | 'ce_call_analytics' | 'ce_activity_analytics';
organizationId: string;
format: 'csv' | 'pdf';
parameters: Record<string, unknown>;
}) => {
return ReportService.generateReport(params);
};
Schedule Report (Admin Only)
import { ReportService } from '@/platform/reports';
// Org admin schedules recurring report
const scheduleReport = async (params: {
reportKey: string;
organizationId: string;
frequency: 'daily' | 'weekly' | 'monthly';
recipients: { roleId: string }[];
parameters: Record<string, unknown>;
}) => {
return ReportService.createSchedule(params);
};
Error Handling
| Error Code | Description | User Message |
|---|
REPORT_NOT_FOUND | Report definition not in pf_reports | βReport configuration not found. Contact support.β |
PERMISSION_DENIED | User lacks export permission | βYou donβt have permission to export this report.β |
GENERATION_FAILED | Report generation error | βFailed to generate report. Please try again.β |
SCHEDULE_FAILED | Schedule creation error | βFailed to schedule report. Please try again.β |
Dependencies
Required PF-12 Tables
pf_reports - Report definitions
pf_report_schedules - Scheduled report configurations
pf_report_executions - Execution history
pf_report_permissions - Permission mappings
Required Views (CE-05)
ce_lead_pipeline_metrics
ce_partner_scorecard
ce_call_analytics
ce_activity_analytics
Testing Requirements
Integration Tests
- Report definition exists in
pf_reports
- Report generates successfully with sample data
- Scheduled report executes on schedule
- Export respects permission keys
- PHI/PII protection in email notifications
Security Tests
- Cross-organization access blocked
- Permission keys enforced
- Audit logging verified
- Auto-expiry working
References
- PF-12 Spec:
specs/pf/specs/PF-12-reports-system.md
- CE-05 Spec:
specs/ce/specs/CE-05-pipeline-reporting.md
- Integration Patterns:
docs/architecture/integrations/index.md