Skip to main content

Crate kharcha_core

Crate kharcha_core 

Source
Expand description

kharcha-core — deterministic core of the Kharcha UPI expense tracker.

Rule-based, no AI. Pure functions: SMS/notification text in, structured payment out. Ports of lib/core/* (Dart) + GenericUpiParser.kt + the insertCaptured dedupe rules.

Re-exports§

pub use categorize::categorize;
pub use categorize::normalize_merchant;
pub use categorize::Rule;
pub use dedupe::decide_capture;
pub use dedupe::CaptureDecision;
pub use dedupe::ExistingRow;
pub use dedupe::DRIFT_SECS;
pub use dedupe::WINDOW_MS;
pub use engine::parse;
pub use engine::parse_batch;
pub use engine::ParsedTransaction;
pub use filter::TransactionFilter;
pub use filter::TxRow;
pub use money::parse_amount_paise;
pub use non_transaction::is_non_transaction;
pub use parser::encode_inbox_line;
pub use parser::parse_upi_notification;
pub use parser::ParsedPayment;
pub use split::split_bill_paisa;

Modules§

categorize
dedupe
Capture dedupe rules. Port of the insertCaptured dedupe in lib/data/transaction_repository.dart (DB access stripped out — this file is the pure decision; the caller owns storage).
engine
Unified capture engine — the single entry point that replaces kharcha’s three divergent parsers (Dart generic + Kotlin generic + the bank fleet, which capture_inbox.dart reconciles with an if/else).
ffi
FFI surface (uniffi → Kotlin/JVM first, Swift/Python later). Core modules stay FFI-agnostic (lifetimes, slices, &str); every exported fn takes/returns owned types only. New API? Wrap it here, never in core.
filter
money
non_transaction
Spam rejection. Port of _nonTransactionRe + isNonTransaction in lib/core/upi_parser.dart: recharge/promo/OTP/request/failure texts return None before parsing.
parser
UPI/bank payment parsing from notification/SMS text. Rule-based, no AI. Port of lib/core/upi_parser.dart (parseUpiNotification, _cleanMerchant, encodeInboxLine). Covers UPI apps, bank apps, and messaging apps (amount + payment keyword).
split