Research prototype · open/synthetic data

Causal RCA Platform

TL;DR. Most defect analytics stops at correlation; this research platform learns the causal graph instead, so root causes are separated from co-symptoms and what-if changes can be screened with do-calculus before touching the line. Four discovery algorithms (PC, GES, NOTEARS, FCI) vote into a 12-node / 7-edge DAG, DoWhy ATE with refutation tests guards the effects, and causes rank by |ATE| x edge_confidence x bootstrap_stability. Research prototype validated on a synthetic injection-molding dataset plus open SECOM/TEP benchmarks; no real-factory numbers are claimed.
4 discovery algorithms PC · GES · NOTEARS · FCI, ensemble-voted
12 / 7 nodes / edges consensus DAG after stability filtering
45+ API endpoints FastAPI, API-key auth + RBAC
700+ tests unit and integration
Causal RCA Platform architecture: data layer, causal discovery, inference and RCA, MLOps and enterprise plumbing, and delivery layer (API, SPA, Streamlit, Neo4j, LLM chat)
System architecture. End-to-end flow: pluggable data connectors -> ensemble causal discovery -> DoWhy inference and RCA ranking -> MLOps / enterprise controls -> delivery surfaces (REST API, React SPA, Streamlit, Neo4j, LLM chat).

Problem

Manufacturing process analytics typically stops at correlation-based defect detection, which tells you which variables move together but not which ones actually cause defects. That leaves operators unable to know which process change will fix a defect versus which is merely a co-symptom, and any what-if change has to be reasoned about without a model of cause and effect. The platform addresses this by learning the causal graph of the process and quantifying cause-effect strength, so root causes can be ranked and interventions can be screened against a causal model before being applied. The validation target is a synthetic injection-molding dataset with 12 variables organized into 3 tiers (process parameters -> intermediate states -> defects) and 13 ground-truth causal edges, plus the open SECOM and TEP benchmarks; real-factory numbers are explicitly not claimed.

What I built

  • Causal core, built end-to-end as main developer: four discovery algorithms (PC, GES, FCI via causal-learn, custom NOTEARS) behind a unified runner with weighted ensemble voting and joblib-parallel bootstrap edge stability, feeding a DoWhy ATE estimator guarded by three refutation tests (placebo, random common cause, data subset) and a do-calculus intervention simulator.
  • RCA engine and analytics: composite scoring |ATE| x edge_confidence x bootstrap_stability extended with mediation, multi-hop path, conditional, and counterfactual RCA; temporal discovery (Granger, window-based GES, regime detection); and a JSON-backed model registry with a 4-stage lifecycle, data/concept-drift detection (KS + PSI), and A/B comparison.
  • Full delivery stack: FastAPI backend (45+ endpoints, API-key auth + RBAC), a React 18 + TypeScript + MUI 6 SPA (12 pages, D3.js causal-graph viz, EN/KO, SSE-streamed local-Ollama chat grounded by ~1500-token context injection), 9 phase-based orchestrators, 700+ tests, and Docker Compose + GitHub Actions CI/CD.

