feat(receipt-import): enhance receipt processing with new category rules and add unit tests
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -120,8 +120,9 @@ Regler:
|
||||
? (parsed.confidence as 'high' | 'medium' | 'low')
|
||||
: 'medium';
|
||||
|
||||
// Guardrail: för låg/medel konfidenspoäng, remmappa till L1-föräldern
|
||||
if (confidence === 'low' || confidence === 'medium') {
|
||||
// Guardrail: endast låg konfidens remappas till L1-förälder.
|
||||
// Medium får behålla sin specifika kategori för att inte tappa precision.
|
||||
if (confidence === 'low') {
|
||||
const l1Name = matchedCategory.path.split(' > ')[0];
|
||||
const l1 = categories.find((c) => c.path === l1Name);
|
||||
if (l1 && l1.id !== matchedCategory.id) {
|
||||
|
||||
Reference in New Issue
Block a user