# Screenshot OCR Validation

Last run: 2026-07-28

Phase 4 provides a local screenshot archive and a reviewable OCR pipeline:

1. Import and permanently archive source images.
2. Assign or correct the screenshot type.
3. Prepare versioned crop artifacts.
4. Run local Tesseract OCR.
5. Parse highlight, passing, rushing, or receiving rows.
6. Compare the immutable parsed row with an editable corrected row.
7. Select the target game and approve corrected rows.
8. Display approved highlights and stat rows in Game Center.

Changing OCR text or rerunning OCR invalidates the extraction's parsed-row draft and
approval metadata. Previously published records remain available until corrected rows
are approved again.

## Automated Checks

Command:

```powershell
npm test
```

Parser coverage:

- Clipped passing touchdown glyphs.
- Rushing row cleanup.
- Receiving player-name cleanup.
- Highlight parsing against target-game context.
- Prevention of team inference outside the target game.

Persistence coverage:

- Raw and corrected rows survive SQLite reload.
- Approval metadata records kind, game, row count, and timestamp.
- Overlapping screenshots dedupe the same game/type/team/player stat row.
- Editing OCR text invalidates stale parsed rows and approval metadata.

## Live Archive Smoke Check

The Electron app opened the existing local data after migration with:

- 1 stored snapshot.
- 11 archived screenshots.
- 26 historical extraction attempts.
- Source and crop previews loading from the permanent archive.
- No renderer error banner.

Historical extractions created before corrected-row support remain readable. Reparse
one of those extractions to populate separate `rawRows` and corrected `rows`.

## Verification

```powershell
npm test
npm run build
```

Both commands pass. The production build includes the Electron main process, preload
bridge, and renderer.
