Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by tramGG on Wednesday January 24, 2018 @05:18PM
(#16226871)
There are people working on decentralization of Health (Data) + AI like Synapse AI, Doc AI, Pandora, etc. State of Decentralized AI: https://imgur.com/mOWKrQE/
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by killerdhmo on Wednesday January 24, 2018 @04:14PM
(#16226368)
Would you have to do something similar to aggregate all my steps for the year (or miles running) for example?
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by minimaxir on Wednesday January 24, 2018 @04:47PM
(#16226642)
For my quick example, you'd have to change the key in the regex appropriately, and there may be other various metadata involved that has to be handled (i.e. whether the steps are from running or from walking). Again, there are 3rd party tools, but I do not want to use them.
The actual data filtering/aggregation/visualization is a different story, and beyond the scope of getting the data. (here's why I was getting the heart rate data in the first place: https://twitter.com/minimaxir/status/949306256874913792)
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by killerdhmo on Wednesday January 24, 2018 @05:42PM
(#16227047)
Thanks for your response! Even just an aggregation would be useful (outside of 3P apps).
Congrats on your new gig! Looks a little more exciting than your previous one ;)
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by mercutio2 on Wednesday January 24, 2018 @09:07PM
(#16228223)
Why are you using regular expressions to parse XML? Python has excellent XML libraries.
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by minimaxir on Thursday January 25, 2018 @12:57AM
(#16229076)
Because reading line-by-line is better than loading-and-parsing a 1 GB (in my case) XML file.
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by icebraining on Thursday January 25, 2018 @02:07AM
(#16229319)
Iterative parsing is your friend: http://boscoh.com/programming/reading-xml-serially.html
There used to be a big argument between DOM and SAX parsers, but iterative/streaming parsers nowadays offer a pretty good compromise.
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by mercutio2 on Thursday January 25, 2018 @10:22AM
(#16231339)
That link has some bizarre misconceptions about namespaces (just define the namespace URLs you’re interested in as constants, don’t depend on the particular short name/URL map you expect, as that guy does).
It also looks like it predates cElementTree, which has an identical API but is vastly faster.
But anyway, yes, iterparse will be much more reliable/flexible than a regular expression search of non-canonical XML data, and will likely be faster, too.
Re:Apple, in Sign of Health Ambitions, Adds Medical Records ...
by patmurraydev on Wednesday January 24, 2018 @10:16PM
(#16228480)
I've always had success with this web based [1] converter, it does all the conversion locally, but can take a while on a few years worth of data.
The Export feature in the Health app currently exports all data as a large XML blob, which is not easy to load up into a spreadsheet. (for reference, I wrote a script to extract heart rate data from the XML and get it into a CSV: https://github.com/minimaxir/get-heart-rate-csv)
The workaround is to use a 3rd party app, which complicates privacy.