Design decisions

  1. Learn causality, not correlation

    Rather than stopping at correlation-based defect detection, the platform learns the causal graph of the process via causal discovery (PC, GES, NOTEARS, FCI) so that root causes are distinguished from co-symptoms and interventions can be reasoned about with do-calculus.

  2. Ensemble discovery with bootstrap edge stability

    No single discovery algorithm is trusted alone. Four algorithms (PC, GES, FCI via causal-learn, and a custom NOTEARS) run behind a unified runner, then weighted ensemble voting plus bootstrap-based edge stability (joblib-parallelized) decide which edges survive into the final DAG, reducing dependence on any one method's assumptions.

    Pipeline: four discovery algorithms (PC, GES, FCI, NOTEARS) vote, bootstrap stability scores each edge, and a confidence >= 0.5 and stability >= 0.6 gate filters down to a 12-node, 7-edge DAG.
    No single discovery algorithm is trusted alone: four methods vote, bootstrap stability scores each edge, and only edges clearing both thresholds (confidence ≥ 0.5 and stability ≥ 0.6) reach the final consensus DAG — 12 nodes, 7 edges.
  3. Guard inferred effects with refutation tests

    Effect estimation uses DoWhy ATE with three refutation tests (placebo treatment, random common cause, data subset). Effects that do not survive refutation are treated as suspect, guarding against spurious cause-effect claims.

  4. Transparent composite RCA scoring

    Root causes are ranked by score = |ATE| x edge_confidence x bootstrap_stability, and every row exposes the underlying ATE, edge confidence, composite score, and bootstrap stability separately so the ranking never becomes a black box. An operator can see, for target Shrinkage, that Cooling Time outranks Mold Temp because its absolute effect is larger while its edge is as confident (82%) and as stable (100%) as Mold Temp's.

    The score = |ATE| x edge_confidence x bootstrap_stability formula with each factor exposed, and a worked Shrinkage example ranking Cooling Time (0.62) above Mold Temp (0.29) and Resin Temp (0.09).
    Root causes rank by score = |ATE| x edge_confidence x bootstrap_stability with every factor exposed separately, so the ranking stays auditable rather than a black box.
  5. Extend beyond plain RCA

    The RCA engine adds mediation analysis (decomposing total effect into direct vs. indirect paths), multi-hop path analysis, conditional RCA (conditioning on a covariate), and counterfactual RCA, exposed through an Advanced Root Cause Analysis panel.

  6. Screen interventions against the causal model

    A What-If page simulates do-interventions on the learned graph: the user picks an intervention variable, sets a counterfactual value, picks a downstream target, and the system returns the expected outcome and the delta from baseline (e.g., forcing Mold Temp = 45 yields expected Shrinkage -6.15 vs baseline -0.001). This lets a user screen candidate process changes against the causal model before applying them, and stacks on a parameter-sweep utility for continuous variable scans.

    A do-intervention on the learned graph: forcing Mold Temp = 45 yields expected Shrinkage -6.15 versus a baseline of -0.001 (effect -6.15).
    Screen a process change before it touches the line: a do-intervention on the learned graph (Mold Temp = 45) returns the expected Shrinkage (-6.15) and its delta from baseline (-0.001).
  7. Phase-based orchestration

    The pipeline is organized into 9 phase-based orchestrators sharing a common base class, spanning data ingestion through discovery, inference, RCA, and delivery, which keeps each stage independently testable and composable.

  8. Multi-process registry

    The platform manages multiple process types in parallel rather than a single hardcoded process. Three built-in processes ship: injection_molding (12 vars, 13 edges; defects Dim Defect / Flow Mark), extrusion (10 vars, 10 edges; defects Dimensional Accuracy / Tensile Strength), and cnc_machining (10 vars, 10 edges; defects Dimensional Tolerance / Tool Life).

  9. MLOps lifecycle and drift detection

    A JSON-backed model registry tracks a 4-stage lifecycle (candidate -> staging -> production -> archived), with data-drift detection (KS test + PSI), concept-drift detection (edge- and ATE-comparison), and an A/B comparison engine with a recommendation heuristic to decide which model to promote.

  10. Grounded local-LLM chat

    A local Ollama model (qwen2.5:3b default) is integrated with SSE streaming. A context-injection prompt summarizes the current causal graph and RCA results into ~1500 tokens so the assistant answers natural-language questions while staying grounded in the actual model state rather than hallucinating.

  11. Operator-facing monitoring on top of Prometheus/Grafana

    Beyond Prometheus/Grafana metrics, a Monitoring page gives a human-readable operator view: a KPI strip (overall status, total requests, active alerts, uptime), a per-component health grid (api, graph, scheduler, data_registry, model_registry, auth, alert_manager) with Up/Down badges and contextual metadata, and a resources panel tracking disk usage and log-file size.

In operation

