A Python application that analyzes bank statements and generates financial summaries. Supports both local file processing and cloud storage integration.
- π Multi-Bank Support - HDFC, SBI, and extensible for other banks
- π Local & Cloud Storage - Work with local files or Google Drive
- οΏ½ Smart Transaction Parsing - Automatic merchant categorization
- π Excel Reports - Professional formatted output with charts
- π§ͺ Comprehensive Testing - Full test suite included
- Python 3.7+
- pip package manager
-
Clone the repository:
git clone <repository-url> cd finance-scprit
-
Create virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create configuration file:
cp config.local.example.json config.json
-
Organize your files:
data/ βββ Finance.xlsx # Main finance spreadsheet βββ banks/ # Bank statements folder βββ HDFC/2024/ β βββ BankstatementJan.xlsx β βββ BankstatementFeb.xlsx βββ SBI/2024/ βββ BankstatementJan.xlsx -
Update config.json:
{ "storage_type": "local", "local_base_path": "./data", "bank_folder_id": "banks", "finance_file_id": "Finance.xlsx" }
-
Set up Google Drive API:
- Follow detailed instructions in
SETUP_INSTRUCTIONS.md - Create credentials in Google Cloud Console
- Download credentials JSON file
- Follow detailed instructions in
-
Create cloud configuration:
{ "storage_type": "cloud", "cloud_provider": "google_drive", "bank_folder_id": "your_google_drive_folder_id", "finance_file_id": "your_finance_xlsx_file_id" }
python main.py# Run all tests
python tests/run_tests.py
# Run specific test
python tests/test_hdfc_parsing.py- HDFC Bank - Full support with UPI transaction parsing
- State Bank of India (SBI) - Complete transaction analysis
- Extensible - Easy to add support for other banks
- Excel files (.xlsx, .xls)
- CSV files (with proper bank statement format)
- Excel file with professional formatting (current)
- (Planned) Optional CSV / JSON exporters will return later once stabilized
File not found errors:
- Check file paths in
config.json - Ensure files exist and are accessible
- Verify folder structure matches configuration
Permission errors:
- Close Excel files before running
- Check file/folder permissions
- Run terminal as administrator if needed (Windows)
Import errors:
- Activate virtual environment:
source venv/bin/activate - Install dependencies:
pip install -r requirements.txt - Check Python version:
python --version(3.7+ required)
Cloud storage issues:
- Verify Google Drive API setup in
SETUP_INSTRUCTIONS.md - Check credential files and permissions
- Ensure file IDs in config are correct
For detailed setup instructions and troubleshooting:
- See
SETUP_INSTRUCTIONS.mdfor Google Drive API setup - Check test files in
/tests/for usage examples - Review configuration templates in project root
finance-scprit/
βββ main.py # Entry script delegating to package
βββ finance_analyzer/ # Core application package
β βββ main.py # FinanceAnalyzer orchestrator (async)
β βββ constants.py # Shared constants & category lists
β βββ models.py # Domain models (Transaction, etc.)
β βββ transaction_processor.py # Pure categorization & merchant mapping application
β βββ config_manager.py # Loads and validates config
β βββ bank_parsers/ # Bank-specific statement normalizers
β β βββ base.py
β β βββ hdfc.py
β β βββ sbi.py
β β βββ registry.py # Bank parser registry
β βββ statement_readers/ # Reads raw bank statement files
β β βββ base.py
β β βββ excel_reader.py
β β βββ factory.py
β βββ categorization_strategy/ # Strategy pattern for pending categorizations
β β βββ base.py
β β βββ user_prompt.py
β β βββ auto.py
β βββ interaction/ # User interaction (CLI async port)
β β βββ port.py # Interaction port & DTOs
β β βββ cli_async_port.py # Concrete CLI implementation
β βββ file_access/ # Storage abstraction (local / future cloud)
β β βββ base.py
β β βββ local_accessor.py
β β βββ cloud_accessor.py
β β βββ factory.py
β βββ cloud_storage/ # Cloud provider adapters
β β βββ base.py
β β βββ google_drive_api.py
β β βββ dropbox_api.py
β β βββ onedrive_api.py
β β βββ factory.py
β βββ services/
β β βββ merchant_mapping_store.py # Dirty-tracked merchant mapping persistence
β β βββ summary/ # Summary domain + service (pandas isolated here)
β β βββ models.py # SummaryData & SummaryRow domain
β β βββ service.py # SummaryService building SummaryData
β βββ writers/ # Output writers (domain-facing)
β β βββ base.py
β β βββ excel_writer.py # Converts domain -> Excel (pandas internally)
β β βββ factory.py
βββ data/ # (Example) Local data directory (not always committed)
βββ config.json # Active configuration
βββ config.json.template # Template configuration
βββ config.local.example.json # Example local configuration
βββ requirements.txt # Python dependencies
βββ README.md
βββ SETUP_INSTRUCTIONS.md # Cloud setup instructions
βββ setup.sh # Optional setup script
βββ credentials.json / token.json # OAuth artifacts (should be gitignored in real setup)
βββ LICENSE
- Create parser in
finance_analyzer/bank_parsers/ - Extend from
Bankbase class - Implement
parse_transaction()method - Register in
bank_parsers/registry.py
- All code changes should include tests
- Run full test suite before submitting
- Follow existing code patterns and structure