File size: 3,747 Bytes
14c58d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/usr/bin/env python3
"""Coach review pack for the ontology (standard section 8): every controlled
vocabulary and threshold on one page with questions to answer and a sign-off
table. Generated from code/ontology.yaml so it never drifts.
python code/make_coach_pack.py -> results/qa/coach_review_pack.md"""
import sys
from datetime import date
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import load_config, load_ontology, rel # noqa: E402
Q = {"delivery_length": "Are these the length buckets coaches use? Missing any (e.g. 'half_volley')?",
"delivery_line": "Is the order and naming right for both right- and left-handed batters?",
"pace_delivery_type": "Which of these can be told apart from video alone, and which need the bowler's word?",
"spin_delivery_type": "Which variations do academy spinners actually bowl?",
"shot_type": "Should drive be split (cover, straight, on)? Is 'other' too big?",
"contact_quality": "Can two coaches agree on edge vs mistimed from replay?",
"execution_quality": "What exactly separates 'good' from 'acceptable'? Write one sentence per level."}
def main():
onto, cfg = load_ontology(), load_config()
L = [f"# Coach review pack: {onto['ontology_version']}", f"Prepared {date.today()}. Please answer the questions,",
"mark changes, and sign off. Values can be added; existing values are never silently redefined.", "",
"## Events (section 7.3)", "For each event, write the exact visible moment you would mark (e.g. 'first frame the front heel touches the ground').", ""]
L += [f"- **{e}**: definition: ______________________" for e in onto["events"]]
L += ["", "## Vocabularies (section 8.1)"]
for k, vals in onto["vocab"].items():
if k in ("annotation_status", "camera_end", "confidence"):
continue
L += ["", f"### {k}", ", ".join(vals), f"*Question:* {Q.get(k, 'Anything missing or ambiguous?')}", "Changes: ______________________"]
L += ["", "## Thresholds (section 8.2), provisional"]
for k, t in onto["thresholds"].items():
L += ["", f"### {k}", "| Label | From (m) | To (m) | Coach's value |", "|---|---|---|---|"]
L += [f"| {name} | {a} | {b} | |" for name, (a, b) in t.items()]
L += ["*Question:* do these match how you coach pace bowlers at this academy? Spin needs its own table."]
es = onto.get("expected_shots") or {}
if es:
L += ["", f"## Batter's expected response ({es.get('status', 'provisional')})",
"Used for the Batter's review point. For each length, the recommended shots by line (first = primary).",
"'_any' covers lines not listed. Edit freely; add lines or shots you coach.", "",
"| Length | Line | Expected shots | Coach's version |", "|---|---|---|---|"]
for length, lines in es.items():
if length == "status":
continue
for line, shots in lines.items():
L.append(f"| {length} | {'any other line' if line == '_any' else line} | {', '.join(shots)} | |")
em = onto.get("expected_movement") or {}
if em:
L += ["", "## Batter's expected foot movement (provisional)", "| Length | Expected | Coach's version |", "|---|---|---|"]
L += [f"| {k} | {v.replace('_', ' ')} | |" for k, v in em.items()]
L += ["", "## Sign-off", "| Name / ID | Role | Date | Approved with changes? |", "|---|---|---|---|", "| | | | |", "| | | | |"]
out = cfg["_paths"]["results"] / "qa" / "coach_review_pack.md"
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text("\n".join(L) + "\n")
print(f"wrote {rel(out)}")
if __name__ == "__main__":
main()
|