{
// Lab results — array of dated snapshots
entries: [
{
date: "2025-03-15", // ISO date string
markers: {
"biochemistry.glucose": 5.2, // category.markerKey → numeric value
"hormones.testosterone": 18.4,
// ... all measured markers for this date
}
}
// ... more entries
],
// Per-file AI import history. entries[] holds the current live marker values;
// importSnapshots[] preserves which source file created/reviewed them.
importSnapshots: [
{
id: "snap_1782290000000_abcd",
date: "2025-03-15",
fileName: "lab-report.pdf",
testType: "blood",
importedAt: 1782290000000,
importHash: "sha256-or-parser-hash",
costInfo: { provider: "openrouter", modelId: "..." },
markers: [
{ rawName: "Glucose", mappedKey: "biochemistry.glucose", value: 5.2, unit: "mmol/L" }
],
excludedIndices: []
}
],
// entries[].markerSources links current live marker values back to snapshots.
// Snapshot delete/re-review must mutate through data-merge/lab-entry helpers
// so marker tombstones and importSnapshots tombstones sync correctly.
// Standalone notes (independent of lab dates)
notes: [
{ date: "2025-03-10", text: "Started vitamin D protocol" }
],
// Supplement timeline
supplements: [
{
name: "Magnesium",
dosage: "morning + evening", // free-text note (display only)
type: "supplement", // or "medication"
startDate: "2025-01-01",
endDate: null, // null = ongoing
periods: [ // optional; for cycling. If absent, uses startDate/endDate
{ start: "2025-01-01", end: null }
],
timesPerDay: 2, // optional outer default multiplier — applied to each ingredient unless overridden
ingredients: [ // optional; per-serving amounts
{ name: "Bisglycinate", amount: "890mg", timesPerDay: 1 }, // row override: takes precedence over outer
{ name: "Taurate", amount: "890mg", timesPerDay: 2 } // "" (inherits outer timesPerDay when blank)
],
note: ""
}
],
// Context cards — all nullable (null = not filled by user)
diagnoses: { // Medical History card
conditions: [
{ name: "Hashimoto's", severity: "major", since: "2020" }
],
familyHistory: [ // first-degree + grandparents
// relative ∈ {mother, father, sibling, child,
// maternal_grandmother, maternal_grandfather,
// paternal_grandmother, paternal_grandfather}
{ relative: "father", condition: "Heart Attack (MI)", onsetAge: 52, note: "survived" },
{ relative: "mother", condition: "Type 2 Diabetes", onsetAge: 45 }
],
note: ""
},
diet: { // Diet card
type: "omnivore",
restrictions: ["gluten-free", "seed-oil-free"],
pattern: "intermittent_fasting",
breakfast: "eggs and avocado",
breakfastTime: "09:00", // 24h format
lunch: "salad with protein",
lunchTime: "13:00",
dinner: "meat and vegetables",
dinnerTime: "18:00",
snacks: "",
snacksTime: "",
note: ""
},
exercise: { // Exercise card
frequency: "4-5x_week",
types: ["strength", "walking"],
intensity: "moderate",
dailyMovement: "active",
note: ""
},
sleepRest: { // Sleep & Rest card
duration: "7-8h",
quality: "good",
schedule: "consistent",
roomTemp: "cool", // circadian-informed
issues: ["occasional_waking"],
environment: ["blackout_curtains", "emf_off"],
practices: ["mouth_taping", "magnesium"],
note: ""
},
lightCircadian: { // Light & Circadian card
amLight: "sunrise_sunlight", // circadian-informed
daytime: "outdoor_work",
uvExposure: "daily",
evening: ["blue_light_glasses", "dim_lights"],
screenTime: "low",
techEnv: ["wifi_off_night"],
cold: "cold_shower",
grounding: "daily_earthing",
mealTiming: ["time_restricted"],
note: ""
},
stress: { // Stress card
level: "moderate",
sources: ["work", "finances"],
management: ["meditation", "exercise"],
note: ""
},
loveLife: { // Love Life & Relationships card
status: "partnered",
relationship: "good",
satisfaction: "satisfied",
libido: "normal",
frequency: "weekly",
orgasm: "yes",
concerns: [],
note: ""
},
environment: { // Environment card
setting: "suburban",
climate: "temperate",
water: "reverse_osmosis", // circadian-informed
waterConcerns: [],
emf: ["wifi", "smart_meter"],
emfMitigation: ["router_timer"],
homeLight: "led_warm",
air: ["hepa_filter"],
toxins: [],
building: "modern",
note: ""
},
// Full-width card — freetext string
interpretiveLens: "Longevity medicine, quantum biology, functional endocrinology",
// Health goals — priority-ordered array
healthGoals: [
{ text: "Optimize testosterone naturally", severity: "major" },
{ text: "Improve sleep quality", severity: "mild" },
{ text: "Reduce inflammation markers", severity: "minor" }
],
// Free-form AI context notes — freetext string
contextNotes: "Currently experimenting with carnivore diet.",
// Menstrual cycle — null for male profiles
menstrualCycle: {
cycleLength: 28, // days (auto-calculated if enough periods)
periodLength: 5, // days
regularity: "regular", // 'regular' | 'irregular' | 'very_irregular'
flow: "moderate",
contraceptive: "none",
conditions: "none",
periods: [
{
startDate: "2025-02-01",
endDate: "2025-02-06",
flow: "moderate",
symptoms: ["cramps", "fatigue"],
notes: ""
}
]
},
// Per-marker reference range overrides
refOverrides: {
"biochemistry.glucose": {
refMin: 3.9,
refMax: 5.6,
optimalMin: 4.0,
optimalMax: 5.0,
labRefMin: 3.9, // stashed lab-stated range from PDF import (for two-step revert)
labRefMax: 5.6, // preserved when user manually edits — revert goes lab → schema default
refSource: "import" // "import" | "manual" — tracks who set the current refMin/refMax
}
// ... user-customized ranges from detail modal editing or import-time range adoption
},
// Display overrides for category labels (from rename)
categoryLabels: {
"mylab": "My Laboratory" // categoryKey → display name
},
// Display overrides for category icons (from emoji picker)
categoryIcons: {
"mylab": "🧪" // categoryKey → emoji
},
// Custom markers from PDF import — keyed by "category.markerKey"
customMarkers: {
"mylab.cortisol": {
name: "Cortisol (AM)",
unit: "nmol/L",
refMin: 170,
refMax: 720,
categoryLabel: "My Lab"
}
},
// Per-marker freeform notes — keyed by "category.markerKey".
// What the marker means to YOU overall, not tied to any one reading.
markerNotes: {
"biochemistry.glucose": "Fasted samples only — non-fasted reads run high for me"
},
// Per-VALUE freeform notes — keyed by "category.markerKey:YYYY-MM-DD".
// Context for a specific reading on a specific date (fasting status,
// retake reason, lab change, etc.). Surfaced inline on the value card +
// emitted as a dedicated AI-context section. Distinct from markerNotes
// (overall) and entries.notes (date-level, not marker-specific).
markerValueNotes: {
"biochemistry.glucose:2024-03-14": "post-workout, blood draw 30 min after gym",
"biochemistry.glucose:2024-04-02": "fasted 14h",
"lipids.ldl:2024-04-02": "retake — first lab reported 5.2 mmol/L"
},
// Tombstone-set tracking which (marker, date) values were entered or
// edited manually (vs imported from a PDF). Same colon-keying as
// markerValueNotes. Value semantics:
// true = manually added value (no original to revert to)
// number = the original SI value (set on first inline edit so a
// user can revert later)
manualValues: {
"biochemistry.glucose:2024-04-02": true,
"lipids.ldl:2024-03-15": 3.2
},
// Timestamped snapshots of context field changes — appended by recordChange()
changeHistory: [
{ field: "diet", date: "2026-03-01", snapshot: { type: "carnivore", ... } },
{ field: "stress", date: "2026-02-15", snapshot: { level: "moderate", ... } }
],
// Agent Access profile-scoped state. Raw setup blobs are never stored;
// this is the synced state used to reconnect browsers and re-push context.
agentAccess: {
enabled: true,
token: "opaque-read-token",
contextKey: "base64url-raw-256-bit-key",
relayProfileId: "profile-id",
updatedAt: 1782290000000,
lastPushedAt: 1782290000000
},
agentAccessWearableSeriesDays: 30
}