An intelligent bank statement analysis tool that leverages artificial intelligence to automatically process, categorize, and analyze financial transactions from bank statements. This application provides insights into spending patterns, transaction categorization, and financial analytics.
- Automated Transaction Processing: Upload and process bank statements in various formats
- AI-Powered Categorization: Intelligent categorization of transactions using machine learning
- Financial Analytics: Generate comprehensive reports and insights from transaction data
- Asynchronous Processing: Background task processing using Celery for handling large datasets
- Real-time Monitoring: Built-in task monitoring with Celery Flower
- RESTful API: Clean API endpoints for integration with other applications
- Data Visualization: Interactive charts and graphs for financial insights
- Backend: Python with Flask/FastAPI
- Task Queue: Celery with Redis/RabbitMQ
- AI/ML: Machine learning models for transaction analysis and categorization
- Database: PostgreSQL/SQLite for data persistence
- Monitoring: Celery Flower for task monitoring
- Containerization: Docker support (optional)
- Python 3.8+
- Redis or RabbitMQ (for Celery message broker)
- PostgreSQL (if using PostgreSQL as database)
-
Clone the repository
git clone <repository-url> cd AI-bank-statement-analyzer
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
cp .env.example .env # Edit .env file with your configuration -
Initialize database
alembic upgrade head
if a change is made to the DB then run this command to perform the migration(s)
alembic revision --autogenerate -m "migration_name" alembic upgrade head
You can also run the application using Docker for easier deployment and development:
-
Build and run with Docker Compose
docker-compose up --build
-
Or build individual containers
docker build -t ai-bank-analyzer . docker run -p 5000:5000 ai-bank-analyzer
Ensure Redis or RabbitMQ is running on your system.
For Redis:
redis-servercelery -A app.tasks.celery_app worker -l infocelery -A app.tasks.celery_app flower --port=5555python app.pyThe application will be available at:
- Main Application: http://localhost:8000
- Celery Flower Dashboard: http://localhost:5555
POST /api/upload
Content-Type: multipart/form-data
GET /api/analysis/{analysis_id}
GET /api/categories
GET /api/summary/{period}
-
Upload Bank Statement: Use the web interface or API to upload your bank statement (PDF, CSV, or Excel format)
-
Processing: The system will automatically:
- Extract transaction data
- Clean and normalize the data
- Apply AI models for categorization
- Generate insights and analytics
-
View Results: Access your analysis through:
- Web dashboard for visual insights
- API endpoints for programmatic access
- Export options for further analysis
Key configuration options in your .env file:
# Database
DATABASE_URL=postgresql://user:password@localhost/dbname
# Celery
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
# AI Models
OPENAI_API_KEY=your_openai_key_here
# Application
FLASK_ENV=development
SECRET_KEY=your_secret_key_hereAccess the Celery Flower dashboard at http://localhost:5555 to monitor:
- Active tasks
- Task history
- Worker status
- Task execution times
- Failed tasks and error logs
Monitor application logs for debugging and performance tracking:
tail -f logs/app.log- PDF: Bank statements in PDF format
- CSV: Comma-separated transaction files
- Excel: .xlsx and .xls files
- Transaction Categorization: Automatic categorization into predefined categories (Food, Transportation, Entertainment, etc.)
- Merchant Recognition: Intelligent merchant name normalization
- Spending Pattern Analysis: Identification of spending trends and patterns
- Anomaly Detection: Detection of unusual transactions
- Budget Recommendations: AI-powered budget suggestions based on spending history
-
Celery Worker Not Starting
- Ensure message broker (Redis/RabbitMQ) is running
- Check celery configuration in settings
-
File Upload Errors
- Verify file format is supported
- Check file size limits
- Ensure proper permissions
-
Database Connection Issues
- Verify database credentials
- Ensure database server is running
- Check network connectivity
Run the application in debug mode for detailed error messages:
export FLASK_ENV=development
python app.py- Batch Processing: Large files are processed in chunks
- Caching: Redis caching for frequently accessed data
- Database Indexing: Optimized database queries
- Async Processing: Background processing for time-intensive tasks
