# winnermarvi/business_analyst architecture

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

- Interactive diagram: https://gitdiagram.com/winnermarvi/business_analyst
- Repository: https://github.com/winnermarvi/business_analyst

## Overview

AI Business Analyst accepts CSV data for automated analysis, model selection, explanations, and reporting, with follow-up dataset chat and natural-language analytics. The evidenced backend entry points are FastAPI routes and the analysis orchestrator; README-documented capabilities whose implementation wiring was not sampled are shown as separate branches with documented or unverified links. The source index supports the ML subsystem relationships, but most individual feature implementations were not excerpted.

Main entry points: [`src/services/pipeline_service.py`](https://github.com/winnermarvi/business_analyst/blob/main/src/services/pipeline_service.py) (Analysis orchestrator), [`src/ml/ml_pipeline.py`](https://github.com/winnermarvi/business_analyst/blob/main/src/ml/ml_pipeline.py) (ML workflow), [`src/api/app.py`](https://github.com/winnermarvi/business_analyst/blob/main/src/api/app.py) (FastAPI endpoints), [`src/services/chat_service.py`](https://github.com/winnermarvi/business_analyst/blob/main/src/services/chat_service.py) (Dataset chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interface and API"]
  node_streamlit["Streamlit frontend"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_analysis["Analysis workflow"]
  node_pipeline["Analysis orchestrator"]
  node_preprocessing["Data preprocessing"]
  node_eda["Exploratory analysis<br/>[eda.py]"]
  node_insights["EDA insights"]
end

subgraph group_modeling["Machine learning"]
  node_ml_service["ML service<br/>[ml_service.py]"]
  node_ml_pipeline["ML workflow<br/>[ml_pipeline.py]"]
  node_target["Target detection<br/>[target_detector.py]"]
  node_model_selection["Best model selection"]
  node_classification["Classification models"]
  node_regression["Regression models"]
  node_explainability["Feature insights and recommendations"]
end

subgraph group_assistant["AI and exploration"]
  node_llm["Business narrative"]
  node_chat["Dataset chat<br/>[chat_service.py]"]
  node_rag["RAG retrieval"]
  node_analytics["Natural-language analytics"]
end

subgraph group_outputs["Reports and charts"]
  node_visualization["Interactive charts"]
  node_report["PDF reporting"]
  node_pdf["PDF report"]
  node_plot["Plotly chart"]
end

node_user(("Analyst"))

node_user -.->|"uses"| node_streamlit
node_streamlit -.->|"requests analysis"| node_api
node_api -->|"runs analysis"| node_pipeline
node_api -->|"requests chat"| node_chat
node_api -->|"uses response types"| node_schemas
node_pipeline -->|"runs EDA"| node_eda
node_pipeline -->|"runs modeling"| node_ml_service
node_pipeline -->|"requests summary"| node_llm
node_pipeline -->|"generates report"| node_report
node_pipeline -->|"generates charts"| node_visualization
node_pipeline -.->|"prepares dataset"| node_preprocessing
node_eda -.->|"generates findings"| node_insights
node_ml_service -.->|"runs ML workflow"| node_ml_pipeline
node_ml_pipeline -->|"detects target type"| node_target
node_ml_pipeline -->|"trains and evaluates"| node_classification
node_ml_pipeline -->|"trains and evaluates"| node_regression
node_ml_pipeline -->|"selects best model"| node_model_selection
node_ml_pipeline -->|"generates explanations"| node_explainability
node_chat -.->|"retrieves context"| node_rag
node_chat -.->|"generates response"| node_llm
node_api -.->|"accepts query"| node_analytics
node_analytics -.->|"requests chart"| node_visualization
node_report -->|"produces"| node_pdf
node_visualization -.->|"renders"| node_plot

click node_streamlit "https://github.com/winnermarvi/business_analyst/tree/main/frontend"
click node_api "https://github.com/winnermarvi/business_analyst/blob/main/src/api/app.py"
click node_schemas "https://github.com/winnermarvi/business_analyst/blob/main/src/api/schemas.py"
click node_pipeline "https://github.com/winnermarvi/business_analyst/blob/main/src/services/pipeline_service.py"
click node_preprocessing "https://github.com/winnermarvi/business_analyst/tree/main/src/preprocessing"
click node_eda "https://github.com/winnermarvi/business_analyst/blob/main/src/eda/eda.py"
click node_insights "https://github.com/winnermarvi/business_analyst/tree/main/src/insights"
click node_ml_service "https://github.com/winnermarvi/business_analyst/blob/main/src/services/ml_service.py"
click node_ml_pipeline "https://github.com/winnermarvi/business_analyst/blob/main/src/ml/ml_pipeline.py"
click node_target "https://github.com/winnermarvi/business_analyst/blob/main/src/ml/target_detector.py"
click node_model_selection "https://github.com/winnermarvi/business_analyst/blob/main/src/ml/select_best_model.py"
click node_classification "https://github.com/winnermarvi/business_analyst/tree/main/src/ml/classification"
click node_regression "https://github.com/winnermarvi/business_analyst/tree/main/src/ml/regression"
click node_explainability "https://github.com/winnermarvi/business_analyst/tree/main/src/explainability"
click node_llm "https://github.com/winnermarvi/business_analyst/tree/main/src/llm"
click node_chat "https://github.com/winnermarvi/business_analyst/blob/main/src/services/chat_service.py"
click node_rag "https://github.com/winnermarvi/business_analyst/tree/main/src/rag"
click node_analytics "https://github.com/winnermarvi/business_analyst/tree/main/src/analytics"
click node_visualization "https://github.com/winnermarvi/business_analyst/tree/main/src/visualization"
click node_report "https://github.com/winnermarvi/business_analyst/tree/main/src/reporting"

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_streamlit,node_api,node_schemas toneBlue
class node_pipeline,node_preprocessing,node_eda,node_insights toneAmber
class node_ml_service,node_ml_pipeline,node_target,node_model_selection,node_classification,node_regression,node_explainability toneMint
class node_llm,node_chat,node_rag,node_analytics toneRose
class node_visualization,node_report,node_pdf,node_plot,node_user toneIndigo
```

## Components

### User interface and API

- [Streamlit frontend](https://github.com/winnermarvi/business_analyst/tree/main/frontend): `frontend`
- [FastAPI endpoints](https://github.com/winnermarvi/business_analyst/blob/main/src/api/app.py): `src/api/app.py`
- [API schemas](https://github.com/winnermarvi/business_analyst/blob/main/src/api/schemas.py): `src/api/schemas.py`

### Analysis workflow

- [Analysis orchestrator](https://github.com/winnermarvi/business_analyst/blob/main/src/services/pipeline_service.py): `src/services/pipeline_service.py`
- [Data preprocessing](https://github.com/winnermarvi/business_analyst/tree/main/src/preprocessing): `src/preprocessing`
- [Exploratory analysis](https://github.com/winnermarvi/business_analyst/blob/main/src/eda/eda.py): `src/eda/eda.py`
- [EDA insights](https://github.com/winnermarvi/business_analyst/tree/main/src/insights): `src/insights`

### Machine learning

- [ML service](https://github.com/winnermarvi/business_analyst/blob/main/src/services/ml_service.py): `src/services/ml_service.py`
- [ML workflow](https://github.com/winnermarvi/business_analyst/blob/main/src/ml/ml_pipeline.py): `src/ml/ml_pipeline.py`
- [Target detection](https://github.com/winnermarvi/business_analyst/blob/main/src/ml/target_detector.py): `src/ml/target_detector.py`
- [Best model selection](https://github.com/winnermarvi/business_analyst/blob/main/src/ml/select_best_model.py): `src/ml/select_best_model.py`
- [Classification models](https://github.com/winnermarvi/business_analyst/tree/main/src/ml/classification): `src/ml/classification`
- [Regression models](https://github.com/winnermarvi/business_analyst/tree/main/src/ml/regression): `src/ml/regression`
- [Feature insights and recommendations](https://github.com/winnermarvi/business_analyst/tree/main/src/explainability): `src/explainability`

### AI and exploration

- [Business narrative](https://github.com/winnermarvi/business_analyst/tree/main/src/llm): `src/llm`
- [Dataset chat](https://github.com/winnermarvi/business_analyst/blob/main/src/services/chat_service.py): `src/services/chat_service.py`
- [RAG retrieval](https://github.com/winnermarvi/business_analyst/tree/main/src/rag): `src/rag`
- [Natural-language analytics](https://github.com/winnermarvi/business_analyst/tree/main/src/analytics): `src/analytics`

### Reports and charts

- [Interactive charts](https://github.com/winnermarvi/business_analyst/tree/main/src/visualization): `src/visualization`
- [PDF reporting](https://github.com/winnermarvi/business_analyst/tree/main/src/reporting): `src/reporting`
- **PDF report**
- **Plotly chart**

### Other components

- **Analyst**

## Connections

- Analyst → Streamlit frontend: uses
- Streamlit frontend → FastAPI endpoints: requests analysis
- FastAPI endpoints → Analysis orchestrator: runs analysis (evidence: `src/api/app.py`)
- FastAPI endpoints → Dataset chat: requests chat (evidence: `src/api/app.py`)
- FastAPI endpoints → API schemas: uses response types (evidence: `src/api/app.py`)
- Analysis orchestrator → Exploratory analysis: runs EDA (evidence: `src/services/pipeline_service.py`)
- Analysis orchestrator → ML service: runs modeling (evidence: `src/services/pipeline_service.py`)
- Analysis orchestrator → Business narrative: requests summary (evidence: `src/services/pipeline_service.py`)
- Analysis orchestrator → PDF reporting: generates report (evidence: `src/services/pipeline_service.py`)
- Analysis orchestrator → Interactive charts: generates charts (evidence: `src/services/pipeline_service.py`)
- Analysis orchestrator → Data preprocessing: prepares dataset
- Exploratory analysis → EDA insights: generates findings
- ML service → ML workflow: runs ML workflow
- ML workflow → Target detection: detects target type (evidence: `src/ml/ml_pipeline.py`)
- ML workflow → Classification models: trains and evaluates (evidence: `src/ml/ml_pipeline.py`)
- ML workflow → Regression models: trains and evaluates (evidence: `src/ml/ml_pipeline.py`)
- ML workflow → Best model selection: selects best model (evidence: `src/ml/ml_pipeline.py`)
- ML workflow → Feature insights and recommendations: generates explanations (evidence: `src/ml/ml_pipeline.py`)
- Dataset chat → RAG retrieval: retrieves context
- Dataset chat → Business narrative: generates response
- FastAPI endpoints → Natural-language analytics: accepts query
- Natural-language analytics → Interactive charts: requests chart
- PDF reporting → PDF report: produces
- Interactive charts → Plotly chart: renders
