Browse Source

❤️‍🩹 health

David Windham 3 months ago
parent
commit
af8d589e7a
5 changed files with 60 additions and 4 deletions
  1. 3 0
      lists/shopping.md
  2. 2 3
      notes/health/diet.md
  3. 53 0
      notes/health/health.md
  4. 1 0
      notes/index.md
  5. 1 1
      notes/play/tennis.md

+ 3 - 0
lists/shopping.md

@@ -35,6 +35,9 @@
 - flower bulbs
 
 
+## Favorite Vendors
+
+- [Public Domain Review](https://publicdomainreview.org/shop/) 
 
 ## Old Amazon Lists
 

+ 2 - 3
notes/health/diet.md

@@ -3,10 +3,9 @@
 ## Log / Todo
 
 - 24/12/08 - **weight**: was down to 178 — back up to 185, but would like to be at 170 lbs.
-  - too much stress/tired eating in the late afternoons. 
-  - the nuts are high calorie. don't need a handful everytime you hit the pantry. 
+  - likely too much stress & tired eating in the afternoons.
 - 23/12/17 - **weight**: considering lowering my overall caloric intake to get down 15-20lbs.
-  - cut crackers/cereal/bread
+  - cut crackers/cereal/bread/bagels, **cake** & **ice cream**
   - more beans ( in salads / in soup / in place of rice )
   - walks after lunch
   - cut down on the cheese

+ 53 - 0
notes/health/health.md

@@ -9,6 +9,7 @@
 
 ## Log
 
+- 24/12/16 - added an Apple Watch mainly for biometric feedback. will [figure out an easy way](#parsing-apple-health-data) to automate and export every so often so I can store it here. 
 - 24/12/07 - hip injury ( IT band muscles / labral ) likely related to playing [tennis](/notes/play/tennis) - need to consider a more wholistic and low impact regular excersize routine like walking, swimming, pilates, & yoga. 
 - 23/12/17 - added a [Diet](/notes/health/diet) log.
 - 23/12/17 - added a ^ sleep log.
@@ -76,3 +77,55 @@ related
 - Mere Medical - https://github.com/cfu288/mere-medical
 - https://github.com/k0rventen/apple-health-grafana
 
+#### Parsing Apple Health data
+
+If you’ve ever wanted to analyze your own health data, here’s how.
+
+###### Exporting as XML
+
+1. Open the [Health app](https://www.apple.com/ca/ios/health/).
+1. Tap on your profile in the top right.
+1. Tap Export All Health Data.
+1. Share the archive with yourself (e.g. via AirDrop, Files, Mail, etc.).
+
+Within the archive, you’ll find `export.xml`. This is where the main metrics are stored.
+
+##### Converting to JSON
+
+If you open `export.xml`, you'll see most of the interesting data is contained in the attributes of `Record` elements.
+So let's make a small Python script to convert those attributes to JSON.
+
+Save the following to a file called `parse.py`:
+
+```python
+import json
+import sys
+from xml.etree.ElementTree import iterparse
+
+for _, elem in iterparse(sys.argv[1]):
+    if elem.tag == "Record":
+        print(json.dumps(elem.attrib))
+```
+
+Then run:
+
+```shell
+python parse.py export.xml
+```
+
+You should immediately start seeing the data in your terminal.
+
+###### Converting to CSV
+
+Using jq, we can convert the JSON to CSV:
+
+```shell
+python parse.py export.xml | jq -r '[.endDate, .type, .unit, .value] | @csv'
+```
+
+If you prefer TSV (e.g. for processing with `cut`), replace `@csv` by `@tsv`.
+
+Save the data to a file and analyze with your favorite software.
+
+
+

+ 1 - 0
notes/index.md

@@ -7,6 +7,7 @@ slug: /
 
 ## Log
 
+- 24/12/16 - ❤️‍🩹 [health](/notes/health) biometrics
 - 24/12/08 - 🚽 [house/bath](/notes/house/bath)
 - 24/10/05 - 🏡 [house/helene](/notes/house/helene)
 - 24/09/12 - 💰 [work/wealth](/notes/work/wealth)

+ 1 - 1
notes/play/tennis.md

@@ -26,7 +26,7 @@ I played a lot of tennis as junior and started back after a twenty-five year bre
 
 ## EHS Tennis
 
-24/12/10 - Due to a recenty injury, I decided I’d whip up a decision tree on wether of not I should resign from my tennis coaching gig before the next season. Had already been considering only doing the last of this year, but with the injury and upcoming projects, the timing is more appropriate right now. Asked my friends and parents to vote on it as well. Figured I'd put it here for posterity.
+24/12/10 - Due to a recenty injury, I decided I’d whip up a decision tree on wether of not I should resign from my tennis coaching gig before the next season. The timing is more appropriate right now with the injury and upcoming projects. Asked my friends and parents to vote on it as well. I've decided **that I'm staying on as head coach**, but I figured I'd put it here for posterity.
 
 
 | YEA | NAY |