Causal graph page: learned DAG with 12 nodes and 7 edges, hierarchical layout with color-coded tiers, confidence and stability filters, and right-hand detail panel showing incoming edges to the selected outcome with confidence and stability per edge
Causal Graph View: learned DAG (12 nodes, 7 edges after ensemble consensus and bootstrap stability filtering) with tier-colored hierarchical layout, confidence/stability sliders, and a per-node detail panel. Outcome Shrinkage is selected, revealing three incoming edges: Mold Temp (82.2% / 100%), Resin Temp (60.0% / 100%), Cooling Time (82.2% / 100%).
Root Cause Analysis page with target Shrinkage: contribution bar chart showing top three causes Cooling Time, Mold Temp, and Resin Temp, plus detailed results table exposing ATE, confidence, composite score, and stability per cause
Root Cause Analysis: causes ranked for target Shrinkage by score = |ATE| x confidence x stability. Top three: Cooling Time (score 0.62, ATE -0.065), Mold Temp (0.29, ATE +0.030), Resin Temp (0.09, ATE +0.013), with each factor exposed separately so the ranking stays transparent.
What-If Simulation page: intervention on Mold Temp set to 45 against target Shrinkage, showing baseline value, expected value after intervention, and the effect as a change
What-If Simulation: do-interventions on the learned graph. Forcing Mold Temp = 45 yields expected Shrinkage -6.15 versus a baseline of -0.001 (effect -6.15), letting operators screen process changes before risking them on the line.
Processes page: multi-process registry listing injection molding, extrusion, and CNC machining with their variable counts, edge counts, and defect targets, plus an Advanced Root Cause Analysis panel with Mediation, Conditional, and Counterfactual toggles
Multi-Process Registry: three built-in processes (injection_molding 12 vars/13 edges; extrusion 10 vars/10 edges; cnc_machining 10 vars/10 edges) with an Advanced Root Cause Analysis panel exposing Mediation, Conditional, and Counterfactual RCA.

Engineering foothold

ClaimEvidence
Learned DAG renders with 12 nodes and 7 edges after ensemble consensus and bootstrap stability filtering, with tier-colored hierarchical layout.Causal Graph View: D3.js DAG with 12 nodes and 7 edges; process parameters (orange), intermediate states (blue), outcomes (red); confidence/stability sliders and a per-node detail panel showing incoming/outgoing edges. Confirmed by committed results/phase2/graph/production_graph.json: 12 variable_names, 7 entries in edge_confidence/edge_stability, metadata filtered_min_confidence=0.5 / filtered_min_stability=0.6, algorithms [fci, pc, ges, notears].
For outcome Shrinkage the detail panel exposes three incoming edges with per-edge confidence and stability.production_graph.json edge_confidence/edge_stability: mold_temp|shrinkage 0.8222 / 1.0 (82.2% / 100%), resin_temp|shrinkage 0.6000 / 1.0 (60.0% / 100%), cooling_time|shrinkage 0.8222 / 1.0 (82.2% / 100%) -- the three incoming edges shown in the Causal Graph View.
RCA ranks causes for a target via score = |ATE| x confidence x stability and exposes each factor separately.Root Cause Analysis: for target Shrinkage, top three causes are Cooling Time (score 0.62, ATE -0.065), Mold Temp (0.29, ATE +0.030), Resin Temp (0.09, ATE +0.013); table shows ATE, confidence, composite score, and stability per row. Formula verified in src/skills/rca_engine.py:166 (contribution = abs(ate_value) * confidence * stability); per-row fields (contribution_score, ate_value, confidence, stability, causal_paths) verified in committed results/phase2/rca/step3_rca_results.json.
What-If page returns expected outcome under a do-intervention plus delta from baseline.What-If Simulation: forcing Mold Temp = 45 yields expected Shrinkage -6.15 vs baseline -0.001 (effect -6.15). Intervention simulator (do-calculus) verified in src/skills/intervention_simulator.py (baselines / effects / target_baselines fields).
Platform manages multiple process types in parallel with distinct variable/edge counts and defect targets.Multi-Process Registry + src/skills/process_registry.py: injection_molding (12 vars / 13 edges; dim_defect / flow_mark), extrusion (10 vars / 10 edges; dimensional_accuracy / tensile_strength), cnc_machining (10 vars / 10 edges; dimensional_tolerance / tool_life). Advanced RCA panel with Mediation, Conditional, Counterfactual toggles.
Monitoring exposes a per-component health grid and resource utilization in one pane.Operational Monitoring + src/dashboard/pages/monitoring_view.py: KPI strip (overall status, total requests, active alerts, uptime); component grid for api, graph, scheduler, data_registry, model_registry, auth, alert_manager with Up/Down badges; resources panel for disk usage and log-file size.
DoWhy ATE estimates are guarded by three refutation tests.src/skills/causal_inference_engine.py:270 default methods = [random_common_cause, placebo_treatment_refuter, data_subset_refuter], invoked via DoWhy model.refute_estimate().
Validated on a synthetic injection-molding dataset and exercised on open public benchmarks; no real-factory numbers claimed.Synthetic dataset verified in src/skills/synthetic_data_generator.py (12 variables, asserts exactly 13 edges, 3 tiers). Open SECOM + TEP benchmarks exercised via src/agents/real_data_validator.py (SECOM UCI semiconductor 590 vars / 1567 obs; TEP Tennessee Eastman 52 vars / 21 faults) and configs/phase{0,1,2}_config.yaml. README License: 'Personal research project'; no real-factory numbers claimed.
Verified with 700+ unit and integration tests across all major modules.1498 test functions across the tests/ tree (grep 'def test_'); the project docs record 'Tests: 700+'. Conservative 700+ claim holds.
Backend exposes 45+ endpoints with API-key auth and RBAC.50 endpoint decorators across src/api/routes/ (grep @router.{get,post,put,delete,patch}); API-key auth + RBAC (viewer/operator/admin) in src/skills/auth_manager.py.
Monitoring page: overall health status, total requests, active alerts, uptime, a per-component health grid covering api graph scheduler data_registry model_registry auth and alert_manager, and resource utilization with disk free disk total disk usage and log file size
Operational Monitoring: KPI strip (overall status, total requests, active alerts, uptime), per-component health grid (api, graph, scheduler, data_registry, model_registry, auth, alert_manager) with Up/Down badges, and a resources panel tracking disk usage and log-file size; backs the platform's Prometheus / Grafana integration.

