Baseline measurement
The baseline measurement answers: how much range does the patient have today? It’s the median of the peaks of the first N clean reps. Rejected reps don’t count, so the starting point is measured with good form.
session.startBaseline(reps: 3) // resets the counter and startsFor hold exercises it counts clean holds instead of reps.
Follow the progress
Section titled “Follow the progress”if let baseline = session.snapshot.baseline { Text("\(baseline.repsDone) of \(baseline.repsNeeded)") if let result = baseline.result { Text("Your range today: \(Int(result))°") }}Or wait for the event:
for await event in session.events() { if case .baselineCompleted(let value) = event { patient.baselineRange = value target = max(value + 10, exercise.defaultTarget) // your logic }}Finish early or cancel
Section titled “Finish early or cancel”session.finishBaseline() // finishes with the clean reps so far (at least one)session.cancelBaseline() // leaves without a result and resetsfinishBaseline() does nothing if there are no clean reps yet.
Why the median
Section titled “Why the median”With three reps of 98°, 102° and 131°, the average (110°) gets dragged up by one bounce. The median (102°) reflects what the patient does consistently.