# lakhmaisszineb/eleva architecture

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

- Interactive diagram: https://gitdiagram.com/lakhmaisszineb/eleva
- Repository: https://github.com/lakhmaisszineb/eleva

## Overview

Eleva is an AI marketing decision agent for e-commerce and retail. Users provide company data and an analysis question through the Streamlit interface or the FastAPI endpoint; the decision engine loads company context, observes and analyzes business data, detects issues, retrieves playbooks, and produces prioritized, explainable recommendations. Separate capabilities import and validate CSV data, calculate per-customer recommendations, and display results. The README documents the full decision sequence; source excerpts and the index confirm orchestration and selected calls, while some subsystem links are documented rather than verified in sampled implementation.

Main entry points: [`engine/decision_engine.py`](https://github.com/lakhmaisszineb/eleva/blob/main/engine/decision_engine.py) (Decision engine), [`ui/views.py`](https://github.com/lakhmaisszineb/eleva/blob/main/ui/views.py) (App views), [`data/company_store.py`](https://github.com/lakhmaisszineb/eleva/blob/main/data/company_store.py) (Company data access), [`llm/groq_client.py`](https://github.com/lakhmaisszineb/eleva/blob/main/llm/groq_client.py) (Groq LLM client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interfaces"]
  node_streamlit["Streamlit app<br/>[streamlit_app.py]"]
  node_views["App views<br/>[views.py]"]
  node_analysis_api["Analysis API<br/>[main.py]"]
  node_pipeline_display["Results display<br/>[pipeline_view.py]"]
  node_ui_components["UI components<br/>[components.py]"]
  node_ui_state["Session state<br/>[state.py]"]
end

subgraph group_ingestion["Data management"]
  node_company_store["Company data access<br/>[company_store.py]"]
  node_sqlite[("SQLite database<br/>[db.py]")]
  node_csv_import["CSV import<br/>[csv_importer.py]"]
  node_column_mapping["Column mapping<br/>[column_mapper.py]"]
  node_company_admin["Company administration<br/>[company_admin.py]"]
end

subgraph group_decision["Decision workflow"]
  node_decision_engine["Decision engine<br/>[decision_engine.py]"]
  node_understand["Understand context<br/>[understand.py]"]
  node_observe["Observe data<br/>[observe.py]"]
  node_detect["Detect issues<br/>[detect.py]"]
  node_retrieve["Retrieve playbooks<br/>[retrieve.py]"]
  node_reason["Reason hypotheses<br/>[reason.py]"]
  node_plan["Plan strategies<br/>[plan.py]"]
  node_decide["Prioritize strategies<br/>[decide.py]"]
  node_recommend["Generate recommendations<br/>[recommend.py]"]
  node_explain["Explain decisions<br/>[explain.py]"]
end

subgraph group_knowledge["Knowledge and language"]
  node_rag["Marketing knowledge RAG<br/>[rag.py]"]
  node_llm_client["Groq LLM client<br/>[groq_client.py]"]
end

subgraph group_insights["Customer insights"]
  node_rfm["RFM segmentation<br/>[rfm.py]"]
  node_metrics["Marketing metrics<br/>[metrics.py]"]
  node_customer_recs["Customer recommendations"]
end

node_business_user(("Business user"))
node_api_client(("API client"))
node_groq["Groq service"]

node_business_user -->|"uses"| node_streamlit
node_streamlit -->|"renders"| node_views
node_views -->|"uses"| node_ui_state
node_views -->|"renders"| node_pipeline_display
node_views -->|"imports data"| node_csv_import
node_views -->|"manages companies"| node_company_admin
node_views -->|"requests recommendations"| node_customer_recs
node_ui_state -->|"accesses data"| node_company_store
node_ui_state -->|"runs analysis"| node_decision_engine
node_pipeline_display -->|"uses explanation"| node_explain
node_pipeline_display -->|"renders with"| node_ui_components
node_api_client -->|"submits analysis"| node_analysis_api
node_analysis_api -->|"runs analysis"| node_decision_engine
node_analysis_api -->|"explains result"| node_explain
node_csv_import -->|"maps columns"| node_column_mapping
node_column_mapping -->|"requests mapping"| node_llm_client
node_csv_import -->|"writes imported data"| node_sqlite
node_company_admin -->|"uses database"| node_sqlite
node_company_store -->|"reads company data"| node_sqlite
node_decision_engine -->|"runs first"| node_understand
node_decision_engine -->|"runs next"| node_observe
node_decision_engine -->|"runs next"| node_detect
node_decision_engine -->|"runs next"| node_retrieve
node_decision_engine -->|"runs next"| node_reason
node_decision_engine -->|"runs next"| node_plan
node_decision_engine -->|"runs next"| node_decide
node_decision_engine -->|"runs last"| node_recommend
node_understand -->|"loads context"| node_company_store
node_observe -->|"loads business data"| node_company_store
node_observe -->|"calculates KPIs"| node_metrics
node_observe -->|"segments customers"| node_rfm
node_retrieve -->|"retrieves knowledge"| node_rag
node_reason -->|"requests reasoning"| node_llm_client
node_plan -->|"requests strategies"| node_llm_client
node_recommend -->|"requests recommendations"| node_llm_client
node_llm_client -->|"sends prompts"| node_groq
node_customer_recs -->|"uses segmentation"| node_rfm
node_business_user -.->|"may use"| node_api_client
node_rag -.->|"loads playbooks"| node_company_store

click node_streamlit "https://github.com/lakhmaisszineb/eleva/blob/main/streamlit_app.py"
click node_views "https://github.com/lakhmaisszineb/eleva/blob/main/ui/views.py"
click node_analysis_api "https://github.com/lakhmaisszineb/eleva/blob/main/api/main.py"
click node_pipeline_display "https://github.com/lakhmaisszineb/eleva/blob/main/ui/pipeline_view.py"
click node_ui_components "https://github.com/lakhmaisszineb/eleva/blob/main/ui/components.py"
click node_ui_state "https://github.com/lakhmaisszineb/eleva/blob/main/ui/state.py"
click node_company_store "https://github.com/lakhmaisszineb/eleva/blob/main/data/company_store.py"
click node_sqlite "https://github.com/lakhmaisszineb/eleva/blob/main/data/db.py"
click node_csv_import "https://github.com/lakhmaisszineb/eleva/blob/main/data/importer/csv_importer.py"
click node_column_mapping "https://github.com/lakhmaisszineb/eleva/blob/main/data/importer/column_mapper.py"
click node_company_admin "https://github.com/lakhmaisszineb/eleva/blob/main/data/company_admin.py"
click node_decision_engine "https://github.com/lakhmaisszineb/eleva/blob/main/engine/decision_engine.py"
click node_understand "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/understand.py"
click node_observe "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/observe.py"
click node_detect "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/detect.py"
click node_retrieve "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/retrieve.py"
click node_reason "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/reason.py"
click node_plan "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/plan.py"
click node_decide "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/decide.py"
click node_recommend "https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/recommend.py"
click node_explain "https://github.com/lakhmaisszineb/eleva/blob/main/engine/explain.py"
click node_rag "https://github.com/lakhmaisszineb/eleva/blob/main/knowledge/rag.py"
click node_llm_client "https://github.com/lakhmaisszineb/eleva/blob/main/llm/groq_client.py"
click node_rfm "https://github.com/lakhmaisszineb/eleva/blob/main/services/rfm.py"
click node_metrics "https://github.com/lakhmaisszineb/eleva/blob/main/services/metrics.py"
click node_customer_recs "https://github.com/lakhmaisszineb/eleva/blob/main/services/client_recommendations.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_streamlit,node_views,node_analysis_api,node_pipeline_display,node_ui_components,node_ui_state,node_business_user,node_api_client toneBlue
class node_company_store,node_sqlite,node_csv_import,node_column_mapping,node_company_admin toneAmber
class node_decision_engine,node_understand,node_observe,node_detect,node_retrieve,node_reason,node_plan,node_decide,node_recommend,node_explain toneMint
class node_rag,node_llm_client toneRose
class node_rfm,node_metrics,node_customer_recs,node_groq toneIndigo
```

## Components

### User interfaces

- [Streamlit app](https://github.com/lakhmaisszineb/eleva/blob/main/streamlit_app.py): `streamlit_app.py`
- [App views](https://github.com/lakhmaisszineb/eleva/blob/main/ui/views.py): `ui/views.py`
- [Analysis API](https://github.com/lakhmaisszineb/eleva/blob/main/api/main.py): `api/main.py`
- [Results display](https://github.com/lakhmaisszineb/eleva/blob/main/ui/pipeline_view.py): `ui/pipeline_view.py`
- [UI components](https://github.com/lakhmaisszineb/eleva/blob/main/ui/components.py): `ui/components.py`
- [Session state](https://github.com/lakhmaisszineb/eleva/blob/main/ui/state.py): `ui/state.py`

### Data management

- [Company data access](https://github.com/lakhmaisszineb/eleva/blob/main/data/company_store.py): `data/company_store.py`
- [SQLite database](https://github.com/lakhmaisszineb/eleva/blob/main/data/db.py): `data/db.py`
- [CSV import](https://github.com/lakhmaisszineb/eleva/blob/main/data/importer/csv_importer.py): `data/importer/csv_importer.py`
- [Column mapping](https://github.com/lakhmaisszineb/eleva/blob/main/data/importer/column_mapper.py): `data/importer/column_mapper.py`
- [Company administration](https://github.com/lakhmaisszineb/eleva/blob/main/data/company_admin.py): `data/company_admin.py`

### Decision workflow

- [Decision engine](https://github.com/lakhmaisszineb/eleva/blob/main/engine/decision_engine.py): `engine/decision_engine.py`
- [Understand context](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/understand.py): `engine/nodes/understand.py`
- [Observe data](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/observe.py): `engine/nodes/observe.py`
- [Detect issues](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/detect.py): `engine/nodes/detect.py`
- [Retrieve playbooks](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/retrieve.py): `engine/nodes/retrieve.py`
- [Reason hypotheses](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/reason.py): `engine/nodes/reason.py`
- [Plan strategies](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/plan.py): `engine/nodes/plan.py`
- [Prioritize strategies](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/decide.py): `engine/nodes/decide.py`
- [Generate recommendations](https://github.com/lakhmaisszineb/eleva/blob/main/engine/nodes/recommend.py): `engine/nodes/recommend.py`
- [Explain decisions](https://github.com/lakhmaisszineb/eleva/blob/main/engine/explain.py): `engine/explain.py`

### Knowledge and language

- [Marketing knowledge RAG](https://github.com/lakhmaisszineb/eleva/blob/main/knowledge/rag.py): `knowledge/rag.py`
- [Groq LLM client](https://github.com/lakhmaisszineb/eleva/blob/main/llm/groq_client.py): `llm/groq_client.py`

### Customer insights

- [RFM segmentation](https://github.com/lakhmaisszineb/eleva/blob/main/services/rfm.py): `services/rfm.py`
- [Marketing metrics](https://github.com/lakhmaisszineb/eleva/blob/main/services/metrics.py): `services/metrics.py`
- [Customer recommendations](https://github.com/lakhmaisszineb/eleva/blob/main/services/client_recommendations.py): `services/client_recommendations.py`

### Other components

- **Business user**
- **API client**
- **Groq service**

## Connections

- Business user → Streamlit app: uses
- Streamlit app → App views: renders (evidence: `streamlit_app.py`)
- App views → Session state: uses (evidence: `ui/views.py`)
- App views → Results display: renders (evidence: `ui/views.py`)
- App views → CSV import: imports data (evidence: `ui/views.py`)
- App views → Company administration: manages companies (evidence: `ui/views.py`)
- App views → Customer recommendations: requests recommendations (evidence: `ui/views.py`)
- Session state → Company data access: accesses data (evidence: `ui/state.py`)
- Session state → Decision engine: runs analysis (evidence: `ui/state.py`)
- Results display → Explain decisions: uses explanation (evidence: `ui/pipeline_view.py`)
- Results display → UI components: renders with (evidence: `ui/pipeline_view.py`)
- API client → Analysis API: submits analysis (evidence: `api/main.py`)
- Analysis API → Decision engine: runs analysis (evidence: `api/main.py`)
- Analysis API → Explain decisions: explains result (evidence: `api/main.py`)
- CSV import → Column mapping: maps columns (evidence: `data/importer/csv_importer.py`)
- Column mapping → Groq LLM client: requests mapping (evidence: `data/importer/column_mapper.py`)
- CSV import → SQLite database: writes imported data (evidence: `data/importer/csv_importer.py`)
- Company administration → SQLite database: uses database (evidence: `data/company_admin.py`)
- Company data access → SQLite database: reads company data (evidence: `data/company_store.py`)
- Decision engine → Understand context: runs first (evidence: `engine/decision_engine.py`)
- Decision engine → Observe data: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Detect issues: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Retrieve playbooks: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Reason hypotheses: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Plan strategies: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Prioritize strategies: runs next (evidence: `engine/decision_engine.py`)
- Decision engine → Generate recommendations: runs last (evidence: `engine/decision_engine.py`)
- Understand context → Company data access: loads context (evidence: `engine/nodes/understand.py`)
- Observe data → Company data access: loads business data (evidence: `engine/nodes/observe.py`)
- Observe data → Marketing metrics: calculates KPIs (evidence: `engine/nodes/observe.py`)
- Observe data → RFM segmentation: segments customers (evidence: `engine/nodes/observe.py`)
- Retrieve playbooks → Marketing knowledge RAG: retrieves knowledge (evidence: `engine/nodes/retrieve.py`)
- Reason hypotheses → Groq LLM client: requests reasoning (evidence: `engine/nodes/reason.py`)
- Plan strategies → Groq LLM client: requests strategies (evidence: `engine/nodes/plan.py`)
- Generate recommendations → Groq LLM client: requests recommendations (evidence: `engine/nodes/recommend.py`)
- Groq LLM client → Groq service: sends prompts (evidence: `llm/groq_client.py`)
- Customer recommendations → RFM segmentation: uses segmentation (evidence: `services/client_recommendations.py`)
- Business user → API client: may use
- Marketing knowledge RAG → Company data access: loads playbooks
