Skip to content

Repository files navigation

πŸ“Œ Project Overview

Retail Insights Assistant is a production-ready GenAI chatbot that enables business users to ask natural language questions about Amazon sales data and receive data-driven insights instantly.

πŸ‘‰ Live Streamlit App: https://assignmentgenaiweek4.streamlit.app/

The system combines:

  • Python + Pandas for analytics
  • Google Gemini Pro API for natural language understanding
  • Streamlit for an interactive UI
  • A scalable architecture design capable of handling 100GB+ datasets

🎯 Objectives

  • Build a GenAI chatbot for business analytics

  • Answer questions like:

    • Which region performed best?
    • What are top-selling categories?
    • What is the cancellation rate?
  • Generate summaries and reports

  • Propose a scalable architecture for large datasets


🧠 Key Features

βœ… Natural-language business queries βœ… Automated sales summaries βœ… Revenue & performance analytics βœ… Interactive Streamlit UI βœ… Gemini AI integration βœ… Scalable design for big data (100GB+)


πŸ—‚οΈ Actual Project Structure

week4/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ streamlit_app.py          # Main application
β”œβ”€β”€ Cleaned_Amazon_Sale_Report.csv
β”œβ”€β”€ sales_report.json         # Precomputed analytics summary
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ Assignment.txt
β”œβ”€β”€ Scalability Architecture for 100GB.md
β”‚
β”œβ”€β”€ 1.png   # Chat Interface
β”œβ”€β”€ 2.png   # Example AI Answer
β”œβ”€β”€ 3.png   # Sales Summary Output
β”œβ”€β”€ 4.png   # Data Insights Visualization
β”œβ”€β”€ 5.png   # Architecture / Scalability Diagram

βš™οΈ Tech Stack

Layer Technology
Language Python
AI Model Google Gemini Pro
UI Streamlit
Analytics Pandas
Visualization Streamlit charts
Big Data (Design) Spark, BigQuery
Deployment (Design) Kubernetes

πŸ—οΈ Architecture:

Architecture1.png

πŸš€ How to Run the Project

1️⃣ Activate Virtual Environment

PS> & "C:\Users\SaisrisatyaPadala\Desktop\All Stars Training\week4\week4\Scripts\Activate.ps1"

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Set Gemini API Key

Create a .env file or set environment variable:

GEMINI_API_KEY=AIzaSy*****

4️⃣ Run the Application

streamlit run streamlit_app.py

App opens at: πŸ‘‰ http://localhost:8501


πŸ“Š Dataset Used

File: Cleaned_Amazon_Sale_Report.csv

Key Columns:

  • Order ID
  • Date
  • Status
  • Category
  • Amount
  • Quantity
  • City, State
  • Fulfilled By
  • Promotion IDs
  • B2B Flag

The dataset is cleaned, normalized, and analysis-ready.


πŸ’¬ Example Questions Supported

  • Which state generated the highest revenue?
  • What is the total revenue for April 2022?
  • Which category sold the most?
  • What is the cancellation rate?
  • Compare B2B vs B2C sales
  • Show monthly revenue trends

πŸ–ΌοΈ Screenshots Explanation (IMPORTANT)

πŸ“Έ Screenshot 1 β€” 1.png

1.png

Chat Interface

Shows the main Streamlit UI where:

  • User enters business questions
  • AI chatbot interaction happens
  • Clean and intuitive design

πŸ“Έ Screenshot 2 β€” 2.png

2.png AI-Generated Answer

Demonstrates:

  • Gemini AI answering a business question
  • Clear, structured, business-friendly response
  • Metrics-based explanation

πŸ“Έ Screenshot 3 β€” 3.png

3.png Sales Summary Output

Displays:

  • Total revenue
  • Total orders
  • Cancelled orders
  • Top states and categories

This summary is generated programmatically and fed to the AI.


πŸ“Έ Screenshot 4 β€” 4.png

4.png Data Insights & Analytics

Shows:

  • Aggregated insights
  • Tabular or chart-based analysis
  • Useful for decision-makers

πŸ“Έ Screenshot 5 β€” 5.png

5png

Data Insights

Illustrates:

  • Cloud-based data ingestion
  • Spark processing
  • BigQuery storage
  • AI query pipeline
  • Caching & retrieval layers

πŸš€ Scalability Challenge: Handling 100GB+ Sales Data

When the dataset grows to 100GB or more, a local CSV + Pandas approach is no longer feasible. The system is redesigned using cloud-native big data and AI retrieval patterns.


πŸ“₯ Data Preprocessing

  • Store raw files in cloud object storage (Google Cloud Storage / AWS S3)

  • Use Apache Spark for distributed preprocessing:

    • Data cleaning & validation
    • Partitioning by Year, Month, Region
    • Aggregation of daily and monthly metrics
  • Save processed data in Parquet / Delta format for efficient reads


πŸ—„οΈ Data Storage & Indexing

  • Load processed data into BigQuery / Snowflake

  • Use:

    • Partitioned tables (by date)
    • Clustered columns (state, category)
  • Create:

    • Aggregated fact tables (revenue, orders, cancellations)
    • Dimensional tables (product, geography)

πŸ” Efficient Data Retrieval

  • Use SQL-based aggregation for structured queries

  • Use LangChain + Retrieval-Augmented Generation (RAG):

    • Convert summaries into embeddings
    • Store embeddings in FAISS / Pinecone
  • Retrieval Flow:

User Query β†’ Intent Detection
          β†’ SQL / Vector Search
          β†’ Relevant Summary
          β†’ Gemini AI Response

☁️ Tools & Technologies Used

Layer Tools
Storage GCS / S3
Processing Apache Spark / Databricks
Analytics BigQuery / Snowflake
AI Gemini Pro
Search FAISS / Pinecone
Orchestration Airflow
Deployment Docker + Kubernetes
Caching Redis

βœ… Benefits of This Approach

  • Scales horizontally to 100GB+
  • Fast query response times
  • Cost-efficient storage
  • AI answers remain accurate and grounded
  • Production-ready architecture

Superior Architecture

Big_Architecture.png

πŸ—οΈ Scalability: Handling 100GB+ Data

❌ Problem with CSV + Pandas

  • Memory limits
  • Slow queries
  • Not production-ready

βœ… Proposed Scalable Architecture

Data Ingestion

  • Cloud Storage (GCS / S3)
  • Batch ingestion

Processing

  • Apache Spark / Databricks
  • Daily & monthly aggregations

Storage

  • BigQuery / Snowflake
  • Partitioned tables

AI Query Flow

User Question
   ↓
Intent Detection
   ↓
SQL / Aggregation Query
   ↓
Summary Data
   ↓
Gemini AI
   ↓
Final Answer

Caching

  • Redis for frequent queries

Deployment

  • Docker + Kubernetes
  • Horizontal Pod Autoscaling

πŸ§ͺ Why This Project Is Production-Ready

βœ” Clean architecture βœ” Clear separation of AI & analytics βœ” Prompt-engineering included βœ” Scales from CSV β†’ Big Data βœ” Real business use case βœ” Fully explainable


πŸ“¦ Deliverables Checklist

βœ… Working GenAI chatbot βœ… Cleaned dataset βœ… Screenshots (1–5) βœ… Scalability architecture document βœ… Complete README βœ… Ready for evaluation


🏁 Conclusion

The Retail Insights Assistant demonstrates how Generative AI + Analytics can transform raw sales data into actionable business intelligence, while being scalable, maintainable, and production-ready.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages