github-actions[bot] commited on
Commit
6f4b727
·
1 Parent(s): 6963661

Automated Deploy: 55409b64ea5d11f498463809792615f7a984ff98

Browse files
AI-coach-agent/src/ai_coach/pitch_report/v1_1/contract.py CHANGED
@@ -234,8 +234,10 @@ class PitchPayload(Strict):
234
  if a.capture_time_s is not None and b.capture_time_s is not None
235
  ):
236
  raise ValueError("Capture event times must be ordered")
237
- if self.context.practice_type == "dry_delivery" and self.events.release.status != "unavailable":
238
- raise ValueError("Dry delivery cannot have ball release")
 
 
239
  for m in self.measurements:
240
  events = [getattr(self.events, key) for key in m.event_ids]
241
  if m.value is not None and any(e.status == "unavailable" for e in events):
 
234
  if a.capture_time_s is not None and b.capture_time_s is not None
235
  ):
236
  raise ValueError("Capture event times must be ordered")
237
+ if (
238
+ self.context.practice_type == "dry_delivery" or self.context.ball_type == "none"
239
+ ) and self.events.release.status != "unavailable":
240
+ raise ValueError("A delivery without a ball cannot have ball release")
241
  for m in self.measurements:
242
  events = [getattr(self.events, key) for key in m.event_ids]
243
  if m.value is not None and any(e.status == "unavailable" for e in events):
AI-coach-agent/tests/test_pitching_report.py CHANGED
@@ -112,6 +112,7 @@ def test_wrong_profile_throwing_hand_cannot_select_another_side_or_enable_advice
112
  lambda p: p["measurements"].pop(),
113
  lambda p: p["athlete"].update(lead_foot="right"),
114
  lambda p: p["context"].update(practice_type="dry_delivery"),
 
115
  ],
116
  )
117
  def test_reject_tampered_measurement_scope_and_event_order(mutation):
 
112
  lambda p: p["measurements"].pop(),
113
  lambda p: p["athlete"].update(lead_foot="right"),
114
  lambda p: p["context"].update(practice_type="dry_delivery"),
115
+ lambda p: p["context"].update(ball_type="none"),
116
  ],
117
  )
118
  def test_reject_tampered_measurement_scope_and_event_order(mutation):
baseball_batting/pitching_coach.py CHANGED
@@ -42,7 +42,7 @@ def build_pitch_payload(options, lineage, corrected, video_times, capture_times)
42
  for key, index in frames.items():
43
  if index is None:
44
  reason = "event_not_marked"
45
- if key == "release" and options.context.practice_type == "dry_delivery":
46
  reason = "event_not_applicable"
47
  if key == "leg_lift" and options.context.drill_type == "rocker":
48
  reason = "event_not_applicable"
 
42
  for key, index in frames.items():
43
  if index is None:
44
  reason = "event_not_marked"
45
+ if key == "release" and (options.context.practice_type == "dry_delivery" or options.context.ball_type == "none"):
46
  reason = "event_not_applicable"
47
  if key == "leg_lift" and options.context.drill_type == "rocker":
48
  reason = "event_not_applicable"
baseball_batting/pitching_input.py CHANGED
@@ -63,8 +63,8 @@ class PitchingInput(MotionInput):
63
  if self.handedness and self.lead_foot == self.handedness:
64
  raise ValueError("Lead foot must be opposite the throwing hand")
65
  if self.release_frame is not None:
66
- if self.context.practice_type == "dry_delivery":
67
- raise ValueError("Dry delivery cannot have ball release")
68
  if self.windows:
69
  w = self.windows[0]
70
  if not w.start_frame <= self.release_frame <= w.end_frame:
 
63
  if self.handedness and self.lead_foot == self.handedness:
64
  raise ValueError("Lead foot must be opposite the throwing hand")
65
  if self.release_frame is not None:
66
+ if self.context.practice_type == "dry_delivery" or self.context.ball_type == "none":
67
+ raise ValueError("A delivery without a ball cannot have ball release")
68
  if self.windows:
69
  w = self.windows[0]
70
  if not w.start_frame <= self.release_frame <= w.end_frame:
docs/PITCHING_APP_INTEGRATION.md CHANGED
@@ -33,7 +33,7 @@ Continue using `POST /v1/uploads` and its presigned video upload, then `POST /v1
33
  "video_upload_id": "<uploaded-video-uuid>",
34
  "mode": "p",
35
  "is_self": false,
36
- "athlete": { "name": "Pitching athlete", "throws": "R" },
37
  "duration_sec": 3.747,
38
  "fps": 24,
39
  "frame_count": 88,
@@ -59,13 +59,13 @@ Headers: `Accept: application/json`, `Authorization: Bearer <engine key>`. Let t
59
  "model": "sam3d",
60
  "single_pitch": true,
61
  "annotated_videos": false,
62
- "handedness": "right",
63
  "camera_stability": "fixed_verified",
64
  "timing": { "kind": "unknown" },
65
  "athlete": {
66
  "athlete_id": "session:<session-id>:athlete",
67
- "throwing_hand": "right",
68
- "lead_foot": "left",
69
  "age_years": null,
70
  "height_cm": null
71
  },
@@ -92,6 +92,8 @@ Use `timing.kind: "unretimed"` only for a known original-speed recording; includ
92
 
93
  `handedness` and `athlete.throwing_hand` must agree. Lead foot is opposite the throwing hand. Pitching does not accept `contact_frame`, `swing_id` or `single_swing: true`. Marked indices must satisfy `0 <= frame < decoded frame_count`; `end_frame` is inclusive. Known marks must be ordered leg lift < foot strike < release. Missing marks are independent: foot strike/release can be measured without a leg lift.
94
 
 
 
95
  ## Poll, fetch, save
96
 
97
  1. The upload returns HTTP 202 with `job_id`, `status_url`, `result_url`, `coach_payload_url`.
 
33
  "video_upload_id": "<uploaded-video-uuid>",
34
  "mode": "p",
35
  "is_self": false,
36
+ "athlete": { "name": "Pitching athlete", "throws": "L" },
37
  "duration_sec": 3.747,
38
  "fps": 24,
39
  "frame_count": 88,
 
59
  "model": "sam3d",
60
  "single_pitch": true,
61
  "annotated_videos": false,
62
+ "handedness": "left",
63
  "camera_stability": "fixed_verified",
64
  "timing": { "kind": "unknown" },
65
  "athlete": {
66
  "athlete_id": "session:<session-id>:athlete",
67
+ "throwing_hand": "left",
68
+ "lead_foot": "right",
69
  "age_years": null,
70
  "height_cm": null
71
  },
 
92
 
93
  `handedness` and `athlete.throwing_hand` must agree. Lead foot is opposite the throwing hand. Pitching does not accept `contact_frame`, `swing_id` or `single_swing: true`. Marked indices must satisfy `0 <= frame < decoded frame_count`; `end_frame` is inclusive. Known marks must be ordered leg lift < foot strike < release. Missing marks are independent: foot strike/release can be measured without a leg lift.
94
 
95
+ For `dry_delivery` or `ball_type: "none"`, release must be null. Mark the exact file that will be uploaded; if exporting or compressing changes its frame list, review the marks again against that file.
96
+
97
  ## Poll, fetch, save
98
 
99
  1. The upload returns HTTP 202 with `job_id`, `status_url`, `result_url`, `coach_payload_url`.
tests/test_pitching_api.py CHANGED
@@ -81,6 +81,7 @@ def payload(opts=None, points=None, clock=True):
81
  {"lead_foot": "right"},
82
  {"context": {"practice_type": "tee"}},
83
  {"context": {"practice_type": "dry_delivery"}},
 
84
  {
85
  "windows": [
86
  {
 
81
  {"lead_foot": "right"},
82
  {"context": {"practice_type": "tee"}},
83
  {"context": {"practice_type": "dry_delivery"}},
84
+ {"context": {"ball_type": "none"}},
85
  {
86
  "windows": [
87
  {