# shanksoff/data-analysis-streamlit-app architecture

> Architecture diagram of the GitHub repository shanksoff/data-analysis-streamlit-app, 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/shanksoff/data-analysis-streamlit-app
- Repository: https://github.com/shanksoff/data-analysis-streamlit-app

## Overview

Ask Your CSV is a Streamlit prototype for analyzing uploaded CSV data through natural-language questions. The main workflow loads a file into a pandas dataframe, builds a data-aware prompt, sends conversation history to Gemini, and can execute returned Python code to produce analysis or plots shown in the chat. The app also exposes export options and contains HTML report-generation logic. The implementation is concentrated in app1.py; omitted source sections limit certainty about some UI wiring and export behavior.

Main entry points: [`app1.py`](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py) (Chat Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_app_ui["Streamlit Interface<br/>[app1.py]"]
  node_chat_results["Chat Results<br/>[app1.py]"]
end

subgraph group_analysis["Analysis Runtime"]
  node_csv_loader["CSV Loader<br/>[app1.py]"]
  node_data_state[("Dataset State<br/>[app1.py]")]
  node_prompt_builder["Prompt Builder<br/>[app1.py]"]
  node_gemini{{"Gemini API"}}
  node_code_runner["Python Executor<br/>[app1.py]"]
end

subgraph group_reporting["Reporting"]
  node_report_export["Report Export<br/>[app1.py]"]
end

node_user(("Analyst"))

node_user -->|"uploads and asks"| node_app_ui
node_app_ui -->|"reads CSV"| node_csv_loader
node_csv_loader -->|"stores dataframe"| node_data_state
node_app_ui -->|"submits question"| node_prompt_builder
node_data_state -->|"supplies dataset"| node_prompt_builder
node_prompt_builder -->|"requests analysis"| node_gemini
node_gemini -->|"returns Python"| node_code_runner
node_code_runner -->|"produces plots"| node_chat_results
node_gemini -->|"returns answer"| node_chat_results
node_chat_results -->|"displays results"| node_user
node_chat_results -->|"uses conversation"| node_report_export

click node_app_ui "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_csv_loader "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_data_state "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_prompt_builder "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_code_runner "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_chat_results "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py"
click node_report_export "https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.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_ui,node_chat_results toneBlue
class node_csv_loader,node_data_state,node_prompt_builder,node_gemini,node_code_runner toneAmber
class node_report_export toneMint
class node_user toneIndigo
```

## Components

### User Interaction

- [Streamlit Interface](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`
- [Chat Results](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`

### Analysis Runtime

- [CSV Loader](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`
- [Dataset State](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`
- [Prompt Builder](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`
- **Gemini API**
- [Python Executor](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`

### Reporting

- [Report Export](https://github.com/shanksoff/data-analysis-streamlit-app/blob/main/app1.py): `app1.py`

### Other components

- **Analyst**

## Connections

- Analyst → Streamlit Interface: uploads and asks (evidence: `README.md`)
- Streamlit Interface → CSV Loader: reads CSV (evidence: `app1.py`)
- CSV Loader → Dataset State: stores dataframe (evidence: `app1.py`)
- Streamlit Interface → Prompt Builder: submits question (evidence: `app1.py`)
- Dataset State → Prompt Builder: supplies dataset (evidence: `app1.py`)
- Prompt Builder → Gemini API: requests analysis (evidence: `app1.py`)
- Gemini API → Python Executor: returns Python (evidence: `app1.py`)
- Python Executor → Chat Results: produces plots (evidence: `app1.py`)
- Gemini API → Chat Results: returns answer (evidence: `app1.py`)
- Chat Results → Analyst: displays results (evidence: `app1.py`)
- Chat Results → Report Export: uses conversation (evidence: `app1.py`)
