Personal Health Data Infrastructure
From 10 Years of Apple Health to AI-Powered Cross-Analysis
Ten years ago, I wasn’t deliberately starting a health project. I just kept my phone in my pocket and wore a watch on my wrist, and the days passed.
Then, not long ago, I exported everything from the iPhone Health app for the first time. After decompressing the archive, I had a 1.3 GB XML file. Ten years. Over 3 million records: steps, heart rate, sleep, workout routes, autonomic nervous system metrics. A history written jointly by my body and time, spanning my years of building a startup, pivoting, leaving my comfort zone, and starting over.
That moment made something clear: the problem isn’t a lack of data. It’s a lack of infrastructure.
Why Build Your Own Analysis System?
Mainstream wearables each operate within closed ecosystems with proprietary algorithms. This creates two fundamental problems.
The first is data silos. Apple Health has its own interpretation logic; Fitbit has its own algorithm. I wear both simultaneously. For total sleep duration on the same night, they agree remarkably well, a difference of just 2 minutes. But their readings diverge by 21 minutes on deep sleep and 15 minutes on REM. Which one to trust? Neither fully. The only honest answer is cross-referencing for trends.
The second is missing dimensions. Phone apps excel at showing you “today” and “this week.” They are not designed for five-year longitudinal trends, and they cannot cross-reference a decline in exercise volume against worsening HRV and accumulating sleep debt simultaneously. Yet the relationships between those metrics are often exactly where the important signals live.
Seeing the full picture requires not another wearable, but your own analysis infrastructure.
Ten Years of Digital Footprints
My iPhone has been tracking activity continuously since August 2015. When Apple Watch joined in 2016, heart rate and sleep began to be measured with greater precision. Starting in 2023, Fitbit became a second wearable, providing an independent measurement baseline.
The ten-year totals: 279,537 step-count records, 231,300 walking and running distance records, over 1.13 million heart rate records, and 29,532 sleep records. On the exercise side: 1,420 runs, 435 cycling sessions, 19 swims, and 966 GPS workout routes.
From September 2023, Apple Watch began capturing deeper metrics: 7,710 HRV readings, 753 resting heart rate records, 9,837 blood oxygen readings, 439 wrist temperature records, and 122 VO2Max readings. These are where wearables deliver real value: not step counts, but the operating state of the autonomic nervous system.
Numbers in isolation carry no emotion. But once the annual distribution spreads out, a great deal becomes legible.
Technical Architecture: Three Data Pipelines
Real-Time Pipeline: Fitbit → MCP → Claude
Through Anthropic’s MCP (Model Context Protocol), the Fitbit API connects directly to Claude Desktop.
How it works: I can tell Claude directly, “Analyze my stress load over the past week.” Claude calls the Fitbit API via MCP, retrieves raw JSON: sleep data (with stage durations), heart rate time series, activity summaries, and analyzes it in real time. What comes back is raw API data, not a pre-interpreted summary from an app.
Technical notes: OAuth 2.0 authentication with automatic token refresh. Runs entirely on-device; data never passes through a third-party server.
Deep Pipeline: Apple Health → XML → Structured Analysis
Apple does not provide a Health API for personal use. The only exit is a manual export from the iPhone.
Processing flow: I use Python to stream-parse the 1.3 GB XML file rather than loading it all at once. First, I build an index of data types, then extract each metric into separate JSON files: sleep, HRV, resting heart rate, blood oxygen, and so on, before computing daily and monthly aggregates.
The core problem solved: Apple categorizes sleep as Core / Deep / REM. Fitbit uses Light / Deep / REM. Apple’s Core broadly corresponds to Fitbit’s Light, but the algorithmic thresholds differ. The approach is to align trend direction only, not compare absolute values.
Automated Pipeline: CI/CD Continuous Deployment
A crontab job on my Mac runs an update script every 10 minutes. It pulls live data via the Fitbit OAuth API, a git push triggers GitHub Actions to build automatically, and Cloudflare Pages deploys the result. The health dashboard stays current at all times. From data generation to site update, no manual intervention.
This isn’t showing off. I don’t want to check a chart occasionally. I want it to run as long-term infrastructure.
What the Data Actually Says
When ten years of curves are overlaid, numbers are more honest than feelings.
The Rise and Fall of Exercise: From Daily Triathlons to Zero
In 2018, I started competing in triathlons. At least one race per year. Around the same time, I joined a discipline community called “Daily Triathlon” (日日三鐵): each day, you complete at least one of swimming, cycling, or running. I usually chose running. Lowest barrier to entry: shoes on, out the door.
Two reasons drove me to it. One was personal: to set an example for my son, to let him see how his father managed his body and his discipline. The other came from my startup experience: physical health is the hardware that carries every decision and every execution. Almost every strong CEO I know has a consistent exercise habit; many actively seek out extreme physical challenges. Not because they “have the time,” but because they understand that the body’s recovery cycles cannot be compressed.
The annual distribution of GPS routes tells the story: 93 in 2021, 340 in 2022, 294 in 2023, 200 in 2024, 39 in 2025. In 2022, there was almost a workout record every single day, the year the Daily Triathlon commitment held most completely.
In the years that followed, work transitions, growing responsibilities, and a changing life structure accumulated. I wasn’t conscious of abandoning my recovery cycles. When exercise got crowded out of the schedule, the data showed the body going into debt immediately.
Sleep Debt: 33 Consecutive Months Below Baseline
Combining Fitbit records (May 2023 to February 2026, 883 nights) with Apple Watch records (September 2023 to December 2025, 537 nights): 33 months, with no single month averaging the recommended 7 hours. The full-period average was approximately 5 hours 50 minutes.
One hour less per day. Over three years, that’s more than a thousand hours of sleep debt.
The trend is what demands attention. The 2023 to 2024 average hovered around 6 hours; 2025 dropped to 5 hours 41 minutes, bottoming out in Q2 at 5 hours 16 minutes. Sleep efficiency fell from 83% to 74%. It isn’t just sleeping less: I’m spending more time in bed while the fraction of time actually asleep keeps shrinking. The body is resting; the nervous system is still running.
HRV and Resting Heart Rate: The Most Honest Metrics
HRV declined from 42 ms in 2023 to 31 ms by mid-2025, a drop of more than 25%. Resting heart rate climbed over the same period from 60 bpm to 72 bpm. Two lines, both pointing at the same thing: the autonomic nervous system under sustained stress.
This is not an emotional judgment. It is a physiological signal. And it is data that only Apple Watch captures: without it, Fitbit alone would never surface the pattern. That is precisely the value of cross-device analysis. The warning that no single app would proactively surface becomes impossible to ignore when multiple dimensions are placed side by side.
Lessons Learned: The Fragility of Data Pipelines
While building this analysis, I found that my body weight data had completely dropped off after 2022. The reason is almost embarrassingly mundane: my smart scale broke, and I never replaced it.
This is a textbook data lesson. Hardware failure is the greatest threat to a personal data infrastructure. Once a data stream breaks, the physical changes during that gap become a permanent blind spot. Not a failure of intention. Just a thread that snapped and was never tied back together.
The same fragility exists in the Apple Health export process. It requires a manual trigger. Without regular exports, the most recent data lives only on the iPhone, inaccessible to any external analysis.
Recognizing this fragility is the first step toward building infrastructure that can actually sustain itself.
Practical Guidance on Device Pairing
Twenty-six months of overlapping dual-device data produced a working set of principles. For total sleep duration, Fitbit takes priority (higher coverage, 25–31 nights per month). For REM sleep, Apple Watch is the reference (its accelerometer is more precise at detecting micro-movements). For deep sleep, look only at trends, never absolute values. This is where the two devices’ algorithms diverge most. HRV, resting heart rate, and blood oxygen are Apple Watch’s exclusive leading indicators.
Fitbit is the primary tool for daily tracking; Apple Watch is the complement for deeper health assessment. The two are not substitutes. They compensate for each other.
Next Steps: From Observation to Intervention
The next phase of this system is not more charts. It’s three things: AI anomaly detection (when HRV stays below baseline for three consecutive days, Claude proactively issues an intervention suggestion); lifestyle annotation (recording before-and-after comparisons for each behavioral intervention); and more data source integration (Oura Ring temperature, smart blood pressure monitor, body composition scale, each additional pipeline adds another layer of cross-analytical depth).
Evolving from “reading data” to “using data to drive behavioral change” is the actual value of a Personal Health Infrastructure.
Closing
Ten years of data proves two things.
The body has been signaling all along. Declining HRV, rising resting heart rate, collapsing sleep efficiency, exercise volume going to zero: these signals scattered across different devices each looked “within range” inside their respective apps. It took a self-built analysis infrastructure to bring them together into a trend impossible to dismiss.
And I have done this before. 1,420 runs, 435 cycling sessions, one triathlon a year: the 340 GPS routes from 2022 prove the Daily Triathlon was achievable. The decline is not fate. It is structure.
Health shouldn’t reduce to “how many steps I took today.” It should be a personal system, one that can be verified, corrected, and continuously refined.
Ten years of data isn’t for nostalgia. It’s a reminder: once you’ve seen the trend clearly, there’s no honest reason to look away.
The health data analysis dashboard for this article is available at paulkuo.tw/health.
For technical details, including Fitbit MCP setup, Apple Health XML parsing, Chart.js visualization, CI/CD automation pipeline, feel free to reach out.


💬 Comments
Loading...