# devinlanyu0422/alert-anomaly-investigator architecture

> Architecture diagram of the GitHub repository devinlanyu0422/alert-anomaly-investigator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devinlanyu0422/alert-anomaly-investigator
- Repository: https://github.com/devinlanyu0422/alert-anomaly-investigator

## Overview

This is a Python helper runtime for an AI Analyst demo focused on alert anomaly investigation. The documented user journey begins with an alert or metric change, checks whether it is real, isolates affected dimensions, assesses likely causes and business impact, then produces an action plan and shareable analysis. The graph also shows data/context access, statistical and trust capabilities, and the documented pipeline and evaluation branches. Source excerpts are partial, so some domain stages are represented by their existing helper directories; unsampled implementation links are omitted where evidence is insufficient.

Main entry points: [`helpers/pipeline/controller.py`](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/pipeline/controller.py) (Pipeline controller), [`helpers/knowledge/context_manifest.py`](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/context_manifest.py) (Business context), [`helpers/data/connection_manager.py`](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/connection_manager.py) (Warehouse connections), [`helpers/export/gdoc_builder.py`](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/export/gdoc_builder.py) (Report export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Investigation workflow"]
  node_pipeline["Pipeline controller<br/>[controller.py]"]
  node_anomaly_profile["Anomaly profiling<br/>[deep_profiler.py]"]
  node_comparison["Metric comparison<br/>[metric_compiler.py]"]
  node_cause_isolation["Cause isolation<br/>[stats_helpers.py]"]
  node_impact_plan["Impact and action<br/>[findings.py]"]
  node_engine["Model engine adapter<br/>[claude_cli.py]"]
end

subgraph group_data_context["Data and context"]
  node_connections["Warehouse connections"]
  node_dialects["SQL dialects<br/>[base.py]"]
  node_context["Business context"]
  node_context_sync["Context source sync<br/>[context_sync.py]"]
  node_connected_metrics["Connected metrics<br/>[engine.py]"]
end

subgraph group_analysis["Analysis and validation"]
  node_experiments["Experiment statistics"]
  node_causal["Causal methods"]
  node_forecasting["Forecasting"]
  node_validation["Analysis validation"]
end

subgraph group_trust_eval["Trust and evaluation"]
  node_provenance["Evidence provenance"]
  node_query_log["Query audit log<br/>[query_log.py]"]
  node_evaluation["Evaluation runs<br/>[controller.py]"]
end

subgraph group_delivery["Operations and delivery"]
  node_export["Report export<br/>[gdoc_builder.py]"]
  node_visualization["Charts and themes<br/>[chart_helpers.py]"]
end

node_analyst(("Analyst / on-call"))
node_warehouse[("Data warehouse")]
node_shared_docs["Google Docs"]

node_analyst -->|"starts investigation"| node_pipeline
node_pipeline -->|"launches workers"| node_engine
node_pipeline -->|"loads context"| node_context
node_connections -.->|"queries data"| node_warehouse
node_connections -->|"uses dialects"| node_dialects
node_connections -->|"records queries"| node_query_log
node_context -->|"resolves source"| node_context_sync
node_context -->|"supplies metric definitions"| node_comparison
node_context -.->|"supports connected models"| node_connected_metrics
node_pipeline -.->|"profiles anomaly"| node_anomaly_profile
node_pipeline -.->|"compares periods"| node_comparison
node_pipeline -.->|"decomposes anomaly"| node_cause_isolation
node_pipeline -.->|"frames findings"| node_impact_plan
node_pipeline -.->|"validates analysis"| node_validation
node_pipeline -.->|"assembles evidence"| node_provenance
node_analyst -->|"requests experiment analysis"| node_experiments
node_analyst -->|"requests causal analysis"| node_causal
node_analyst -->|"requests forecast"| node_forecasting
node_analyst -->|"runs evaluations"| node_evaluation
node_pipeline -.->|"produces shareable report"| node_export
node_pipeline -.->|"produces charts"| node_visualization
node_export -.->|"exports document"| node_shared_docs

click node_pipeline "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/pipeline/controller.py"
click node_anomaly_profile "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/deep_profiler.py"
click node_comparison "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/metric_compiler.py"
click node_cause_isolation "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/stats/stats_helpers.py"
click node_impact_plan "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/findings.py"
click node_connections "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/connection_manager.py"
click node_dialects "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/dialects/base.py"
click node_context "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/context_manifest.py"
click node_context_sync "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/context_sync.py"
click node_connected_metrics "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/connected_context/engine.py"
click node_experiments "https://github.com/devinlanyu0422/alert-anomaly-investigator/tree/main/helpers/stats/experiment_stats"
click node_causal "https://github.com/devinlanyu0422/alert-anomaly-investigator/tree/main/helpers/stats/experiment_stats/causal"
click node_forecasting "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/stats/forecast_helpers.py"
click node_validation "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/validation/structural_validator.py"
click node_provenance "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/provenance/provenance_assembler.py"
click node_query_log "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/provenance/query_log.py"
click node_evaluation "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/evals/controller.py"
click node_engine "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/engines/claude_cli.py"
click node_export "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/export/gdoc_builder.py"
click node_visualization "https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/viz/chart_helpers.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pipeline,node_anomaly_profile,node_comparison,node_cause_isolation,node_impact_plan,node_engine toneBlue
class node_connections,node_dialects,node_context,node_context_sync,node_connected_metrics,node_warehouse toneAmber
class node_experiments,node_causal,node_forecasting,node_validation toneMint
class node_provenance,node_query_log,node_evaluation toneRose
class node_export,node_visualization,node_analyst,node_shared_docs toneIndigo
```

## Components

### Investigation workflow

- [Pipeline controller](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/pipeline/controller.py): `helpers/pipeline/controller.py`
- [Anomaly profiling](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/deep_profiler.py): `helpers/data/deep_profiler.py`
- [Metric comparison](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/metric_compiler.py): `helpers/data/metric_compiler.py`
- [Cause isolation](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/stats/stats_helpers.py): `helpers/stats/stats_helpers.py`
- [Impact and action](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/findings.py): `helpers/knowledge/findings.py`
- [Model engine adapter](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/engines/claude_cli.py): `helpers/engines/claude_cli.py`

### Data and context

- [Warehouse connections](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/connection_manager.py): `helpers/data/connection_manager.py`
- [SQL dialects](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/data/dialects/base.py): `helpers/data/dialects/base.py`
- [Business context](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/context_manifest.py): `helpers/knowledge/context_manifest.py`
- [Context source sync](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/knowledge/context_sync.py): `helpers/knowledge/context_sync.py`
- [Connected metrics](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/connected_context/engine.py): `helpers/connected_context/engine.py`

### Analysis and validation

- [Experiment statistics](https://github.com/devinlanyu0422/alert-anomaly-investigator/tree/main/helpers/stats/experiment_stats): `helpers/stats/experiment_stats`
- [Causal methods](https://github.com/devinlanyu0422/alert-anomaly-investigator/tree/main/helpers/stats/experiment_stats/causal): `helpers/stats/experiment_stats/causal`
- [Forecasting](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/stats/forecast_helpers.py): `helpers/stats/forecast_helpers.py`
- [Analysis validation](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/validation/structural_validator.py): `helpers/validation/structural_validator.py`

### Trust and evaluation

- [Evidence provenance](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/provenance/provenance_assembler.py): `helpers/provenance/provenance_assembler.py`
- [Query audit log](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/provenance/query_log.py): `helpers/provenance/query_log.py`
- [Evaluation runs](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/evals/controller.py): `helpers/evals/controller.py`

### Operations and delivery

- [Report export](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/export/gdoc_builder.py): `helpers/export/gdoc_builder.py`
- [Charts and themes](https://github.com/devinlanyu0422/alert-anomaly-investigator/blob/main/helpers/viz/chart_helpers.py): `helpers/viz/chart_helpers.py`

### Other components

- **Analyst / on-call**
- **Data warehouse**
- **Google Docs**

## Connections

- Analyst / on-call → Pipeline controller: starts investigation (evidence: `README.md`)
- Pipeline controller → Model engine adapter: launches workers (evidence: `helpers/pipeline/controller.py`)
- Pipeline controller → Business context: loads context (evidence: `helpers/pipeline/controller.py`)
- Warehouse connections → Data warehouse: queries data
- Warehouse connections → SQL dialects: uses dialects (evidence: `helpers/data/connection_manager.py`)
- Warehouse connections → Query audit log: records queries (evidence: `helpers/data/connection_manager.py`)
- Business context → Context source sync: resolves source (evidence: `helpers/knowledge/context_manifest.py`)
- Business context → Metric comparison: supplies metric definitions (evidence: `helpers/knowledge/context_manifest.py`)
- Business context → Connected metrics: supports connected models
- Pipeline controller → Anomaly profiling: profiles anomaly
- Pipeline controller → Metric comparison: compares periods
- Pipeline controller → Cause isolation: decomposes anomaly
- Pipeline controller → Impact and action: frames findings
- Pipeline controller → Analysis validation: validates analysis
- Pipeline controller → Evidence provenance: assembles evidence
- Analyst / on-call → Experiment statistics: requests experiment analysis (evidence: `README.md`)
- Analyst / on-call → Causal methods: requests causal analysis (evidence: `README.md`)
- Analyst / on-call → Forecasting: requests forecast (evidence: `README.md`)
- Analyst / on-call → Evaluation runs: runs evaluations (evidence: `README.md`)
- Pipeline controller → Report export: produces shareable report
- Pipeline controller → Charts and themes: produces charts
- Report export → Google Docs: exports document
