Create, update, or delete metrics for your institution
The modifyMetrics
mutation allows you to create new metrics or update existing metrics.
The mutation accepts a single metrics
argument, which should be an array of MetricInput
objects.
mutation {
modifyMetrics(
metrics: # [MetricInput] Array of MetricInput objects
)
}
MetricInput
MetricInput
The MetricInput
object contains all the attributes for the metric you want to create or update. If you provide a uuid
for an existing metric at your institution, it will be updated with the attributes provided. However, if you provide a new uuid
, a new record will be created with the attributes provided.
mutation {
modifyMetrics(
metrics: [
{
uuid: "cfc559be-a810-40b7-9ba1-d5240e88db81", # New UUID creates a new record
#...
},
{
uuid: "cfc559be-a810-40b7-9ba1-d5240e88db81", # Existing UUID updates an existing record
#...
}
]
)
}
athleteFacing
[Boolean]
The athleteFacing
attribute designates whether or not athletes can view their performance history for the metric from their individual account (defaults to true
).
description
[String]
The description
attribute allows you to provide instructions or notes about the metric for athletes and coaches.
delete
[Boolean]
The delete
attribute allows you to flag a metric for deletion (only applicable for existing metrics). Note that deletion happens asynchronously, so it may take a few seconds for the delete operations to actually occur.
exerciseName
[String]
The exerciseName
attribute is the name of the exercise that is performed as part of the metric test.
measurementType*
[String]
The measurementType
attribute indicates the variable dimension of measurement for the metric. For example, a Back Squat 1 Rep Max uses weight and reps as parameters of it's evaluation, but weight is the primary variable that is being tested, while "1 rep" is constant.
Allowed values are "calories"
, "distance"
, "heart_rate"
, "height"
, "reps"
, "speed"
, "time"
, "watts"
, and "weight"
.
Note: The measurementType
attribute forces a true
value for the measure[type]
attribute that corresponds to the selected measurement type. For example, if the measurementType
is "weight"
, then the measureWeight
attribute is forced to be true
. Other measure[type]
attributes can also be true, but the one corresponding to the measurementType
must be true.
name*
[String]
The name
attribute is the name of the metric, e.g. "Back Squat 1RM."
uuid*
[String]
The uuid
attribute is the metric's unique identifier. It must conform to the standard UUID string format.
--Calories--
measureCalories
[Boolean]
The measureCalories
attribute indicates whether or not the metric includes a calories dimension.
caloriesMeasurement
[Float]
The caloriesMeasurement
attribute specifies the value of the calories dimension, e.g. the number calories on a ski erg machine.
--Distance--
measureDistance
[Boolean]
The measureDistance
attribute indicates whether or not the metric includes a distance dimension.
distanceMeasurement
[Float]
The distanceMeasurement
attribute specifies the value of the distance dimension, e.g. the distance jumped.
distanceMeasurementUnit
[String]
The distanceMeasurementUnit
attribute specifies the unit of measurement for the distance value. Allowed values are "centimeters"
, "feet"
, "inches"
, "kilometers"
, "meters"
, "miles"
, and "yards"
.
--Heart Rate--
measureHeartRate
[Boolean]
The measureHeartRate
attribute indicates whether or not the metric includes a heart rate dimension.
heartRateMeasurement
[Float]
The heartRateMeasurement
attribute specifies the value of the heart rate dimension, e.g. an anaerobic threshold (heart rate measurements are always measured in beats per minute).
--Height--
measureHeight
[Boolean]
The measureHeight
attribute indicates whether or not the metric includes a height dimension.
heightMeasurement
[Float]
The heightMeasurement
attribute specifies the value of the height dimension, e.g. the height used for a box jump.
heightMeasurementUnit
[String]
The heightMeasurementUnit
attribute specifies the unit of measurement for the height value. Allowed values are "centimeters"
, "feet"
, "inches"
, and "meters"
.
--Reps--
measureReps
[Boolean]
The measureReps
attribute indicates whether or not the metric includes a repetitions dimension.
repsMeasurement
[Float]
The repsMeasurement
attribute specifies the number of repetitions for the exercise.
--Speed--
measureSpeed
[Boolean]
The measureSpeed
attribute indicates whether or not the metric includes a speed dimension.
speedMeasurement
[Float]
The speedMeasurement
attribute specifies the value of the speed dimension, e.g. the speed of a sprint.
speedMeasurementUnit
[String]
The speedMeasurementUnit
attribute specifies the unit of measurement for the speed value. Allowed values are "feet_per_second"
, "kilometers_per_hour"
, "meters_per_second"
, and "meters_per_minute"
, "miles_per_hour"
, "yards_per_second"
, and "yards_per_minute"
.
--Time--
measureTime
[Boolean]
The measureTime
attribute indicates whether or not the metric includes a time dimension.
timeMeasurement
[Float]
The timeMeasurement
attribute specifies the value of the time dimension in seconds.
--Watts--
measureWatts
[Boolean]
The measureWatts
attribute indicates whether or not the metric includes a watts dimension.
wattsMeasurement
[Float]
The wattsMeasurement
attribute specifies the value of the watts dimension, e.g. the watts output of a stationary bike.
--Weight--
measureWeight
[Boolean]
The measureWeight
attribute indicates whether or not the metric includes a weight dimension.
weightMeasurement
[Float]
The weightMeasurement
attribute specifies the value of the weight dimension, e.g. the weight on the bar.
weightMeasurementUnit
[String]
The weightMeasurementUnit
attribute specifies the unit of measurement for the weight value. Allowed values are "pounds"
and "kilograms"
.
Sample Mutation
Putting it all together, a sample mutation might look something like the following:
mutation {
modifyMetrics(
metrics: [
{
uuid: "bc7ec5fe-8508-4c11-bbd1-29be86a1f77e",
name: "Bench Press 1RM",
measurementType: "weight",
exerciseName: "Bench Press",
measureReps: true,
repsMeasurement: 1
},
{
uuid: "8ec74779-49ed-431c-a3eb-9271a4f22336",
name: "Back Squat 1RM",
measurementType: "weight",
exerciseName: "Back Squat"
measureReps: true,
repsMeasurement: 1
}
]
) {
metrics {
persisted,
uuid
}
}
}
This would return a JSON response like the following:
{
"data": {
"modifyMetrics": {
"metrics": [
{
"persisted": true,
"uuid": "bc7ec5fe-8508-4c11-bbd1-29be86a1f77e"
},
{
"persisted": true,
"uuid": "8ec74779-49ed-431c-a3eb-9271a4f22336"
}
]
}
}
}
* indicates required attribute