mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
Long-term retention for the dense intra-day tier (PULSE, HRV, SpO2) folds to per-local-hour means instead of a single daily mean: the last 14 days keep every raw sample, older days keep up to 24 points per metric — the day's shape survives permanently at ~9k rows/metric/year. Hourly rows key as stats:<HK>:<YYYY-MM-DD>T<HH> anchored at local HH:30, adopt-in-place against both unique indexes with the P2002 retry outside the transaction. The pre-fold DAY-rollup recompute extends to HRV (mean fidelity, not only min/max) and the post-fold recompute is gone for the whole tier. Derived resting rows for proxy users still mint from the day's raw samples. A one-shot rebuild reconstructs the hourly shape for every already-folded day from the soft-deleted raw samples and retires the daily row in the same transaction — at no instant are both grains live, so no AVG-over-live-rows reader can double-count. Boot discovery pairs live daily-grain rows with surviving tombstones (parameter-bound SQL, pinned against real Postgres) and converges to zero once converted; days whose tombstones were pruned keep their daily mean. PULSE/SpO2 DAY buckets keep the true pre-fold stats; HRV DAY buckets recompute from the hourly rows (strictly better than the collapsed fold-time bucket); WEEK/MONTH/YEAR respans enqueue whole-bucket recomputes.
docs/ — internal reference + operator playbooks
The user-facing documentation lives at https://docs.healthlog.dev — that's the canonical surface for self-hosting guides, integration walkthroughs, AI-provider setup, and the doctor-report workflow.
The files in this directory are the internal operator playbooks, audit notes, and machine-readable specs that ship alongside the source:
api/— the OpenAPI 3.1 spec for the native-client subset (iOS DTO codegen target). Seeapi/README.mdfor the preview commands. Also home to the MCP-server contract:api/mcp-capabilities.md(tools, resources, prompts, write model) andapi/mcp-skills.md(building a connector / skill).ops/— backup / restore + encryption-key-rotation playbooks. These are the runbooks an operator reaches for during an incident.self-hosting/— horizontal-scaling notes (HEALTHLOG_PROCESS_TYPE=web|worker|all) and the deploy-pipeline recipe. Routine install steps stay ondocs.healthlog.dev. Includesself-hosting/mcp.md— enabling the off-by-default MCP connector and pointing Claude.ai / ChatGPT / Claude Desktop at it.migration/— release-by-release migration notes. Read the entry for the version you're upgrading from.audit/— per-release audit summaries archived for forensic traceability.apple-store-connect-checklist.md— the iOS submission gate.doctor-report.md— PDF generator design notes.codex-protocol-spec.md— Codex / ChatGPT OAuth protocol reverse-engineering notes.ui-guidelines.md— UI / a11y house style.
If you're a self-hoster looking to spin up an instance, start at https://docs.healthlog.dev or jump to the Quick Start in the project README.