How sandeepklr12345-gif/cause-trace works
CauseTrace is an AI-assisted root-cause analysis workspace for API manufacturing. A reviewer supplies incident text or a document through the copilot; the backend extracts evidence and runs a routed analysis that can develop hypotheses, challenge causes, identify evidence gaps, and propose CAPA. Results populate a provenance-aware investigation for human review; only a person can confirm a root cause, and saving requires confirmation. The graph follows those documented stages and the sampled frontend/backend wiring. Some subsystem links rely on the README or SOURCE INDEX references; unsampled internals are not assumed beyond those references.
Main entry points: investigations.py Review actions · nodes.py Analysis stages · api.js API client · chat.py Chat endpoint
Components 21
Investigation workspace
- Workspace shell
frontend/src/App.jsx - AI copilot
frontend/src/components/Copilot.jsx - RCA form sections
frontend/src/components - Chat state
frontend/src/store/chatSlice.js - Investigation state
frontend/src/store/investigationSlice.js
AI analysis
- Chat endpoint
backend/app/routers/chat.py - Document extraction
backend/app/services/documents.py - Analysis graph
backend/app/ai/graph.py - Analysis stages
backend/app/ai/nodes.py - Analysis prompts
backend/app/ai/prompts.py - Structured LLM calls
backend/app/ai/llm.py - Mock responses
backend/app/ai/mock.py - Safety and scoring
backend/app/ai/merge.py
Review and persistence
- Review actions
backend/app/routers/investigations.py - Audit and undo
backend/app/services/persist.py
Application platform
- API client
frontend/src/api.js - Investigation schemas
backend/app/schemas.py - Database models
backend/app/models.py - PostgreSQL access
backend/app/db.py
Other components
- Reviewer
- Groq service
Connections 30
- Reviewer → AI copilot: provides input
frontend/src/components/Copilot.jsx - Reviewer → RCA form sections: reviews results
- Workspace shell → AI copilot: renders
frontend/src/App.jsx - Workspace shell → RCA form sections: renders
frontend/src/App.jsx - AI copilot → Chat state: dispatches chat
frontend/src/components/Copilot.jsx - Chat state → API client: streams chat
frontend/src/store/chatSlice.js - Chat state → Investigation state: updates investigation
frontend/src/store/chatSlice.js - Investigation state → API client: loads and edits
frontend/src/store/investigationSlice.js - API client → Chat endpoint: posts chat
frontend/src/api.js - API client → Review actions: calls review APIs
frontend/src/api.js - API client → Document extraction: uploads document
frontend/src/api.js - Chat endpoint → Analysis graph: runs analysis
backend/app/routers/chat.py - Chat endpoint → Audit and undo: saves chat changes
backend/app/routers/chat.py - Review actions → Document extraction: extracts uploaded text
backend/app/routers/investigations.py - Analysis graph → Analysis stages: dispatches stages
backend/app/ai/graph.py - Analysis stages → Analysis prompts: uses prompts
backend/app/ai/nodes.py - Analysis stages → Structured LLM calls: requests structured output
backend/app/ai/nodes.py - Analysis stages → Safety and scoring: merges analysis
backend/app/ai/nodes.py - Analysis stages → Investigation schemas: validates against
backend/app/ai/nodes.py - Structured LLM calls → Mock responses: uses in mock mode
backend/app/ai/llm.py - Structured LLM calls → Groq service: invokes model
backend/app/ai/llm.py - Review actions → Safety and scoring: sanitizes review edits
backend/app/routers/investigations.py - Review actions → Audit and undo: records changes
backend/app/routers/investigations.py - Review actions → Investigation schemas: validates investigation
backend/app/routers/investigations.py - Chat endpoint → PostgreSQL access: loads session
backend/app/routers/chat.py - Review actions → PostgreSQL access: loads session
backend/app/routers/investigations.py - Audit and undo → Database models: writes audit and snapshots
backend/app/services/persist.py - Database models → PostgreSQL access: uses database base
backend/app/models.py - Review actions → Database models: reads investigation records
backend/app/routers/investigations.py - Review actions → Reviewer: requires human confirmation