How yosefzaher/expenses_tracker works
Project Type and Purpose
• This is a desktop GUI application (built in Python) for tracking daily expenses.
• It uses a local SQLite database (Expenses.db) to store records, a Tkinter GUI (with tkcalendar) for interaction, the requests library to fetch currency-conversion rates, and exports data to CSV.
File Structure
• Top-level files:
• ExpensesTracker_project.py – the main application logic and UI
• Expenses.db – SQLite database file
• requirements.txt – dependency list
• README.md – project description
• No separate frontend/backend folders: everything lives in one Python process.
• Uses environment variables (via python-dotenv) for external API keys.
README for Additional Insights
• Core features:
• CRUD on expenses (add, update, delete)
• Currency conversion to USD (via external API)
• CSV export
• UI layout: input fields, buttons, a table view, and a total-display section.
Main Components
a. Presentation Layer (UI)
• Tkinter main window
• Widgets: Entry fields, Dropdowns (Currency, Category, Payment Method), Buttons (Add, Delete, Update, Convert, Export), Table/Grid, Total display
• tkcalendar date-picker component
b. Application Logic Layer
• Controller functions in ExpensesTracker_project.py handling button callbacks
• Business rules: validation, CRUD operations, sum calculation, conversion logic
c. Data Layer
• SQLite database (Expenses.db)
• ORM or direct SQL queries in the Python script
• CSV export module (reads DB rows and writes a .csv file)
d. External Service
• Currency conversion API (accessed via requests)
• Environment variables loaded by python-dotenv for API key
Relationships and Data Flows
1. User clicks “Add Expense” → UI widget event → Controller processes input → Writes to SQLite DB → Refreshes UI table
2. User clicks “Update/Delete” → Similar flow, targeting a specific record
3. User clicks “Convert to USD” → Controller reads all expenses from DB → Sends HTTP request to currency API → Receives rates → Applies conversion → Displays results in UI
4. User clicks “Export to CSV” → Controller queries DB → Writes .csv file to local filesystem
Architectural Patterns and Principles
• Layered architecture: Presentation → Application → Data
• Single-process monolithic desktop app
• Separation of concerns: UI code vs. data-access vs. external-service calls
• Use of environment variables for secrets (python-dotenv)
Final Checklist
• Components: UI (Tkinter + tkcalendar), Controller/Business Logic, SQLite DB, External API, CSV Export
• Notes on key technologies: Python 3.x, Tkinter, SQLite, requests, python-dotenv