“QuickBites Insights” – AI Enabled Dashboard for Quick Service Restaurants on Snowflake

 

 

Quick Service Restaurants

Quick Service Restaurants (QSRs) are fast-food establishments that offer limited menu items, speedy service, and affordable pricing. They focus on efficiency, often featuring counter service, drive-thru options, or self-service kiosks. Popular examples include McDonald’s, KFC, and Subway. QSRs prioritize convenience, making them a go-to choice for customers seeking quick and budget-friendly meals.

For Quick Service Restaurants (QSRs), understanding customer preferences, supplier performance, and spending trends are crucial for sustained success.

Enter “QuickBites Insights -> Your Hub for Loyalty, Spend Trends, and Supplier Performance,”

  • A powerful Streamlit dashboard designed to provide comprehensive, data-driven insights that empower QSRs to make informed decisions and enhance operational efficiency.

With QuickBites Insights, restaurant owners and managers can leverage cutting-edge Snowflake capabilities to analyze key business metrics across multiple dimensions. The dashboard offers a deep dive into customer loyalty patterns, using Snowflake’s native classifier to predict whether a customer is loyal or at risk of churn. It also provides footfall analysis across varying weather conditions to help businesses optimize staffing and inventory levels effectively, while supplier performance tracking ensures partners meet required standards through detailed KPI analysis.

In addition to customer and supplier insights, QuickBites Insights offers menu item analysis to help businesses review pricing strategies and identify best-selling products. The dashboard’s Random Forest classifier predicts customers’ eligibility for loyalty tier upgrades, helping businesses engage their most valuable patrons proactively. The daily spends forecasting feature leverages Snowflake’s native forecasting capabilities, providing accurate projections for better financial planning and resource allocation.

Customer feedback is a goldmine of insights, and QuickBites Insights harnesses the power of Large Language Models (LLMs) within Snowflake to summarize, categorize, and predict the sentiment of customer reviews. By combining predictive analytics, supplier performance tracking, and sentiment analysis, QuickBites Insights equips QSRs with the tools they need to thrive in an increasingly competitive market.

Understanding the Data:

The QuickBites Dashboard is built upon a comprehensive collection of datasets, including Customer Loyalty, Customer Footfalls, Supplier KPI Data, Menu Items, Restaurant Daily Spend Data, and Customer Feedback.

Exploratory Data Analysis:

 

  1. Customer Loyalty Analysis:

 

Using a Bar chart, we visualize the distribution of payment methods across Loyalty Tiers and the Average Spend and No. of Customers in each Tier.

A comparison between potential Churners vs Engaged customers is visualized with the help of a bar chart. A line chart is used to see the no. of monthly signup across the months

 

 

2) Footfall Analysis:

A donut chart which represents the Percentage of Footfalls across each weather.

A line chart visualizing the footfall orders across each month

 

3) Supplier KPI Analysis

A bubble chart which shows the distribution of the suppliers based on their performance, by classifying them into three tiers

A bar chart which shows the distribution of Supplier Scores sliced by the KPI Measures. The below are the KPI measures.

  • On-time Delivery
  • Order Accuracy
  • Product Quality
  • Customer Support
  • Pricing
  • Innovation
  • Sustainability

 

4) Analysis of the Menu

A bar chart representing the top 5 sold products and least sold items.

A scatter plot which compares the Price and Total sales for the Month for each Food Category.

 

Use Cases on Snowflake Cortex

Snowflake Cortex is an intelligent, fully managed service that offers machine learning and AI solutions to Snowflake users. It brings state of the art ML and AI solutions to your data, within your Snowflake security perimeter.

Time Series Forecasting of Restaurant Daily Spend

By analyzing Daily Spend Data of Customers, we can forecast future Customer speding using a time series model. A forecast model generates predictions for either a single time series or multiple time series. To create and train the forecasting model, we use the CREATE SNOWFLAKE.ML.FORECAST command. Afterward, we can use model_name>!FORECAST method to generate forecasts. This prediction will be visualized in a line chart.

 

Customer Loyalty Prediction:

 

Customer Loyalty Prediction using Snowflake’s Cortex ML Classification Model

 

Extracting Customer Data with Snowflake and Pandas


To build and train a classification model for predicting customer loyalty, we utilize the CREATE SNOWFLAKE.ML.CLASSIFICATION command. By gathering data from the QSR.PUBLIC.CUSTOMER_DATA table and transforming it into a DataFrame, we can harness the robust data manipulation features of Pandas to extract meaningful insights.

 

Single Prediction

       Once the model is developed, it is utilized to predict a single outcome based on input features extracted from the dataset. Accurate predictions empower organizations to make well-informed decisions, streamline operations, and improve customer experiences. For example, in the restaurant industry, the model can forecast customer loyalty levels, allowing businesses to allocate resources more efficiently and devise effective strategic plans.

 

Batch Prediction:

The same approach can be leveraged to generate predictions for multiple records simultaneously, allowing for the efficient processing of large volumes of Customer data. By utilizing batch processing capabilities, organizations can streamline their analysis and gain valuable insights at scale.

 

Loyalty Tier Upgrade Prediction:

 

Data Retrieval

In this session, we start by extracting data from the QSR.PUBLIC.CUSTOMER_LOYALTY table and converting it into a DataFrame. To ensure data quality, rows with missing values are filtered out, resulting in a clean and robust dataset ready for analysis.

Next, a classification machine learning model is developed using the RandomForestClassifier() from the sklearn.ensemble library. By harnessing the power of the Random Forest algorithm, this model delivers accurate and dependable predictions of customer loyalty, providing valuable insights based on the processed data.

code:

session5 = get_active_session()

result = session5.table(“QSR.PUBLIC.CUSTOMER_LOYALTY “)

list = result.collect()

df = pd.DataFrame(list)

Data Preprocessing

 

Creating New Features

Engineering new features from existing variables for better performance of the model.

Encoding Categorical Variables


Label encoding is used to convert categorical variables into numeric format, facilitating the modelling process.

Splitting Data and Training the Model


The dataset is divided into training and testing subsets. A RandomForestClassifier model is then trained using the training data to make accurate predictions.

 

Single Prediction

Upon selecting the single prediction tab, the code retrieves test data, encodes categorical variables, applies preprocessing steps, and subsequently predicts the loyalty tier upgrade for an individual customer.

 

Batch Prediction

When you navigate to the batch prediction tab, the code seamlessly processes test data by encoding categorical variables and applying necessary preprocessing steps. It then generates loyalty tier upgrade predictions, storing the results in the CUSTOMER_LOYALTY_BATCH_PREDICTIONS table for easy review and analysis.

 

Leveraging Large Language Models for Sentiment Analysis and Review Categorization and Summarization

The goal is to classify customer feed backs and assess their sentiment to extract meaningful insights that can enhance customer satisfaction. Through a structured analysis of feedback, businesses can pinpoint key areas for improvement, enabling them to implement targeted strategies that enhance the overall customer experience.

 

Sentiment Prediction

Sentiment analysis helps businesses understand the emotional tone of customer feedback by categorizing it as positive, neutral, or negative. Snowflake’s sentiment function assigns precise sentiment scores, enabling businesses to track satisfaction trends and address concerns proactively, fostering a more personalized customer experience.

Leveraging Snowflake Cortex LLM models and advanced Llama3 LLMs with prompt engineering, businesses can efficiently process vast amounts of data. This combination automates sentiment analysis at scale, empowering organizations to enhance customer satisfaction and refine their engagement strategies effectively

 

Review Categorization

Review categorization involves sorting feedback based on its context to uncover key themes and topics. By leveraging Llama3 LLMs and prompt engineering, businesses can accurately identify recurring issues, strengths, and areas for improvement. This streamlined analysis enables better decision-making and strategic focus.

 

Review Summarization

Review summarization focuses on condensing feedback into concise, meaningful insights. By utilizing Llama3 LLMs and advanced prompt engineering, businesses can extract key points from extensive reviews, highlighting common themes and sentiments. This approach enhances decision-making by providing a clear and actionable overview of customer feedback.

 

QSR Bot using Cortex Analyst

The AI-powered Cortex Bot, built using Cortex Analyst, leverages the advanced capabilities of Snowflake Cortex—a fully-managed, LLM-powered feature designed to create intelligent applications that provide accurate and reliable answers to business queries based on structured data within Snowflake. In Snowflake Cortex Analyst bots, YAML files define intents, parameters, and SQL mappings, allowing the bot to interpret user queries and retrieve structured data efficiently. This configuration enables seamless interaction with Snowflake databases, ensuring accurate and context-aware responses.With this seamless integration, the QSR Bot efficiently retrieves insights directly from the relevant tables within the schema, ensuring precise and data-driven responses to support informed decision-making.

YAML File

YAML (YAML Ain’t Markup Language) is a readable data format for configurations, serialization, and application interaction. It uses indentation (spaces, not tabs) for structure and is common in Kubernetes, Ansible, and Snowflake Cortex. YAML files consist of key-value pairs, lists, and mappings for structured data.

Example of a Yaml file

 

Steps to create Cortex Analyst Bot:

  1. Define the YAML Configuration File:
    • The YAML file specifies the schema, tables, and intent of the chatbot.
    • It outlines how the chatbot processes user queries and maps them to database queries.
  2. Upload the YAML File to Snowflake Stage:
    • Store the YAML file in the Snowflake stage for easy retrieval.
  3. Configure the Chatbot Application:
    • Use the uploaded YAML file in the chatbot’s backend logic to process user inputs and retrieve relevant data.
    • The Python-based chatbot will reference the YAML file from the Snowflake stage to interpret queries.
  4. Develop the Python Script to Process Messages:
    • The chatbot will use the Snowflake Cortex API to process user inputs and generate responses.
    • The provided Python code snippet shows how the chatbot integrates with Snowflake Cortex using the send_message function.
  5. Deploy and Test the Chatbot:
    • Deploy the chatbot using a Streamlit interface.
    • Allow users to input queries and get responses based on the configured schema.
    • Display SQL queries and execute them to fetch results from the Snowflake database.

Find the quick start on how to create a semantic model here

Conclusion

By analyzing these KPIs, we gain comprehensive insights into Restaurant customer satisfaction and loyalty standards. These visualizations not only help in understanding current trends but also assist in making informed predictions for future planning.

Please feel free to reach out to us for your Snowflake, Streamlit or AI/ML solution needs. Cittabase is a Premier partner with Snowflake.



Leave a Reply