OpenHumans / ohjh-example-notebooks

Explore your personal data with https://notebooks.openhumans.org
http://openhumansfoundation.org/ohjh-example-notebooks/
MIT License
22 stars 10 forks source link

Update twitter-and-fitbit-activity.ipynb: Fix checking for valid fitbit data and correct url #25

Closed jacobrosenthal closed 6 years ago

jacobrosenthal commented 6 years ago

Copy paste error checking for valid fitbit data and correct url to fix

jacobrosenthal commented 6 years ago

@gedankenstuecke Done

jacobrosenthal commented 6 years ago

BTW this example still doesnt work for me, Im still figuring out why. I get this error atm

AttributeError                            Traceback (most recent call last)
<ipython-input-28-f1c1c789a178> in <module>()
      2 joined_data['steps'] = joined_data['steps'].apply(int)
      3 joined_data = joined_data[joined_data['steps'] != 0]
----> 4 joined_data['year'] = joined_data.index.year

AttributeError: 'Index' object has no attribute 'year'
gedankenstuecke commented 6 years ago

Thanks! And that's weird, it worked for my own data with the notebook of this PR. Could you post the output of joined_data.head() here to see how it looks like?

jacobrosenthal commented 6 years ago

@gedankenstuecke

print(joined_data.head())
joined_data = twitter_mean.join(fitbit_steps,how='right')
joined_data['steps'] = joined_data['steps'].apply(int)
joined_data = joined_data[joined_data['steps'] != 0]
joined_data['year'] = joined_data.index.year
Empty DataFrame
Columns: [hashtag, media, url, date, tweets_per_day, steps]
Index: []
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-2c8307d99bc3> in <module>()
      3 joined_data['steps'] = joined_data['steps'].apply(int)
      4 joined_data = joined_data[joined_data['steps'] != 0]
----> 5 joined_data['year'] = joined_data.index.year

AttributeError: 'Index' object has no attribute 'year'
gedankenstuecke commented 6 years ago

Ah, it seems you don't have data on overlapping dates for Fitbit and Twitter, that's why the joined_data looks like this:

Empty DataFrame
Columns: [hashtag, media, url, date, tweets_per_day, steps]
Index: []

Is this somewhat expected for you or should there be data? 😄

jacobrosenthal commented 6 years ago

Yeah I just noticed my fitbit data is like 1.1kb and the tracker-steps field is empty, so yeah I have a feeling the sync isnt working. I deleted the data and am trying to sync again. I used fitbit for a few months this year and a few times over the past few years, so I would expect some decent data in there.

screen shot 2018-05-20 at 6 07 12 pm

jacobrosenthal commented 6 years ago

Just deleted and resynced, same tiny amount of data. Something looks to be wrong with the fitbit sync, where can I report that?

gedankenstuecke commented 6 years ago

Oh, that's not good and surprising to hear as we thought the fitbit integration works fine now! Did you press the update button on https://oh-fitbit-integration.herokuapp.com/ after logging in to request an update?

If you could share your project_member_id that's on https://www.openhumans.org/activity/fitbit-connection/ (either here or via email at bastian@openhumans.org) I and @mcescalante can have a look what's going wrong there!

gedankenstuecke commented 6 years ago

Ok, that issue should have been fixed through https://github.com/OpenHumans/oh-fitbit-integration/pull/14 🎉

jacobrosenthal commented 6 years ago

Look good, couple megs now instead of 1kb. Thanks!

On Mon, May 21, 2018 at 9:11 AM Bastian Greshake Tzovaras < notifications@github.com> wrote:

Ok, that issue should have been fixed through OpenHumans/oh-fitbit-integration#14 https://github.com/OpenHumans/oh-fitbit-integration/pull/14 🎉

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenHumans/ohjh-example-notebooks/pull/25#issuecomment-390702087, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb0dIrry7ZV2sDy7NgVxUN09deWkNWcks5t0uctgaJpZM4UF3YF .

gedankenstuecke commented 6 years ago

Great, glad to hear that! And thanks for reporting the problem!

gedankenstuecke commented 6 years ago

Thanks for the fixes! 👍 🎉