Add data quality normalization for cars: mileage in thousands and leasing prices
All checks were successful
Build and Deploy BlaaAi / build-and-deploy (push) Successful in 4m24s

- detect km < 500 on non-new cars (e.g. '130' instead of '130.000')
- detect prices < 5.000 kr (likely monthly leasing rate not sale price)
- flags shown in AI prompt → forces low score (1-3)
- orange warning box in UI distinct from AI warnings
This commit is contained in:
Henrik Jess Nielsen
2026-05-24 19:35:43 +02:00
parent 9299506523
commit 12c3bc3e15
2 changed files with 67 additions and 0 deletions

View File

@@ -425,6 +425,10 @@
const pct = Math.round(score * 10);
const warn = item.ai_warnings
? `<p class="text-xs mt-2" style="color:#dc2626">↑ ${item.ai_warnings}</p>` : "";
const qualityFlags = (item.data_quality_flags || []).length > 0
? `<div class="mt-2 rounded-lg px-3 py-2" style="background:#fff7ed;border:1px solid #fed7aa">
${item.data_quality_flags.map(f => `<p class="text-xs" style="color:#c2410c">${f}</p>`).join("")}
</div>` : "";
const tag = rankTag(score);
const card = document.createElement("div");
@@ -447,6 +451,7 @@
</div>
<p class="text-xs leading-relaxed" style="color:#78716c">${item.ai_reason || ""}</p>
${warn}
${qualityFlags}
</div>
<div class="shrink-0 text-right ml-2">
<p class="font-semibold text-sm tabular-nums">${Number(item.price_dkk || 0).toLocaleString("da-DK")}<span class="text-xs font-normal ml-0.5" style="color:#a8a29e">kr</span></p>