Search by

vielhuber / healthspace

vielhuber

Personal health dashboard with manual measurements and Google Health integration.

Package info

github.com/vielhuber/healthspace

pkg:composer/vielhuber/healthspace

Statistics

Installs: 12

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.2.2 2026-11-10 10:25 UTC

This package is auto-updated.

Last update: 2026-11-10 10:25:48 UTC


README

Personal health dashboard with SQLite storage: measurements, AI meal-photo calorie estimates, intake statistics, Google Health activity/sleep and an installable PWA.

Setup

Requires PHP >= 8.3 with cURL, Fileinfo and PDO SQLite, Composer and HTTPS. Protect dot directories and SQLite files (the supplied Apache rules do this).

composer require vielhuber/healthspace
./vendor/bin/healthspace-init

Point the web server at the application root. Configure .data/.env:

  • AUTH_PASSWORD: login password (generated by the installer).
  • GOOGLE_HEALTH_CLIENT_ID / GOOGLE_HEALTH_CLIENT_SECRET: optional watch sync. Register the exact site root, including its trailing slash, as the OAuth redirect URI; connect Google Health in the app.
  • AI_PROVIDER, AI_MODEL, AI_API_KEY, AI_BASE_URL: existing AI connection for meal photos and weekly summaries. The model must support images.

Usage

  • Übersicht: concise AI review of activity, sleep, measurements and logged calorie intake (three to four sentences).
  • Gewicht & Blutdruck: weight, body fat, blood pressure and pulse; edit/delete records.
  • Essen & Ernährung: use + in any page's menu to take/select a photo for immediate calorie estimation and storage; daily totals, seven-day statistics and a 30-day chart. Multiple meals per day are supported; incorrect entries can be removed. JPEG, PNG and WebP up to 8 MB are accepted; the browser resizes photos before upload. Photos are sent to the configured AI provider but not retained by healthspace. Estimates cover only logged meals.
  • Aktivität & Schlaf: Google Health trends, refreshed by the scheduled sync; daily step goal: 5,000.

The interface always uses dark mode with locally hosted Space Grotesk (SIL OFL 1.1). Install through the browser menu (iOS: Share → Add to Home Screen). The offline screen and static assets are cached, never private health pages or photos. Photo recognition and health data require a connection; failed uploads are not queued.

Scheduled sync:

0 6,18 * * * curl -fsS 'https://your-host/?scrape=1&key=<URL-encoded AUTH_PASSWORD>' >/dev/null

Maintenance

Back up .data/ (credentials, OAuth token and database). Update via Composer without replacing runtime data; rerun healthspace-init if bootstrap or Apache rules change.

Development checks: composer test, npm test, npm run format:check (after composer install and npm install).

Import from Extrablatt (optional)

Stop sync, back up both databases, initialise healthspace and transfer only the required credentials. Adjust the source path below and run with SQLite’s stop-on-error mode (sqlite3 -bail .data/database.sqlite < migrate-health.sql). Reconnect Google Health afterwards. Never overwrite an existing healthspace database.

ATTACH DATABASE '/path/to/extrablatt/.data/database.sqlite' AS previous;
BEGIN IMMEDIATE;
INSERT OR ROLLBACK INTO health_days (
    day, steps, distance_meters, floors, calories, active_minutes,
    sleep_minutes, sleep_period_minutes, sleep_onset_minutes, nap_minutes, nap_count,
    sleep_deep_minutes, sleep_light_minutes, sleep_rem_minutes, sleep_awake_minutes,
    sleep_start, sleep_end, updated_at
) SELECT
    day, steps, distance_meters, floors, calories, active_minutes,
    sleep_minutes, sleep_period_minutes, sleep_onset_minutes, nap_minutes, nap_count,
    sleep_deep_minutes, sleep_light_minutes, sleep_rem_minutes, sleep_awake_minutes,
    sleep_start, sleep_end, updated_at
FROM previous.health_days;
INSERT OR ROLLBACK INTO health_measurements (
    id, day, weight_kg, body_fat_percentage, blood_pressure_systolic,
    blood_pressure_diastolic, pulse, created_at, updated_at
) SELECT
    id, day, weight_kg, body_fat_percentage, blood_pressure_systolic,
    blood_pressure_diastolic, pulse, created_at, updated_at
FROM previous.health_measurements;
COMMIT;
DETACH DATABASE previous;