Skip to main content
# Myotest client API

## Setup

- Python > 3.4
- pip install -r requirement.txt

## Install dev version in your notebook

This will install a python package named "revo-client" in your current environment

##### Local version

- ```pip install -e {PATH TO YOUR REPO}```

##### Repository version

- ```pip install revo-client```



## Create Client

By default a connect will connect to the production server

```python
from myotest import Client

# Connect to production server with your api token
client = Client("my-api-token")

# Connect to staging server
client = Client("my-api-token", server="staging")

# Connect to another server
client = Client("my-api-token", server="https://my-server")

# Create a client for another user ( you must be the user's coach to be able to get his information )
client = Client("my-api-token", user_id="other-user-uuid")

```

## Root queries

```python

# Fetch last workout that contains tags
workout = client.get_last_workout_with_tags(["vam_high", "ranges"])

# Fetch workout with id
workout = client.get_workout_with_id("workout-uuid")

# Fetch current profile
profile = client.get_profile()

```

## Objects

### Object :: Workout

#### Attributes
- id (ID)
- title (string)
- start (datetime)
- end (datetime)
- type (string) workout type
- target_duration (timedelta) workout requested duration
- effective_duration (timedelta)
- slots (list of Object::Slot)
- datasets (list of Object::Dataset)
- training_load (Object::TrainingLoad)

#### workout.get_dataset(name)
Return the dataset matching name, if the name is complete (i.e. "mil-1") the dataset is returned.
If the name is partial (i.e. "mil") the first dataset is returned (lower index)

#### workout.get_slots()
Return all workout slots in execution order

#### workout.get_slot_with_tags(tags)
Return the first slot (Object :: Slot) containing all tags, if any

```workout.get_slot_with_tags(["vm_high])```


### Object :: Dataset

#### Attributes
- id (ID)
- name (string)
- dataframe (Pandas dataframe)
- describe (dict) Full dataset describe
- avro_schema (dict)
- workout (Object::workout)

### Object :: Slot

#### Attributes
- id (ID)
- tags (list of string)
- type (string)
- value (Object::SlotValue)
- text (string)
- result (Object::SlotResult)
- end_time (datetime)
- start_time (datetime)
- power_type (string)
- analysis (list of dict)
- workout (Object::workout)
- training_load (Object::TrainingLoad)

### Object :: SlotResult

#### Attributes
- power (dict) Describe of power **("max","min","std","mean","count","median")**
- speed (dict) Describe of speed **("max","min","std","mean","count","median")**
- gps_power (dict) Describe of gps_power **("max","min","std","mean","count","median")**
- gps_speed (dict) Describe of gps_speed **("max","min","std","mean","count","median")**
- distance (float) distance in meters
- gps_distance (float) distance in meters
- regularity_90 (float) regularity 90% of the time
- step_count_ratio (float) step vs run ratio
- regularity_median (float) median on regularity

**gps_speed** and **gps_power** are only available if the mil contains those information, if
the user created a workout without gps, those values are null

### Object :: SlotValue

#### Attributes
- value (float) distance=meters, duration=seconds, repetition=count
- type (distance | duration | repetition )

### Object :: Profile

#### Attributes
- id (ID)
- full_name (string)
- gender (male|female)
- weight (float) in kilogram
- height (float) in meter
- leg_length (float) in meter
- waist (float) in meter
- vma (float)
- pma (float)
- birth_date (date)
- age (float) in years


### Object :: AvroSchema

#### Attributes
- name (string)
- type (string) record type
- fields (Array of dict)


### Object :: TrainingLoad

Training load is only available to a slot using PMA calculation.
For other slot types, all the values are 0

#### Attributes
- requested_min (integer) requested training load minimum
- requested_max (integer) requested training load maximum
- fields (Array of dict) effetctive training load


## Script Example

```python
from myotest import Client

client = Client("my-api-token")
workout = client.get_last_workout_with_tags(["vma_high"])
await workout.load_slots()
slot = workout.get_slot_with_tags(["vma_high"])
profile = client.get_profile()

print(
"Hello I'm {} and I am {} years old, my last"
"vma workout had a regularity of {}".format(
profile.full_name,
profile.age,
slot.result.regularity_median))
```

Release files for revo-client 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for revo-client 0.9.0
File Size Uploaded
revo-client-0.9.0.tar.gz 13.6 kB Details

Release files / revo-client-0.9.0.tar.gz

Download URL revo-client-0.9.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
62ff67d15dc19a02f8456851aa0f47eb3ed7aef7b9bb5c74fd59e1c97b550bfb
BLAKE2b-256 checksum
How to use checksums
99e0e8332abb61c031a876068f8ef2422d2ab8f610006caed86d29ea042b456f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.9.0 This release

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page