Modify athlete KPI measurements
The modifyKpiData
mutation allows you to modify athlete KPI measurements at the institution.
The mutation accepts a single kpis
argument, which should be an array of KpiInput
objects.
mutation {
modifyKpiMeasurements(
kpis: # [KpiMeasurementsInput] Array of KpiMeasurementsInput objects
)
}
KpiMeasurementsInput
KpiMeasurementsInput
The KpiMeasurementsInput
object identifies which KPI you want to record data for along with the measurements you want to record.
mutation {
modifyKpiMeasurements(
kpis: [
{
uuid: "string",
measurements: # [KpiMeasurementInput] Array of KpiMeasurementInput objects
]
)
}
uuid*
[String]
The uuid
tells FYTT which KPI to record measurements for. The UUID is automatically generated for every KPI in FYTT, and can be found by navigating to the KPI within the UI and scrolling down to the bottom:
measurements*
[KpiMeasurementIinput]
The measurements argument should be an array of KpiMeasurementInput
objects.
KpiMeasurementInput
KpiMeasurementInput
Each KpiMeasurementInput
object represents a single measurement for a given athlete on a given date for the given KPI.
athleteEmail*
String
The athleteEmail
is how you identify which athlete the measurement is for. The email must correspond to an email for an athlete that already exists in FYTT. If we can't find an athlete with the given email, no record will be created (required if no athleteUuid
provided).
athleteUuid*
String
The athleteUuid
is how you identify which athlete the measurement is for. This value is generated by FYTT for each athlete and can be obtained by querying institution.athletes
(required if no athleteEmail
provided).
date*
ISO 8601 String
The date
is the date that the measurement took place on. If a measurement already exists in FYTT for a given athlete on a given date, the value of that measurement will be updated with the new value provided. Otherwise, a new record will be created for the athlete with the measurement date and value provided.
value*
Float
The value
attribute is the value of the measurement. The unit of measurement for the KPI is specified on the KPI object, which can be accessed via the application UI, or it can accessed by querying the KPI through the API.
delete
Boolean
The delete
attribute can be set to true
to flag the measurement for deletion. If a measurement exists for the athlete on the given date, the record will be deleted.
Sample Mutation
Putting it all together, a sample mutation might look something like the following:
mutation {
modifyKpiMeasurements(
kpis: [
{
uuid: "bc7ec5fe-8508-4c11-bbd1-29be86a1f77e",
measurements: [
{
athleteEmail: "[email protected]", # Alternatively, use athleteUuid.
date: "2023-10-01",
value: 195
},
{
athleteEmail: "[email protected]",
date: "2023-10-01",
value: 175
}
]
},
{
uuid: "8ec74779-49ed-431c-a3eb-9271a4f22336",
measurements: [
{
athleteEmail: "[email protected]",
date: "2023-10-01",
value: 155
},
{
athleteEmail: "[email protected]",
date: "2023-10-01",
value: 145
}
]
}
]
) {
kpis {
name
}
}
}
This would return a JSON response like the following:
{
"data": {
"modifyKpiMeasurements": {
"kpis": [
{
"name": "Back Squat 1RM"
},
{
"name": "Bench Press 1RM"
}
]
}
}
}
* indicates required attribute
Avoid Request Timeouts
Requests will be much more performant if they're scoped by KPI rather than by athlete. In other words, you'll get the best performance if you send measurements for many athletes for a single KPI. Performance will be worse if you send measurements for many KPIs for a single athlete.