Commit 3dfa9ec
Enhance accounting network generation with domain knowledge
Add comprehensive domain-aware features to improve flow matching:
Account Classification System:
- AccountClass enum (Asset, Liability, Equity, Revenue, COGS, Expense,
Tax, Intercompany, Suspense, OtherIncomeExpense, Unknown)
- Numeric classification (1xxx=Asset, 2xxx=Liability, etc.)
- Keyword-based classification fallback (cash, receivable, payable, etc.)
VAT/Tax Detection:
- VatDetector with known rates for multiple jurisdictions
(UK 20%, Germany 19%, France 20%, Canada GST 5%/HST 13-15%)
- Automatic VAT split detection from gross/net amount ratios
- VatPattern struct with rate, amounts, and input/output VAT flags
Transaction Pattern Recognition:
- TransactionPattern enum (SimpleSale, SaleWithVat, SimplePurchase,
PurchaseWithVat, Payment, Receipt, Payroll, Depreciation, Accrual,
AccrualReversal, Transfer, Intercompany, CostAllocation, Adjustment)
- PatternMatcher with configurable patterns
- Pattern detection based on account class combinations
Enhanced Flow Metadata:
- from_account_class, to_account_class on flows
- pattern, vat_rate, is_tax_flow, is_intercompany flags
- confidence_factors list for matching rationale
Confidence Boosting:
- Pattern-based confidence adjustments (capped at 1.0)
- Higher confidence for recognized transaction patterns
- Enhanced statistics tracking (VAT entries, pattern counts)
Also includes clippy fixes:
- Domain::from_str() renamed to Domain::parse()
- Manual strip_prefix usage
- Derive Default where applicable
- Unused variable prefixes
Tests: 75 tests pass (60 original + 15 new enhanced feature tests)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 40bd9f0 commit 3dfa9ec
10 files changed
Lines changed: 1593 additions & 181 deletions
File tree
- crates
- rustkernel-accounting/src
- rustkernel-core/src
- rustkernel-derive/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
| 221 | + | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
| |||
303 | 302 | | |
304 | 303 | | |
305 | 304 | | |
306 | | - | |
| 305 | + | |
307 | 306 | | |
308 | 307 | | |
309 | 308 | | |
| |||
313 | 312 | | |
314 | 313 | | |
315 | 314 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | 315 | | |
327 | 316 | | |
328 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
0 commit comments