| Crates.io | tktax-analysis |
| lib.rs | tktax-analysis |
| version | 0.2.2 |
| created_at | 2025-02-01 16:25:23.23133+00 |
| updated_at | 2025-02-01 16:25:23.23133+00 |
| description | A robust Rust crate for financial account analysis, histogram generation, donation processing, and more. |
| homepage | |
| repository | https://github.com/klebs6/tktax |
| max_upload_size | |
| id | 1538556 |
| size | 103,533 |
tktax-analysis is a Rust crate dedicated to robust, production-grade tax and financial data analysis (ἀνάλυσις). It integrates multiple transaction sources (e.g., Amazon purchases, charity donatio (Latin), medical records, etc.) and provides an extensible framework for categorization, histogram generation, and summarization. By capitalizing on a composable set of traits and robust error handling, this crate streamlines year-end reporting, business expense analysis, philanthropic contributions, and beyond.
Core capabilities:
AccountAnalysis<TxCat> for any user-defined TransactionCategory.AccountAnalysisHooks enable flexible instantiation of business and medical transaction sets, donation builders, and category maps.AccountAnalysisFlags) to highlight medical/insurance expenses, treasury transactions, checks, and more.use tktax_analysis::*;
use tktax_transaction_category::MyCustomCategory; // a user-defined TxCat
fn main() -> Result<(), AccountError> {
// Acquire program config from your environment or configuration file
let program_config = ProgramConfig::new(/* ... */);
// Construct hooks for specialized analysis
let hooks = AccountAnalysisHooksBuilder::default()
.program_config(program_config)
// Provide user-defined function pointers for custom data initialization
.create_amazon_biz_expenses_fn(Some(my_create_amazon_biz_expenses))
// ...
.build()
.map_err(|e| AccountError::new(/* handle error without unwrap */))?;
// Prepare account list, donation config, etc.
let year = TrackedYear::new(2025);
let accounts = vec![AccountKind::Checking, AccountKind::Credit];
let donation_config = Some(DonationConfig::new(/* ... */));
// Perform the full analysis
hooks.run_analysis::<MyCustomCategory>(year, accounts, donation_config.as_ref())?;
Ok(())
}
TransactionCategory for domain-specific categorization.run_analysis to produce short or comprehensive financial reports.run_analysis fosters end-to-end data ingestion and processing.AccountAnalysisFlags deliver flexible configuration (e.g., partial or complete reports).ShowAccountSummary, ShowMonthlySummary, etc.) let you adapt analysis logic to custom data structures.tktax-analysis is distributed under terms compatible with typical open-source licenses (e.g., MIT). Refer to LICENSE for details.