1 unstable release
new 0.2.2 | Feb 1, 2025 |
---|
#16 in #treasury
210KB
3K
SLoC
tktax-check is a Rust crate within the TKTAX ecosystem, providing a mechanism to classify and retrieve Check or Treasury transactions from a financial Account. Drawing upon underlying modules (tktax_3p, tktax_account, tktax_line_item, tktax_money, tktax_transaction, tktax_transaction_category), it encapsulates domain-specific transaction logic to facilitate reporting, analysis, and high-level accounting workflows.
Overview
-
Core Structure
TheCheckOrTreasuryTransaction<'a, TxCat>
struct (whereTxCat: TransactionCategory + 'static
) provides a specialized aggregator for a transaction (from transactio in Latin) and its category (from Κατηγορία in Ancient Greek).- Implements the
LineItem<TxCat>
trait for uniformity with other items in the TKTAX pipeline. - Exposes
tx_amount()
,category()
, andtx()
to integrate seamlessly with higher-level logic.
- Implements the
-
Category Prediction
Uses aCategoryMap<TxCat>
to predict categories from transaction descriptions. If a transaction belongs to a recognized "treasury/check" category, it is collected into a type-safe vector for further accounting or auditing procedures. -
Example Usage
use tktax_check::GetTreasuryTransactionsAndChecks; fn process_account(account: &Account, category_map: &CategoryMap<YourTxCat>) { let treasury_and_checks = account.treasury_transactions_and_checks(category_map); for item in treasury_and_checks { println!("{}", item); } }
This function retrieves and prints all relevant Check or Treasury transactions from the given
Account
.
Features
-
Idempotent Classification
Repeated calls on the same data set yield consistent results without data mutation side effects. -
Sorting by Category
Retrieved transactions are automatically sorted by their respective category. This sorting allows you to programmatically group checks and treasury transactions in ascending category order. -
Minimal Coupling
The crate is designed to be orthogonally integrated with the existing TKTAX modules while retaining an isolated core logic.
Getting Started
Add the following to your Cargo.toml
:
[dependencies]
tktax-check = "0.1.0"
Ensure your project also includes dependencies for the underlying TKTAX modules (e.g., tktax_3p
, tktax_account
, etc.) as needed.
Contributing
Contributions to tktax-check are welcome. Please open issues or merge requests on the repository to propose changes. For complex new features or refactors, discussion is appreciated before submission to maintain design coherence.
Dependencies
~26–38MB
~644K SLoC