Nasaq
Components

Health Reports

Health reports over a period with averages that skip missing days, a one-figure trend chart, meals and caffeine per day, and each engine's days on and off protocol.

PreviewOpen ↗

Code

import { HealthReport, reportToCsv } from "@fadymondy/nasaq/web";<HealthReport  days={days}  engines={[{ engine: "hydration", days: hydrationHistory }]}  period={30}  onPeriodChange={(n) => load(n)}  onExport={async () => { download(reportToCsv(days)); }}/>;

Wellness · beta

Live examples and controls: Health Reports in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/health-reports.json

A report over 7, 30 or 90 days. Averages skip days with no reading instead of counting them as zero. One chart shows one figure at a time (water, steps, sleep, weight, resting heart rate). Meals and caffeine are stacked bars per day with a legend. A table gives each day-judging engine's days on protocol, off it and not judged, with streaks. An optional export button hands the work to the host.

When to use

  • The weekly or monthly review screen.

When not to use

Import

import { HealthReport } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

import { HealthReport, reportToCsv } from "@fadymondy/nasaq/web";

<HealthReport
  days={days}
  engines={[{ engine: "hydration", days: hydrationHistory }]}
  period={30}
  onPeriodChange={(n) => load(n)}
  onExport={async () => { download(reportToCsv(days)); }}
/>;

Anatomy

HealthReport                  data-slot="health-report"
├─ header                     h1, lede, Export button, period ToggleGroup
├─ Averages                   StatGrid
├─ Trend                      figure ToggleGroup, ChartContainer (bars or line)
├─ Meals / Caffeine           stacked bar Cards
└─ Protocol days              Table

API

PropTypeNotes
daysReportDay[]Oldest first. Missing figures are left out.
enginesEngineReport[]Per-engine HistoryDay[] for the same period.
periods / period / onPeriodChangeDefault [7, 30, 90].
onExport() => Promise<void | { error?: string }>Omit to hide the button.
loading, error, onRetrySkeleton, the server's message, retry.
labelsPartial<HealthReportLabels>Override any string.

Helpers exported from the folder: summariseReport, average, metricSeries, reportToCsv.

On this page