mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 19:56:18 -04:00
Expand React race hub analytics
This commit is contained in:
@@ -187,3 +187,10 @@ After v1:
|
||||
- Add Dataset Status, Strategy, and Position Evolution views.
|
||||
- Use real local-first data where available and honest missing states otherwise.
|
||||
- Continue frontend work with Claude.
|
||||
|
||||
### Phase 7: Analytics Data Foundation
|
||||
|
||||
- Return to Cursor for backend work.
|
||||
- Add local-first store, ingestion, and Race Hub API support for stints,
|
||||
positions, and related analytics datasets.
|
||||
- Keep React Strategy/Position views honest until real data is available.
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# Phase 7 Analytics Data Foundation
|
||||
|
||||
## Purpose
|
||||
|
||||
Phase 7 returns to backend work. Phase 6 added honest frontend placeholders for
|
||||
strategy and position evolution, but the Race Hub API does not yet expose the
|
||||
local datasets needed to draw those views.
|
||||
|
||||
The goal is to expand the local store, ingestion, and Race Hub read model with
|
||||
the first analytics datasets.
|
||||
|
||||
## Scope
|
||||
|
||||
Add local-first support for:
|
||||
|
||||
- laps;
|
||||
- stints;
|
||||
- pit stops;
|
||||
- race control;
|
||||
- weather;
|
||||
- positions, if volume and schema stay manageable.
|
||||
|
||||
Prioritize stints and positions because they unlock the Strategy and Position
|
||||
Evolution views.
|
||||
|
||||
## Backend Work
|
||||
|
||||
Expected changes:
|
||||
|
||||
- add SQLite tables and migrations for the selected datasets;
|
||||
- add store upsert/read methods;
|
||||
- extend `internal/ingest` session ingestion;
|
||||
- extend `internal/query.RaceHub`;
|
||||
- extend `/api/v1/race-hub` metadata counts;
|
||||
- keep raw payload provenance for every fetched endpoint.
|
||||
|
||||
## Guardrails
|
||||
|
||||
- Keep ingestion idempotent.
|
||||
- Keep tests offline.
|
||||
- Do not fetch OpenF1 directly from React.
|
||||
- Do not persist high-volume car telemetry yet.
|
||||
- If positions are too large for this phase, document the limit and implement
|
||||
stints/pits first.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- Store migrations and CRUD tests pass.
|
||||
- Ingestion writes new datasets and raw payloads.
|
||||
- Race Hub API exposes new datasets with metadata.
|
||||
- Existing React placeholders can detect available stints/positions.
|
||||
- Focused Go tests pass.
|
||||
@@ -61,8 +61,10 @@ not implementation tickets yet.
|
||||
implementation slice for the production Web UI.
|
||||
- [14 Phase 6 React Race Hub Analytics](14-phase-6-react-race-hub-analytics.md):
|
||||
next frontend slice for strategy, position, and richer Race Hub views.
|
||||
- [Claude Phase 6 Prompt](claude-phase-6-react-race-hub-analytics-prompt.md):
|
||||
current handoff prompt for the next Claude frontend phase.
|
||||
- [15 Phase 7 Analytics Data Foundation](15-phase-7-analytics-data-foundation.md):
|
||||
backend slice for laps, stints, pits, race control, weather, and positions.
|
||||
- [Cursor Phase 7 Prompt](cursor-phase-7-analytics-data-foundation-prompt.md):
|
||||
current handoff prompt for the next Cursor backend phase.
|
||||
|
||||
## External References
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# Claude Prompt: Phase 6 React Race Hub Analytics
|
||||
|
||||
You are continuing the React frontend work for `box-box`.
|
||||
|
||||
Phase 5 added the Vite + React + TypeScript app under `frontend/` and built the
|
||||
first Race Hub route using:
|
||||
|
||||
```text
|
||||
GET /api/v1/race-hub?session_key=...
|
||||
```
|
||||
|
||||
Your task is Phase 6: expand Race Hub into a richer analysis surface while
|
||||
keeping the design F1-native and operational.
|
||||
|
||||
## Read First
|
||||
|
||||
Read:
|
||||
|
||||
- `frontend/README.md`
|
||||
- `frontend/src/pages/RaceHubPage.tsx`
|
||||
- `frontend/src/styles/app.css`
|
||||
- `frontend/src/types.ts`
|
||||
- `documentations/refactor/06-visual-design-direction.md`
|
||||
- `documentations/refactor/13-phase-5-react-race-hub.md`
|
||||
- `documentations/refactor/14-phase-6-react-race-hub-analytics.md`
|
||||
- `internal/query/racehub.go`
|
||||
|
||||
## Goal
|
||||
|
||||
Add a more useful Race Hub interaction model: tabs or segmented views for
|
||||
classification, grid, strategy, position evolution, and dataset status.
|
||||
|
||||
## Required Work
|
||||
|
||||
1. Add a compact Race Hub tab/segmented control.
|
||||
2. Preserve the existing classification and grid views.
|
||||
3. Add a Dataset Status view that makes available/missing datasets very clear.
|
||||
4. Add Strategy and Position Evolution views with honest missing states if the
|
||||
backend does not yet expose enough data.
|
||||
5. Improve the desktop information hierarchy so the timing table feels more
|
||||
legible and intentional.
|
||||
6. Preserve the mobile table fix: active phone columns must fit the viewport.
|
||||
7. Add or update frontend tests.
|
||||
|
||||
## Guardrails
|
||||
|
||||
- Do not fake analytics data.
|
||||
- Do not fetch OpenF1 directly from React.
|
||||
- Do not start live timing React work.
|
||||
- Avoid card sludge and generic SaaS dashboard patterns.
|
||||
- Keep old Web UI behavior intact.
|
||||
- Make backend changes only if they are tiny API contract fixes.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm test -- --run
|
||||
npm run build
|
||||
cd ..
|
||||
go build -o /tmp/box-box ./cmd/main.go
|
||||
```
|
||||
|
||||
Visually check desktop and phone widths.
|
||||
|
||||
## Final Response
|
||||
|
||||
Report:
|
||||
|
||||
- views/components added;
|
||||
- API datasets used;
|
||||
- tests/build results;
|
||||
- desktop/mobile visual notes;
|
||||
- any backend data needed for real strategy/position charts.
|
||||
@@ -0,0 +1,72 @@
|
||||
# Cursor Prompt: Phase 7 Analytics Data Foundation
|
||||
|
||||
You are working in the `box-box` repository.
|
||||
|
||||
Phase 6 added React Race Hub analytics tabs, but Strategy and Position Evolution
|
||||
still show honest missing states because the backend does not expose stints or
|
||||
position samples in `/api/v1/race-hub`.
|
||||
|
||||
Your task is Phase 7: expand the local-first backend data foundation for Race
|
||||
Hub analytics.
|
||||
|
||||
## Read First
|
||||
|
||||
- `CLAUDE.md`
|
||||
- `documentations/refactor/15-phase-7-analytics-data-foundation.md`
|
||||
- `internal/store/*`
|
||||
- `internal/ingest/*`
|
||||
- `internal/query/racehub.go`
|
||||
- `internal/api/openf1.go`
|
||||
- `internal/models/types.go`
|
||||
- `frontend/src/components/StrategyView.tsx`
|
||||
- `frontend/src/components/PositionEvolutionView.tsx`
|
||||
|
||||
## Goal
|
||||
|
||||
Add backend support for the datasets needed by strategy and position views,
|
||||
prioritizing stints and positions.
|
||||
|
||||
## Required Work
|
||||
|
||||
1. Add a new SQLite migration for selected analytics tables.
|
||||
2. Add store structs, upserts, and reads.
|
||||
3. Extend session ingestion to fetch and store:
|
||||
- stints;
|
||||
- pit stops if straightforward;
|
||||
- positions if volume is acceptable;
|
||||
- race control and weather if scoped cleanly.
|
||||
4. Store raw payloads for every fetched endpoint.
|
||||
5. Extend `internal/query.RaceHub` with available analytics datasets.
|
||||
6. Update dataset metadata counts.
|
||||
7. Add offline tests with fake OpenF1 source data.
|
||||
|
||||
## Guardrails
|
||||
|
||||
- Do not fake frontend data.
|
||||
- Do not fetch OpenF1 from React.
|
||||
- Do not add high-volume car telemetry.
|
||||
- Keep migrations idempotent.
|
||||
- Keep existing Phase 5/6 React behavior working.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
go test ./internal/store/... ./internal/ingest/... ./internal/query/... ./internal/web/...
|
||||
go build -o /tmp/box-box ./cmd/main.go
|
||||
cd frontend && npm test -- --run && npm run build
|
||||
```
|
||||
|
||||
If `go test ./...` fails only on OpenF1 network integration tests, report it as
|
||||
unrelated.
|
||||
|
||||
## Final Response
|
||||
|
||||
Report:
|
||||
|
||||
- tables added;
|
||||
- datasets ingested;
|
||||
- Race Hub API fields added;
|
||||
- tests/builds run;
|
||||
- whether frontend Strategy/Position tabs now have real data available.
|
||||
Reference in New Issue
Block a user