Skip to content

rogervdo/Hackmty2025-CapitalOne

Repository files navigation

Cappie banner (placeholder)

✨ Cappie ✨

“Pequeños cambios, grandes logros.”

HackMTY Sponsor FastAPI MySQL iOS Gemini



Cappie is a banking app with a Financial Coach (Normal mode) that turns your transactions into simple, explainable actions — inspired by Capital One’s friendly, trustworthy vibe.


🔎 Table of Contents


✨ Project Description

Problem Addressed

Managing money is time-consuming and mentally taxing. Most banking apps are reactive (balances + lists) and don’t guide the user with clear, actionable steps. Budgets can be rigid or vague, and they rarely show the impact of small daily choices on weekly goals.

Our Solution: Cappie

A Financial Coach inside a banking app that turns transactions into simple, explainable actions.

How the MVP (Normal mode) works

  • “Tinder for spending” onboarding: quick swipes (✅ / ❌) to learn habits.
  • Emoji + map-based history: fast, emotional visualization by category/location.
  • Weekly goals + Savings Envelope: small, achievable targets and a ledger to “compensate now”.
  • Explainable recommendations (the “why”): generated with Gemini, while metrics/rules run on-device for privacy.
  • Coach Metrics & Opportunities: real-time metrics (needs, regrets, progress), and saving opportunities from “regret” expenses.
  • AI-assisted classification: emoji/category suggestions and goal creation from a free-text prompt.

Expected outcome (MVP)

  • Less friction to understand spending.
  • Small changes that accelerate goals (“Pequeños cambios, grandes logros.”).
  • A friendly, non-punitive experience aligned with Capital One’s spirit.

🛠️ Technologies Used

Layer Technologies Purpose
Frontend (iOS) SwiftUI, Combine, Swift Charts Native UI: coach views, emoji history, goals & envelope.
Backend (API) FastAPI, Uvicorn, Pydantic REST endpoints: expenses, coach metrics, opportunities, swipe, goals, emojis.
Database MySQL 8 Tables: Usuario, Gastos, Metas. Seed/Dump: backend/HackMTYCapitalOne2025.sql.
AI (NLG) Google Gemini API Suggestions, emoji categorization, goal creation from prompt.
Connector mysql-connector-python MySQL access from FastAPI.
Design Figma (Capital One vibe) Palette: Blue #004481, Red #D10000, Background #F5F7FA.

🚀 Quick Start

Requirements: Python 3.10+, MySQL 8+

# 1) Install deps
pip install -r requirements.txt

# 2) Environment variables (create .env — do NOT commit)
#   GEMINI_API_KEY=your_key
#   MYSQL_HOST=localhost
#   MYSQL_PORT=3306
#   MYSQL_DB=CapitalOne
#   MYSQL_USER=cappie_user
#   MYSQL_PASSWORD=change_me

# 3) Load database (see section below if you need a new user)
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS CapitalOne;"
mysql -u root -p CapitalOne < backend/HackMTYCapitalOne2025.sql

# (Optional) App DB user
mysql -u root -p -e "CREATE USER IF NOT EXISTS 'cappie_user'@'%' IDENTIFIED BY 'change_me';
GRANT ALL ON CapitalOne.* TO 'cappie_user'@'%'; FLUSH PRIVILEGES;"

# 4) Run API
uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Docs:
# Swagger UI → http://localhost:8000/docs
# Redoc      → http://localhost:8000/redoc

🔌 API — Key Endpoints

Method Route Body / Params (summary) Description
POST /emojis { "prompt": "text" } Returns emoji and category for an expense using Gemini.
POST /gastos/nuevo { chargeName, amount, location, category, utility, user } Creates a new expense.
GET /gastos Lists all expenses joined with user name.
GET /gastos/{user_id} user_id path Lists a user’s expenses (newest first).
GET /gastos/{user_id}/utility-null user_id path Lists a user’s unclassified expenses (utility = 'not assigned').
GET /coach/{user_id} user_id path Coach metrics: needs, regrets, weekly cap, goal, progress, unsorted count, impact.
GET /coach/{user_id}/opportunities user_id path Saving opportunities derived from regret expenses (top 3).
GET /swipe/unclassified/{user_id} user_id path Up to 10 unclassified transactions for the Swipe view.
POST /swipe/update `{ "transaction_id": n, "utility_value": "aligned" "regret" }`
POST /metas { "prompt": "...", "user_id": n } Creates a goal from free-text using Gemini and saves it.

Interactive docs: /docs (Swagger) · /redoc
Note: In SQL for utility-null use utility = 'not assigned' (not IS).


📘 Database (MySQL) & Seed

Schema (main tables)

Table Key Fields Notes
Usuario idUser, user, password Demo users included in seed.
Gastos id, chargeName, amount, timeStamp, location, category, utility, user utility ∈ {'aligned','regret','not assigned'}
Metas idMeta, user, nombre_meta, descripcion, goal_amount, tipo, start_date, end_date Linked to users; column names matter.

Load seed

mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS CapitalOne;"
mysql -u root -p CapitalOne < backend/HackMTYCapitalOne2025.sql

# Optional: dedicated app user
mysql -u root -p -e "CREATE USER IF NOT EXISTS 'cappie_user'@'%' IDENTIFIED BY 'change_me';
GRANT ALL ON CapitalOne.* TO 'cappie_user'@'%'; FLUSH PRIVILEGES;"

👥 Team

Role Name GitHub Contact
Backend Lead Angel Muñoz @zamer22 angelaamunoza@gmail.com
Backend Lead Rogelio Villareal @rogervdo rogervdo@icloud.com
Design / UI / SwiftUI Bryan Meza @Bryan-Meza bryan.albertolemus9@gmail.com
Design / UI / SwiftUI Pablo Zapata @PabloZL27 Pablo.ZZLL@hotmail.com

💛 Acknowledgements

  • Capital One — inspiration and sponsorship.
  • HackMTY 2025 — venue to build Cappie.
  • Mentors & community who provided feedback and testing.

About

Hackmty project for Capital One fintech track

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors