extract combined exercise module

This commit is contained in:
Dima Gerasimov 2021-01-11 20:31:15 +00:00 committed by karlicoss
parent 6b451336ed
commit 5b501d1562
2 changed files with 23 additions and 10 deletions

17
my/body/exercise/all.py Normal file
View file

@ -0,0 +1,17 @@
'''
Combined exercise data
'''
from ...core.pandas import DataFrameT, check_dataframe
@check_dataframe
def dataframe() -> DataFrameT:
# this should be somehow more flexible...
from ...endomondo import dataframe as EDF
from ...runnerup import dataframe as RDF
import pandas as pd # type: ignore
return pd.concat([
EDF(),
RDF(),
])

View file

@ -1,7 +1,7 @@
''' '''
Cardio data, filtered from Endomondo and inferred from other data sources Cardio data, filtered from various data sources
''' '''
from ...core.pandas import DataFrameT, check_dataframe as cdf from ...core.pandas import DataFrameT, check_dataframe
CARDIO = { CARDIO = {
@ -21,12 +21,12 @@ NOT_CARDIO = {
} }
@cdf @check_dataframe
def endomondo_cardio() -> DataFrameT: def dataframe() -> DataFrameT:
assert len(CARDIO.intersection(NOT_CARDIO)) == 0, (CARDIO, NOT_CARDIO) assert len(CARDIO.intersection(NOT_CARDIO)) == 0, (CARDIO, NOT_CARDIO)
from ...endomondo import dataframe as EDF from .all import dataframe as DF
df = EDF() df = DF()
# not sure... # not sure...
# df = df[df['heart_rate_avg'].notna()] # df = df[df['heart_rate_avg'].notna()]
@ -42,7 +42,3 @@ def endomondo_cardio() -> DataFrameT:
df = df[is_cardio | neither] df = df[is_cardio | neither]
return df return df
def dataframe() -> DataFrameT:
return endomondo_cardio()