baseball-engine / docs /OBJECTIVE_FEEDBACK.md
github-actions[bot]
Automated Deploy: dfdf45dceffb5ca874ea1e3ec4bb6ef21be47137
2426de8
|
Raw History Blame Contribute Delete
7.52 kB

Measured swing details and measurement coverage

Read product.objective_feedback from the existing /product endpoint. Combined products use schema_version: "1.2". Engine result, timing and coach contracts remain unchanged. Annotated swing clips still appear in product.swings.

The main screen now uses engine calculations and recording timestamps. Gemini supplies optional short visual notes; it does not supply the displayed numbers, grades, coverage percentage, faults or drills. Model/event accuracy remains unvalidated: a reproducible calculation can still depend on a mistaken detection.

What gets measured

The fixed objective-details-v1 definition requests seven values per swing:

Feature Key Calculation and meaning
Load and timing load_to_swing_ms Detected backward hand preparation to detected forward hand movement, using capture timestamps.
Load and timing foot_down_to_swing_ms Forward hand start minus estimated front-foot landing. Signed: positive is after landing. If the sensitivity interval crosses zero, the order is unresolved.
Load and timing swing_duration_ms Forward hand start to separately observed ball interaction, or calibrated closest approach for a miss. Arm extension cannot supply the end.
Load and timing early_late_shift_ms Timing-only correction of recorded bat/ball paths when the necessary calibrated geometry is available. A one-camera projected near miss cannot supply it.
Hips and shoulders hip_shoulder_separation_foot_plant_deg Accepted 3D hip/shoulder landmark-line separation at foot settling. This is a landmark construction, not a clinically validated axial rotation.
Bat path and contact bat_image_axis_rotation_deg Signed change of independently detected 2D shaft directions across forward-hand-start to arm-extension frames. Fixed camera and a unique shaft in every frame are required. Positive is counterclockwise on screen.
Bat path and contact contact_capture_time_s Midpoint of the independently supported ball-interaction time interval in the original recording. The full interval is included.

The bat-shaft value is image-plane geometry, not 3D attack angle, barrel path, bat speed or contact quality. Its axis is undirected (modulo 180 degrees), and unsampled rotations cannot be resolved. Missing shafts, competing detections, an unverified camera or an ambiguous direction jump withhold the value.

Coverage is availability, not a performance grade

coverage = round(100 × available requested values / applicable requested values)

The aggregate counts measurement/swing pairs across all detected swings, not just those Gemini reviewed. Each swing also has its own coverage breakdown.

For example, one available value out of seven gives 14% measurement coverage. It does not mean the player has a bad swing. Two clear Gemini comments cannot create a 100/100 score. Extra reference values, moments and visual notes do not increase coverage.

Exclude genuinely inapplicable values: landing time for a no-step swing, contact time for a confirmed miss, timing correction for a hit, and incoming-pitch timing correction for tee practice. Missing evidence remains in the denominator. Zero is a legitimate available measurement. No applicable values gives a null coverage percentage rather than an invented zero.

Shape the app should read

{
  "schema_version": "1.2",
  "objective_feedback": {
    "schema_version": "1.0",
    "calculation_version": "objective-details-v1",
    "source": "engine_measurements",
    "coverage": {
      "name": "Measurement coverage",
      "basis": "available_requested_measurements",
      "definition_version": "objective-details-v1",
      "value": 14,
      "unit": "%",
      "available_count": 1,
      "applicable_count": 7,
      "requested_count": 7,
      "not_applicable_count": 0,
      "unavailable_count": 6,
      "explanation": "1 of 7 applicable measurements available (14%).",
      "meaning": "Measurement availability only. This does not rate the swing or establish measurement accuracy."
    }
  }
}

That is a response excerpt. The complete report also includes median_capture_frame_interval_ms, notice and reps. Every rep contains:

  • rep, matching the existing annotated clip's rep number.
  • coverage, using the same availability-count shape.
  • features[], with key, label and measurements[].
  • moments[], with the original frame, capture time, playback time, time inside its preview clip, method, and an explicit is_contact_proxy flag.
  • references[], extra projected/legacy estimates excluded from coverage.

Every measurement contains key, label, value, unit, status, display, explanation, basis, method, evidence_frame_ids, interval, interval_kind, reason_code, accuracy_validated: false and judgment_eligible: false. status is estimated, unavailable or not_applicable. Do not convert null into zero.

Example: a landing-to-hand interval may be 333.333 ms, displayed as 333 ms, with interval: [300, 366.667] and interval_kind: "frame_sensitivity". The range tests moving the event frames; it is not a validated accuracy bound. Displaying milliseconds does not establish one-millisecond detection precision.

evidence_frame_ids refer to full engine frames. Only frames also listed in product.evidence.frames have an image URL; do not invent URLs for unsampled frames. Event clip_playback_time_s can be used to seek the annotated preview.

Main screen and Gemini text

Show objective_feedback.coverage under the label Measurement coverage. Show each rep's three feature sections using each item's display and explanation. Keep source frames and intervals accessible. The explanations are generated by code from the actual values, not invented by the language model.

Show references separately. In particular:

  • Legacy stride percentages use projected body-height scaling, not calibrated physical height or ground-plane stride distance.
  • Legacy center-of-mass drift is a hip-midpoint reference, not whole-body center of mass.
  • A knee angle at the lead-arm-extension proxy is not a confirmed knee angle at ball contact.

Gemini notes remain in visual_review.features. New reviews use text_style_version: "specific-observations-v2". Notes identify a body part, direction and visible sequence using sampled frame references. They are visual estimates and appear below the measured details. rating, priority and drill are null in this mode. The old visual_review.score shape remains for compatibility, with value: null and reason_code: "replaced_by_measurement_coverage" for completed new reviews. Do not display the previous experimental grade.

Measurement-based coaching remains available separately. Its Mechanics score may remain null when no qualified benchmark comparison is available.

For a retained older product, explicitly call POST /v1/analyses/{job_id}/video-review to build the new breakdown and refresh the visual notes. This preserves measurements and clip hashes; image review uses Gemini quota. A completed current-style report is returned unchanged on retries. Existing current reports keep their measured breakdown during image-only retries.

The authenticated /v1/objective-feedback-schema endpoint and objective-feedback.schema.json publish the complete report structure.