health-sleep-analysis

Analyze Apple HealthKit sleep, SpO2, heart rate, and HRV data into visual reports.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/riipandi/minis-skills --skill health-sleep-analysis-riipandi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: health-sleep-analysis
Source: https://github.com/riipandi/minis-skills/tree/main/health-sleep-analysis
Command: npx skills add https://github.com/riipandi/minis-skills --skill health-sleep-analysis-riipandi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires matplotlib, numpy, rsvg-convert, font-noto-cjk, and includes scripts (resource) components.

What problem does it solve? Raw Apple HealthKit sleep and cardiac exports are hard to interpret, making it difficult to spot trends in sleep stages, blood oxygen, resting heart rate, and HRV without manual analysis. ## Core Features & Use Cases - Sleep Report Generation: Produces 7-day weekly report cards, 30-day monthly trends, and half-year or full-year long-term trend charts from HealthKit sleep stage and SpO2 data. - Cardiac Health Analysis: Evaluates resting heart rate, HRV (SDNN), and blood oxygen against clinical reference ranges, flagging potential issues like low SpO2 dips associated with sleep apnea. - Localized Visual Output: Renders dark-themed SVG/PNG charts via rsvg-convert or matplotlib with Chinese, English, and Japanese chart text. - Use Case: Ask for a monthly sleep review and receive a rendered trend chart showing nightly sleep stages, minimum SpO2, bedtime patterns, and a written health summary in your language. ## Quick Start Analyze my Apple Health sleep data for the past 30 days and generate a monthly sleep trend report with blood oxygen levels.

Frequently Asked Questions about health-sleep-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze Apple Health sleep data with Python?

Export sleep and blood oxygen samples using the apple-healthkit CLI into JSON files, then run the provided scripts to aggregate nightly sleep stages and render trend charts. Outputs are SVG and PNG reports covering 7-day, 30-day, half-year, or full-year periods.

How to visualize sleep stages and SpO2 trends from HealthKit?

Use the sleep_report_librsvg.py or sleep_month_trend_librsvg.py scripts, which parse HealthKit JSON samples, map stages like asleepDeep and asleepREM, and render stacked bar charts plus SpO2 trend lines via rsvg-convert.

What languages do the sleep report charts support?

The rendering scripts accept a --lang argument supporting zh (Chinese), en (English), and ja (Japanese). All chart titles, labels, legends, and insight cards are localized automatically based on this flag.

Why do Chinese or Japanese characters show as boxes in the chart?

Missing CJK fonts cause tofu boxes in rendered charts. Install the Noto CJK font package with apk add font-noto-cjk before running the rendering scripts to fix the display.

Why does the chart show stale or missing sleep data after re-running?

The workspace directory has an iSH iOS sync delay that causes stale cached reads. Always write raw HealthKit JSON and script outputs to /tmp/, then copy only the final PNG files to the workspace for display.

What SpO2 level during sleep is considered dangerous?

Readings at or above 95% are normal, 90-94% is low and worth monitoring, and anything below 90% is dangerous. Frequent drops below 95% or any reading under 90% may indicate obstructive sleep apnea and warrant medical evaluation.