Skip to content

GetTestsAth

GetTestsAth(athleteId: str, from_: int = None, to_: int = None, sync: bool = False, includeInactive: bool = False)

As of July 10, 2024 GetTestsTeam has been deprecated for the preferred use of GetTests. This function will be fully superseded Jan 01, 2025 12:00:00.

Description

Get test trials only from a specific athlete. Allows filtering of results based on time frames, synchronization needs, and the active status of tests.

Parameters

athleteId: (str) The unique identifier of the athlete whose tests are to be retrieved.

from_: (int) Unix timestamp specifying the start time from which tests should be fetched. Default is None, which fetches tests from the beginning.

to_: (int) Unix timestamp specifying the end time until which tests should be fetched. Default is None, which fetches tests up to the current time.

sync: (bool) If True, the function fetches updated and newly created tests to synchronize with the database. Default is False.

includeInactive: (bool) Default to False, where only active tests are returned. If True, all tests including inactive ones are returned.

Returns

A Pandas DataFrame containing details of the test trial, with columns:

  • id: Unique test id
  • timestamp: Unix timestamp of the the recording time of the trial.
  • athlete_data: Columns of athlete data. Same as DataFrame returned from GetAthletes(.id, .name, .teams, .groups, .active, external.name)
  • testType_data: Columns of test type data(.id, .name, .canonicalId, .groups, .active, external.name)
  • tags_data: Columns of test tags data(.id, .name). Each is a list of any applicable values.
  • all test metrics: Calculated center of mass displacement from starting height at each time point.

DataFrame is also returned with specific attributes:

  • Athlete Id
  • Athlete Name
  • Count
  • Last Sync
  • Last Test Time

Raises

Exception

  • No Access Token Found.
  • If the HTTP response status is not 200, indicating an unsuccessful API request, or if there is a failure in parsing the JSON response.

Value Error

  • If there is an error in handling the JSON response or data formatting.

Example

Get Athlete Specific Test Data
from hdforce import GetTestsAth

# Get my athlete test data
Data = GetTestsAth(athleteId = "MyAthletesId", from_ = 1690859091, to_ = 1711392994)

# Print DataFrame Attributes
print(f"Count: {Data.attrs["Count"]}")
print(f"Last Sync:{Data.attrs["Last Sync"]}")
print(f"Last Test Time: {Data.attrs["Last Test Time"]}")

# Print rows 0:3
print(Data.iloc[:3, :20]) # All columns not printed
Print Outputs
Count: 58
Last Sync: 1711392834
Last Test Time: 1711392822

DataFrame output

id timestamp athlete_id athlete_name athlete_teams athlete_groups athlete_active external_GradYear external_location external_uniqueId external_StudentID external_DPMb6ek2mgUNVcg8siSqpnIvE2i2 testType_id testType_name testType_canonicalId tag_ids tag_names segment Right Avg_ Propulsive Force(N) Relative Propulsive Net Impulse(N_s/kg)
YB35oOBAGHNQew0WziDt 1690859091 OLbsebtmf81eiwg1AeE5 Lauren Green ['DPMb6ek2mgUNVcg8siSqpnIvE2i2', 'vW9iEKafhs2PamfKSdGC'] ['yh8RnOvg56dQNrZGBKWZ'] True 2004 Whittier 83keo9wjei939ekd9 SA0042643 nan 0f0017f87fb97445c95b9f2d1133b56b Drop Landing rKgI4y3ItTAzUekTUpvR [] [] Drop Landing:3 nan nan
2RnV4tM3J6IW2qYKgqg2 1690859127 OLbsebtmf81eiwg1AeE5 Lauren Green ['DPMb6ek2mgUNVcg8siSqpnIvE2i2', 'vW9iEKafhs2PamfKSdGC'] ['yh8RnOvg56dQNrZGBKWZ'] True 2004 Whittier 83keo9wjei939ekd9 SA0042643 nan 0f0017f87fb97445c95b9f2d1133b56b Drop Landing rKgI4y3ItTAzUekTUpvR [] [] Drop Landing:4 nan nan
qNIZaBguZefAyar4oUtu 1690859309 OLbsebtmf81eiwg1AeE5 Lauren Green ['DPMb6ek2mgUNVcg8siSqpnIvE2i2', 'vW9iEKafhs2PamfKSdGC'] ['yh8RnOvg56dQNrZGBKWZ'] True 2004 Whittier 83keo9wjei939ekd9 SA0042643 nan 7b22e645bdf341c90cf0f5459c957e6a Drop Jump gyBETpRXpdr63Ab2E0V8 [] [] Drop Jump:3 1387.7479 1.5916