This project implements a transaction categorizer that reads transactions from a Redis queue, categorizes them using machine learning and rule-based approaches, and updates the results in a database. It's designed to process financial transactions efficiently and accurately.
.
├── app.py
├── compose.yaml
├── config.yaml
├── Dockerfile
├── logs
│ └── app.log
├── model_files
│ ├── training_data.joblib
│ └── transaction_categorization_model.joblib
├── requirements.txt
├── scheduler.py
└── src
├── database
│ ├── db_connector.py
│ └── db_utils.py
├── models
│ └── models.py
├── transaction_categorization
│ ├── categorization_rules.py
│ ├── categorize.py
│ ├── data_loader.py
│ └── model_trainer.py
└── utils
├── category_files
│ ├── keyword_categories.yaml
│ └── merchant_categories.yaml
├── config_utils.py
├── logging_utils.py
└── utils.py
- Redis Queue: Transactions are read from a Redis queue for processing.
- Categorization Engine: Utilizes both machine learning (ML) and rule-based approaches for accurate categorization.
- Database Connector: Manages connections and updates to the database.
- Scheduler: Manages the timing and flow of ml model updation.
-
Clone the repository:
git clone [repository-url] cd transaction-categorizer
-
Install dependencies:
pip install -r requirements.txt
-
Set up Redis:
- Ensure Redis is installed and running on your system.
- Update the Redis connection details in
config.yaml
.
-
Configure the database:
- Update database connection details in
config.yaml
.
- Update database connection details in
-
Start the main application:
python -m app
-
(Optional) Run the scheduler separately:
python scheduler.py
Adjust settings in config.yaml
:
- Redis connection details
- Database connection details
- Model file paths
- Logging configurations
To run the application using Docker:
-
Build the Docker image:
docker build -t transaction-categorizer .
-
Run the container:
docker-compose up -d
Refer to README.Docker.md
for more detailed Docker instructions.
Logs are stored in logs/app.log
. Configure logging levels in config.yaml
.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
FedhaTrac - [email protected]
Project Link: https://github.com/Fedharac/fedhatrac-categorizer-service