-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add from_strava(activity_id) method to WDF #8
Comments
A. B. C. |
A. B. C. Said that, if I will abstract away from the fact that it has DF under the bonnet and will simply see it as a Class designed for its own purpose, then few factory methods indeed can take care of massaging various data sources into canonical form. But at the moment I personally don't envision how such Class would enter the data flows I'm working with. |
A. B. C. |
A. What I wanted to say is if we keep the DF nature intact, then we should not shy away from using IO methods (https://pandas.pydata.org/pandas-docs/stable/io.html). If we treat WDF as a completely separate entity with it's own design decision, then data source specific factory method is OK for me. |
With your analogy my approach is identical to pandas: IO methods are not on the dataframe class but are separate methods in the pandas/sweat library: Two extra things I want to mention:
|
You are right, it is indeed a factory method... If that is how
|
|
Following your proposal, the structure of
|
Good idea, in your proposal both work flows are supported without adding much nesting to the modules.
Or if the api is more complex even:
If you think the low-level api is not too much nested down ( |
I think it is ok, the btw, is it a normal practice to define functions in the |
Good point about code in
|
It would be nice to be able to populate WDF from multiple sources. Strava is one very obvious pick.
To make this work efficiently few things must be agreed upon:
Access Strava API directly using
requests
andjson
(currently implemented instrava.py
and very easy to reason about) or rely on stravalib with all benefits of errors handling, but with an overhead of response-object mapping.Decide on what to do with the @requires decorator. Strava calls power - watts for example. One option is to get rid of the decorator and allow methods to specify the column name as an input argument (what
seaborn
orpandas.plot
do for example). Another option is to rename the columns on the fly to canonical names so @requires doesn't get confused. I do prefer the first option.The text was updated successfully, but these errors were encountered: