Expense_Manager / replit.md
Ashlin-Joseph's picture
Upload 7 files
13fdb7b verified
|
Raw History Blame Contribute Delete
4.74 kB

College Expense Tracker

Overview

A Streamlit-based web application designed to help college students track and visualize their expenses. The application provides an intuitive interface for recording expenses, categorizing them, and analyzing spending patterns through interactive visualizations. Data is persisted locally using CSV file storage, making it lightweight and portable without requiring a database server.

User Preferences

Preferred communication style: Simple, everyday language.

System Architecture

Frontend Architecture

  • Framework: Streamlit - A Python-based web framework chosen for rapid development and built-in UI components
  • Visualization: Plotly Express for interactive charts and graphs
  • State Management: Streamlit's session_state for maintaining application state across user interactions
  • Layout: Wide layout configuration to maximize screen real estate for data visualization

Design Rationale: Streamlit was selected for its simplicity and Python-native development experience, eliminating the need for separate frontend/backend codebases. This is ideal for a student-focused tool where quick iterations and minimal deployment complexity are priorities.

Data Storage

  • Storage Method: CSV file-based persistence
  • File Location: Local filesystem (expenses.csv)
  • Data Structure: Pandas DataFrame for in-memory data manipulation
  • Caching Strategy: @st.cache_data decorator used for loading expenses to optimize performance

Design Rationale: CSV storage provides a simple, human-readable format that doesn't require database setup or maintenance. This approach offers portability (easy to backup/share) and zero infrastructure overhead, suitable for a personal expense tracking application. The tradeoff is limited concurrent user support, which is acceptable for a single-user college expense tracker.

Data Processing & Analysis

  • Date Handling: Datetime operations for temporal analysis with configurable granularity (Daily, Weekly)
  • Aggregation: Pandas-based data aggregation for expense categorization and time-based grouping
  • Error Handling: Try-catch blocks around file I/O operations to gracefully handle data loading/saving failures

Design Rationale: Pandas provides powerful data manipulation capabilities well-suited for financial data analysis. The granularity feature allows users to view expenses at different time scales, supporting both detailed daily tracking and broader trend analysis.

Application State Management

  • Session State: Centralized expense data stored in st.session_state.expenses_df
  • Initialization: Lazy loading pattern - data is loaded from CSV only on first access
  • Persistence Flow: In-memory DataFrame → CSV file on updates

Design Rationale: Streamlit's session state maintains data consistency during user interactions without page reloads. The separation between in-memory state and file persistence provides a clear data flow while enabling undo/redo functionality if needed.

External Dependencies

Python Libraries

  • streamlit: Core web application framework and UI components
  • pandas: Data manipulation, CSV reading/writing, and DataFrame operations
  • plotly.express: Interactive data visualization and charting
  • datetime: Date/time manipulation for expense tracking and temporal analysis
  • os: File system operations for CSV file existence checks

Data Storage

  • CSV Files: Local file system storage (no external database required)
  • Files:
    • expenses.csv - stores all expense records
    • budgets.csv - stores monthly budget settings (YYYY-MM format)

Recent Changes (October 2025)

  • Date Range Filtering: Added ability to filter expenses by custom date ranges in View Expenses tab
  • Expense Management: Implemented edit and delete functionality for individual expenses
  • Trend Analysis: Added Trends tab with line charts showing spending patterns over time (daily, weekly, monthly aggregation)
  • Category Budgets: Enhanced Budget tab with category-wise budget limits and progress tracking
  • Monthly Budgets: Added Monthly Budget Input tab for setting total monthly budgets
  • Monthly Expense Sheet: Added dedicated tab comparing monthly spending against budgets with visual alerts
  • Data Export: Implemented CSV export functionality for filtered and complete expense data

Deployment Considerations

  • Runtime: Python 3.x environment required
  • File Permissions: Write access needed for creating/updating expenses.csv and budgets.csv
  • No External Services: Currently operates as a standalone application with no third-party API integrations