Commit Graph

9 Commits

Author SHA1 Message Date
1d8f139c7c feat: inclure l'unité/poids dans la normalisation LLM
fetch_unnormalized() remonte maintenant la colonne `unit` (ex: "250 g",
"20 sachets"). Le normaliseur concatène name_raw + unit avant d'envoyer
au LLM, qui peut ainsi placer le poids dans le champ format.

Résultat : "Haribo dragibus" → "Dragibus | Haribo | 250g"
au lieu de   "Haribo dragibus" → "Dragibus | Haribo | -"

Améliore aussi la qualité du fuzzy matching Picnic ↔ Leclerc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:35:46 +01:00
93333afffa fix: _eml_to_html retourne le payload QP brut (accents non cassés)
Problème : email.policy.default + get_content() décode déjà les accents
(=C3=A9 → é), puis picnic._decode_and_parse() les re-encode en ASCII
avec errors="replace" → les accents devenaient "?" → date introuvable.

Solution : utiliser l'ancienne API email.message_from_bytes() sans policy
et get_payload(decode=False) pour récupérer le corps brut encore QP-encodé,
exactement comme un fichier .html sauvegardé depuis le mail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:27:58 +01:00
8af474c928 feat: support .eml Picnic + correction fuzzy matching
Support .eml :
  - pipeline._eml_to_html() extrait le HTML des emails Picnic
  - Déposer un .eml dans inbox/picnic/ fonctionne comme un .html
  - Pas de nouvelle dépendance (module email stdlib)
  - 5 tests ajoutés (test_eml.py)

Correction fuzzy matching :
  - Le score est maintenant calculé sur le nom seul (avant " | ")
  - Évite que les différences de marque/poids pénalisent le score
  - Résultat : 8 paires trouvées vs 0 avant la correction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:23:57 +01:00
be4d4a7076 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>
2026-02-25 18:02:48 +01:00
f360332626 feat: watcher — surveillance automatique du dossier inbox/
Surveille inbox/picnic/ et inbox/leclerc/ avec watchdog.
Chaque nouveau fichier est importé automatiquement :
  - succès/doublon → processed/{source}_{date}_{nom}
  - erreur         → failed/{nom} + failed/{nom}.log

Nouvelle commande CLI : python -m tickettracker.cli watch [--inbox] [--db]
22 tests ajoutés (test_watcher.py), tous passent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:02:40 +01:00
268417d4fc Sprint 4 - Dashboard 2026-02-24 20:57:54 +01:00
30e4b3e144 feat: dashboard web FastAPI Sprint 4
Ajout d'un dashboard lecture seule par-dessus la DB SQLite existante.

Fichiers créés :
  - tickettracker/web/queries.py   : 7 fonctions SQL (stats, compare, historique...)
  - tickettracker/web/api.py       : router /api/* JSON (FastAPI)
  - tickettracker/web/app.py       : routes HTML + Jinja2 + point d'entrée uvicorn
  - tickettracker/web/templates/   : base.html, index.html, compare.html, product.html, receipt.html
  - tickettracker/web/static/style.css : personnalisations Pico CSS
  - tests/test_web.py              : 19 tests (96 passent, 1 xfail OCR)

Fichiers modifiés :
  - requirements.txt : +fastapi, uvicorn[standard], jinja2, python-multipart, httpx
  - config.py        : +DB_PATH (lu depuis TICKETTRACKER_DB_PATH)

Lancement : python -m tickettracker.web.app

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 20:04:55 +01:00
1e5fc97bb7 feat: migration Windows → Ubuntu, stabilisation suite de tests
- Ajout venv Python (.venv) avec pip bootstrap (python3-venv absent)
- Correction OCR Linux : marqueur TTC/TVA tolère la confusion T↔I
  (Tesseract 5.3.4 Linux lit parfois "TIc" au lieu de "TTC")
- test_leclerc.py : skipif si Tesseract absent, xfail pour test de somme
  (précision OCR variable entre plateformes, solution LLM vision prévue)
- Résultat : 77 passent, 1 xfail, 0 échec (vs 78 sur Windows)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 18:53:41 +01:00
laurent
bb62bd6eb6 chore: initial commit 2026-02-22 17:59:42 +01:00