Modify athlete KPI measurements

modifyKpvMeasurements

The modifyKpvData mutation allows you to modify athlete KPV measurements at the institution.

The mutation accepts a single kpvs argument, which should be an array of KpvInput objects.

mutation {
  modifyKpvMeasurements(
    kpvs: # [KpvMeasurementsInput] Array of KpvMeasurementsInput objects
  )
}

KpvMeasurementsInput

The KpvMeasurementsInput object identifies which KPV you want to record data for along with the measurements you want to record.

mutation {
  modifyKpvMeasurements(
    kpvs: [
      {
        uuid: "string",
        measurements: # [KpvMeasurementInput] Array of KpvMeasurementInput objects
    ]
  )
}

uuid* [String]

The uuid tells FYTT which KPV to record measurements for. The UUID is automatically generated for every KPV in FYTT, and can be found by navigating to the KPV within the UI and scrolling down to the bottom:

measurements* [KpvMeasurementInput]

The measurements argument should be an array of KpvMeasurementInput objects.

KpvMeasurementInput

Each KpvMeasurementInput object represents a single measurement for a given athlete on a given date for the given KPV.

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.

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.

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.

unit String

The unit attribute specifies the unit of measurement for the record. It is only applicable for height and weight measurements. Otherwise, the measurement automatically inherits its unit from the specified KPI.

Acceptable values for a height measurement are "feet" and "centimeters". Acceptable values for a weight measurement are "pounds" and "kilograms".

value* Float

The value attribute is the value of the measurement. The unit of measurement for the KPV is specified on the KPV object, which can be accessed via the application UI, or it can accessed by querying the KPV through the API.

Sample Mutation

Putting it all together, a sample mutation might look something like the following:

mutation {
  modifyKpvMeasurements(
    kpvs: [
      {
        uuid: "bc7ec5fe-8508-4c11-bbd1-29be86a1f77e",
        measurements: [
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 4
          },
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 2
          }
        ]
      },
      {
        uuid: "8ec74779-49ed-431c-a3eb-9271a4f22336",
        measurements: [
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 6
          },
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 3
          }
        ]
      }
    ]
  ) {
    kpvs {
      name
    }
  }
}

This would return a JSON response like the following:

{
  "data": {
    "modifyKpvMeasurements": {
      "kpvs": [
        {
          "name": "Soreness"
        },
        {
          "name": "Fatigue"
        }
      ]
    }
  }
}

* indicates required attribute

⚠️

Avoid Request Timeouts

Requests will be much more performant if they're scoped by KPV rather than by athlete. In other words, you'll get the best performance if you send measurements for many athletes for a single KPV. Performance will be worse if you send measurements for many KPVs for a single athlete.