Files
BeyondCX_Insights/docs/GAP_ANALYSIS.md
sujucu70 75e7b9da3d feat: Add Streamlit dashboard with Blueprint compliance (v2.1.0)
Dashboard Features:
- 8 navigation sections: Overview, Outcomes, Poor CX, FCR, Churn, Agent, Call Explorer, Export
- Beyond Brand Identity styling (colors #6D84E3, Outfit font)
- RCA Sankey diagram (Driver → Outcome → Churn Risk flow)
- Correlation heatmaps (driver co-occurrence, driver-outcome)
- Outcome Deep Dive (root causes, correlation, duration analysis)
- Export functionality (Excel, HTML, JSON)

Blueprint Compliance:
- FCR: 4 categories (Primera Llamada/Rellamada × Sin/Con Riesgo de Fuga)
- Churn: Binary view (Sin Riesgo de Fuga / En Riesgo de Fuga)
- Agent: Talento Para Replicar / Oportunidades de Mejora
- Fixed FCR rate calculation (only FIRST_CALL counts as success)

Technical:
- Streamlit + Plotly for interactive visualizations
- Light theme configuration (.streamlit/config.toml)
- Fixed Plotly colorbar titlefont deprecation

Documentation:
- Updated PROJECT_CONTEXT.md, TODO.md, CHANGELOG.md
- Added 4 new technical decisions (TD-014 to TD-017)
- Created TROUBLESHOOTING.md with 10 common issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:27:30 +01:00

367 lines
12 KiB
Markdown

# GAP ANALYSIS: CXInsights vs BeyondCX Blueprints
> **Generated**: 2026-01-19
> **Blueprints Analyzed**: 4 documents in `docs/blueprints/`
---
## Executive Summary
CXInsights currently implements a **subset** of the BeyondCX blueprint requirements. The project has strong foundations for RCA (Root Cause Analysis) but is missing several key frameworks defined in the blueprints.
| Framework | Coverage | Status |
|-----------|----------|--------|
| **Ventas (Sales Analysis)** | ~40% | Partial - conversion tracking, some agent failures |
| **Close The Loop (CX)** | ~30% | Partial - CX drivers only |
| **FCR (First Call Resolution)** | ~5% | Missing - no FCR detection |
---
## Blueprint 1: Contexto BeyondCX (General Framework)
### What it defines:
- Role: Expert auditor for call analysis (energy sector - Endesa B2C)
- Three strategic frameworks: Ventas, Close the Loop, FCR
- Rules: Evidence-based, no invented info, professional analysis
### CXInsights Alignment:
| Requirement | CXInsights Status | Notes |
|-------------|-------------------|-------|
| Evidence-based analysis | ✅ Implemented | `evidence_spans[]` required for all RCA labels |
| No invented info | ✅ Implemented | LLM must quote transcript |
| Professional output | ✅ Implemented | Structured JSON with traceability |
| Three frameworks | ⚠️ Partial | Only partial coverage of each |
---
## Blueprint 2: Análisis de Llamadas de Venta (Sales Framework)
### What it defines (5 KPIs):
#### KPI 1: Tasa de Conversión de Venta
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Determine Venta/No Venta | ✅ `CallOutcome.SALE_COMPLETED/SALE_LOST` | Covered |
| Max 5 key factors for success | ⚠️ `lost_sales_drivers[]` | Different structure |
| Max 5 factors for failure | ⚠️ `lost_sales_drivers[]` with RCALabel | Missing detailed actions |
| Origin attribution (agent/client/company) | ❌ Missing | No origin field |
| Specific corrective actions | ❌ Missing | Only `reasoning` field |
**Gap Details:**
- CXInsights captures WHAT caused lost sale (driver_code)
- Blueprint requires: WHO is responsible + HOW to fix it + EXAMPLE from call
#### KPI 2: Efectividad de Campañas
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Campaign effectiveness analysis | ❌ Not implemented | **MAJOR GAP** |
| Product-message fit detection | ❌ Not implemented | |
| Customer feedback capture | ❌ Not implemented | |
| Segmentation analysis | ❌ Not implemented | |
**Gap Details:**
- CXInsights has no concept of "campaign"
- No way to track which campaign a call belongs to
- No analysis of product-customer fit
#### KPI 3: Habilidades del Equipo de Ventas
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| "Buen Comercial" / "Necesita Mejora" classification | ❌ Not implemented | **MAJOR GAP** |
| Agent strengths identification | ⚠️ Partial via drivers | Implicit only |
| Agent weaknesses documentation | ⚠️ `OBJECTION_NOT_HANDLED`, `POOR_PITCH` | Limited |
| Coaching recommendations | ❌ Not implemented | |
**Gap Details:**
- No agent skill scoring or classification
- No explicit "good practices to replicate" output
- No coaching action recommendations
#### KPI 4: Argumentarios y Objeciones
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Script quality evaluation | ❌ Not implemented | **GAP** |
| Objection handling quality | ⚠️ `OBJECTION_NOT_HANDLED` driver | Binary only |
| Improvement recommendations | ❌ Not implemented | |
**Gap Details:**
- CXInsights only detects IF objection was handled poorly
- Blueprint requires HOW to improve + specific examples
#### KPI 5: Ciclo de Venta
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Actions that lengthen sales cycle | ❌ Not implemented | **GAP** |
| Friction points in call | ⚠️ Events (HOLD, SILENCE) | Partial |
| Optimization recommendations | ❌ Not implemented | |
---
## Blueprint 3: Close The Loop (CX Framework)
### What it defines (5 Pillars):
#### Pilar 1: Mejorar Experiencia de Cliente (CX)
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| "Buen CX" / "CX Mejorable" classification | ❌ Not implemented | No binary CX outcome |
| Positive CX factors | ❌ Not implemented | Only negative drivers |
| Friction points | ✅ `poor_cx_drivers[]` | Covered |
| Customer feedback (explicit/implicit) | ❌ Not implemented | |
**Gap Details:**
- CXInsights only captures PROBLEMS (poor CX drivers)
- No capture of positive CX factors
- No explicit CX quality rating
#### Pilar 2: Reducir Fuga de Clientes (Churn)
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| "Sin riesgo de fuga" / "En riesgo de fuga" | ❌ Not implemented | **MAJOR GAP** |
| Churn risk factors | ❌ Not implemented | |
| Origin attribution (company/agent/client) | ❌ Not implemented | |
| Prevention factors | ❌ Not implemented | |
**Gap Details:**
- CXInsights has no churn risk classification
- `CallOutcome.CANCELLATION_*` exists but no risk prediction
- No churn drivers taxonomy
#### Pilar 3: Eficiencia Operativa
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Process inefficiencies | ⚠️ `COMPLEX_PROCESS`, `SYSTEM_ERROR` | Very partial |
| Agent efficiency analysis | ❌ Not implemented | |
| Optimal efficiency factors | ❌ Not implemented | |
| Process improvement proposals | ❌ Not implemented | |
#### Pilar 4: Valor del Cliente (Customer Value)
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Explicit customer needs | ❌ Not implemented | **MAJOR GAP** |
| Latent/implicit needs | ❌ Not implemented | |
| Upsell/cross-sell opportunities | ❌ Not implemented | |
| Customer value maximization | ❌ Not implemented | |
#### Pilar 5: Talento Interno
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| Positive agent behaviors | ❌ Not implemented | |
| Agent skills to replicate | ❌ Not implemented | |
| Improvement areas | ⚠️ Agent-related drivers | Limited |
| Coaching recommendations | ❌ Not implemented | |
---
## Blueprint 4: FCR (First Call Resolution)
### What it defines:
| Blueprint Requirement | CXInsights Implementation | Gap |
|-----------------------|---------------------------|-----|
| First call vs repeat call detection | ❌ Not implemented | **CRITICAL GAP** |
| Factors causing repeat calls | ❌ Not implemented | |
| Churn risk combined with FCR | ❌ Not implemented | |
| 4 categories: Primera Llamada (sin/con riesgo) + Rellamada (sin/con riesgo) | ❌ Not implemented | |
**Gap Details:**
- CXInsights has `CALLBACK_REQUIRED` driver but no FCR detection
- No mechanism to identify if call is first contact or repeat
- No churn-FCR cross-analysis
---
## Output Format Comparison
### Blueprint Required Output Structure:
```
Factor Clave 1: [etiqueta breve]
- Descripción objetiva basada en transcripción
- Por qué ayuda/impide [objetivo]
- Qué tiene que hacer el agente para [corregir/replicar]
- Ejemplo/fragmento de la transcripción
Separados por: "··· "
```
### CXInsights Current Output Structure:
```python
RCALabel(
driver_code="PRICE_TOO_HIGH",
confidence=0.85,
evidence_spans=[
EvidenceSpan(
text="Es muy caro para mí",
start_time=45.2,
end_time=47.8
)
],
reasoning="Customer objected to price"
)
```
### Gap:
| Blueprint Field | CXInsights Field | Gap |
|-----------------|------------------|-----|
| Etiqueta breve | `driver_code` | ✅ Equivalent |
| Descripción detallada | `reasoning` | ⚠️ Too brief |
| Acciones correctivas | ❌ Missing | **GAP** |
| Ejemplo con fragmento | `evidence_spans[].text` | ✅ Covered |
| Origin (agent/client/company) | ❌ Missing | **GAP** |
| Max 5 factors | No limit | ⚠️ Different |
---
## Summary: Required Changes
### HIGH PRIORITY (Core Functionality Gaps)
1. **Add FCR Detection Module**
- Detect first call vs repeat call
- Track call reason/topic
- Link to churn risk
2. **Add Churn Risk Classification**
- Binary: "Sin riesgo" / "En riesgo de fuga"
- Churn drivers taxonomy
- Prevention factors
3. **Add Agent Skill Assessment**
- Binary: "Buen Comercial" / "Necesita Mejora"
- Skill dimensions scoring
- Coaching recommendations
4. **Enhance RCALabel Structure**
```python
class RCALabel:
driver_code: str
confidence: float
evidence_spans: list[EvidenceSpan]
reasoning: str
# NEW FIELDS:
origin: Literal["agent", "customer", "company", "process"]
corrective_action: str | None # What to do to fix
replicable_practice: str | None # What to replicate
```
### MEDIUM PRIORITY (Enhanced Analysis)
5. **Add Customer Value Analysis**
- Explicit needs detection
- Implicit/latent needs
- Upsell opportunities
6. **Add Campaign Tracking**
- Campaign ID field
- Campaign effectiveness metrics
- Product-customer fit analysis
7. **Add Positive Factors Output**
- Not just problems (drivers) but also successes
- "Buen CX" factors
- "Effective sales" factors
### LOW PRIORITY (Refinements)
8. **Enhance Output Format**
- Limit to max 5 factors per category
- Add structured corrective actions
- Match blueprint output structure
9. **Add Script Quality Analysis**
- Argumentario quality scoring
- Objection handling quality
- Improvement suggestions
---
## Taxonomy Extension Required
### New Driver Categories Needed:
```yaml
# CHURN RISK DRIVERS (New)
churn_risk:
PRICE_DISSATISFACTION:
description: "Customer unhappy with pricing"
SERVICE_DISSATISFACTION:
description: "Customer unhappy with service"
COMPETITOR_INTEREST:
description: "Customer considering competitors"
CONTRACT_ENDING:
description: "Contract ending soon"
REPEATED_ISSUES:
description: "Customer has called multiple times for same issue"
# FCR DRIVERS (New)
fcr_failure:
INCOMPLETE_RESOLUTION:
description: "Issue not fully resolved"
MISSING_INFORMATION:
description: "Agent didn't provide all needed info"
PENDING_ACTION:
description: "Action pending from company side"
UNCLEAR_NEXT_STEPS:
description: "Customer unclear on what happens next"
# POSITIVE CX FACTORS (New - inverse of poor_cx)
good_cx:
QUICK_RESOLUTION:
description: "Issue resolved quickly"
EMPATHETIC_SERVICE:
description: "Agent showed empathy"
PROACTIVE_HELP:
description: "Agent anticipated needs"
CLEAR_COMMUNICATION:
description: "Agent communicated clearly"
# AGENT SKILLS (New)
agent_skills:
EFFECTIVE_CLOSING:
description: "Agent closed sale effectively"
GOOD_RAPPORT:
description: "Agent built good rapport"
OBJECTION_MASTERY:
description: "Agent handled objections well"
PRODUCT_KNOWLEDGE:
description: "Agent demonstrated product knowledge"
```
---
## Recommended Implementation Phases
### Phase 1: Core Gaps (Essential)
1. Add `churn_risk` field to CallAnalysis
2. Add `fcr_status` field (first_call / repeat_call)
3. Add `origin` field to RCALabel
4. Add `corrective_action` field to RCALabel
### Phase 2: Enhanced Analysis
5. Add positive factors capture (good_cx, effective_sales)
6. Add agent skill classification
7. Add customer value analysis
### Phase 3: Campaign & Optimization
8. Add campaign tracking
9. Add sales cycle analysis
10. Match exact blueprint output format
---
## Files Requiring Modification
| File | Changes Required |
|------|------------------|
| `config/rca_taxonomy.yaml` | Add churn, FCR, positive factors |
| `src/models/call_analysis.py` | Add churn_risk, fcr_status, origin fields |
| `src/inference/prompts.py` | Update prompt for new fields |
| `src/inference/analyzer.py` | Parse new output structure |
| `src/aggregation/` | Aggregate new metrics |
| `src/exports/` | Include new fields in exports |
---
**Última actualización**: 2026-01-19