Skip to content
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

[Feature Request] - Integration with Auto Extractors #25

Open
latetedemelon opened this issue Mar 1, 2024 · 10 comments
Open

[Feature Request] - Integration with Auto Extractors #25

latetedemelon opened this issue Mar 1, 2024 · 10 comments

Comments

@latetedemelon
Copy link

latetedemelon commented Mar 1, 2024

Idea here is to automate the data updates. There are two possible workflows:

https://apps.apple.com/us/app/health-export-csv/id1477944755
https://apps.apple.com/us/app/simple-health-export-csv/id1535380115
https://apps.apple.com/us/app/health-auto-export-json-csv/id1115567069

  • This application would autoextract the data to an icloud location
  • User would be responsible for getting the data to the import directory. There are other project that can do this.
  • This application would scan that directory on update, accept the format of the export and import the new data.

https://apps.apple.com/us/app/health-auto-export-json-csv/id1115567069

  • This workflow would have the data call out to an endpoint, rest or MQTT
  • MQTT woudl probably be the easiest to integrate
  • Here is an http endpoint to receive the rest data
  • https://github.com/irvinlim/apple-health-ingester
  • This application would listen on an mqtt broker and update the influx db upon publish events.

More than happy to use my limited my skills to help but I'm not an expert and wanted to see if you were even interested.

@latetedemelon
Copy link
Author

Actually it would appear someone has done some of this work here:

https://www.ivaylopavlov.com/charting-apple-healthkit-data-in-grafana/
https://github.com/irvinlim/apple-health-ingester

@latetedemelon
Copy link
Author

Apparent here is a way to create an API via Firebase:

https://github.com/emreloper/apple-health-api

@k0rventen
Copy link
Owner

Hey ! Thx for the suggestion, that's a great idea !

You're right, it should be easier to transfer the health data, rather than manually exporting from the Health App, sending to the computer etc..

I guess having an API endpoint available on our side that the iPhone can hit isn't that difficult to setup. It would be mostly a matter of checking the format sent by the app.

I'll try with the app you mentionned ! When I have a PoC ready I'll bump the issue :)

Regards,

@goldjunge91
Copy link

Hi,

I've been exploring ways to store and utilize iOS Health & ScreenTime data and found this repository incredibly helpful—thank you for your efforts!

While I'm more of a 'copy and paste' coder 😄, I'm keen to contribute some ideas for automated data extraction:

1. Healthflux (MacOS only)

Created by Felix Kohlhas, this project automates the extraction of Health data on MacOS from an Database file.

2. ScreenFlux (MacOS only)

Felix also developed ScreenFlux, which includes a tool, ScreenTime to CSV, for exporting screen time data.

3. Universal Compatibility:

To ensure compatibility across all Apple iOS & MacOS / versions, we could leverage or enhance @mm's Heartbridge shortcut. Consider these examples:

Importantly, in my oppinion is this approach respects user privacy, ensuring that health data is not shared with third-party APIs.

@k0rventen, if you haven't started implementing these function, I'd love to give it a try. I recently developed a web app using Next.js/React, PostgreSQL, and some Python for web scraping. Although my code might not be the cleanest, I'm eager to help and contribute to this project.

Best Regards.

@k0rventen
Copy link
Owner

Hey @goldjunge91 ! Thx for your interest !
Of course, you're more than welcome to help !

On my side I tried this app: https://apps.apple.com/us/app/health-auto-export-json-csv/id1115567069. But the true 'export' through the network is behind a subscription, which IMO isn't what I want for users to deal with.
One workaround would be to use a Shortcut to automate this process. I've played around with it (aka set up a ASGI server on this project and a POST endpoint to publish the export to), but haven't been any further.

This simpler app (https://apps.apple.com/us/app/simple-health-export-csv/id1535380115) looks like a better fit but there is no true export function, and there is no automations available for it in Shortcuts.

Importantly, in my oppinion is this approach respects user privacy, ensuring that health data is not shared with third-party APIs.

I second this. Everything should be local.

If you want i can push what I've already done in a separate branch for you to look at, but it's very much a WIP ;)

Regards,

@k0rventen
Copy link
Owner

Pushed to this branch.

And here is the shortcut that i've made: https://www.icloud.com/shortcuts/41f3bde06db040c1a08c18218a02dd54.

Install the new dependencies, run python api.py, change the IP in the Shortcut to your server's, then launch it. It should create a 'import.csv' file (which is actually JSON, forgot to change it when testing).

@jschulman
Copy link

The shortcut doesn't import correctly for me. What is the full POST url to port 5000? A curl test would be great.

@k0rventen
Copy link
Owner

As said in a comment above,

I've played around with it (aka set up a ASGI server on this project and a POST endpoint to publish the export to), but haven't been any further.

The server doesn't actually import the data, but merely creates a file locally with the data from the shortcut.

@djhn75
Copy link

djhn75 commented Aug 26, 2024

Here is a shortcut that can transfer several data points for a specific date to influxdb v2. Maybe someone is interested.

You just have to enter the IP, ORG, and Api token in the dictionary

https://www.icloud.com/shortcuts/3a457dd48dcd42869eb9c02374bed114

@latetedemelon
Copy link
Author

This one appears to work for influxdb v1:
https://github.com/ivailop7/Healthkit-influxdb-grafana
This one for version 2:
https://github.com/samanthavbarron/Healthkit-influxdb-grafana
And here is my WIP for Victoria Metrics:
https://github.com/latetedemelon/Healthkit-influxdb-grafana

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

No branches or pull requests

5 participants