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:
85
tickettracker/web/templates/matches.html
Normal file
85
tickettracker/web/templates/matches.html
Normal file
@@ -0,0 +1,85 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Correspondances fuzzy — TicketTracker{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Correspondances Picnic ↔ Leclerc</h1>
|
||||
|
||||
<p>
|
||||
Ces paires ont été détectées automatiquement par fuzzy matching.
|
||||
Validez celles qui désignent le même produit pour enrichir la comparaison de prix.
|
||||
</p>
|
||||
|
||||
<!-- Résumé statistiques -->
|
||||
<div class="stat-grid">
|
||||
<article class="stat-card">
|
||||
<h3>{{ pending | length }}</h3>
|
||||
<p>En attente</p>
|
||||
</article>
|
||||
<article class="stat-card">
|
||||
<h3>{{ validated_count }}</h3>
|
||||
<p>Validées</p>
|
||||
</article>
|
||||
<article class="stat-card">
|
||||
<h3>{{ rejected_count }}</h3>
|
||||
<p>Rejetées</p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
{% if pending %}
|
||||
<article>
|
||||
<h2>Paires à valider</h2>
|
||||
<div class="overflow-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Produit Picnic</th>
|
||||
<th>Prix moy.</th>
|
||||
<th>Produit Leclerc</th>
|
||||
<th>Prix moy.</th>
|
||||
<th>Score</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for m in pending %}
|
||||
<tr>
|
||||
<td>{{ m.name_picnic }}</td>
|
||||
<td>{% if m.price_picnic %}{{ "%.2f"|format(m.price_picnic) }} €{% else %}—{% endif %}</td>
|
||||
<td>{{ m.name_leclerc }}</td>
|
||||
<td>{% if m.price_leclerc %}{{ "%.2f"|format(m.price_leclerc) }} €{% else %}—{% endif %}</td>
|
||||
<td>
|
||||
<small class="match-score {% if m.score >= 95 %}score-high{% elif m.score >= 85 %}score-medium{% else %}score-low{% endif %}">
|
||||
{{ "%.0f"|format(m.score) }}%
|
||||
</small>
|
||||
</td>
|
||||
<td class="match-actions">
|
||||
<form method="post" action="/api/match/{{ m.id }}/validate" style="display:inline">
|
||||
<button type="submit" class="btn-validate">✓ Valider</button>
|
||||
</form>
|
||||
<form method="post" action="/api/match/{{ m.id }}/reject" style="display:inline">
|
||||
<button type="submit" class="btn-reject secondary outline">✗ Rejeter</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{% else %}
|
||||
<article>
|
||||
<p>
|
||||
Aucune paire en attente.
|
||||
{% if validated_count == 0 and rejected_count == 0 %}
|
||||
Lancez d'abord la commande de matching :
|
||||
<pre><code>python -m tickettracker.cli match --threshold 85</code></pre>
|
||||
{% else %}
|
||||
Toutes les paires ont été traitées ({{ validated_count }} validées, {{ rejected_count }} rejetées).
|
||||
{% endif %}
|
||||
</p>
|
||||
</article>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user