R Package of the Day: HawkinR

CMSC 405

Nick Katz

What is hawkinR?

Overview

  • SQL for the force plate: allows data queries/pulls

  • made by Hawkins Dynamics for API Integration

  • Main usage: mass reports, machine learning data sets, and data flow

Hawkins Force Plate Force Plate Dashboard

Setup & Authentication

Loading

#Loading 
library(tidyverse)
library(lubridate) 
library(knitr)
library(janitor) 
library(hawkinR) 
#install.packages("devtools")
#devtools::install_github("HawkinDynamics/hawkinR")

Authentication with API Key - get_access()

#API Key
HAWKIN_TOKEN <- "gKbhVn.QTH8acfXEgERyMKltuh0bFaSc8s4B"

# Authentication
get_access(refreshToken = HAWKIN_TOKEN, region = "Americas")

Key Functions 1

get_tests

  • Team classification: the easiest classification system within Hawkins, all pitchers in-house
  • Date: looking at the 100 days of data for pitchers
# Pulling Data - get_tests()
TEAM_ID <- "E0p1p4xDfbdFbHIGL0YjNTKw97Y2" 

# Date range: the last year
date_to <- Sys.Date()
date_from <- Sys.Date() - 100
# Using get_tests() 
last_100_days_data <- get_tests(
  teamId = TEAM_ID, 
  from = format(date_from, "%Y-%m-%d"), 
  to = format(date_to, "%Y-%m-%d"))

Key Functions 2

get_forcetime / get_athletes

  • force-time data for a specific test by ID

  • raw physics of one jump: useful in scientific / study testing

# create a data frame of my athlete info 
roster <- get_athletes() 
#ID of example athlete
ID = "9IT2dWfglX0rG2j3kx3Y"

# Unique identifier for Counter-Movement Test
CMJ = "96baa7ef1443c7a219702eb22e3e68d3"

#Pulling tests related to specific ID
ex_CMJ_data <- last_100_days_data %>%
  filter(athlete_id == ID, testType_uuid == CMJ)
#2796 -> 26 tests from last 100 days
ex_test_id <- "SS6GjjsLRrRbEu1Xyk2u"
ex_forcetime <- get_forcetime(testId = ex_test_id)

Outputs / Datasets

Applications

  • SQL DB with updating functions
  • ML project with pitching velocity
  • Individual routine visualizations/ feedback