Research prototype · open/synthetic data
Causal RCA Platform
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
-
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.
-
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.
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. -
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.
-
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.
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. -
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.
-
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.
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). -
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.
-
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).
-
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.
-
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.
-
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




Engineering foothold
| Claim | Evidence |
|---|---|
| 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. |

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
