Skip to content

[MRG] adding support for apple health - #44

Merged
gedankenstuecke merged 4 commits into
OpenHumans:masterfrom
gedankenstuecke:adding-apple-health
May 16, 2020
Merged

[MRG] adding support for apple health#44
gedankenstuecke merged 4 commits into
OpenHumans:masterfrom
gedankenstuecke:adding-apple-health

Conversation

@gedankenstuecke

Copy link
Copy Markdown
Member

This PR:

  • adds the frontend features to display our new support for Apple Watch/Apple Health
  • adds the parsers needed on the backend
  • adds those parsers to the RetrospectiveEvent and SymptomReport objects as is done for all other wearables.

I've tested it with my data and it worked for all cases. I think it should be ready to be deployed!

Comment thread retrospective/tasks.py
)
new_analysis.save()
except:
pass

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case would an exception be thrown here? maybe add a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, it's a rather general catch-all as the merging of Fitbit & Fitbit Intraday is really fickle and easily crashes (e.g. I stopped using my Fitbit some time ago but still have my data in my account. Fitbit still updates the data even and reports 0 for each day, this leads the whole pipeline to crash 🙈 ).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not ideal but better than a server error ruining other processing/response? wouldn't hold this up based on improving this further

Comment thread quantified_flu/helpers.py
if i["source"] == "direct-sharing-453" and i["basename"].startswith(
"heartrate_samples"
):
missing_sources.pop("apple_health", None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright so this PR handles the case of the data having been imported by OH already, and doesn't offer an option to import them through QF. Is this planned for future?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, the Apple Health data is a bit special, as you can't export it through an API or anything, but just through having the corresponding iPhone app installed that exports data. Which makes integrating it much harder.

To integrate this in QF we'd need to generate a whole new API to which to export the data (not to mention the fact that it took 2 months to get the app into the appstore :D).

So using the app we got now seems the way to go (plus it doesn't make much difference, as people need to use an external tool in any case).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see :D

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit of code reminds me that supporting the google fit data from the separate activity is missing :) I created #46

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @madprime!

@madprime madprime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I only looked at the code, didn't try running it. I made a minor PR that's just formatting the template code for readability (at least, that's what I intended), and added an issue that occurred to me while looking over the code. :)

Comment thread quantified_flu/helpers.py
if i["source"] == "direct-sharing-453" and i["basename"].startswith(
"heartrate_samples"
):
missing_sources.pop("apple_health", None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit of code reminds me that supporting the google fit data from the separate activity is missing :) I created #46

</p>
{% endif %}
</div>
{% endif %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened up the code wondering if this was an extra endif (it's not) & have a minor code formatting PR to share. just readability, as I was trying to check this over :)

Comment thread retrospective/tasks.py
)
new_analysis.save()
except:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not ideal but better than a server error ruining other processing/response? wouldn't hold this up based on improving this further

(minor) improve template code formatting
@gedankenstuecke
gedankenstuecke merged commit 12ae90e into OpenHumans:master May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants