AI Meal Prediction With Expense Tracker
AI Meal Prediction With Expense Tracker
DECLARATION
We hereby declare that the project work entitled (AI Meal Prediction with Expense
Tracker) is an authentic record of our own work carried out as requirements of
Capstone Project for the award of B.Tech degree in ____________(Programme
Name) from Lovely Professional University, Phagwara, under the guidance of (Name
of Faculty Mentor), during August to November 2022. All the information furnished
in this capstone project report is based on our own intensive work and is genuine.
(Signature of Student 1)
Date:
(Signature of Student 2)
Date:
(Signature of Student 3)
Date:
(Signature of Student 4)
Date:
3
CERTIFICATE
This is to certify that the declaration statement made by this group of students is
correct to the best of my knowledge and belief. They have completed this Capstone
Project under my guidance and supervision. The present work is the result of their
original investigation, effort and study. No part of the work has ever been submitted
for any other degree at any University. The Capstone Project is fit for the submission
and partial fulfillment of the conditions for the award of B.Tech degree in
_____________ (Programme Name) from Lovely Professional University, Phagwara.
Designation
Date :
4
ACKNOWLEDGMENT
I wish to send my warmest appreciation to each and every person who assisted me in
completing this project because their support and willingness to guide me through the
process from beginning to end was invaluable. In the absence of their support, this
work would have been impossible.
To start off, I would like to wholeheartedly thank my project guide, [Insert Guide’s
Name], for their contribution in the form of insightful suggestions, prompt revisions,
unrelenting motivation, and encouragement. Their assistance during the “machine
learning to deep learning” paradigm shift greatly boosted the scope and value of this
research.
Furthermore, I would like to appreciate my faculty and the entire department of [Your
Institute Name] for their support and environment which was highly conducive to the
successful completion of this work.
A very special thanks goes to my friends and peers for motivating me and providing
me with useful feedback during the course of this project.
And finally, I wish to close with my deepest gratitude to my family for their
boundless support and patience alongside believing in my capabilities throughout this
entire endeavor.
5
TABLE OF CONTENT
DECLARATION..........................................................................................................2
CERTIFICATE............................................................................................................3
ACKNOWLEDGMENT..............................................................................................4
TABLE OF CONTENT...............................................................................................5
ABSTRACT..................................................................................................................8
Chapter 1: Introduction...............................................................................................9
1.1 Background Study.............................................................................................9
1.2 Motivation and System Development Needs..................................................10
1.3 Overview and Objective of the Project...........................................................11
Chapter 2: Profile of the Problem and Rationale/Scope of the Study...................12
2.1 Problem Statement..........................................................................................12
2.2 Rationale for the Study....................................................................................12
2.3 Scope of the Study...........................................................................................13
2.3.1 Input Modalities and User Profiling......................................................14
2.3.2 AI-Driven Meal Prediction and Expense Management........................14
2.3.3 System Architecture and Platform Deployment....................................14
2.3.4 Data Privacy and Security Considerations............................................15
2.4 Research Questions.........................................................................................15
2.5 Limitations of the Study..................................................................................15
Chapter 3: Existing System.......................................................................................17
3.1 Introduction.....................................................................................................17
3.2 Analysis of Existing Systems..........................................................................17
3.3 Comparative Gap Analysis..............................................................................19
3.4 System Requirements......................................................................................19
3.5 System Architecture Design............................................................................20
3.6 Data Flow Diagrams........................................................................................21
3.6.1 Level 0 Data Flow Diagram (Context Diagram)...................................21
6
ABSTRACT
In an era where digital innovation shapes daily living, maintaining a balance between
health and finances remains a complex challenge. Addressing this gap, the present
study introduces a novel mobile application, AI Meal Prediction with Expense
Tracker, that seamlessly merges personalized meal planning with intelligent expense
management. Designed using Flutter and Dart for cross-platform efficiency and
Firebase Firestore for real-time backend support, the system leverages Google’s
Gemini API to dynamically tailor meal suggestions based on users’ Body Mass Index
(BMI) and dietary preferences. Unlike traditional applications, this platform
introduces a dual innovation: first, AI-driven recipe recommendations that adapt to
real-time health metrics, and second, a self-adjusting grocery expense tracker that
aligns spending with personalized dietary goals.
The application framework enables users to effortlessly compute their BMI, receive
AI-suggested meal plans suited to their health objectives, and discover local grocery
vendors offering budget-friendly options, enhancing convenience and accessibility.
Furthermore, the system pioneers the concept of the Health-to-Spend Ratio (HSR), a
novel metric that empowers users to make informed decisions balancing nutritional
needs and financial prudence. The integration of geolocation services, real-time data
syncing, and AI-driven personalization underlines a paradigm shift in mobile health
technology—from static tracking to dynamic, actionable guidance.
Development efforts were carried out in Android Studio and Visual Studio Code,
ensuring robust native support and scalable deployment. Performance evaluation
through user testing demonstrated high accuracy in BMI calculations, responsive AI
interactions, and substantial user satisfaction in both health management and
budgeting modules. By fusing health intelligence with financial analytics, this project
not only addresses current technological gaps but also promotes sustainable daily
living practices. The research concludes that AI-powered systems like this have the
potential to redefine how individuals manage health and expenses simultaneously,
creating a more holistic approach to digital well-being.
9
Chapter 1: Introduction
In the era of intelligent systems and personalized healthcare, managing nutrition and
financial expenses through technology has become a critical part of modern living. As
people increasingly seek to align healthier lifestyles with economic sustainability,
there arises a need for mobile solutions that can seamlessly integrate both domains.
However, current applications are often fragmented, addressing either meal planning
or expense tracking independently. To bridge this gap, this research presents the
development of AI Meal Prediction with Expense Tracker—a mobile application
framework designed to provide intelligent meal recommendations based on individual
health metrics while simultaneously managing grocery expenditures.
The application, built using Flutter and Dart for cross-platform compatibility and
Firebase Firestore for real-time backend support, integrates Google's Gemini API to
dynamically generate personalized meal plans. Unlike conventional solutions that
offer static suggestions or manual tracking, this system employs AI to adapt meal
recommendations based on the user's Body Mass Index (BMI) and dietary
preferences, and further ties meal suggestions to a real-time grocery expense tracker.
The result is a holistic system that empowers users to balance health goals and
budgetary constraints effectively.
did not account for the economic impact of dietary choices, and budgeting tools
lacked the nuance to advise healthier spending strategies.
Thus, there is a compelling need for a unified platform that simultaneously addresses
nutritional health and financial tracking with dynamic, personalized intelligence,
ensuring greater engagement, usability, and impact.
Another driving force behind this project is the promotion of proactive user
engagement. By making users aware of the direct relationship between their food
choices and financial well-being, the application encourages smarter, more
sustainable decision-making over the long term.
Ultimately, the goal is to design a solution that transcends simple tracking and moves
toward intelligent advising, providing users with actionable recommendations that
adjust to their evolving health and financial landscapes.
The system architecture processes user data—such as height, weight, and dietary
preferences—to compute BMI and generate meal suggestions via the Gemini API.
These suggestions include not only health-aligned recipes but also estimated costs,
allowing users to evaluate meals both nutritionally and financially. Furthermore, a
geolocation feature enables users to find nearby grocery vendors offering the
necessary ingredients, thereby enhancing accessibility and cost efficiency.
In the pursuit of healthy living, individuals often face two interlinked challenges:
maintaining a nutritious diet and managing food-related expenses. Traditional mobile
applications address either dietary planning or financial budgeting separately,
resulting in fragmented user experiences that lack real-time adaptability and
personalized intelligence. Diet-focused apps offer static meal plans without
consideration for regional ingredient availability or user-specific financial constraints.
Conversely, budgeting apps track grocery spending but fail to contextualize
expenditures in terms of nutritional value or dietary goals.
This study identifies a significant gap: the absence of an intelligent, lightweight, and
contextually adaptive mobile system that simultaneously addresses personalized meal
planning and dynamic expense management. The lack of such integrated systems
hampers individuals' ability to achieve sustainable health and financial goals,
especially for those living in budget-sensitive or resource-constrained environments.
The challenge lies in designing an application that not only personalizes nutrition
advice using real-time BMI tracking but also intelligently manages grocery spending
in accordance with user-defined limits.
The rationale behind this project emerges from the increasing necessity for holistic
health and finance management in the digital age. As technological advancements
make personalized applications more accessible, users expect systems that adapt
seamlessly to their health conditions and economic realities. The fragmentation
between diet and budget management systems creates cognitive overload, forcing
users to operate multiple apps and make manual adjustments without intelligent
support.
The scope of this project is centered around the design, development, and evaluation
of a mobile-based system that integrates AI-powered meal prediction with intelligent
14
expense tracking. The study encompasses several dimensions crucial to achieving the
project's objectives:
The system accepts user inputs such as height, weight, age, dietary preferences (e.g.,
vegetarian, low-carb), and target health goals (e.g., weight loss, muscle gain). Using
these inputs, the Body Mass Index (BMI) is calculated dynamically and serves as a
foundation for generating personalized meal suggestions. The application also allows
users to define a weekly or monthly grocery budget, enabling the system to adjust
meal recommendations according to financial constraints. Real-time user profiling
ensures that meal plans and spending insights remain continuously aligned with users’
evolving needs.
At the core of the system is an AI engine that interacts with the Gemini API to
generate customized meal plans. Each meal suggestion includes estimated costs based
on regional pricing data and aligns with the user's health profile. By linking meal
generation with expense tracking, the system ensures that dietary advice is not only
health-appropriate but also economically viable. A Health-to-Spend Ratio (HSR) is
computed for each plan, offering users a metric that balances nutritional benefit
against financial expenditure, thus supporting smarter decision-making.
The application is developed using Flutter and Dart, providing a consistent user
experience across Android and iOS platforms. Firebase Firestore serves as the real-
time backend, enabling seamless synchronization of user data, meal histories, and
expense records. Geolocation services are integrated to facilitate nearby grocery store
discovery, enhancing the practical applicability of meal recommendations. The
system architecture is optimized for lightweight operation, supporting real-time
updates, minimal latency, and efficient performance even on mid-range mobile
devices.
15
User data, including health metrics and financial information, are encrypted during
transmission and storage. Firebase Authentication and secure Firestore rules are
employed to protect user accounts, ensuring compliance with modern data privacy
regulations such as GDPR. Audio data or sensitive credentials are never stored
permanently without user consent. Security protocols ensure that personalized
recommendations do not compromise the confidentiality or integrity of user
information.
The research study is guided by key questions that address the technological, health,
and economic aspects of the system:
How effectively can the AI model generate meal plans that align with real-time
BMI data and user preferences?
To what extent does linking meal suggestions with expense tracking influence
user engagement and satisfaction?
Can the system deliver real-time, low-latency performance suitable for budget
and health management on mobile devices?
How resilient is the system in adjusting meal and expense recommendations
based on regional variations and user goal changes?
What metrics most accurately reflect the balance between nutritional optimization
and financial sustainability?
These questions direct the system design, testing methodology, and impact evaluation,
ensuring that the project addresses practical challenges and user expectations.
time price updates, although planned for future releases, are currently dependent on
static or periodically refreshed datasets.
Secondly, while BMI offers a useful baseline for health profiling, it does not account
for all dimensions of personal health, such as muscle mass distribution, metabolic
rates, or chronic health conditions. Thus, meal recommendations based solely on BMI
may not be optimal for every individual, highlighting the need for future integration
with more comprehensive health profiling tools.
Finally, the current system is limited to generating meal plans and expense tracking in
a single language and does not yet accommodate multilingual support or culturally
specific dietary frameworks. Addressing these gaps will be critical for expanding the
system’s global reach and inclusivity.
By recognizing these limitations, the project establishes a clear foundation for future
enhancements, including adaptive pricing models, advanced health profiling
integration, offline operation modes, and expanded cultural adaptability.
17
3.1 Introduction
The design and development of an intelligent, real-time AI Meal Prediction with
Expense Tracker application necessitate a multidisciplinary approach, integrating
mobile development, AI-driven decision-making, health metric computation, and
financial analytics. Existing applications in the domains of health management and
expense tracking often operate in isolation, offering fragmented user experiences. Few
platforms combine real-time dietary recommendations with dynamic expense control
based on users' changing health profiles. As personalized wellness and financial
discipline become critical in modern lifestyles, there is an urgent need for lightweight,
adaptive, and AI-powered solutions. This chapter analyzes the limitations of current
health and finance-related mobile applications, identifies the critical gaps, and
outlines the architectural advancements proposed in the integrated AI Meal Prediction
with Expense Tracker system.
The proposed application embraces self-adjusting meal planning through BMI and
dietary goal tracking while linking grocery expenditures to the health plans generated.
Through real-time AI interactions, geolocation-based vendor suggestions, and budget-
linked dietary advice, the platform seeks to offer a comprehensive lifestyle
management solution.
On the other hand, budgeting applications such as Mint, YNAB (You Need A
Budget), and Goodbudget focus solely on expense tracking. Although they are
efficient in categorizing spending, they lack contextual understanding of how
expenditures, particularly grocery spending, impact users' nutritional goals or dietary
habits. Users must independently balance health needs and financial realities, leading
to disjointed decision-making and poor long-term outcomes.
Some newer apps attempt to integrate broader wellness or fitness tracking features,
yet none offer a truly AI-driven, real-time solution that directly links meal generation
with financial planning. The absence of systems that can dynamically adjust meal
plans according to updated health metrics, changing budgets, and localized ingredient
pricing represents a critical gap. This disconnect results in low user engagement,
reduced platform retention, and ineffective personal health and budgeting strategies.
Proposed AI Meal
Health Apps (e.g., Budgeting Apps
Parameter Prediction with Expense
MyFitnessPal) (e.g., Mint)
Tracker
Grocery Vendor
No No Yes
Geolocation
19
Proposed AI Meal
Health Apps (e.g., Budgeting Apps
Parameter Prediction with Expense
MyFitnessPal) (e.g., Mint)
Tracker
The AI Meal Prediction with Expense Tracker addresses these gaps by integrating
BMI tracking, AI-powered meal generation, budget management, and location-based
grocery discovery into a single cohesive application. This dual-focus design ensures
that users do not need to oscillate between multiple apps or manually align health and
finance goals.
Capture user health parameters such as height, weight, dietary preference, and
target goals.
Estimate meal costs based on regional vendor data and synchronize expense
tracking.
Allow users to search for grocery vendors nearby, with filtering by budget,
distance, and health compliance.
Store and manage user data securely, enabling cross-device synchronization via
Firebase Firestore.
Mobile Frontend Layer: Built using Flutter and Dart, providing users with an
intuitive, responsive interface for data input, meal plan viewing, expense
monitoring, and vendor locating.
21
AI Engine Layer: Integrating the Gemini API for real-time AI-powered meal
generation, driven by BMI and dietary goals.
The Level 0 DFD outlines the top-level flow of data between the user, the AI Meal
Prediction system, and external services.
The Level 1 DFD describes the major internal modules and their interactions:
This chapter has critically analyzed the shortcomings of existing health and budgeting
applications, compared alternative approaches, and established the architectural
foundation of the proposed system. The AI Meal Prediction with Expense Tracker
addresses multiple existing gaps by offering a real-time, personalized, integrated
approach to health and finance management. Through modular design, cloud
scalability, secure data handling, and dynamic AI integration, the system sets a new
standard for mobile lifestyle applications, making sustainable living achievable for a
wider demographic.
24
Unlike traditional calorie-counting or static diet apps, this solution employs real-time
interaction with Google’s Gemini API to generate meal suggestions tailored to
evolving user profiles. On the financial side, the application computes a Health-to-
Spend Ratio (HSR) for every user, quantifying the balance between nutritional benefit
and expenditure. Through geolocation services, it also identifies nearby vendors,
offering users choices that are not only healthy but economically viable.
Designed with a cross-platform architecture using Flutter and Firebase Firestore, the
application ensures lightweight deployment, real-time data synchronization, and
secure handling of sensitive health and financial information. By integrating AI-
driven personalization with robust financial oversight, the platform is positioned to
revolutionize how individuals manage their diets and grocery spending in daily life.
From a technical perspective, the system is built upon a proven stack of technologies.
Flutter and Dart offer cross-platform development flexibility, while Firebase Firestore
25
enables real-time cloud synchronization without the need for complex server
management. Integration with Gemini API provides dynamic AI-driven meal
generation tailored to user health profiles.
The system processes user inputs, computes BMI, generates AI-driven meal plans,
estimates costs, and updates expense trackers—all in near real-time. Data security and
authentication are managed through Firebase Authentication with end-to-end
encryption. Geolocation capabilities are provided via device-native APIs, ensuring
accurate vendor discovery.
Economic feasibility was assessed by estimating the overall operational costs based
on cloud hosting, API usage, maintenance, and updates.
Table 4.1: Estimated Annual Operational Cost for AI Meal Prediction with Expense
Tracker
Graph 4.1: Annual Cost Breakdown for AI Meal Prediction with Expense Tracker
26
The analysis reveals that the system is highly economical for its intended impact. A
large portion of the cost is driven by AI API usage and ongoing maintenance,
reflecting the dynamic and user-centric nature of the platform. This cost-efficiency
makes the solution particularly attractive for individual entrepreneurs, health startups,
and academic initiatives focusing on personal health technologies.
The system supports responsive design principles, ensuring smooth usage across
smartphones, tablets, and desktops. Meal plans and expense reports are generated in
real time, typically within 2–4 seconds of user input, enhancing usability and user
satisfaction.
27
Recognizing the sensitive nature of user health and financial data, the application is
designed under a strict privacy-by-design framework. All data transmissions occur
over HTTPS with encryption at rest and in transit.
User data, including BMI and expense histories, are stored securely within Firebase’s
authenticated user environment. No personally identifiable information is shared
externally without explicit user consent. Furthermore, compliance with regulations
such as GDPR, HIPAA (where applicable), and India’s Data Protection Bill is
maintained.
Users are provided with full transparency regarding data usage through a detailed
privacy policy, and granular consent mechanisms are implemented at each data
collection point. By adhering to industry best practices in data security and privacy
management, the system builds trust and meets all legal obligations for modern
mobile applications.
The project timeline was structured to ensure efficient development, testing, and
deployment across well-defined phases. The total execution plan is mapped to a six-
month agile cycle, balancing feature development with extensive quality assurance.
Graph 4.2: Project Development Timeline for AI Meal Prediction with Expense
Tracker
28
The timeline accommodates buffer periods for unexpected challenges such as API
changes, AI model tuning, or user interface redesigns based on feedback. Agile sprint
cycles allow for iterative improvements and quick adaptations, ensuring that the final
product remains aligned with user expectations and technological advancements.
The success of the AI Meal Prediction with Expense Tracker project depends on a
structured, collaborative plan that ensures timely milestones and strategic resource
allocation.
The development process is divided into distinct phases, each leading to tangible
deliverables ensuring traceability and quality control.
Each phase transitions into the next after formal review and validation, minimizing
rework and project drift.
Resource planning emphasizes efficient role distribution across key domains: Flutter
development, backend engineering, AI model integration, UI/UX design, and QA. A
project lead coordinates sprint planning, progress tracking, and risk mitigation.
Given the modular nature of the system, development efforts can be parallelized,
enabling independent progress on the frontend, backend, and AI modules.
An effective risk management plan is essential for maintaining system stability and
project momentum. The system anticipates potential risks and has mitigation
strategies for each.
Graph 4.3: Risk Assessment Matrix for AI Meal Prediction with Expense Tracker
30
Post-graph analysis:
The risk matrix highlights major concerns such as fluctuating grocery prices, API
availability changes, and health data security vulnerabilities. Mitigation strategies
include caching price data for offline operation, fallback prompts for API disruptions,
and frequent security audits. This proactive risk management ensures that the
application remains resilient and dependable even under adverse operational
conditions.
31
This chapter outlines the general and specific software subsystem requirements
crucial for the development and deployment of the platform. By establishing a clear
and structured requirement framework, the project ensures that the final application
will meet its core objectives—enabling real-time personalized meal planning tied with
budget management—while offering scalability, operational efficiency, accessibility,
and future-proof architecture.
The frontend is developed using Flutter and Dart, ensuring smooth cross-platform
operation on both Android and iOS devices. It offers a clean, responsive, and
accessible user interface. On the backend, Firebase Firestore is utilized to manage
real-time data synchronization, session management, and storage of user-generated
content like expense records and meal histories.
32
Data transmission is secured with HTTPS protocols, and user sessions are protected
through Firebase Authentication mechanisms. The system architecture follows
modular principles, supporting horizontal scalability using cloud-native services.
Performance optimization ensures that meal plan generation and expense tracking are
completed within a few seconds, offering a real-time experience even under moderate
multi-user loads. Furthermore, the application initially supports English and Hindi,
with future plans for expanding multilingual support based on regional user needs.
The overall system is designed to be not just a standalone personal assistant for health
and finance management but also a scalable platform capable of integrating future
features such as allergy detection, wearable health device connections, and advanced
predictive analytics.
The functional flow of the application begins with user onboarding, where users may
either create an account or proceed as a guest. Once authenticated, users input
personal health information, including height, weight, dietary preferences, and budget
constraints. The system immediately computes the Body Mass Index (BMI) and stores
this dynamic health profile securely.
Following the computation, the user can trigger the AI meal generation module,
which interacts with the Gemini API to generate meal suggestions aligned with their
health and budget parameters. Each generated meal is accompanied by an estimated
grocery cost, allowing users to assess nutritional and financial implications
simultaneously.
Upon selecting a meal, users can add required ingredients to a shopping list, which
tracks cumulative expenditure against the defined budget. The system calculates and
displays a Health-to-Spend Ratio (HSR) for real-time feedback on the cost-
effectiveness of dietary choices.
33
Additionally, geolocation services enable users to locate nearby vendors selling the
required ingredients, sorted by distance, price, and dietary relevance. Dynamic
expense dashboards summarize spending trends over weeks and months, providing
visual feedback through graphs and charts.
Registered users have access to a personal dashboard where past meals, expense
records, and budget adherence statistics are viewable. Data persistence is carefully
managed to ensure that only essential insights are stored while respecting user
privacy.
High system availability is targeted, aiming for a minimum uptime of 99.7%. The
system employs auto-scaling Firebase services and continuous server health
34
Post-graph analysis:
The graph highlights that while core functionality like meal planning and expense
tracking are essential, non-functional elements such as data security, accessibility, and
real-time performance significantly impact user satisfaction and long-term platform
success. Balancing these requirements ensures that the system is not only feature-rich
but also sustainable and secure for widespread adoption.
36
CHAPTER 6: DESIGN
6.1 System Design
The design phase for the AI Meal Prediction with Expense Tracker translates
functional requirements into a structured technical blueprint. The application follows
a layered modular architecture, separating concerns into three primary layers: the
presentation layer, the application processing layer, and the data management layer.
The presentation layer, developed using Flutter and Dart, provides an intuitive,
mobile-first interface allowing users to input health data, generate AI meal plans,
track grocery expenses, and access vendor suggestions. It ensures cross-platform
responsiveness and accessibility for users on Android and iOS devices.
The application processing layer orchestrates the core backend operations, including
user profile management, BMI calculation, AI interaction with the Gemini API for
meal generation, expense estimation, and Health-to-Spend Ratio (HSR) computation.
Firebase Cloud Functions are leveraged to manage serverless logic while ensuring
real-time responsiveness and security.
The data management layer operates through Firebase Firestore, storing user health
profiles, budget tracking data, meal histories, and geolocation-based vendor details.
Data security and user privacy are prioritized through encryption and minimal
retention policies.
Communication between the layers is established using secure REST APIs, ensuring
modularity, fault tolerance, and scalability. The design enables future expansions,
such as adding allergy management modules or integrating wearable device data,
without disrupting the core system.
Data Flow Diagrams (DFDs) depict how user inputs flow through various modules
like BMI calculators, meal generators, expense trackers, and vendor locators until
37
Use Case Diagrams model how different actors—including Users and Administrators
—interact with the system, capturing operations such as meal plan generation,
expense tracking, budget monitoring, and system administration.
Sequential workflows, including health data input, meal suggestion generation, and
expense management, are represented via detailed flowcharts. Pseudocode is also
written to capture critical processing algorithms like BMI calculation, AI meal
fetching, and expense aggregation.
Immediately, the system computes the user’s Body Mass Index (BMI), categorizing
them into health groups (e.g., underweight, normal, overweight) based on standard
medical guidelines. This BMI classification informs the AI meal generation module,
which invokes the Gemini API with personalized prompts to create tailored meal
suggestions aligning with the user's health goals and budget.
The generated meals are accompanied by real-time cost estimates, enabling users to
evaluate health and financial implications simultaneously. Selected meals populate a
dynamic shopping list, continuously updating the budget balance and computing the
Health-to-Spend Ratio (HSR) for each addition.
38
Through geolocation services, users can discover local vendors offering the
ingredients needed, sorted by price proximity or health relevance. Expense graphs and
summaries are generated dynamically on user dashboards, giving insights into
nutritional spending patterns over time.
Security protocols ensure all data transfers use HTTPS encryption, and sensitive
information is stored securely within Firebase Firestore. Backend services operate
asynchronously to maintain low latency, and all sensitive user sessions are token-
secured.
6.4 Flowcharts
Figure 6.1: Overall System Flowchart – AI Meal Prediction with Expense Tracker
39
This flowchart maps the full user journey from login to receiving dynamic health and
budget summaries.
Figure 6.2: Flowchart for Meal Plan Generation and Expense Tracking Module
his shows the modular backend flow focusing specifically on AI meal creation and
budget integration.
6.5 Pseudocode
mealSuggestions = GeminiAPI.fetchMealPlans(prompt)
40
totalCost = 0
shoppingList = []
This pseudocode illustrates how user data flows through BMI calculation, AI-based
meal prediction, cost estimation, and HSR computation to generate a fully
personalized, budget-conscious meal plan.
41
CHAPTER 7: TESTING
7.1 Functional Testing
Functional testing for the AI Meal Prediction with Expense Tracker platform was
designed to validate that each component behaved according to the defined user
requirements and technical specifications. The objective of this testing phase was to
ensure that critical functionalities, including user login, BMI computation, AI meal
plan generation, expense estimation, vendor discovery, and Health-to-Spend Ratio
(HSR) calculation, operated reliably across diverse user scenarios.
Testing began with validating user onboarding, ensuring that account creation, login,
and guest access functioned seamlessly. Health data input, a core function for BMI
calculation, was tested for accuracy and boundary conditions, confirming that
abnormal values such as negative weights or unrealistic height entries were properly
handled with clear validation messages.
Subsequently, the AI meal generation module was rigorously tested. Input parameters,
including BMI category, dietary preference, and budget limit, were supplied to the
Gemini API integration, and the returned meal plans were examined for relevancy,
nutritional alignment, and cost feasibility. Particular focus was given to how well
meal suggestions adapted to budget changes or dietary shifts in real-time.
The expense tracking module was tested by simulating the addition of multiple meals
into the shopping cart, ensuring that cumulative costs reflected correctly and updated
dynamically with each new item. Budget alerts, triggered when users approached or
exceeded their predefined spending limits, were also validated.
Unit testing was carried out at the module level to isolate and validate individual
backend functions. Each function was tested using both standard and abnormal data
inputs to ensure robustness. For instance, the BMI calculator was tested with edge
cases such as zero-height values to verify appropriate exception handling.
Backend services were assessed using test coverage analysis tools to ensure that over
90% of the codebase was tested, with special attention given to exception handling,
invalid input recovery, and API timeout resilience. These practices helped identify
and correct hidden defects before final deployment, greatly enhancing system stability
and user experience.
At the base level, unit testing validated the behavior of standalone functions and
classes. This included the BMI computation module, Gemini API request handlers,
meal parsing logic, cost estimators, and budget monitoring routines. Each unit was
provided with normal, boundary, and abnormal inputs to rigorously validate expected
behavior and error recovery paths.
43
Integration testing involved combining multiple functional units and verifying their
collective behavior. Special attention was given to the integration between the BMI
profile module, meal generation service, and expense tracker, ensuring smooth data
exchange and consistent business logic. The seamless passing of budget constraints
into meal plan generation and the correct interpretation of grocery cost estimates were
particularly crucial and were validated under a variety of user scenarios.
Full system testing evaluated the end-to-end workflows on real devices and networks.
Users performed health data entry, generated personalized meals, built shopping carts,
monitored their budget statuses, and searched for nearby vendors, ensuring that the
platform operated seamlessly across mobile devices, tablets, and web simulators.
Manual testing was employed extensively across the frontend, validating that users
could easily navigate the interface, input health details, generate and select meals, and
monitor budgets without encountering confusing workflows or system errors. Special
focus was given to ensuring that accessibility standards were met, with high-contrast
UI themes and adjustable font sizes tested for compliance with WCAG 2.1 guidelines.
Automated backend testing involved scripting batch user sessions where hundreds of
synthetic profiles were processed through the BMI calculator, meal plan generation
module, and expense tracker. These simulations helped uncover rare bugs such as
budget overrun miscalculations, which were promptly corrected before deployment.
AI meal generation accuracy was assessed using a test set of varied user profiles to
confirm that meal suggestions corresponded logically with health goals and budget
limits. An accuracy rate of approximately 93% was achieved in generating relevant,
goal-aligned meal plans based on varying BMI profiles and dietary restrictions.
Security testing was another critical facet. Penetration testing scenarios, such as API
endpoint fuzzing, session hijacking attempts, and malicious payload uploads, were
conducted. Thanks to strict API authentication, HTTPS-only communications, and
proactive input sanitization, the system successfully resisted all critical security
threats without data breaches or service disruptions.
Performance testing confirmed that the system could sustain simultaneous interactions
from over 500 users without significant degradation of response times. Meal plan
generation, expense updates, and budget recalculations consistently completed within
2–4 seconds under peak load conditions.
In conclusion, the extensive and layered testing strategies implemented for the AI
Meal Prediction with Expense Tracker ensured that the platform is not only
functionally robust but also scalable, secure, and highly aligned with user
expectations, ready for sustainable deployment and growth in the real world.
45
CHAPTER 8: IMPLEMENTATION
8.1 Implementation of the Project
The implementation phase of the AI Meal Prediction with Expense Tracker platform
involved the structured development, integration, and deployment of all system
components, culminating in a cohesive and reliable real-time mobile application. Each
module—including the frontend interface, backend services, AI meal generation
engine, budget tracking logic, and vendor discovery system—was developed
independently, validated through rigorous testing, and carefully integrated to form the
overall platform.
The mobile frontend was designed using Flutter and Dart, ensuring responsiveness
and compatibility across Android and iOS devices. Flutter’s widget-based architecture
enabled efficient UI rendering and allowed the application to maintain consistency
across screen sizes and device types. The backend was developed using Firebase
Firestore for real-time database operations and Firebase Cloud Functions for scalable
serverless logic execution, maintaining optimal system responsiveness.
Security was embedded at every layer of the system. HTTPS communication was
enforced, authentication was managed using Firebase Authentication with token
validation, and Firestore rules were written to strictly limit unauthorized data access.
46
Rigorous internal audits validated data flow integrity from mobile clients to backend
services.
Following comprehensive integration testing and stress simulations, the system was
deployed to production through Firebase Hosting and Cloud Services. Load balancing
and auto-scaling were configured to ensure high availability during periods of peak
user activity. Post-deployment, the platform operated with consistent stability,
delivering real-time, AI-personalized meal plans tied closely to user financial goals.
During the initial pilot phase, select early adopters—including fitness enthusiasts,
dieticians, and financial planners—were invited to use the platform in parallel with
their existing manual diet and budgeting systems. Participants were encouraged to
input health profiles, generate meal plans, monitor their expenses, and compare the
AI-driven outputs against traditional methods.
Extensive real-world testing was carried out across varied user demographics,
accounting for different dietary preferences, geographic locations, and budget ranges.
Feedback collection focused on key aspects such as meal relevancy, cost accuracy, UI
intuitiveness, responsiveness under network constraints, and perceived financial
health improvements.
Insights gained from the pilot phase were crucial in refining the platform.
Adjustments were made to improve AI prompt templates, optimize budget tracking
logic, and enhance meal cost estimations based on live market data. Particular
improvements included introducing multi-currency support, dynamic recalculation of
expenses when meal choices were updated, and enhanced error handling for
geolocation-based vendor searches.
consistent system uptime of 99.8%, the transition to full production status was
completed. Users formally phased out manual budget tracking methods in favor of the
integrated, AI-enhanced mobile application, validating the effectiveness of the
conversion plan.
Quarterly system health reports were generated, reviewing key performance indicators
such as average transaction latency, meal plan generation success rates, Health-to-
Spend Ratio accuracy, and expense overrun warning effectiveness. These reports
guided preventive maintenance operations, ensuring consistent user experiences and
high service availability.
Software updates followed an agile cycle, incorporating user feedback into sprint
planning. Regular maintenance included refreshing vendor databases, tuning Gemini
API prompt structures to reflect evolving food trends, and updating budgeting
algorithms to accommodate inflationary price changes in groceries.
New Year health resolutions or seasonal diet trends, ensured that performance
remained unaffected by sudden usage surges.
Security audits confirm that the platform adheres to stringent data privacy regulations,
ensuring compliance with GDPR, CCPA, and India's Data Protection guidelines. All
communications are securely encrypted, sensitive user information is tokenized, and
no personally identifiable financial or health data is retained beyond the necessary
operational window.
Feedback collected during pilot testing and live operations has been overwhelmingly
positive, with users appreciating the platform’s responsiveness, simplicity, practical
integration of health and budget management, and intuitive visualization of expense
50
In its current state, the AI Meal Prediction with Expense Tracker stands as a scalable,
efficient, and user-centric solution, offering a groundbreaking integration of AI-driven
health management and financial tracking into daily life practices.
One area of concern involves enhancing meal plan diversity and nutritional detail.
While the current AI-generated plans align well with BMI and user preferences, more
granular customization—such as micronutrient balancing, specific dietary needs (e.g.,
diabetic-friendly, gluten-free), and allergy-aware suggestions—remains an
aspirational goal. Expanding prompt structures and integrating a broader nutrition
database will be essential to meet these personalized needs.
Cost estimation accuracy, while generally reliable, can fluctuate due to sudden
grocery price changes, regional pricing disparities, or seasonal variations.
Incorporating real-time grocery pricing APIs and enabling periodic user feedback
loops for manual price corrections will help refine the expense tracking accuracy
further.
Although the system operates efficiently under present load conditions, predictive
resource scaling remains an area for improvement. Anticipating user spikes—such as
during New Year health resolutions or festival periods—through predictive analytics
and proactive cloud resource provisioning will enhance the platform’s resilience and
cost-effectiveness.
51
Finally, while administrative dashboards provide useful insights into system health
and basic user activity metrics, deeper analytics modules are needed. Expanding
administrative reporting to include trends like popular meal choices, regional dietary
shifts, expense saving patterns, and Health-to-Spend Ratio averages over time would
empower data-driven product refinement and strategic decision-making.
On the security front, embedding encryption and access control mechanisms from the
outset proved far more efficient than attempting reactive security patching. Regular
vulnerability scans, session management audits, and data minimization strategies
ensured that security remained a proactive, ingrained practice rather than an
afterthought.
sprint reviews ensured that deliverables remained tightly aligned with both technical
goals and user feedback.
Risk management practices evolved from simple risk listing into dynamic risk
tracking. Risks such as API downtime, user growth surges, and regulatory changes
were continuously assessed, prioritized, and mitigated through backup services, load
testing, and regulatory audits, ensuring organizational resilience.
Involving users early through pilot testing proved crucial. Users contributed critical
insights into UI simplification, preference-driven meal generation, and budget
visibility enhancements. Their feedback drove meaningful changes that technical
teams alone might have overlooked, reinforcing the value of user-centered design
philosophy.
The necessity of continuous monitoring and learning cycles was another key
takeaway. The post-deployment strategy of maintaining live dashboards, automatic
error reporting, and periodic system health checks significantly reduced downtime,
improved service reliability, and positioned the team for future growth.
Conclusion
The development and deployment of the AI Meal Prediction with Expense Tracker
mark a significant step forward in merging artificial intelligence with everyday health
and financial management. In an era where personalized wellness and conscious
budgeting are increasingly important, this platform successfully integrates real-time
AI meal planning with intelligent expense tracking, offering users a practical,
dynamic tool to enhance both their health and financial well-being.
Throughout the project journey, meticulous attention was given to system design,
modular architecture, data privacy, and user-centered functionality. The integration of
the Gemini API for meal prediction, coupled with real-time grocery cost estimation,
demonstrated how AI-driven personalization could move beyond static
recommendations to deliver actionable, budget-conscious advice tailored to individual
users' needs. Furthermore, leveraging modern technologies such as Flutter, Firebase,
and secure cloud practices ensured the platform's scalability, reliability, and
accessibility across diverse user demographics.
Testing phases validated the system's robustness under varying operational scenarios,
confirming its ability to maintain high responsiveness, security, and accuracy.
Positive user feedback reinforced the platform's practical value, particularly in
simplifying complex decisions around diet management and expense control.
However, this journey also illuminated areas for continued enhancement, such as
expanding meal diversity, improving real-time pricing integration, optimizing global
scalability, and enriching administrative analytics. These future challenges present
opportunities for continuous learning, system refinement, and expanded impact.
REFRENCE
[1] McFee, B., Raffel, C., Liang, D., Ellis, D.P.W., McVicar, M., Battenberg, E.,
Nieto, O., "Librosa: Audio and Music Signal Analysis in Python," Proceedings of the
14th Python in Science Conference, 2015.
[2] Hughes, T., Mierle, K., "Recurrent Neural Networks for Voice Activity
Detection," IEEE International Conference on Acoustics, Speech and Signal
Processing (ICASSP), 2013.
[3] Hershey, S., Chaudhuri, S., Ellis, D.P.W., Gemmeke, J.F., Jansen, A., Moore,
R.C., Plakal, M., et al., "CNN Architectures for Large-Scale Audio Classification,"
IEEE International Conference on Acoustics, Speech and Signal Processing, 2017.
[4] Ravanelli, M., Bengio, Y., "Speaker Recognition from Raw Waveform with
SincNet," IEEE Spoken Language Technology Workshop, 2018.
[5] Kingma, D.P., Ba, J., "Adam: A Method for Stochastic Optimization,"
International Conference on Learning Representations (ICLR), 2014.
[6] Sohn, J., Kim, N.S., Sung, W., "A Statistical Model-Based Voice Activity
Detection," IEEE Signal Processing Letters, 1999.
[7] Benyassine, A., Shlomot, E., Su, H.Y., Suh, J.W., "ITU-T Recommendation
G.729 Annex B: A Silence Compression Scheme for Use with G.729 Optimized for
VAD," 1997.
[8] Segura, J.C., Benítez, C., Torre, A., Rubio, A., "Robust End-Point Detection
Based on Energy and Zero-Crossing Rate for Speech Recognition in Noisy
Environments," 2004.
[9] Zhang, X., Wu, J., "Deep Belief Networks Based Voice Activity Detection," IEEE
Transactions on Audio, Speech, and Language Processing, 2019.
55
[10] Nguyen, A., Yosinski, J., Clune, J., "Deep Neural Networks are Easily Fooled:
High Confidence Predictions for Unrecognizable Images," IEEE Conference on
Computer Vision and Pattern Recognition, 2015.
[11] Goodfellow, I., Bengio, Y., Courville, A., "Deep Learning," MIT Press, 2016.
[12] Chollet, F., "Deep Learning with Python," Manning Publications, 2018.
[13] Abadi, M., et al., "TensorFlow: A System for Large-Scale Machine Learning,"
Proceedings of the 12th USENIX Symposium on Operating Systems Design and
Implementation (OSDI), 2016.
[14] Thakkar, A., Mehta, S., "Review on Techniques and Challenges in Voice
Activity Detection," International Journal of Computer Applications, 2018.
[16] Roberts, C.K., Barnard, R.J., "Effects of Exercise and Diet on Chronic Disease,"
Journal of Applied Physiology, 2005.
[17] Khera, A.V., Kathiresan, S., "Genetics of Coronary Artery Disease: Discovery,
Biology, and Clinical Translation," Nature Reviews Genetics, 2017.
[19] Vaswani, A., et al., "Attention Is All You Need," Proceedings of the 31st
International Conference on Neural Information Processing Systems (NIPS), 2017.
[20] Papernot, N., McDaniel, P., Jha, S., "Towards the Science of Security and
Privacy in Machine Learning," IEEE European Symposium on Security and Privacy,
2016.
[21] Buhrmester, V., Münch, D., Arens, M., "Analysis of Explainable Artificial
Intelligence (XAI) Methods for Deep Learning Models in Computer Vision: A
Survey," Frontiers in Artificial Intelligence, 2019.
56
[23] Nair, V., Hinton, G.E., "Rectified Linear Units Improve Restricted Boltzmann
Machines," Proceedings of the 27th International Conference on Machine Learning
(ICML), 2010.
[25] Scrum.org, "The Scrum Guide: The Definitive Guide to Scrum," 2020 Edition.
[30] Agarwal, R., Dhar, V., "Big Data, Data Science, and Analytics: The Opportunity
and Challenge for IS Research," Information Systems Research, 2014.