build-val.mjs — VAL (Value Above League) engine (S189)
VAL is a per-season, single-number player-value metric — our answer to PFR's AV, but position-aware, era-adjusted, availability-aware, and transparent. Said out loud "val." Works across ALL sports we host (NFL, NBA, MLB, NHL, MLS): the engine is generic, only the per-sport SPORT_CONFIGS (value stats, weights, playing-time basis) differ.
How it improves on AV: • Era-adjusted BY CONSTRUCTION — z-scored against the OTHER players at the same position IN THAT SAME SEASON, so different eras are automatically comparable. • Position/role-fair — every group has its own value-stat weights and season baseline. • Availability-aware — a per-appearance rate is scaled by playing time, so a full season outvalues a half one without over-rewarding a hot cameo. • Transparent — the weights are right here in the open.
Method (per player-season): weighted composite z of the group's value stats (per- appearance for counting stats, raw for rates) → friendly scale → × availability → × honors nudge. Career VAL = sum; weighted VAL = recency-weighted (wAV-style). Output: data/{sport}/val.json (index only — never mutates profiles).
Run: node scripts/build-val.mjs --sport nfl (or nba|mlb|nhl|mls|all)