""" Shoulder Mobility rubric scorer — pure function, no model calls. FMS Shoulder Mobility Criteria (bilateral): - Score 3: fists within one hand-length of each other. - Score 2: fists within 1.5 hand-lengths. - Score 1: fists more than 1.5 hand-lengths apart. - Score 0: PAIN (clearing test) — never auto-scored. """ from __future__ import annotations from formscout.types import BiomechFeatures, ScoreResult def score_shoulder_mobility(features: BiomechFeatures) -> ScoreResult: """Pure rubric scorer for shoulder mobility.""" alignments = features.alignments angles = features.angles has_measure = "inter_fist_normalized" in angles if not has_measure: return ScoreResult( score=1, rationale="Insufficient data: inter-fist distance not measurable", confidence=0.3, notes="missing key measurements", ) norm_dist = angles["inter_fist_normalized"] within_one = alignments.get("fists_within_one_hand", False) within_1_5 = alignments.get("fists_within_1_5_hand", False) if within_one: score = 3 rationale = f"Fists within one hand-length (normalized distance {norm_dist:.2f})" elif within_1_5: score = 2 rationale = f"Fists within 1.5 hand-lengths (normalized distance {norm_dist:.2f})" else: score = 1 rationale = f"Fists beyond 1.5 hand-lengths apart (normalized distance {norm_dist:.2f})" confidence = features.confidence * 0.9 return ScoreResult( score=score, rationale=rationale, confidence=confidence, notes="", )