This project is a comprehensive E-commerce Competitor Strategy Dashboard designed to assist businesses in analyzing competitor data, predicting trends, and generating actionable strategies to optimize pricing, promotions, and customer satisfaction. The dashboard integrates data scraping, machine learning, and large language models (LLMs) to provide meaningful insights.
- Competitor pricing, discounts, and reviews are scraped daily from e-commerce platforms (e.g., Amazon) using BeautifulSoup.
- The data is stored in two CSV files:
competitor_data.csv
: Contains product pricing, discounts, and dates.reviews.csv
: Contains customer reviews for each product.
- Customer reviews are analyzed for sentiment using the Hugging Face Transformers library.
- Sentiment results are visualized in a bar chart using Plotly.
- A Random Forest Regressor model predicts discounts based on product prices.
- An ARIMA model forecasts future discounts for the next five days.
- The dashboard leverages OpenAI's API to generate actionable strategies based on:
- Competitor data (current and predicted trends).
- Customer sentiment analysis.
- Generated strategy recommendations are sent to a Slack channel for immediate access by stakeholders.
- Built with Streamlit, the dashboard allows users to:
- Select a product for analysis.
- View competitor data, predicted discounts, and sentiment analysis.
- Read detailed strategy recommendations.
- URLs for products are predefined and scraped using BeautifulSoup.
- Functions extract product titles, prices, discounts, and customer reviews.
- Product prices and discounts are cleaned and converted to numerical formats.
- Dates are parsed to ensure proper indexing for time-series forecasting.
- Random Forest Regressor: Predicts potential discounts based on price and historical discount data.
- ARIMA: Forecasts future discounts for a specified number of days.
- Hugging Face's
pipeline()
is used to analyze customer sentiment (Positive, Negative, Neutral). - Results are visualized as an interactive bar chart in the dashboard.
- OpenAI's API is utilized to generate strategy recommendations tailored to the selected product's data and sentiment trends.
app.py
: Main Streamlit app integrating data loading, visualization, sentiment analysis, forecasting, and strategy generation.
scraper.py
: Scrapes competitor product data and reviews from e-commerce platforms and saves them as CSV files.
competitor_data.csv
: Contains scraped competitor data with fields:product_name
,price
,discount
,date
reviews.csv
: Contains customer reviews with fields:product_name
,reviews
API_KEY.py
(Not shared in the repository):- Contains API keys for Groq API and Slack Webhook integration.
- Python 3.8 or above
- Libraries:
pandas
,numpy
,streamlit
,plotly
,requests
,beautifulsoup4
,selenium
,scikit-learn
,statsmodels
,transformers
- API keys for:
- OpenAI (Groq API)
- Slack Webhook
- Clone the repository:
git clone https://github.com/your-username/ecommerce-strategy-dashboard.git cd ecommerce-strategy-dashboard
- Install required dependencies:
pip install -r requirements.txt
- Add your API keys to
API_KEY.py
:GROQ_API_KEY = "your-groq-api-key" SLACK_WEBHOOK_API_KEY = "your-slack-webhook-key"
- Run the scraper to collect competitor data:
python scraper.py
- Launch the dashboard:
streamlit run app.py
- Competitor Analysis: View competitor pricing, discounts, and trends.
- Sentiment Analysis: Interactive sentiment bar chart.
- Discount Forecasting: Predicted discounts for the next 5 days.
- Strategy Recommendations: AI-generated strategies for pricing, promotions, and customer satisfaction.
- Automatically sends generated strategies to a specified Slack channel.
- Expand data scraping to additional e-commerce platforms.
- Integrate more advanced NLP models for nuanced sentiment analysis.
- Incorporate real-time data updates and streaming.