Session 47: Name normalization + grade intel + ticker polish (2149 tests)

- Name normalization completed: NICKNAMES table (Matt↔Matthew, Mike↔Michael...)
  resolved in nameKey, parenthetical team-tag strip "(STL)", verified accent-fold
  (Iván/Ivan, José/Jose). Slate strip now DISPLAYS the normalized de-dotted name
  ("AJ Ewing" not "A.J. Ewing") via buildPlayerStripsFromProps.
- Complete MLB VYNDR INTELLIGENCE: mlbGameLogFeatures derives rest_days (days off
  between latest games; 0=B2B) + ab_per_game (usage). buildIntelFields renders
  usage as "X AB/G", rest as B2B/Xd, matchup from bvp_advantage fallback.
- Ticker SCAN dedup: pushTickerItems keeps one SCAN per sport (sport field or
  text-prefix parse for legacy); MOVE/GRADE preserved; cap 50.
- BOMBER threshold prorated for mid-season (hr>=15 strong / >=10 mod) so June
  sluggers classify BOMBER not FLEX/DRIVER.

Backend 2122 -> 2149 tests (+27), 179 suites. Web build clean (exit 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-19 01:45:36 -04:00
parent c8fc9f577e
commit 78db55d499
13 changed files with 346 additions and 32 deletions
+8 -4
View File
@@ -193,8 +193,10 @@ function isRelevantGame(game, now = Date.now()) {
}
// ── Pre-graded snapshot overlay (Session 45) ────────────────────────
// Session 46 — key by the normalized name so "A.J. Ewing"/"AJ Ewing" merge.
const { nameKey } = require('./playerName');
// Session 46/47 — key by the normalized name (nicknames/accents/periods/parens)
// so variants merge; DISPLAY the de-dotted, paren-stripped form.
const { nameKey, normalizeName } = require('./playerName');
const displayName = (raw) => normalizeName(raw).display || String(raw || '');
const gradeKey = (player, stat) => `${nameKey(player)}|${String(stat || '').toLowerCase()}`;
const sideCh = (dir) => (String(dir || 'over').toLowerCase() === 'under' ? 'U' : 'O');
@@ -257,7 +259,7 @@ function buildPlayerStripsFromProps(gameProps, gradeIndex, deltaIndex, now = Dat
const rec = gradeIndex[gradeKey(p.player, p.stat_type || p.stat)];
if (!byPlayer[pk]) {
byPlayer[pk] = {
player: p.player,
player: displayName(p.player),
team: p.team || '',
archetype: rec && rec.archetype ? { primary: rec.archetype } : undefined,
stats: [],
@@ -265,7 +267,9 @@ function buildPlayerStripsFromProps(gameProps, gradeIndex, deltaIndex, now = Dat
};
order.push(pk);
} else {
if (String(p.player).length > String(byPlayer[pk].player).length) byPlayer[pk].player = p.player;
// Display the longest (most complete) de-dotted variant seen.
const cand = displayName(p.player);
if (cand.length > String(byPlayer[pk].player).length) byPlayer[pk].player = cand;
if (!byPlayer[pk].archetype && rec && rec.archetype) byPlayer[pk].archetype = { primary: rec.archetype };
}
if (rec) {