A Flask-based web application for managing and analyzing personal finance data from CSV bank statements.
- Financial Overview: Display total income, total expenses, and balance with interactive cards
- Cumulative Chart: Visualize cumulative income and expenses over time using Plotly
- Quick Navigation: Direct links to income and expense analysis
- Advanced Filtering: Filter transactions by type (income/expenses), search text, and date ranges
- Sorting: Sort transactions by date or amount in ascending/descending order
- Tagging System:
- Assign tags to transactions using an editable select box
- Create new tags on the fly
- Visual histogram showing transaction totals by tag
- Find Similar: Search for similar transactions based on description, counterparty, or amount
- Bulk Tagging: Tag multiple similar transactions at once
- Tag the Search: Bulk tag all transactions matching current filters
- Find Patterns: AI-powered pattern detection to group similar transactions
- Pagination: Browse through large transaction datasets efficiently
- Multi-Granularity Views: Analyze finances by day, week, month, or year
- Database Views: Optimized SQL views for fast performance on large datasets
- Comparative Metrics:
- Overall average comparison (across all periods)
- Same-period average (e.g., all Aprils, all Mondays)
- Color-coded indicators (green = below average, red = above average)
- Tag Distribution: View spending by category at each granularity level
- Period Details: Income, expenses, balance, and transaction counts per period
- Intelligent Detection: AI-powered detection of recurring transactions
- Monthly Patterns: Identifies transactions that occur regularly each month
- Validation Wizard: Interactive interface to review and validate detected patterns
- Transaction Selection: Choose which transactions belong to each pattern
- Recurrent Tracking:
- Total recurrent income summary
- Total recurrent expenses summary
- Pattern count and details
- Pattern Management: Save, view, and delete validated patterns
- CSV Import: Admin-only feature to import bank CSV files
- Duplicate Detection: Automatically skips duplicate transactions
- Format Support: Handles semicolon-separated CSV files with European date and number formats
- Admin System: Admin users created via command-line interface
- Login Page: Secure login with Flask-Login
- Access Control: Import functionality restricted to admin users
-
Clone the repository (or navigate to the project folder):
cd /Users/jaoga/devlab/OWN/myfin -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On macOS/Linux # or venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
Initialize the database:
flask --app app init-db
-
Create an admin user:
flask --app app create-admin
Follow the prompts to enter username and password.
-
Initialize database views for summary analysis:
python init_views.py
This creates optimized SQL views for the Summary Analysis feature.
-
Migrate database for pattern analysis:
python migrate_patterns.py
This creates the pattern tables for recurring transaction detection.
-
Start the Flask development server:
python app.py
or
flask --app app run
-
Access the application: Open your browser and navigate to
http://localhost:5000 -
Login: Use the admin credentials you created earlier
- Login as an admin user
- Navigate to "Import Data" in the navigation bar
- Upload your CSV file (must be semicolon-separated with the correct format)
- The application will import transactions and skip duplicates
Your CSV file should have the following columns (semicolon-separated):
Numéro de compte- Account NumberNom du compte- Account NameCompte contrepartie- Counterparty AccountNuméro de mouvement- Transaction NumberDate comptable- Accounting Date (DD/MM/YYYY)Date valeur- Value Date (DD/MM/YYYY)Montant- Amount (European format: -1.234,56)Devise- Currency (e.g., EUR)Libellés- DescriptionDétails du mouvement- Transaction DetailsMessage- Additional Message
- View Overview: Check the home page for overall financial statistics
- Filter Transactions: Use the analyze page to filter by type, date range, or search text
- Tag Transactions:
- Select a tag from the dropdown for each transaction
- Create new tags by selecting "+ Add new tag"
- Find Similar: Click the search icon to find and bulk-tag similar transactions
id: Primary keyusername: Unique usernamepassword_hash: Hashed passwordis_admin: Boolean flag for admin privilegescreated_at: Account creation timestamp
id: Primary keyaccount_number: Bank account numberaccount_name: Account holder namecounterparty_account: Other party's accounttransaction_number: Bank transaction referenceaccounting_date: Transaction date (indexed)value_date: Value dateamount: Transaction amount (negative for expenses)currency: Currency codedescription: Transaction descriptiondetails: Detailed transaction informationmessage: Additional messagetag_id: Foreign key to tags tableimported_at: Import timestamp
id: Primary keyname: Unique tag namecolor: Hex color code for visualizationcreated_at: Tag creation timestamp
- Backend: Flask 3.0.0
- Database: SQLite with SQLAlchemy ORM
- Authentication: Flask-Login
- Data Processing: Pandas
- Visualization: Plotly
- Frontend: TailwindCSS, Font Awesome
- JavaScript: Vanilla JS for interactivity
- Change the
SECRET_KEYinconfig.pyfor production use - Admin users can only be created via command-line interface
- Passwords are hashed using Werkzeug's security functions
- File uploads are restricted to CSV files with a 16MB limit
myfin/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── models.py # Database models
├── requirements.txt # Python dependencies
├── README.md # This file
├── templates/ # HTML templates
│ ├── base.html # Base template
│ ├── login.html # Login page
│ ├── index.html # Home page
│ ├── analyze.html # Analysis page
│ └── import.html # Import page
├── uploads/ # Upload directory (created automatically)
└── finance.db # SQLite database (created on first run)
Personal project - feel free to use and modify as needed.