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.

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.

AreaInputOutput
Body compositionScale report files (PDF or image), typed weigh-ins, waist and hipTrend charts, headline figures, segment readings
NutritionTyped entries and emailed food notesDaily totals, target meters, calorie and macro trends
MovementOura or Google Health sync, typed days, logged exerciseSteps and calorie charts, estimated daily burn
SleepOura sync or typed nightsNightly history, target band, sleep debt
Stress/MoodA daily rating from 1 to 5, with an optional Oura comparisonDaily history and agreement count
EvaluationA snapshot of the above, plus a user-chosen Claude Code skillA 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.

Renderer: features/body-scan/Page, widget, settingsindex.tsxNutrition and activityfood.tsx, wellness.tsxEvaluation and sync UIevaluate.tsx, sync buttonscontent/body-scan.jsonRead and written through useFeatureData; stored data is normalized on every usewindow.qor bridge, IPC invokeMain processScan importbodyscan.tsFolder, file names,tiling, extractionClaude serviceScan reading, foodlook-up, food notes,evaluation skillSync adaptersoura.tsgoogleHealth.tsOAuth and daily dataLocal files and GmailScan folder on disk;report attachmentsthrough gmail.tsClaudeCLI or API provider;the skill needs the CLIOura and GoogleOura API v2Google Health API v4
Health is one feature view over one content file, with three adapters in main.
ModuleResponsibility
index.tsxData shape, scan import hook, page, widget, settings, charts, intake handler
food.tsxFood log, saved-food library, nutrition look-up, emailed food notes
wellness.tsxMovement, sleep and stress views, sleep debt, daily burn estimate
evaluate.tsxData snapshot, skill request, result parsing and history
oura.tsx, googlehealth.tsxSync buttons, merge rules, connection settings
effects.tsDefault visual and sound effect for a newly stored scan
src/main/bodyscan.tsEmail attachments, folder scan, image tiling, report extraction
src/main/oura.ts, src/main/googleHealth.tsOAuth, 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.

content/body-scan.jsonBodyscans: one per dateweights: typed weigh-insmeasurements: waist, hipfailed: file and reasonNutritionfood: logged entriesfoods: saved library, keyed by name and unitdayLabels: text per datewellnesssleep: one per morningstress: 1 to 5 per dayouraStress: ring verdictsteps: daily activityexercise: logged sessionsTargets and profilegoals: body, macros, fiber, added sugar, sleep, steps, active caloriesprofile: age, height, gender, steps per mileEvaluationskill: name of the skill to runevaluation: latest resultevaluations: results the user savedImport and display settingsfolder, email (sender and file name prefix), autoScan,effects (visual, sound), activitySource (oura or google)
Daily records are keyed by calendar date, written as YYYY-MM-DD.
RecordKeyMain fields
Scandatefile, importedAt, up to 21 metrics, muscle and fat by body part
Typed weigh-indateweight in pounds; a scan on the same date is used instead
Tape measurementdatewaist and hip in inches, either one or both
Food entryiddate, name, quantity, unit, calories, protein, carbs, fat, fiber, added sugar, estimated fields, note
Saved foodname and unitThe same nutrient figures for exactly one unit
Sleep nightmorning wokenbed and wake times, total, efficiency, REM, deep, latency, resting heart rate, source
Activity daydatesteps, total calories, active calories, active minutes, source
Exerciseiddate, 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.

Health pageImport in mainGmail and folderClaudebodyScan.importattachments, 60 daysnew matching filessave to the folder,pick new dateslist and read filesslice tall imagesfiles, prompt, JSON schemaprinted figuresto pounds, validatescans, failures, noticesmerge by date
Only dates that are not yet stored are read.

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 a pdf, png, jpg or jpeg extension. 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.

Nutrition viewSaved libraryClaudeHealth datastore the new entryfind name and unitsaved figures, if anyif incomplete: look up one unitnutrients and a noteentry totals, marked ~save per-unit record
The saved library answers first; Claude fills only what is missing.
  • 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

TargetBehavior
Protein, carbs, fatA meter per macro against a daily gram target, with each macro's share of calories
FiberA daily minimum to reach
Added sugarA daily ceiling; natural sugar is not counted against it
No target setThe 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.

SyncWindowMerge rule
Activity from OuraLast 30 days: steps, total and active calories, active minutesFills gaps and refreshes synced days; typed days are kept
Steps from GoogleLast 30 daysSame rule as Oura activity
Sleep from OuraFrom the day after the latest stored night; 30 nights if noneThe longest main sleep per morning, naps excluded; typed nights are kept
Stress from OuraFrom the day after the latest stored verdict; 30 days if noneStored 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 daily scope 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.json and config/googlehealth.json, encrypted with Electron safeStorage where the operating system provides it.

Derived figures

These are calculated when the page renders and are not stored.

FigureHow it is worked out
BMR for a dayThe latest scale reading on or before the day, or the earliest if the day comes first
Estimated burnBMR times an activity factor from the previous 14 days of steps, plus that day's logged exercise
Measured burnFor a past day with a stored total calorie figure, that total replaces the estimate
Exercise caloriesThe user's figure if given; otherwise (MET - 1) x body weight in kg x hours, from activity name and intensity
Sleep debtTotal shortfall below the low end of the sleep target over the last 14 days; longer nights do not offset it
Metabolic ageThe Mifflin-St Jeor equation solved for age from the scale's BMR, limited to 18 to 80; motivational only
Waist-hip ratioWaist divided by hip, for dates that have both tape measurements
Average daily stepsActivity levelFactor
Under 5,000, or none loggedSedentary1.2
5,000 to 7,499Lightly active1.375
7,500 to 9,999Moderately active1.55
10,000 to 12,499Active1.725
12,500 or moreVery active1.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.

Health pageClaude serviceClaude CLIHealth databuild snapshotask: prompt and skillrequire theCLI providerclaude -p with Skillreply textresultevaluation: text, time, skillSave: append to evaluations
The result is stored, so reopening it costs no request.
Snapshot contentAmount sent
Age, height, gender and goalsCurrent values
Body scans and tape measurementsThe latest 12 of each
Sleep, stress and activityThe latest 14 records of each
ExerciseThe latest 14 dates with exercise, with estimated calories
FoodThe 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.

LineMeaning
SUMMARY: textA short overall statement
AREA|rating|name|textOne area, rated green, yellow or red
NEXT: textOne 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

SurfaceContents
PageDate range selector, headline figures, evaluation, weight and composition, manual weight and tape entry, nutrition, movement, sleep, stress, detailed body charts
WidgetWeight, metabolic age, today's steps and sleep, sleep debt, today's mood, and macros against targets, as data and targets allow
SettingsScan folder and email pickup, automatic check, effects, stored scans, goals and targets, profile, skill name, activity source, connections
IntakeThe 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:

ActionWhat is sentTo
Reading a scale reportThe report file or its image tilesClaude
Looking up a foodThe food name, unit and any known figuresClaude, which may search the web
Reading emailed food notesThe food lines from the notesClaude
Evaluating healthThe snapshot above, handled by the chosen skillClaude, and whatever tools the skill uses
SyncA date range, with the user's authorizationOura or Google
Email pickupA search for report attachments from one senderGmail