Skip to content

Commit

Permalink
hdforce v1.1.2 w/ updated test types to include TS test names and IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
laureng-hd committed Aug 1, 2024
1 parent 52d5637 commit 56f0540
Show file tree
Hide file tree
Showing 46 changed files with 1,283 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Test Package and TestPyPI
on:
push:
branches:
- dev_env
- '*'

jobs:
test-package:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update README Badges

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
update-readme:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Update README badges
run: |
sed -i "s|branch=.*)](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml)|branch=${GITHUB_REF#refs/heads/})](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml)|" README.md
sed -i "s|hawkinPy/.*)](https://img.shields.io/github/last-commit/HawkinDynamics/hawkinPy/)|hawkinPy/${GITHUB_REF#refs/heads/})](https://img.shields.io/github/last-commit/HawkinDynamics/hawkinPy/)|" README.md
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "Update README badges with branch ${GITHUB_REF#refs/heads/}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ MANIFEST
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
get-pip.py

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -161,4 +162,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# HDFORCE <img src="docs/img/hdlogo_sm.png" align="right" alt="" width="120" />
# HDFORCE v1.1.2 <img src="docs/img/hdlogo_sm.png" align="right" alt="" width="120" />

**Get your data from the Hawkin Dynamics API**

<!-- badges: start -->
![GitHub Release](https://img.shields.io/github/v/release/HawkinDynamics/hawkinPy)
[![Test Py Versions and OS](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml/badge.svg?branch=dev_env)](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml)
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/HawkinDynamics/hawkinPy/dev_env)
[![Test Py Versions and OS](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml/badge.svg?branch=main)](https://github.com/HawkinDynamics/hawkinPy/actions/workflows/push-test.yml)
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/HawkinDynamics/hawkinPy/main)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![license](https://img.shields.io/badge/license-MIT%20+%20file%20LICENSE-lightgrey.svg)](https://choosealicense.com/)
Expand All @@ -16,7 +16,7 @@
HDFORCE provides simple functionality with Hawkin Dynamics API. These functions are for use with ‘Hawkin Dynamics Beta API’ version 1.10-beta. You must be a Hawkin Dynamics user with an active integration account to utilize functions within the package.

## Functions
This API is designed to get data out of your Hawkin Dynamics server and interact with your data more intimately. It is not designed to be accessed from client applications directly. There is a limit on the amount of data that can be returned in a single request (256 MB). As your database grows, it will be necessary to use the `from` and `to` parameters to limit the size of the responses. Responses that exceed the memory limit will timeout and fail. It is advised that you design your client to handle this from the beginning. A recommended pattern would be to have two methods of fetching data. A scheduled pull that uses the `from` and `to` parameters to constrain the returned data to only tests that have occurred since the last fetch e.g. every day or every 5 minutes. And then a pull that fetches the entire database since you began testing that is only executed when necessary. A recommended way of doing this is to generate the `from` and `to` parameters for each month since you started and send a request for each either in parallel or sequentially.
This API is designed to get data out of your Hawkin Dynamics server and interact with your data more intimately. It is not designed to be accessed from client applications directly. There is a limit on the amount of data that can be returned in a single request (256 MB). As your database grows, it will be necessary to use the `from_` and `to_` parameters to limit the size of the responses. Responses that exceed the memory limit will timeout and fail. It is advised that you design your client to handle this from the beginning. A recommended pattern would be to have two methods of fetching data. A scheduled pull that uses the `from_` and `to_` parameters to constrain the returned data to only tests that have occurred since the last fetch e.g. every day or every 5 minutes. And then a pull that fetches the entire database since you began testing that is only executed when necessary. A recommended way of doing this is to generate the `from_` and `to_` parameters for each month since you started and send a request for each either in parallel or sequentially.

This package was meant to help execute requests to the Hawkin Dynamics API with a single line of code. There are 13 functions to help execute 4 primary objectives:

Expand Down
20 changes: 20 additions & 0 deletions docs/About/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelogs

## hdforce v1.1.2

* Bug fix: addition of new TruStrength test names and IDs to testTypeId validation method

## hdforce v1.1.1

* Corrected versioning and documentation

## hdforce v1.1.0

* Additions of CreateAthlete and UpdateAthlete functions
* Expansion of GetTests function to include 'team', 'group', type', and 'athlete' arguments
* Deprecation of GetTestsAth, GetTestsType, GetTestsTeam, and GetTestsGroup

## hdforce v1.0.01

* Initial release of production package
* Full logging configuration and Authentication features
* Tested on Python version 3.9 <-> 3.12, on Mac, Windows, and Linux

## hdforce v1.0.0rc0

* Improved logging
Expand Down
56 changes: 56 additions & 0 deletions docs/Functions/CreateAthletes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
__`CreateAthletes(athletes: List[NewAthletes])`__

### Description
Create athletes for your account. Up to 500 at one time.

### Parameters
`athletes`: (_list_) A list of Athletes with class of `NewAthlete`, which requires a "name". If other parameters are left, they will assume default values.

### Classes
`NewAthlete`: (_class_)
**REQUIRED**
* name: _str_
* active: _str_
*Optional*
* teams: _list_
* groups: _list_
* external: _dict_ {externalName1 : externalValue1, externalName2 : externalValue2}

### Returns
A list of AthleteResult objects indicating the success or failure of each athlete creation.

* __successful__: list of names of athletes added successfully
* __failures__: list of athletes that failed in execution, grouped by their reason for failure.

### 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.


### Example

``` Python
from hdforce import CreateAthletes, NewAthlete

# Create list of athletes to add using NewAthlete class
players = [
NewAthlete(name= "New Guy", active=False, teams=[], groups=[], external={"Title": "Younger Brother"}),
NewAthlete(name= "Old Guy", active=False, teams=[], groups=[], external={"Title": "Older Brother"})
]

# Create players
newRoster = CreateAthletes(athletes = players)

# Print lgCreation Response
print(newRoster)
```

_output_

{
"successful": ["New Guy", "Old Guy"],
"failures": []
}

1 change: 0 additions & 1 deletion docs/Functions/GetAthletes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ _output_
|----------------------|--------------|--------------------------------------------------|----------------------|--------|-------------------|-------------------|--------------------|--------------------|
| OLbsebtmf81eiwg1AeE5 | Lauren Green | ['DPMb6ek2mgUNVcg8siSqpnIvE2i2', 'vW9iEKafhs2PamfWQpFZ'] | ['yh8RnOvg56dQNrZGBKWZ'] | True | 2004 | Whittier | 83keo9wjei939ekd9 | SA0042643 |


2 changes: 1 addition & 1 deletion docs/Functions/GetForceTime.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ _output_
| 2001 | 2.002 | 46 | 122 | 168 | -1.128090 | -0.078543 | -189.519185 | [] |
| 2002 | 2.003 | 49 | 126 | 175 | -1.136487 | -0.079675 | -198.885184 | [] |
| 2003 | 2.004 | 53 | 130 | 183 | -1.144821 | -0.080816 | -209.502302 | [] |
| 2004 | 2.005 | 56 | 135 | 191 | -1.153090 | -0.081965 | -220.240178 | [] |
| 2004 | 2.005 | 56 | 135 | 191 | -1.153090 | -0.081965 | -220.240178 | [] |
2 changes: 1 addition & 1 deletion docs/Functions/GetMetrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ _output_
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump | peakRelativeBrakingForce | Peak Relative Braking Force | % | The peak instantaneous vertical ground reaction force applied to the system center of mass during the braking phase as a percentage of system weight. |
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump | avgPropulsiveForce | Avg. Propulsive Force | N | The average vertical ground reaction force applied to the system center of mass during the propulsion phase. |
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump | avgRelativePropulsiveForce| Avg. Relative Propulsive Force | % | The average vertical ground reaction force applied to the system center of mass during the propulsion phase as a percentage of system weight. |
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump | peakPropulsiveForce | Peak Propulsive Force | N | The peak instantaneous vertical ground reaction force applied to the system center of mass during the propulsion phase. |
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump | peakPropulsiveForce | Peak Propulsive Force | N | The peak instantaneous vertical ground reaction force applied to the system center of mass during the propulsion phase. |
2 changes: 1 addition & 1 deletion docs/Functions/GetTags.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ _output_
| Afcw45lIkeHFnlUyDeSn | 10/5 | 10/5 Multi-Rebound test protocol |
| KmZmhxUqrbOhLLvRLAbG | 5/3 | 5/3 Multi-Rebound test protocol |
| Lgc8uJh80NacB8eaqjOg | 20kg | addition of 20kg load to system mass |
| hVgWJkwHZ9Mm8XDymP3W | Hands On Hips | Akimbo style jump |
| hVgWJkwHZ9Mm8XDymP3W | Hands On Hips | Akimbo style jump |
12 changes: 10 additions & 2 deletions docs/Functions/GetTests.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__`GetTests(from_: int = None, to_: int = None, sync: bool = False, active: bool = True)`__
__`GetTests(from_: int = None, to_: int = None, sync: bool = False, athleteId: str = None, typeId: str = None, teamId: str = None,groupId: str = None, includeInactive: bool = False)`__

### Description
Get all test trials from an account. Allows filtering of results based on time frames, synchronization needs, and the active status of tests.
Expand All @@ -10,7 +10,15 @@ __`to_`__: _(int)_ Unix timestamp specifying the end time until which tests shou

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

__`active`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.
__`athleteId`__: _(str)_ The unique identifier of the athlete whose tests are to be retrieved.

__`typeId`__: _(str)_ The canonical test ID, test type name, or test name abbreviation. Must correspond to known test types.

__`teamId`__: _(str)_ A single team ID, tuple or list of team IDs to receive tests from specific teams.

__`groupId`__: _(str)_ A single group ID, tuple or list of group IDs to receive tests from specific groups.

__`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:
Expand Down
7 changes: 5 additions & 2 deletions docs/Functions/GetTestsAth.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__`GetTestsAth(athleteId: str, from_: int = None, to_: int = None, sync: bool = False, active: bool = True)`__
__`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.
Expand All @@ -12,7 +15,7 @@ __`to_`__: _(int)_ Unix timestamp specifying the end time until which tests shou

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

__`active`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.
__`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:
Expand Down
7 changes: 5 additions & 2 deletions docs/Functions/GetTestsGroup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__`GetTestsGroup(groupId: str, from_: int = None, to_: int = None, sync: bool = False, active: bool = True)`__
__`GetTestsGroup(groupId: 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 for specified group(s). Allows filtering of results based on time frames, synchronization needs, and the active status of tests.
Expand All @@ -12,7 +15,7 @@ __`to_`__: _(int)_ Unix timestamp specifying the end time until which tests shou

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

__`active`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.
__`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:
Expand Down
7 changes: 5 additions & 2 deletions docs/Functions/GetTestsTeam.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__`GetTestsTeam(teamId: str, from_: int = None, to_: int = None, sync: bool = False, active: bool = True)`__
__`GetTestsTeam(teamId: 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 for specified team(s). Allows filtering of results based on time frames, synchronization needs, and the active status of tests.
Expand All @@ -12,7 +15,7 @@ __`to_`__: _(int)_ Unix timestamp specifying the end time until which tests shou

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

__`active`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.
__`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:
Expand Down
9 changes: 7 additions & 2 deletions docs/Functions/GetTestsType.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__`GetTestsType(typeId: str, from_: int = None, to_: int = None, sync: bool = False, active: bool = True)`__
__`GetTestsType(typeId: 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 type of test. Allows filtering of results based on time frames, synchronization needs, and the active status of tests.
Expand All @@ -16,6 +19,8 @@ The typeId has been created to be more user friendly, as it accepts any of canon
| r4fhrkPdYlLxYQxEeM78 | Multi Rebound | MR |
| ubeWMPN1lJFbuQbAM97s | Weigh In | WI |
| rKgI4y3ItTAzUekTUpvR | Drop Landing | DL |
| 4KlQgKmBxbOY6uKTLDFL | TS Free Run | TSFR |
| umnEZPgi6zaxuw0KhUpM | TS Isometric Test | TSISO |

### Parameters
__`typeId`__: _(str)_ The canonical test ID, test type name, or test name abbreviation. Must correspond to known test types.
Expand All @@ -26,7 +31,7 @@ __`to_`__: _(int)_ Unix timestamp specifying the end time until which tests shou

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

__`active`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.
__`includeInactive`__: _(bool)_ If True, only active tests are fetched. If False, all tests including inactive ones are fetched. Default is True.

### Returns
A Pandas DataFrame containing details of the test trial, with columns:
Expand Down
25 changes: 12 additions & 13 deletions docs/Functions/GetTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ print(testTypes)

_output_

| id | name |
|----------------------|--------------------|
| id | name |
|----------------------|----------------------|
| 7nNduHeM5zETPjHxvm7s | Countermovement Jump |
| QEG7m7DhYsD6BrcQ8pic | Squat Jump |
| 2uS5XD5kXmWgIZ5HhQ3A | Isometric Test |
| gyBETpRXpdr63Ab2E0V8 | Drop Jump |
| 5pRSUQVSJVnxijpPMck3 | Free Run |
| pqgf2TPUOQOQs6r0HQWb | CMJ Rebound |
| r4fhrkPdYlLxYQxEeM78 | Multi Rebound |
| ubeWMPN1lJFbuQbAM97s | Weigh In |
| rKgI4y3ItTAzUekTUpvR | Drop Landing |



| QEG7m7DhYsD6BrcQ8pic | Squat Jump |
| 2uS5XD5kXmWgIZ5HhQ3A | Isometric Test |
| gyBETpRXpdr63Ab2E0V8 | Drop Jump |
| 5pRSUQVSJVnxijpPMck3 | Free Run |
| pqgf2TPUOQOQs6r0HQWb | CMJ Rebound |
| r4fhrkPdYlLxYQxEeM78 | Multi Rebound |
| ubeWMPN1lJFbuQbAM97s | Weigh In |
| rKgI4y3ItTAzUekTUpvR | Drop Landing |
| 4KlQgKmBxbOY6uKTLDFL | TS Free Run |
| umnEZPgi6zaxuw0KhUpM | TS Isometric Test |
Loading

0 comments on commit 56f0540

Please sign in to comment.