---
title: Add first-half and second-half player game totals to the game sample
type: task
status: completed
description: >-
  The game sample has no player totals scoped to a half, so a question like 130+ first-half
  receiving yards then second-half yards cannot be built; add half-windowed totals the games page
  and its generation agent can filter and summarize.
base_uri: user:task/league/add-half-scoped-player-game-totals.md
created_at: '2026-10-24T20:14:36.625Z'
entity_id: 0932c2de-c723-4200-b103-9f5d385d80d7
finished_at: '2026-10-24T21:52:03.045Z'
owner_identity_uri: █████████████████████████
priority: Medium
public_read: true
relations:
  - relates [[██████████████████████-████-██████-█████████]]
  - relates [[█████████████████████████-█████-████-█████]]
  - relates [[user:task/league/generate-games-views-from-natural-language.md]]
started_at: '2026-10-24T21:12:10.354Z'
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-10-24T21:52:03.045Z'
visibility_analyzed_at: '2026-11-05T23:48:11.317Z'
---

## Context

The first described question on /games (generation 47f1ecf7, 2026-10-24) asked for receivers with 130 or more receiving yards in the first half, and their receiving yards in the second half of those games. The agent could not build it, because the catalogue has no player total scoped to part of a game:

- player_game metrics read the whole game only.
- play metrics carry `half` and `quarter` and can be filtered by them, but a play sample summarizes per-play means, and its filters select plays, not games. So "games where the first-half total reached 130" has no expression.

The agent substituted whole-game receiving yards and recorded the gap as its shortfall.

## Plan

- [x] Choose the shape: separate half-scoped player_game metrics in a `by_half` group (`first_half_receiving_yards`, read with `this_game`). A window was rejected because every existing window means earlier games.
- [x] Derive the half totals from `nfl_plays`: 11 box-score stats per half, from every live play, two-point tries out, overtime in neither half. Calibrated over 2024: the play-derived totals match the gamelog on 99 to 100 percent of player-games.
- [x] Add them to the catalogue, the play-aggregate loader and the value table (league `9193d0e61`), with a loader spec seeding plays across quarters and overtime.
- [x] Teach the generation contract the metrics, with the 130-yard first-half question as its example.
- [x] Deployed with `yarn deploy:all` at league `5000d6d3f` on 2026-10-24. The original question on /games (generation bd4f85bc) then built the first-half filter with second-half yards and no shortfall, in 109 seconds. Read-only against production through the CLI it already answers: 19 receiver games since 2023 with 130+ first-half yards, second-half median 13 (a direct SQL count also gives 19).

## Key locations

- `libs-shared/game-sample/game-sample-catalogue.mjs` and `game-sample-play-metrics.mjs` — the vocabulary
- `libs-server/game-sample/load-game-sample-frames.mjs` — the frame loaders
- `libs-server/games-view/generation/games-view-generation-contract.mjs` — the agent's instructions and worked examples
