How katotaku879/budget-app works
Project Type and Purpose
• This is a standalone, full-stack desktop application implemented as a single Python process.
• Purpose: A PyQt5-based household budget management tool with real-time analytics, goal-tracking, and CSV import/backup support.
File Structure Analysis
• Top-level files:
• budget_app.py – monolithic entry point containing UI, business logic, data access
• requirements.txt – lists dependencies (PyQt5, pandas, numpy, SQLite3)
• README.md – full architecture and feature description
• 家計簿アプリ起動.bat – Windows launch scripts
• No separate frontend/backend folders; all layers live in one script.
README Insights
• Confirms a 4-layer architecture: Presentation (GUI), Business Logic, Data, Analysis Engine.
• Describes MVC pattern with BaseWidget for common UI components.
• Lists 5 main GUI widgets and 5 core database tables in budget.db.
Main Components
a. Presentation Layer (PyQt5 GUI)
• Widgets: IncomeExpenseWidget, BreakdownWidget,
MonthlyReportWidget, GoalManagementWidget, SavingsGoalWidget
• BaseWidget common functionality (navigation, styling)
b. Business Logic Layer
• Controllers handling user actions, input validation, goal management
• Real-time calculations via pandas (e.g., update_monthly_expense)
• CSV import & backup scheduler
c. Data Access Layer
• SQLite connector module (CRUD operations, transaction management)
• pandas bridges (read_sql, DataFrame processing)
d. Persistence Layer (SQLite Database)
• budget.db file with tables: expenses, monthly_income, recurring_expenses, category_goals, savings_goals
e. (Optional) Analysis Engine
• Trend computation, AI-powered advice module (future extension)
Relationships and Data Flows
• User → GUI widget (slots/signals) → Business Logic
• Business Logic → Data Access (SQL queries, pandas DataFrames) → SQLite
• Data Access → pandas/Numpy processing → Business Logic → GUI updates
• CSV import flow: CSV file → pandas transform → Data Access → SQLite
• Backup flow: SQLite file copy → local backup storage
Architectural Patterns and Principles
• Layered (4-layer) architecture: clear separation of concerns
• MVC style: Widgets = View, business-logic methods = Controller, SQLite = Model
• BaseWidget inheritance promotes DRY UI code
• Data normalization in DB, transaction safety in Data Access
Key Technologies and Libraries
• Python 3.7+
• PyQt5 (Widgets, Charts)
• SQLite3 (lightweight RDBMS)
• pandas/numpy for in-memory analysis
• shutil & scheduler for backup automation