Tech stack

Causal Discovery
PC, GES, FCI (causal-learn), NOTEARS (custom), Weighted ensemble voting, Bootstrap-based edge stability, joblib (parallel)
Causal Inference & RCA
DoWhy ATE estimation, Refutation tests (placebo, random common cause, data subset), Composite ranking |ATE| x confidence x stability, Mediation analysis, Multi-hop path analysis, Conditional RCA, Counterfactual RCA, do-calculus intervention simulator
Temporal
Granger causality, Window-based GES, Regime detection, Temporal stability tracking
MLOps
JSON-backed model registry (4-stage lifecycle), Data-drift detection (KS test + PSI), Concept-drift detection (edge / ATE comparison), A/B comparison with recommendation
Backend
FastAPI (45+ endpoints), uvicorn, Pydantic, SQLAlchemy, SSE streaming
Frontend
Vite, React 18, TypeScript, MUI 6, D3.js, Recharts, TanStack Query, 12 pages, bilingual EN / KO, dark / light themes
Knowledge Graph
Neo4j, Pluggable GraphStore abstraction, Cypher path exploration, Data lineage
LLM Integration
Ollama (qwen2.5:3b default), SSE streaming, ~1500-token context injection (causal graph + RCA results)
Dashboards
Streamlit (9 pages), matplotlib, seaborn
Security
API-key authentication, RBAC (admin / operator / viewer), JSON-lines audit log, Configurable alert rules with webhook delivery
Monitoring
prometheus_client metrics, Grafana dashboards, Liveness / readiness / detailed health endpoints
Infrastructure
Docker Compose (multi-service: API / frontend / dashboard / Prometheus / Grafana / Neo4j), GitHub Actions CI/CD (lint, test, image build), Structured JSON logging with rotating handlers
Validation
Synthetic injection-molding dataset (12 vars, 13 edges, 3 tiers), Open public benchmarks: SECOM, TEP, 700+ unit and integration tests

Gallery

← All projects