SpendWise: AI-Powered Financial Analysis Tool

Project Inspiration

SpendWise emerged from the challenge of making everyday financial decisions more informed. By leveraging AI to analyze receipts and provide economic insights, we transform mundane shopping trips into opportunities for financial growth and learning, helping users make smarter purchasing decisions. We also want to make saving money fun and engaging, so we're introducing a multiplayer game built with Pygame to incentivize users.

Technology Stack

  • Languages: Python (backend, game), HTML/CSS/JavaScript (frontend), SQL (database)
  • Frameworks: Flask web framework, SQLAlchemy ORM, Pygame (game)
  • AI Integration: Google Generative AI (Gemini API) for image processing and economic analysis
  • Security: Werkzeug password hashing, Fernet encryption for API keys, URLSafeTimedSerializer for tokens
  • APIs: OpenStreetMap/Overpass API (location data), OpenFoodFacts (product data)
  • Database: SQLite (development), with structure supporting PostgreSQL migration
  • Authentication: Flask-Login, email verification system

What it does

SpendWise analyzes receipt images to provide detailed financial insights:

  1. Extracts text from receipt images using Gemini AI
  2. Categorizes purchases automatically
  3. Evaluates purchase economics by comparing against alternatives
  4. Recommends nearby stores with better prices
  5. Calculates potential savings considering travel costs
  6. Provides detailed spending analytics and visualization
  7. Securely manages third-party API keys
  8. Offers a multiplayer game where users compete to earn points based on savings achieved through SpendWise insights.

How we built it

We constructed SpendWise with a modular architecture:

  1. Receipt Processing Pipeline: Implemented OCR with Gemini API for text extraction
  2. Economic Analysis Engine: Created algorithms to evaluate purchase efficiency
  3. Store Recommendation System: Integrated location services to find nearby alternatives
  4. User Authentication: Built secure login system with email verification
  5. Database Models: Designed schema for users, receipts, API keys, and game data.
  6. RESTful API: Developed endpoints supporting web and mobile interfaces
  7. Game Development: Developed a Pygame-based multiplayer game integrated with the SpendWise platform.

Challenges we ran into

  1. OCR Accuracy: Receipt formats vary dramatically, requiring sophisticated prompt engineering
  2. Economic Evaluation: Needed to balance multiple factors including product similarity, distance, and travel costs
  3. Location Data: Working with geographic APIs required handling inconsistent responses
  4. API Key Security: Implementing secure encryption for third-party credentials
  5. User Experience: Making complex financial data accessible and actionable
  6. Game Integration: Balancing game complexity with accessibility and ensuring seamless integration with the core SpendWise functionality.

Accomplishments that we're proud of

  1. AI-Powered Receipt Analysis: Successfully implementing Gemini API for accurate text extraction
  2. Sophisticated Economic Analysis: Developing algorithms that consider travel costs when recommending alternatives
  3. Secure API Key Management: Creating an encrypted system for storing sensitive credentials
  4. Location-Based Recommendations: Integrating multiple geographic services for accurate store recommendations
  5. Comprehensive Dashboard: Building intuitive visualizations of spending patterns
  6. Engaging Multiplayer Game: Creating a fun and rewarding game experience that reinforces smart spending habits.

What we learned

  1. AI Integration: Practical application of generative AI in financial tools
  2. Geographic Computing: Implementing distance calculations and location-based services
  3. Flask Architecture: Structuring complex applications with multiple integrated systems
  4. Security Best Practices: Proper handling of sensitive user data and API keys
  5. Data Processing Pipelines: Building robust systems to extract, transform, and analyze receipt data
  6. Game Development with Pygame: Learning the intricacies of game development, including game mechanics, user interface design, and multiplayer integration.

What's next for SpendWise

  1. Mobile App Development: Expanding our existing API to support native mobile applications
  2. Machine Learning Price Predictions: Implementing ML models to predict future prices
  3. Budget Integration: Connecting receipt analysis with budget planning
  4. Social Features: Adding ability to share savings tips and participate in saving challenges within the game context.
  5. Personalized Financial Coaching: Developing AI-driven recommendations based on spending patterns
  6. Retailer Partnerships: Creating an ecosystem for exclusive discounts and cashback opportunities, potentially integrated into the game as rewards.
  7. Expanding Game Features: Adding new game modes, challenges, and rewards to keep users engaged and motivated to save.

By adding the game element, SpendWise becomes more than just a financial analysis tool; it becomes a platform for users to actively engage with their finances in a fun and rewarding way. This gamified approach can significantly increase user engagement and motivation to save money.

Built With

Share this project:

Updates