Skip to content

Time Projection for Partial Hurdle Run #115

@samuelbaldwin05

Description

@samuelbaldwin05

When a hurdle run ends before the finish (athlete stops early), project the estimated total race time over remaining hurdles plus a fixed final segment (after the hurdles are done it is less clear how long the runner will take) estimate. The client specifically requested this model as it is valuable for coaches to have runners only do a few hurdles.


New Event Type

Add "hurdles_partial" to EventTypeEnum in frontend/src/types/event.types.ts and the equivalent backend enum (wherever event_type is validated — check backend/app/schemas/run_schemas.py
and backend/app/schemas/csv_schemas.py).

When this event type is detected, the hurdle service needs to know the target event (110mH, 100mH, 400mH) to know expected hurdle count and final segment distance. Add target_event as a
required field alongside event_type on run creation for this type.


Backend — Projection Logic

Create backend/app/utils/hurdle_projection.py. Model after hurdle_metrics.py in structure.

Given completed HurdleMetricRow objects:

  1. Fit a linear trend to hurdle_split_ms over hurdle_num (captures fatigue/drift)
  2. Extrapolate projected splits for remaining hurdles using that trend
  3. Add the final segment distance (this will require some research)

Note: Final segment distances are from landing contact (not hurdle clearance) — roughly one stride shorter than the rule-book numbers.

Return a new HurdleProjectionResponse schema with: completed splits, projected splits, projected final segment time, projected total time, and a confidence field (0–1, degrades with fewer
completed hurdles).


Frontend — New Components

Model these after the existing hurdle charts in frontend/src/components/charts/hurdles/ but as new files — do not modify existing components.

  • ProjectedSplitChart.tsx — extend the split bar chart pattern (HurdleSplitChart.tsx) with completed bars solid and projected bars dashed/greyed
  • ProjectedFinishKPI.tsx — KPI card showing projected total time with a confidence indicator (similar color-threshold pattern to GctIncreaseChart.tsx)

Wire both into VisualizationsPage.tsx under a new "Partial Run Projection" section, using a hardcoded partial run ID for now.


Tasks

  • Add hurdles_partial event type to frontend and backend enums
  • Create hurdle_projection.py with drift extrapolation + final segment estimate
  • Add HurdleProjectionResponse to hurdle_schemas.py
  • Add projection endpoint to hurdle_routes.py (follow existing route patterns)
  • Build ProjectedSplitChart.tsx and ProjectedFinishKPI.tsx
  • Wire into VisualizationsPage.tsx
  • Submit screenshots

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions