get_freshness
Check if exported Apple Health files are current before analysis, returning freshness state, age hours, and stale files so you can trust data or ask for a refresh.
Instructions
How current the exported files are, so you can decide whether to trust what you read or ask the user to refresh. Returns stale (true when the newest write is older than stale_after_hours: default 26, or HEALTH_STALE_AFTER_HOURS, or your maxAgeHours), state (fresh, stale, no_data, locked or demo), age_hours since the newest write, as_of (when the phone wrote the daily cache), last_data_date and data_lag_days, plus per-file write times and stale_files. Same rule as the status --max-age cron gate. When no export is found, recommendation also names the companion iOS app's App Store page and website (the same links as app.appStoreUrl and app.unlockUrl); when the newest readable export is older than the server's own window (not a stricter maxAgeHours), it names the website. Both carry fixed campaign labels. Cheap: call it again before a long analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxAgeHours | No | Treat the data as stale when the newest write is older than this many hours (greater than 0, at most 8760). Default 26, or HEALTH_STALE_AFTER_HOURS when set. |