Spaces:
Sleeping
Sleeping
Update analytics/recommendation_engine.py
Browse files
analytics/recommendation_engine.py
CHANGED
|
@@ -7,6 +7,19 @@ from analytics.recommendation_rules import apply_recommendation_rules
|
|
| 7 |
from models.live_fair_simulator_v3 import build_upcoming_simulated_rows
|
| 8 |
from models.opportunity_model import estimate_plate_appearance_probability
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def build_upcoming_hitter_recommendations(
|
| 12 |
game_row: dict,
|
|
|
|
| 7 |
from models.live_fair_simulator_v3 import build_upcoming_simulated_rows
|
| 8 |
from models.opportunity_model import estimate_plate_appearance_probability
|
| 9 |
|
| 10 |
+
def _lineup_distance_from_slot(slot: str) -> int:
|
| 11 |
+
s = str(slot or "").strip().lower()
|
| 12 |
+
|
| 13 |
+
if s in {"current", "current_batter", "now"}:
|
| 14 |
+
return 0
|
| 15 |
+
if s in {"on_deck", "ondeck", "on-deck"}:
|
| 16 |
+
return 1
|
| 17 |
+
if s in {"in_hole", "inhole", "in-hole"}:
|
| 18 |
+
return 2
|
| 19 |
+
if s in {"three_away", "3_away", "three-away", "3-away"}:
|
| 20 |
+
return 3
|
| 21 |
+
|
| 22 |
+
return 0
|
| 23 |
|
| 24 |
def build_upcoming_hitter_recommendations(
|
| 25 |
game_row: dict,
|