Skip to content

feat: Implement Root Cause Analysis AI endpoints (SWOT, Five Whys) #132

@mottych

Description

@mottych

Overview

Implement AI-powered root cause analysis endpoints to help leaders analyze issues and identify underlying causes. These endpoints support the issue resolution process in strategic planning.

Topics to Implement

1. SWOT Analysis (\swot_analysis)

Generate SWOT (Strengths, Weaknesses, Opportunities, Threats) analysis for a given subject.

Current Registry Entry:
\\python
"POST:/operations/swot-analysis": EndpointDefinition(
endpoint_path="/operations/swot-analysis",
http_method="POST",
topic_id="swot_analysis",
response_model="SwotAnalysisResponse",
topic_type=TopicType.SINGLE_SHOT,
category=TopicCategory.OPERATIONS_AI,
description="Generate SWOT analysis for operations",
is_active=False, # Currently disabled
parameter_refs=(
_req("subject"),
_onb("context", "business_context"),
),
)
\\

Use Case:

  • User identifies an issue or strategic decision
  • AI generates comprehensive SWOT analysis
  • Helps leaders understand internal/external factors

Expected Response:
\\json
{
"strengths": ["Strong product features", "Good customer support"],
"weaknesses": ["Poor onboarding experience", "Limited documentation"],
"opportunities": ["Improve self-service resources", "Add guided tours"],
"threats": ["Competitors with better onboarding", "Customer expectations rising"],
"summary": "Overall analysis summary...",
"recommendations": ["Focus on...", "Address..."]
}
\\

2. Five Whys Questions (\ ive_whys_questions)

Generate Five Whys analysis questions to drill down to root causes.

Current Registry Entry:
\\python
"POST:/operations/five-whys-questions": EndpointDefinition(
endpoint_path="/operations/five-whys-questions",
http_method="POST",
topic_id="five_whys_questions",
response_model="FiveWhysQuestionsResponse",
topic_type=TopicType.SINGLE_SHOT,
category=TopicCategory.OPERATIONS_AI,
description="Generate Five Whys analysis questions",
is_active=False, # Currently disabled
parameter_refs=(
_issue("issue"),
_req("depth"),
),
)
\\

Use Case:

  • User describes an issue or problem
  • AI generates progressive "why" questions
  • Helps identify root cause through iterative questioning

Expected Response:
\\json
{
"issue": "Customer churn increased by 15%",
"questions": [
{
"level": 1,
"question": "Why is customer churn increasing?",
"potential_answers": ["Poor onboarding", "Feature gaps", "Support issues"]
},
{
"level": 2,
"question": "Why is onboarding poor?",
"potential_answers": ["Complex interface", "No guidance", "Too many steps"]
}
],
"potential_root_causes": [
"Lack of user documentation",
"Complex product interface",
"Missing customer success touchpoints"
],
"recommendations": ["Implement guided onboarding...", "Create help documentation..."]
}
\\

Implementation Notes

  • These may not fit the standard single-shot or conversation pattern
  • May require interactive/iterative flow (Five Whys especially)
  • Consider hybrid approach: initial AI suggestions + user refinement
  • Could integrate with issue tracking system

Dependencies

  • Response model definitions needed (SwotAnalysisResponse, FiveWhysQuestionsResponse)
  • May integrate with Issue entity
  • Business context enrichment from onboarding data

Acceptance Criteria

  • \POST /operations/swot-analysis\ generates comprehensive SWOT
  • \POST /operations/five-whys-questions\ generates drill-down questions
  • Both endpoints integrate with business context
  • Response models properly validated
  • Unit tests with 80%+ coverage
  • Integration with issue resolution workflow

Related Issues

  • Part of Operations AI suite
  • Supports strategic planning workflows
  • See also: Issue Categorization, Impact Assessment, Action Plan Optimization (separate issues)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpost-mvpFeatures planned for after MVP release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions