baseball-engine / AI-coach-agent /docs /PITCH_REPORT_API.md
github-actions[bot]
Automated Deploy: 9a9b646cc63bf5c0b3e1e8ce109df190b8eca5f7
7bf5a7e
|
Raw History Blame Contribute Delete
2.47 kB

Pitch report API

POST /v1/sessions/{session_id}/pitch-report takes the ML pitch payload (contract pitch-1.1, schema docs/pitching-coach-payload.schema.json, example docs/pitching-coach-payload.example.json) for a pitching session (mode: "p"), unchanged. Library entry point: ai_coach.pitch_report.build_pitch_report(payload, athlete) (pitch_report/v1_1/service.py). The response follows the swing report layout (overall score, groups, focus area with a drill, measurements, data quality) plus the pitching sections coaching (AI cards), drill_evaluation and delivery_evidence.

Scoring

  • Benchmarks: OBP pitching, college pitchers per throwing side (knowledge/pitching_benchmarks.yaml). P25–P75 is on target and P10–P90 satisfactory. OBP has no usable high-school or pro groups, so every level uses college with a level_assumed or level_approximated note.
  • Throwing side: payload athlete.throwing_hand, then the profile, then the opposite of the lead foot. A profile that disagrees is reported (throwing_hand_conflict) and blocks advice.
  • Values far outside the P10–P90 band (more than two band widths) are tracking errors: implausible_value, not rated.
  • A result whose rating changes when an event moves by one frame is shown without a tip and is never the focus (event_sensitive_scores).
  • ankle_span_at_foot_strike_cm has no OBP equivalent and is shown for reference only.

Context

Context Result
fastball, baseball, standard drill, any known practice everything compared
any of practice, drill, pitch or ball unknown compared as a regular fastball; leg-lift and stride results are rated but not coached (practice_context_unknown)
step_back, rocker compared, except leg-lift and stride results (not_comparable_for_drill)
other drill, dry_delivery, non-fastball, training ball or no ball described without scores (practice_context_unverified)

Text

Headline, group summaries, result text, tips and the focus message come from knowledge/pitch_v1_1_coaching.yaml (plain words, no numbers, guarded by the same checks as the swing report). The focus is the lowest-scoring coachable result with its drill; maintain when everything is on target; general (rhythm drill) when nothing is coachable. The AI cards in coaching are generated separately and never replace the headline or focus. Coaching text and drill choices need coach review.