# deshvan11/ecommerce_analytics_engine architecture

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

- Interactive diagram: https://gitdiagram.com/deshvan11/ecommerce_analytics_engine
- Repository: https://github.com/deshvan11/ecommerce_analytics_engine

## Overview

This is a local SQLite e-commerce analytics CLI. The user starts the menu; initialization creates schema and views and loads customer/product CSVs, then selected CRUD, order, audit, or reporting workflows query or update the database and print results. Order placement is a distinct transactional stage, while analytics SQL and the monthly view provide separate reporting paths. Source excerpts show the Python calls; SQL-file relationships are also documented in the README.

Main entry points: [`src/main.py`](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py) (Interactive CLI), [`ecommerce.db`](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/ecommerce.db) (SQLite Database), [`src/data_loader.py`](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/data_loader.py) (CSV Data Loader), [`sql/procedures_and_views.sql`](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/procedures_and_views.sql) (Monthly Summary View)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI Interface"]
  node_cli["Interactive CLI<br/>[main.py]"]
end

subgraph group_workflows["Commerce Workflows"]
  node_crud["Customer and Inventory CRUD<br/>[main.py]"]
  node_orders["Order Transactions<br/>[main.py]"]
  node_audit["Audit Log Operations<br/>[main.py]"]
end

subgraph group_data["Data and Storage"]
  node_manager["Database Manager<br/>[db_config.py]"]
  node_loader["CSV Data Loader<br/>[data_loader.py]"]
  node_customers["Customer Seed CSV<br/>[customers.csv]"]
  node_products["Product Seed CSV<br/>[products.csv]"]
  node_schema["Relational Schema<br/>[schema.sql]"]
  node_database[("SQLite Database<br/>[ecommerce.db]")]
end

subgraph group_reporting["Analytics and Reports"]
  node_analytics["Analytics Query Runner<br/>[main.py]"]
  node_queries["Analytics SQL"]
  node_monthly["Monthly Summary View"]
end

node_user(("User"))

node_user -->|"selects actions"| node_cli
node_cli -->|"connects through"| node_manager
node_cli -->|"initializes schema"| node_schema
node_cli -->|"initializes view"| node_monthly
node_cli -->|"starts data load"| node_loader
node_loader -->|"reads rows"| node_customers
node_loader -->|"reads rows"| node_products
node_loader -->|"inserts seed data"| node_database
node_manager -->|"opens connection"| node_database
node_schema -->|"defines tables"| node_database
node_cli -->|"dispatches CRUD"| node_crud
node_cli -->|"dispatches orders"| node_orders
node_cli -->|"dispatches audit"| node_audit
node_cli -->|"dispatches reports"| node_analytics
node_cli -->|"queries summary"| node_monthly
node_crud -->|"reads and writes"| node_database
node_orders -->|"commits transaction"| node_database
node_audit -->|"reads audit rows"| node_database
node_analytics -->|"loads SQL"| node_queries
node_analytics -->|"executes queries"| node_database
node_monthly -->|"summarizes orders"| node_database

click node_cli "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py"
click node_crud "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py"
click node_orders "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py"
click node_audit "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py"
click node_manager "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/db_config.py"
click node_loader "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/data_loader.py"
click node_customers "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/data/customers.csv"
click node_products "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/data/products.csv"
click node_schema "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/schema.sql"
click node_database "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/ecommerce.db"
click node_analytics "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py"
click node_queries "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/analytics_queries.sql"
click node_monthly "https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/procedures_and_views.sql"

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_cli,node_user toneBlue
class node_crud,node_orders,node_audit toneAmber
class node_manager,node_loader,node_customers,node_products,node_schema,node_database toneMint
class node_analytics,node_queries,node_monthly toneRose
```

## Components

### CLI Interface

- [Interactive CLI](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py): `src/main.py`

### Commerce Workflows

- [Customer and Inventory CRUD](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py): `src/main.py`
- [Order Transactions](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py): `src/main.py`
- [Audit Log Operations](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py): `src/main.py`

### Data and Storage

- [Database Manager](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/db_config.py): `src/db_config.py`
- [CSV Data Loader](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/data_loader.py): `src/data_loader.py`
- [Customer Seed CSV](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/data/customers.csv): `data/customers.csv`
- [Product Seed CSV](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/data/products.csv): `data/products.csv`
- [Relational Schema](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/schema.sql): `sql/schema.sql`
- [SQLite Database](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/ecommerce.db): `ecommerce.db`

### Analytics and Reports

- [Analytics Query Runner](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/src/main.py): `src/main.py`
- [Analytics SQL](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/analytics_queries.sql): `sql/analytics_queries.sql`
- [Monthly Summary View](https://github.com/deshvan11/ecommerce_analytics_engine/blob/main/sql/procedures_and_views.sql): `sql/procedures_and_views.sql`

### Other components

- **User**

## Connections

- User → Interactive CLI: selects actions (evidence: `README.md`)
- Interactive CLI → Database Manager: connects through (evidence: `src/main.py`)
- Interactive CLI → Relational Schema: initializes schema (evidence: `src/main.py`)
- Interactive CLI → Monthly Summary View: initializes view (evidence: `src/main.py`)
- Interactive CLI → CSV Data Loader: starts data load (evidence: `src/main.py`)
- CSV Data Loader → Customer Seed CSV: reads rows (evidence: `src/data_loader.py`)
- CSV Data Loader → Product Seed CSV: reads rows (evidence: `src/data_loader.py`)
- CSV Data Loader → SQLite Database: inserts seed data (evidence: `src/data_loader.py`)
- Database Manager → SQLite Database: opens connection (evidence: `src/db_config.py`)
- Relational Schema → SQLite Database: defines tables (evidence: `README.md`)
- Interactive CLI → Customer and Inventory CRUD: dispatches CRUD (evidence: `src/main.py`)
- Interactive CLI → Order Transactions: dispatches orders (evidence: `src/main.py`)
- Interactive CLI → Audit Log Operations: dispatches audit (evidence: `src/main.py`)
- Interactive CLI → Analytics Query Runner: dispatches reports (evidence: `src/main.py`)
- Interactive CLI → Monthly Summary View: queries summary (evidence: `src/main.py`)
- Customer and Inventory CRUD → SQLite Database: reads and writes (evidence: `src/main.py`)
- Order Transactions → SQLite Database: commits transaction (evidence: `src/main.py`)
- Audit Log Operations → SQLite Database: reads audit rows (evidence: `src/main.py`)
- Analytics Query Runner → Analytics SQL: loads SQL (evidence: `src/main.py`)
- Analytics Query Runner → SQLite Database: executes queries (evidence: `src/main.py`)
- Monthly Summary View → SQLite Database: summarizes orders (evidence: `README.md`)
