feat: fuzzy matching Picnic ↔ Leclerc + page /matches dans le dashboard

Nouvelle table product_matches (status: pending/validated/rejected).
Matching via RapidFuzz token_sort_ratio, seuil configurable (défaut 85%).

Workflow :
  1. python -m tickettracker.cli match [--threshold 85]
     → calcule et stocke les paires candidates
  2. http://localhost:8000/matches
     → l'utilisateur valide ou rejette chaque paire
  3. La comparaison de prix enrichie avec les paires validées

Nouvelles dépendances : rapidfuzz, watchdog (requirements.txt).
10 tests ajoutés (test_matcher.py), tous passent.
Suite complète : 129 passent, 1 xfail, 0 échec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 18:02:48 +01:00
parent f360332626
commit be4d4a7076
13 changed files with 804 additions and 23 deletions

View File

@@ -38,7 +38,12 @@
<tbody>
{% for p in products %}
<tr>
<td>{{ p.name }}</td>
<td>
{{ p.name_display }}
{% if p.match_type == 'fuzzy' %}
<span class="badge-fuzzy" title="Correspondance fuzzy validée">~</span>
{% endif %}
</td>
<td>{{ "%.2f"|format(p.price_picnic) }} €</td>
<td>{{ "%.2f"|format(p.price_leclerc) }} €</td>
<td class="{% if p.diff > 0 %}diff-positive{% elif p.diff < 0 %}diff-negative{% endif %}">
@@ -56,7 +61,12 @@
</table>
</div>
<p><small>Positif = Leclerc plus cher, négatif = Picnic plus cher.</small></p>
<p>
<small>Positif = Leclerc plus cher, négatif = Picnic plus cher.</small><br>
<small><span class="badge-fuzzy">~</span> = correspondance fuzzy validée (noms différents, même produit)</small>
</p>
<p><a href="/matches">Gérer les correspondances fuzzy →</a></p>
{% endif %}
{% endblock %}