mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Composite 0-100 score with three bands (green >= 75, yellow 50..74, red < 50). Server-deterministic so the same inputs always produce the same output. Sub-components: - bpInTargetRate (30 %) — reuses the existing all-time figure - weightTrendAlignment (20 %) — slope vs target band over 30 days - moodStability (20 %) — `100 - CV*100`, requires >= 5 entries - complianceRate (30 %) — mean of medication compliance30 Null components scale the remaining weights proportionally so the score never lies about what was actually measured. Pure helpers (linearRegressionSlope, coefficientOfVariation, weightTrendAlignment, moodStability, complianceRate) live alongside the composite. Tests cover strong/mixed/poor scenarios, every null-redistribution shape (bp null, bp+mood null, all-but-compliance null, all null) and determinism (same input -> same output). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>