{"id":15722957,"url":"https://github.com/robmarkcole/applehealthdata","last_synced_at":"2026-01-07T19:54:43.024Z","repository":{"id":85843869,"uuid":"130169931","full_name":"robmarkcole/applehealthdata","owner":"robmarkcole","description":"Apple Health Data Extraction Code","archived":false,"fork":false,"pushed_at":"2018-04-18T01:09:16.000Z","size":1712,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T00:07:45.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Matlab","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robmarkcole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-19T06:37:22.000Z","updated_at":"2018-05-04T20:16:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"31317577-5fa1-4c17-abc4-5849721d92ad","html_url":"https://github.com/robmarkcole/applehealthdata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2Fapplehealthdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2Fapplehealthdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2Fapplehealthdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2Fapplehealthdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robmarkcole","download_url":"https://codeload.github.com/robmarkcole/applehealthdata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395590,"owners_count":20770243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T22:09:49.978Z","updated_at":"2026-01-07T19:54:43.011Z","avatar_url":"https://github.com/robmarkcole.png","language":"Matlab","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\r\n\r\n# Apple Health Data Extractor\r\n\r\n\r\n## Installation\r\n\r\nThis m script is self contained and can be run directly from MATLAB.\r\n\r\n\r\n## Citation\r\n\r\nIf you use `Apple Health Data Extractor` to extract step count or distance data for your publication, please cite it as:\r\n\r\n\r\n## Summary\r\n\r\nWith the increased interest in activity monitoring, especially step counting, the ability to accurately measure and record steps is imperative. Commonly-available commercial products such as FitBit, Jawbone and ActiGraph can be worn to measure steps in addition to other activitys [@tudor2008revisiting]. These devices have been shown to be accurate in step-counting studies [@veerabhadrappa2018tracking]. However, they require that \r\n\r\n- subjects remember to wear the device at all times, \r\n- researchers purchase and maintain enough devices to run a large-scale study\r\n- subjects periodically upload their data in a long-term study\r\n\r\nA solution to these problems is to leverage a device that many subjects will already own and is already counting their steps: an iPhone. The Apple Health app is, by default, counting steps and distance traveled. Subjects own their own device, need not install any software and will likely remember to have it with them all the time. The difficult part in research studies is collecting and analyzing the data from the phone. Subjects can export the data to an xml file contained within a zip file that contains their movement data. \r\n\r\nThe data is structured in time epochs of several minutes of step and distance data. This program extracts daily step and distance data from the exported zip file from the Apple Health app. In this version, a single zip file can be selected and analyzed. A loop can be written around the script to automate the extraction process in a batch. \r\n\r\nInstructions to retrieve the raw data from the app are in the pdf file.\r\n  \r\nApple Health writes the data in epochs of various lengths of time. Data in epochs that pass through midnight local time are counted all in the second day.\r\n\r\nThe script produces two matrix variables: `steplist` and `distlist`. `steplist` is a two-column vector with the date in YYYYMMDD format as the first column and the number of steps recorded that day as the second. `distlist` is a two-column vector with the date in YYYYMMDD format as the second column and the distance traveled (in miles) recorded that day as the second. For visualization and spot-checking, the script will also produce histograms of the two metrics. \r\n\r\nAn example health data file from an iPhone 6 running iOS 11.3 is included in the archive as `example.zip`. \r\n\r\nThe output of the example file produces the two matrices and following histograms:\r\n\r\n![Fidgit deposited in figshare.](hist.png)\r\n\r\n### Getting the data file from the iPhone\r\n\r\n1.\tOpen or search for the �Health� app from your home screen. \r\n\r\n![Fidgit deposited in figshare.](step1.png)\r\n\r\n2.\tOnce the app opens, you will see the screen below. Tap on the red profile icon in the top right of the app.\r\n\r\n![Fidgit deposited in figshare.](step2.png)\r\n\r\n3.\tThe screen below will then open. Scroll down to �Export Health Data� and click on the button. It will ask you if you are sure, click �Export�. Select how you want to get the data file. You can email it to using �Mail� or �Gmail� (whatever you use to check your email) or save it to a cloud service like Dropbox. The file will be in zip format and, by default, called �export.zip�. \r\n\r\n![Fidgit deposited in figshare.](step3.png)\r\n\r\n## References\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobmarkcole%2Fapplehealthdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobmarkcole%2Fapplehealthdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobmarkcole%2Fapplehealthdata/lists"}