Skip to content

Dry-run a threshold change against recent sessions

POST
/api/thresholds/preview/
curl --request POST \
--url http://localhost:8000/api/thresholds/preview/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "activity": "running", "exercise": "Treadmill", "metric_key": "cadence", "min_good": 178, "max_good": 184, "session_window_days": 30 }'

Any team member; read-only. Replays a proposed (min_good, max_good) band over the team’s recent session window (default 30 days, configurable via session_window_days) and reports which sessions would flip in/out of the green zone — without persisting anything. No DB write, no audit row. Backs the “Preview impact” affordance on the editor row before the coach commits the save.

object
activity
required
  • running - Running
  • walking - Walking
  • jump - Vertical Jump
  • weightlifting - Weightlifting
  • mobility - Mobility Assessment
  • workspace_wellness - Workspace Wellness
  • agility - Agility
  • fencing - Fencing
  • cycling - Cycling
  • tennis - Tennis
  • padel - Padel Tennis
  • bowling - Bowling
  • baseball - Baseball
  • football - Football
  • badminton - Badminton
  • cricket - Cricket
  • basketball - Basketball
  • scuba_diving - Scuba Diving
  • ice_hockey - Ice Hockey
  • american_football - American Football
  • fri - Falls Risk Indicator
string
Allowed values: running walking jump weightlifting mobility workspace_wellness agility fencing cycling tennis padel bowling baseball football badminton cricket basketball scuba_diving ice_hockey american_football fri
exercise
string
nullable
metric_key
required
string
>= 1 characters
min_good
number format: double
nullable
max_good
number format: double
nullable
gender
One of:
  • male - Male
  • female - Female
  • nonbinary - Non-binary
  • `` -
string
Allowed values: male female nonbinary
age_band
One of:
  • under_18 - Under 18
  • 18_34 - 18–34
  • 35_49 - 35–49
  • 50_64 - 50–64
  • 65_69 - 65–69
  • 70_74 - 70–74
  • 75_79 - 75–79
  • 80_84 - 80–84
  • 85_plus - 85+
  • `` -
string
Allowed values: under_18 18_34 35_49 50_64 65_69 70_74 75_79 80_84 85_plus
skill_level
One of:
  • beginner - Beginner
  • intermediate - Intermediate
  • advanced - Advanced
string
Allowed values: beginner intermediate advanced
session_window_days
integer
>= 1 <= 90
Examples
ExampleDry-runANewBand

Dry-run a new band

{
"activity": "running",
"exercise": "Treadmill",
"metric_key": "cadence",
"min_good": 178,
"max_good": 184,
"session_window_days": 30
}
Media typeapplication/json
object
total_evaluated
required
integer
before
required
object
green_count
required
integer
yellow_count
required
integer
red_count
required
integer
after
required
object
green_count
required
integer
yellow_count
required
integer
red_count
required
integer
flipped_to_green
required
Array<object>
object
session_id
required
string
client_display_name
required
string
value
required
number format: double
flipped_to_red
required
Array<object>
object
session_id
required
string
client_display_name
required
string
value
required
number format: double
session_window_days
required
integer
Examplegenerated
{
"total_evaluated": 1,
"before": {
"green_count": 1,
"yellow_count": 1,
"red_count": 1
},
"after": {
"green_count": 1,
"yellow_count": 1,
"red_count": 1
},
"flipped_to_green": [
{
"session_id": "example",
"client_display_name": "example",
"value": 1
}
],
"flipped_to_red": [
{
"session_id": "example",
"client_display_name": "example",
"value": 1
}
],
"session_window_days": 1
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examplegenerated
{
"detail": "example"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examplegenerated
{
"detail": "example"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examplegenerated
{
"detail": "example"
}