# wp113department-cell/data_analysis architecture

> Architecture diagram of the GitHub repository wp113department-cell/data_analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wp113department-cell/data_analysis
- Repository: https://github.com/wp113department-cell/data_analysis

## Overview

The product is a Streamlit CSV-analysis app. Users upload or select a dataset, ask a question, and receive a grounded answer; the first question also runs a LangGraph overview pipeline for statistics, charts, insights, and a markdown report. The UI invokes the query agent for each question and streams the overview workflow through the graph. README statements document the major result panels and Groq integration; the graph source shows node calls and parallel branches. Some UI and agent internals were not sampled, so their finer relationships are omitted.

Main entry points: [`main.py`](https://github.com/wp113department-cell/data_analysis/blob/main/main.py) (Streamlit app), [`agent/graph.py`](https://github.com/wp113department-cell/data_analysis/blob/main/agent/graph.py) (Workflow runner), [`agent/agents.py`](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py) (AI insights), [`data/sample_data.csv`](https://github.com/wp113department-cell/data_analysis/blob/main/data/sample_data.csv) (CSV dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Streamlit app<br/>[main.py]"]
  node_dataset["CSV dataset<br/>[sample_data.csv]"]
  node_answer_panel["Answer panel<br/>[main.py]"]
  node_stats_panel["Statistics panel<br/>[main.py]"]
  node_charts_panel["Charts panel<br/>[main.py]"]
  node_insights_panel["Insights panel<br/>[main.py]"]
  node_report_panel["Report download<br/>[main.py]"]
end

subgraph group_workflow["Analysis workflow"]
  node_graph["Workflow runner<br/>[graph.py]"]
end

subgraph group_agents["Analysis agents"]
  node_query["Question answering<br/>[agents.py]"]
  node_planner["Analysis planner<br/>[agents.py]"]
  node_insights["AI insights<br/>[agents.py]"]
end

subgraph group_results["Analysis results"]
  node_statistics["Statistics<br/>[agents.py]"]
  node_visualization["Chart generation<br/>[agents.py]"]
  node_report["Markdown report<br/>[agents.py]"]
end

node_user(("Data analyst"))
node_groq["Groq inference"]

node_user -->|"uploads and asks"| node_app
node_dataset -->|"selects sample"| node_app
node_app -->|"asks each question"| node_query
node_app -->|"streams overview"| node_graph
node_graph -->|"runs planner"| node_planner
node_graph -->|"runs statistics"| node_statistics
node_graph -->|"runs visualization"| node_visualization
node_graph -->|"runs insights"| node_insights
node_graph -->|"runs report"| node_report
node_planner -->|"dispatches plan"| node_statistics
node_planner -->|"dispatches plan"| node_visualization
node_statistics -->|"provides statistics"| node_insights
node_visualization -->|"joins branch"| node_insights
node_insights -->|"provides insights"| node_report
node_query -.->|"uses LLM"| node_groq
node_planner -.->|"uses LLM"| node_groq
node_insights -.->|"uses LLM"| node_groq
node_report -.->|"uses LLM"| node_groq
node_app -->|"renders answer"| node_answer_panel
node_app -->|"renders statistics"| node_stats_panel
node_app -->|"renders charts"| node_charts_panel
node_app -->|"renders insights"| node_insights_panel
node_app -->|"offers report"| node_report_panel

click node_app "https://github.com/wp113department-cell/data_analysis/blob/main/main.py"
click node_dataset "https://github.com/wp113department-cell/data_analysis/blob/main/data/sample_data.csv"
click node_query "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_graph "https://github.com/wp113department-cell/data_analysis/blob/main/agent/graph.py"
click node_planner "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_statistics "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_visualization "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_insights "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_report "https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py"
click node_answer_panel "https://github.com/wp113department-cell/data_analysis/blob/main/main.py"
click node_stats_panel "https://github.com/wp113department-cell/data_analysis/blob/main/main.py"
click node_charts_panel "https://github.com/wp113department-cell/data_analysis/blob/main/main.py"
click node_insights_panel "https://github.com/wp113department-cell/data_analysis/blob/main/main.py"
click node_report_panel "https://github.com/wp113department-cell/data_analysis/blob/main/main.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_app,node_dataset,node_answer_panel,node_stats_panel,node_charts_panel,node_insights_panel,node_report_panel toneBlue
class node_graph toneAmber
class node_query,node_planner,node_insights toneMint
class node_statistics,node_visualization,node_report toneRose
class node_user,node_groq toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`
- [CSV dataset](https://github.com/wp113department-cell/data_analysis/blob/main/data/sample_data.csv): `data/sample_data.csv`
- [Answer panel](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`
- [Statistics panel](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`
- [Charts panel](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`
- [Insights panel](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`
- [Report download](https://github.com/wp113department-cell/data_analysis/blob/main/main.py): `main.py`

### Analysis workflow

- [Workflow runner](https://github.com/wp113department-cell/data_analysis/blob/main/agent/graph.py): `agent/graph.py`

### Analysis agents

- [Question answering](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`
- [Analysis planner](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`
- [AI insights](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`

### Analysis results

- [Statistics](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`
- [Chart generation](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`
- [Markdown report](https://github.com/wp113department-cell/data_analysis/blob/main/agent/agents.py): `agent/agents.py`

### Other components

- **Data analyst**
- **Groq inference**

## Connections

- Data analyst → Streamlit app: uploads and asks (evidence: `README.md`)
- CSV dataset → Streamlit app: selects sample (evidence: `README.md`)
- Streamlit app → Question answering: asks each question (evidence: `main.py`)
- Streamlit app → Workflow runner: streams overview (evidence: `main.py`)
- Workflow runner → Analysis planner: runs planner (evidence: `agent/graph.py`)
- Workflow runner → Statistics: runs statistics (evidence: `agent/graph.py`)
- Workflow runner → Chart generation: runs visualization (evidence: `agent/graph.py`)
- Workflow runner → AI insights: runs insights (evidence: `agent/graph.py`)
- Workflow runner → Markdown report: runs report (evidence: `agent/graph.py`)
- Analysis planner → Statistics: dispatches plan (evidence: `agent/graph.py`)
- Analysis planner → Chart generation: dispatches plan (evidence: `agent/graph.py`)
- Statistics → AI insights: provides statistics (evidence: `agent/graph.py`)
- Chart generation → AI insights: joins branch (evidence: `agent/graph.py`)
- AI insights → Markdown report: provides insights (evidence: `agent/graph.py`)
- Question answering → Groq inference: uses LLM (evidence: `README.md`)
- Analysis planner → Groq inference: uses LLM (evidence: `README.md`)
- AI insights → Groq inference: uses LLM (evidence: `README.md`)
- Markdown report → Groq inference: uses LLM (evidence: `README.md`)
- Streamlit app → Answer panel: renders answer (evidence: `README.md`)
- Streamlit app → Statistics panel: renders statistics (evidence: `README.md`)
- Streamlit app → Charts panel: renders charts (evidence: `README.md`)
- Streamlit app → Insights panel: renders insights (evidence: `README.md`)
- Streamlit app → Report download: offers report (evidence: `README.md`)
