The NUBAN Classifier is a Python-based project for validating and classifying Nigerian bank account numbers based on the Nigeria Uniform Bank Account Number (NUBAN) scheme. The system uses the NUBAN algorithm defined by the Central Bank of Nigeria (CBN) to calculate check digits, validate account numbers, and identify the banks to which they belong.
- Check Digit Calculation: Computes the check digit for a NUBAN account number using a standardized algorithm.
- Validation: Verifies the integrity of a NUBAN account number based on its check digit.
- Bank Classification: Identifies possible banks for a given account number.
- Python 3.7+
-
Clone the repository:
git clone https://github.com/babaniyi/nuban_classifier.git cd nuban-classifier
-
Install dependencies:
pip install -r requirements.txt
-
Run tests to verify the installation:
pytest tests/
from nuban_classifier import classify_account_number
# Example account number
account_number = "1234567890"
matching_banks = classify_account_number(account_number)
if matching_banks:
print(f"The account number may belong to: {', '.join(matching_banks)}")
else:
print("No matching banks found.")
calculate_check_digit(serial_number, bank_code)
: Calculates the check digit for a given serial number and bank code.classify_account_number(account_number)
: Identifies all possible banks an account number may belong to.
.
├── nuban_classifier.py # Core module with validation and classification logic
├── tests/ # Unit tests
│ ├── test_account_classifier.py
├── requirements.txt # List of dependencies
├── README.md # Project documentation
Use pytest
to run the included unit tests:
pytest tests/
- Check Digit Calculation:
- Tests for correctness of the computed check digit.
- Account Classification:
- Verifies the identification of valid and invalid account numbers.
This project is licensed under the MIT License. See the LICENSE file for details.