[HRT-83] feat: Météo & terrain intégrés dans prédictions ML (Premium) #10

Merged
admin merged 1 commits from feature/HRT-83-meteo-terrain-ml-predictions into master 2026-04-30 08:40:16 +02:00
Owner

Résumé

Intégration des données météo et terrain dans les prédictions ML pour les plans Premium/Pro.

Changements

scoring_v2.py

  • Ajout get_terrain_condition(penetrometre_intitule) : normalise le pénétromètre PMU → bon / souple / lourd / inconnu
  • Ajout compute_weather_impact(weather_data, terrain_condition) : calcule un delta de score sur [-5, +5]
  • score_cheval_v2() accepte weather_data=Nonebackward-compatible (free tier inchangé)

api_v1/routes/predictions.py

  • _fetch_ml_predictions() : nouveau paramètre include_weather=False
  • Quand include_weather=True : LEFT JOIN pmu_courses (pénétromètre) + pmu_meteo (date+num_reunion)
  • /predictions/all : retourne terrain_condition + weather_impact par cheval
  • /predictions/top3 : inchangé (free tier, pas de champs météo)

api_v1/routes/valuebets.py

  • Même LEFT JOIN météo/terrain dans /valuebets
  • Chaque value bet inclut terrain_condition + weather_impact

Tests

  • 42/42 tests pytest tests/test_api_v1.py passent
  • Tests unitaires scoring_v2 : backward-compat, terrain parsing, weather_impact
  • Schéma DB vérifié : JOIN pmu_meteo sur date_programme + num_reunion (UNIQUE ✓)

Ticket

HRT-83

## Résumé Intégration des données météo et terrain dans les prédictions ML pour les plans Premium/Pro. ## Changements ### `scoring_v2.py` - Ajout `get_terrain_condition(penetrometre_intitule)` : normalise le pénétromètre PMU → `bon` / `souple` / `lourd` / `inconnu` - Ajout `compute_weather_impact(weather_data, terrain_condition)` : calcule un delta de score sur [-5, +5] - `score_cheval_v2()` accepte `weather_data=None` — **backward-compatible** (free tier inchangé) ### `api_v1/routes/predictions.py` - `_fetch_ml_predictions()` : nouveau paramètre `include_weather=False` - Quand `include_weather=True` : LEFT JOIN `pmu_courses` (pénétromètre) + `pmu_meteo` (date+num_reunion) - `/predictions/all` : retourne `terrain_condition` + `weather_impact` par cheval - `/predictions/top3` : **inchangé** (free tier, pas de champs météo) ### `api_v1/routes/valuebets.py` - Même LEFT JOIN météo/terrain dans `/valuebets` - Chaque value bet inclut `terrain_condition` + `weather_impact` ## Tests - 42/42 tests `pytest tests/test_api_v1.py` passent - Tests unitaires `scoring_v2` : backward-compat, terrain parsing, weather_impact - Schéma DB vérifié : JOIN `pmu_meteo` sur `date_programme + num_reunion` (UNIQUE ✓) ## Ticket HRT-83
admin added 1 commit 2026-04-29 15:35:47 +02:00
- scoring_v2.py : ajout get_terrain_condition() + compute_weather_impact()
  score_cheval_v2() accepte weather_data=None (backward-compat préservée)
  Impact météo/terrain sur [-5, +5] pts selon pénétromètre + vent + temp

- api_v1/routes/predictions.py : _fetch_ml_predictions() avec include_weather=True
  LEFT JOIN pmu_courses (pénétromètre) + pmu_meteo sur date+num_reunion
  /predictions/all → terrain_condition + weather_impact dans chaque row
  /predictions/top3 → inchangé (free tier, pas de champs météo)

- api_v1/routes/valuebets.py : même LEFT JOIN météo/terrain
  /valuebets → terrain_condition + weather_impact dans chaque value bet

Tests : 42/42 passent (pytest tests/test_api_v1.py)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
admin merged commit 91134e2f3f into master 2026-04-30 08:40:16 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/turf_saas#10