# azzzwhy/data-analysis architecture

> Architecture diagram of the GitHub repository azzzwhy/data-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azzzwhy/data-analysis
- Repository: https://github.com/azzzwhy/data-analysis

## Overview

This is a local-data statistical analysis agent: a user asks a question, the configured model selects a tool, local code computes over the dataset, and the model explains the returned results. The main flow is supported by the README and sampled agent/skill excerpts. The skill also documents resident sessions, analysis planning, batch work, and report deliverables; links for unsampled subsystems are limited to what the tree and documentation support.

Main entry points: [`agent/agent_main.py`](https://github.com/azzzwhy/data-analysis/blob/main/agent/agent_main.py) (Tool-calling agent), [`skills/cudf-analytics/scripts/gpu_analytics.py`](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_analytics.py) (Statistical engine), [`agent/skills.py`](https://github.com/azzzwhy/data-analysis/blob/main/agent/skills.py) (Skill dispatch), [`skills/cudf-analytics/scripts/gpu_session.py`](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_session.py) (Resident sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_tui["Terminal UI<br/>[tui_app.py]"]
  node_cli["CLI entry<br/>[agent_main.py]"]
end

subgraph group_agent["Agent and connections"]
  node_setup["Connection setup<br/>[api_setup.py]"]
  node_config["API configuration<br/>[api_config.py]"]
  node_agentloop["Tool-calling agent<br/>[agent_main.py]"]
  node_skills["Skill dispatch<br/>[skills.py]"]
end

subgraph group_analytics["Local analytics"]
  node_analytics["Statistical engine<br/>[gpu_analytics.py]"]
  node_session["Resident sessions<br/>[gpu_session.py]"]
  node_planning["Analysis planning<br/>[analysis_plan.py]"]
  node_cache["Parquet cache<br/>[parquet_cache.py]"]
  node_reports["Report outputs"]
end

subgraph group_extensions["Extensions"]
  node_external["External tool policy<br/>[external_tools.py]"]
end

node_user(("Analyst"))
node_provider["Model provider"]
node_dataset["Local dataset"]
node_mcp["MCP servers"]
node_external_skill["Installed skills"]

node_user -->|"asks question"| node_tui
node_tui -->|"runs query"| node_agentloop
node_user -->|"asks question"| node_cli
node_cli -->|"starts agent"| node_agentloop
node_setup -.->|"lists models"| node_provider
node_setup -->|"saves settings"| node_config
node_agentloop -->|"loads settings"| node_config
node_agentloop -->|"sends prompts"| node_provider
node_provider -->|"returns tool calls"| node_agentloop
node_agentloop -->|"dispatches tools"| node_skills
node_skills -->|"runs analysis"| node_analytics
node_analytics -->|"reads data"| node_dataset
node_analytics -->|"returns statistics"| node_agentloop
node_agentloop -->|"sends tool results"| node_provider
node_provider -->|"returns answer"| node_agentloop
node_skills -->|"runs session tools"| node_session
node_session -->|"loads data"| node_dataset
node_session -->|"builds plan"| node_planning
node_session -->|"runs analysis"| node_analytics
node_analytics -.->|"uses cache"| node_cache
node_agentloop -->|"dispatches external tools"| node_external
node_external -.->|"calls approved tools"| node_mcp
node_external -.->|"discovers skills"| node_external_skill
node_skills -.->|"creates deliverables"| node_reports

click node_tui "https://github.com/azzzwhy/data-analysis/blob/main/agent/tui_app.py"
click node_cli "https://github.com/azzzwhy/data-analysis/blob/main/agent/agent_main.py"
click node_setup "https://github.com/azzzwhy/data-analysis/blob/main/agent/api_setup.py"
click node_config "https://github.com/azzzwhy/data-analysis/blob/main/agent/api_config.py"
click node_agentloop "https://github.com/azzzwhy/data-analysis/blob/main/agent/agent_main.py"
click node_skills "https://github.com/azzzwhy/data-analysis/blob/main/agent/skills.py"
click node_analytics "https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_analytics.py"
click node_session "https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_session.py"
click node_planning "https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/analysis_plan.py"
click node_cache "https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/parquet_cache.py"
click node_reports "https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/make_deliverables.py"
click node_external "https://github.com/azzzwhy/data-analysis/blob/main/agent/external_tools.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_tui,node_cli toneBlue
class node_setup,node_config,node_agentloop,node_skills toneAmber
class node_analytics,node_session,node_planning,node_cache,node_reports,node_mcp toneMint
class node_external toneRose
class node_user,node_provider,node_dataset,node_external_skill toneIndigo
```

## Components

### User experience

- [Terminal UI](https://github.com/azzzwhy/data-analysis/blob/main/agent/tui_app.py): `agent/tui_app.py`
- [CLI entry](https://github.com/azzzwhy/data-analysis/blob/main/agent/agent_main.py): `agent/agent_main.py`

### Agent and connections

- [Connection setup](https://github.com/azzzwhy/data-analysis/blob/main/agent/api_setup.py): `agent/api_setup.py`
- [API configuration](https://github.com/azzzwhy/data-analysis/blob/main/agent/api_config.py): `agent/api_config.py`
- [Tool-calling agent](https://github.com/azzzwhy/data-analysis/blob/main/agent/agent_main.py): `agent/agent_main.py`
- [Skill dispatch](https://github.com/azzzwhy/data-analysis/blob/main/agent/skills.py): `agent/skills.py`

### Local analytics

- [Statistical engine](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_analytics.py): `skills/cudf-analytics/scripts/gpu_analytics.py`
- [Resident sessions](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/gpu_session.py): `skills/cudf-analytics/scripts/gpu_session.py`
- [Analysis planning](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/analysis_plan.py): `skills/cudf-analytics/scripts/analysis_plan.py`
- [Parquet cache](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/parquet_cache.py): `skills/cudf-analytics/scripts/parquet_cache.py`
- [Report outputs](https://github.com/azzzwhy/data-analysis/blob/main/skills/cudf-analytics/scripts/make_deliverables.py): `skills/cudf-analytics/scripts/make_deliverables.py`

### Extensions

- [External tool policy](https://github.com/azzzwhy/data-analysis/blob/main/agent/external_tools.py): `agent/external_tools.py`

### Other components

- **Analyst**
- **Model provider**
- **Local dataset**
- **MCP servers**
- **Installed skills**

## Connections

- Analyst → Terminal UI: asks question
- Terminal UI → Tool-calling agent: runs query
- Analyst → CLI entry: asks question
- CLI entry → Tool-calling agent: starts agent
- Connection setup → Model provider: lists models
- Connection setup → API configuration: saves settings
- Tool-calling agent → API configuration: loads settings
- Tool-calling agent → Model provider: sends prompts
- Model provider → Tool-calling agent: returns tool calls
- Tool-calling agent → Skill dispatch: dispatches tools
- Skill dispatch → Statistical engine: runs analysis
- Statistical engine → Local dataset: reads data
- Statistical engine → Tool-calling agent: returns statistics
- Tool-calling agent → Model provider: sends tool results
- Model provider → Tool-calling agent: returns answer
- Skill dispatch → Resident sessions: runs session tools
- Resident sessions → Local dataset: loads data
- Resident sessions → Analysis planning: builds plan
- Resident sessions → Statistical engine: runs analysis
- Statistical engine → Parquet cache: uses cache
- Tool-calling agent → External tool policy: dispatches external tools
- External tool policy → MCP servers: calls approved tools
- External tool policy → Installed skills: discovers skills
- Skill dispatch → Report outputs: creates deliverables
