qor Health Tech Spec
How qor Health, the health tracking feature inside qor, ingests, stores, calculates and evaluates health data. As of November 29, 2026.
Contents
Overview
qor Health is a qor feature that brings body composition, nutrition, movement, sleep and stress into one dated record and tracks them against the user's own goals. Its code lives in features/body-scan/; the feature id, body-scan, also names its content file.
This is an as-built spec: it describes qor Health as the code works today. Hosting, storage, backups, theming and the Claude providers come from qor itself and are covered in the qor core tech spec.
| Area | Input | Output |
|---|---|---|
| Body composition | Scale report files (PDF or image), typed weigh-ins, waist and hip | Trend charts, headline figures, segment readings |
| Nutrition | Typed entries and emailed food notes | Daily totals, target meters, calorie and macro trends |
| Movement | Oura or Google Health sync, typed days, logged exercise | Steps and calorie charts, estimated daily burn |
| Sleep | Oura sync or typed nights | Nightly history, target band, sleep debt |
| Stress/Mood | A daily rating from 1 to 5, with an optional Oura comparison | Daily history and agreement count |
| Evaluation | A snapshot of the above, plus a user-chosen Claude Code skill | A dated review that can be saved |
Design rules
- The user's entry wins. A typed food figure is never replaced by a look-up. A typed night or activity day is never replaced by a sync.
- Estimates are visible. Nutrition figures from Claude are shown with a tilde, and an estimated burn is labeled as an estimate.
- Repeat work is free. Stored scan dates are not read again, and a saved food is not looked up again.
- Interpretation is the user's choice. The evaluation runs a skill the user names, so the standards it applies are theirs.
Architecture
The renderer side is a standard qor feature with a page, a dashboard widget, a settings panel and an email intake handler. It imports from @qor/theme-kit for shared code and types, and builds its interface from the active theme's components. File access, Gmail, Claude and the health provider APIs sit in the main process.
| Module | Responsibility |
|---|---|
index.tsx | Data shape, scan import hook, page, widget, settings, charts, intake handler |
food.tsx | Food log, saved-food library, nutrition look-up, emailed food notes |
wellness.tsx | Movement, sleep and stress views, sleep debt, daily burn estimate |
evaluate.tsx | Data snapshot, skill request, result parsing and history |
oura.tsx, googlehealth.tsx | Sync buttons, merge rules, connection settings |
effects.ts | Default visual and sound effect for a newly stored scan |
src/main/bodyscan.ts | Email attachments, folder scan, image tiling, report extraction |
src/main/oura.ts, src/main/googleHealth.ts | OAuth, token storage, API calls and response mapping |
Data model
All Health records live in one JSON file. The feature normalizes stored content before using it, so a file written before a field existed still loads with that field filled in.
| Record | Key | Main fields |
|---|---|---|
| Scan | date | file, importedAt, up to 21 metrics, muscle and fat by body part |
| Typed weigh-in | date | weight in pounds; a scan on the same date is used instead |
| Tape measurement | date | waist and hip in inches, either one or both |
| Food entry | id | date, name, quantity, unit, calories, protein, carbs, fat, fiber, added sugar, estimated fields, note |
| Saved food | name and unit | The same nutrient figures for exactly one unit |
| Sleep night | morning woken | bed and wake times, total, efficiency, REM, deep, latency, resting heart rate, source |
| Activity day | date | steps, total calories, active calories, active minutes, source |
| Exercise | id | date, activity, minutes, intensity, calories if known |
A missing source on a night or activity day means the user typed it. That one field is what the sync merge rules read.
Scale report import
The scale is read through its report files, not a device or cloud API. The scale app shares a PDF or screenshot; qor Health saves or finds it in a local folder and has Claude copy the printed figures.
When it runs
- The Health page checks once when it opens, if automatic checking is on and no scan for today is stored.
- Check for Scans runs the same import on request. Try again also retries files that failed before.
- The dashboard widget does not start an import.
Finding files
- A folder file is named
bodyscan-followed by the date as MMDDYY or MMDDYYYY, with apdf,png,jpgorjpegextension. A name that is not a real calendar day is reported, not guessed. - Optional email pickup searches the last 60 days of attachments from one sender. A file whose name starts with the configured prefix is saved under the folder naming rule, dated by the day the email arrived.
- Stored dates and previously failed files are skipped. If two files share a new date, the more recently modified one is used.
Reading a report
- A PDF is sent as it is. A tall screenshot is cut into overlapping tiles about 2,200 pixels high, so small print stays readable.
- The request uses a fixed system prompt and a JSON schema. Claude is told to copy figures exactly and to return null for anything the report does not show.
- The app converts kilograms to pounds and rounds to one decimal. A report without a plausible weight fails, and an impossible percentage is dropped.
- The file name supplies the date. If the report header shows a different date, the user is told.
- Reports are read one at a time. A failure on one is recorded and the rest continue. Each import is timed through qor metrics.
When a new date is stored, an effect plays. The active theme can supply its own for body-scan:imported, and the visual and sound have separate switches.
Nutrition
A food is logged as an amount and a unit, such as a fraction of a cup or a number of servings. Nutrition figures typed in the form are per unit; the entry stores the totals and the library stores one unit.
- Lookup order. Figures the user typed, then the saved library, then Claude. A request is made only when calories, protein, carbs or fat are still missing.
- Look-up request. It asks for exactly one unit as eaten, returns six nutrients and a short note on the assumed portion or source, and allows web search for published figures.
- Corrections. Editing an entry makes the changed figures the user's own and updates the saved food.
- Day labels. Free text on a date marks an unusual day. Labels appear on charts and are passed to the evaluation.
Food by email
Health claims the qor food intake subject. Each non-blank line is one food. Claude splits the lines into name, quantity and unit, and each entry is dated by the day the email arrived. The entries are then stored together and completed from the library or a look-up. An entry that cannot be completed stays in the log without calories and can be looked up later.
Targets
| Target | Behavior |
|---|---|
| Protein, carbs, fat | A meter per macro against a daily gram target, with each macro's share of calories |
| Fiber | A daily minimum to reach |
| Added sugar | A daily ceiling; natural sugar is not counted against it |
| No target set | The day's total is still shown |
Connected sources
Oura supplies sleep, activity and a daily stress verdict. Google Health supplies daily step totals. The user picks which one feeds Movement; Oura is the default. Each sync starts from a button.
| Sync | Window | Merge rule |
|---|---|---|
| Activity from Oura | Last 30 days: steps, total and active calories, active minutes | Fills gaps and refreshes synced days; typed days are kept |
| Steps from Google | Last 30 days | Same rule as Oura activity |
| Sleep from Oura | From the day after the latest stored night; 30 nights if none | The longest main sleep per morning, naps excluded; typed nights are kept |
| Stress from Oura | From the day after the latest stored verdict; 30 days if none | Stored in ouraStress, apart from the user's own rating |
Sign-in
- Both connections use OAuth with a client the user registers, through a temporary loopback server and the system browser, with a state check.
- Oura uses the
dailyscope and a fixed redirect port, 8765, because its redirect address is registered exactly. Its refresh tokens are single-use, so refreshes run one at a time and the new token is saved immediately. - Google Health uses a read-only activity and fitness scope, with its own client and token, separate from Gmail.
- Credentials and tokens are stored apart from health records, in
config/oura.jsonandconfig/googlehealth.json, encrypted with ElectronsafeStoragewhere the operating system provides it.
Derived figures
These are calculated when the page renders and are not stored.
| Figure | How it is worked out |
|---|---|
| BMR for a day | The latest scale reading on or before the day, or the earliest if the day comes first |
| Estimated burn | BMR times an activity factor from the previous 14 days of steps, plus that day's logged exercise |
| Measured burn | For a past day with a stored total calorie figure, that total replaces the estimate |
| Exercise calories | The user's figure if given; otherwise (MET - 1) x body weight in kg x hours, from activity name and intensity |
| Sleep debt | Total shortfall below the low end of the sleep target over the last 14 days; longer nights do not offset it |
| Metabolic age | The Mifflin-St Jeor equation solved for age from the scale's BMR, limited to 18 to 80; motivational only |
| Waist-hip ratio | Waist divided by hip, for dates that have both tape measurements |
| Average daily steps | Activity level | Factor |
|---|---|---|
| Under 5,000, or none logged | Sedentary | 1.2 |
| 5,000 to 7,499 | Lightly active | 1.375 |
| 7,500 to 9,999 | Moderately active | 1.55 |
| 10,000 to 12,499 | Active | 1.725 |
| 12,500 or more | Very active | 1.9 |
Health evaluation
The evaluation hands a trimmed snapshot of the user's data to a Claude Code skill. The skill, named in settings and installed on the user's machine, decides how to judge it. It runs only through the Claude CLI provider, and the page needs at least one scan.
| Snapshot content | Amount sent |
|---|---|
| Age, height, gender and goals | Current values |
| Body scans and tape measurements | The latest 12 of each |
| Sleep, stress and activity | The latest 14 records of each |
| Exercise | The latest 14 dates with exercise, with estimated calories |
| Food | The latest 14 logged days: totals, macro shares, BMR, burn and day labels |
The page understands a line format and shows it as a summary, a traffic light for each area, and next steps. A reply in any other form is shown as plain text, so a different skill still works.
| Line | Meaning |
|---|---|
SUMMARY: text | A short overall statement |
AREA|rating|name|text | One area, rated green, yellow or red |
NEXT: text | One suggested next step; the line may repeat |
The latest result is stored with its time and skill name. Save adds it to a dated history, and saved results can be reopened or deleted. The evaluation is wellness feedback, not medical advice.
Interface
| Surface | Contents |
|---|---|
| Page | Date range selector, headline figures, evaluation, weight and composition, manual weight and tape entry, nutrition, movement, sleep, stress, detailed body charts |
| Widget | Weight, metabolic age, today's steps and sleep, sleep debt, today's mood, and macros against targets, as data and targets allow |
| Settings | Scan folder and email pickup, automatic check, effects, stored scans, goals and targets, profile, skill name, activity source, connections |
| Intake | The qor food email subject |
Charts, meters, tooltips and stress faces come from the theme contract, so each theme can draw them in its own style. Deleting a stored scan leaves its file in the folder, so the next check can read it again.
Data handling
Health records stay in qor's local data directory and follow qor's atomic saves and scheduled backups. Turning the feature off hides it without changing its data. These actions send data off the machine:
| Action | What is sent | To |
|---|---|---|
| Reading a scale report | The report file or its image tiles | Claude |
| Looking up a food | The food name, unit and any known figures | Claude, which may search the web |
| Reading emailed food notes | The food lines from the notes | Claude |
| Evaluating health | The snapshot above, handled by the chosen skill | Claude, and whatever tools the skill uses |
| Sync | A date range, with the user's authorization | Oura or Google |
| Email pickup | A search for report attachments from one sender | Gmail |