From 64fa65b46060f0a318e333015d91d993693ccc59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 22 Oct 2026 06:22:30 +0200 Subject: [PATCH] test(backup): pin the file and the restored account against golden copies Seed one account as far as the schema allows (a row of every two-ended model, every column of those rows and of the account row, the instance settings, a sharing grant), export it both ways and restore each file into a fresh account, over the live account, and from a version-1 file in the old shapes. The files, counts, parsed payload, preview, restore outcome, reported phases, audit rows, wide-event fields and every row the account holds afterwards are compared with golden copies after ids, ciphertext and run-time timestamps are normalised. Refusals, skip reports and the schema's issue list for malformed files are pinned the same way. The seed moves out of the round-trip test into a shared fixture module so both files fill the same account. --- .gitleaks.toml | 3 + .prettierignore | 4 + .../export-disaster-recovery.json | 4029 +++++++++++++++ .../backup-parity/export-portable.json | 3233 ++++++++++++ .../__golden__/backup-parity/refusals.json | 806 +++ .../restore-disaster-recovery-over-live.json | 406 ++ .../restore-disaster-recovery.json | 4401 +++++++++++++++++ .../backup-parity/restore-portable.json | 3785 ++++++++++++++ .../backup-parity/restore-skips.json | 1015 ++++ .../backup-parity/restore-version-1.json | 1807 +++++++ .../backup-parity/schema-issues.json | 454 ++ .../backup-parity/seeded-account.json | 2094 ++++++++ tests/integration/backup-fixture.ts | 1573 ++++++ tests/integration/backup-parity.test.ts | 1436 ++++++ tests/integration/backup-round-trip.test.ts | 1597 +----- 15 files changed, 25084 insertions(+), 1559 deletions(-) create mode 100644 tests/integration/__golden__/backup-parity/export-disaster-recovery.json create mode 100644 tests/integration/__golden__/backup-parity/export-portable.json create mode 100644 tests/integration/__golden__/backup-parity/refusals.json create mode 100644 tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json create mode 100644 tests/integration/__golden__/backup-parity/restore-disaster-recovery.json create mode 100644 tests/integration/__golden__/backup-parity/restore-portable.json create mode 100644 tests/integration/__golden__/backup-parity/restore-skips.json create mode 100644 tests/integration/__golden__/backup-parity/restore-version-1.json create mode 100644 tests/integration/__golden__/backup-parity/schema-issues.json create mode 100644 tests/integration/__golden__/backup-parity/seeded-account.json create mode 100644 tests/integration/backup-fixture.ts create mode 100644 tests/integration/backup-parity.test.ts diff --git a/.gitleaks.toml b/.gitleaks.toml index b5d9433d0..ee6dfb046 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -11,6 +11,9 @@ paths = [ # All test files contain hardcoded fake tokens / idempotency-keys. '''(^|/)__tests__/''', '''\.test\.ts$''', + # Golden copies of the backup file written by the parity test: synthetic + # fixture values, and every `…Encrypted` value already opened to its text. + '''^tests/integration/__golden__/''', # OpenAPI spec contains example tokens (`hlk_example…`) used to document the schema. '''^docs/api/openapi\.yaml$''', ] diff --git a/.prettierignore b/.prettierignore index 3ed52cc01..d31480228 100644 --- a/.prettierignore +++ b/.prettierignore @@ -25,3 +25,7 @@ src/__tests__/baselines # Benchmark results, written by scripts/bench/run.ts and committed as they # come out, so a re-run diffs cleanly against the last one. scripts/bench/results + +# Golden copies of the backup file and the restored account, written by the +# parity test itself (BACKUP_PARITY_WRITE=1), so a rewrite diffs cleanly. +tests/integration/__golden__ diff --git a/tests/integration/__golden__/backup-parity/export-disaster-recovery.json b/tests/integration/__golden__/backup-parity/export-disaster-recovery.json new file mode 100644 index 000000000..038acf059 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/export-disaster-recovery.json @@ -0,0 +1,4029 @@ +{ + "payload": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "5", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + }, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": null, + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": "FASTING", + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deep-sleep", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": "DEEP", + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "PULSE", + "value": 61, + "valueMin": null, + "valueMax": null, + "unit": "bpm", + "measuredAt": "2026-07-02T06:30:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deleted-sample", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 4, + "deletedAt": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": 2.5, + "valueMax": 2.5, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": "rt-Measurement-notes", + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": "rt-Measurement-externalSourceVersion", + "aggregationProvenance": "HEALTHKIT_STATISTICS", + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": "IRREGULAR", + "deviceType": "rt-Measurement-deviceType", + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "medications": [ + { + "id": "", + "treatmentClass": "GLP1", + "dosesPerUnit": 3, + "unitsPerDose": "2.5", + "notificationsEnabled": false, + "pausedAt": "2026-06-30T12:34:56.789Z", + "snoozedUntil": "2026-06-30T12:34:56.789Z", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": true, + "asNeeded": true, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "rt-Medication-atcCode", + "rxNormCode": "rt-Medication-rxNormCode", + "lowStockNotifiedAt": "2026-06-30T12:34:56.789Z", + "lowStockNotifiedThresholdDays": 3, + "reorderLeadDays": 3, + "externalSource": "WEB", + "externalId": "rt-Medication-externalId", + "updatedAt": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "active": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-06-30T12:34:56.789Z", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "createdAt": "", + "schedules": [ + { + "id": "", + "daysOfWeek": "rt-MedicationSchedule-daysOfWeek", + "timesOfDay": [ + "rt-MedicationSchedule-timesOfDay" + ], + "reminderGraceMinutes": 3, + "rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": 3, + "cyclicOffWeeks": 3, + "doseWindows": { + "roundTrip": "rt-MedicationSchedule-doseWindows" + }, + "unitsPerDose": "2.5", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose" + }, + { + "id": "", + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "unitsPerDose": null, + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null + } + ], + "sideEffects": [ + { + "id": "", + "notes": "rt-MedicationSideEffect-notes", + "notesEncrypted": "", + "createdAt": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3 + } + ], + "pauseEras": [ + { + "id": "", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "id": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ], + "doseChanges": [ + { + "id": "", + "note": "rt-MedicationDoseChange-note", + "noteEncrypted": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "createdAt": "" + }, + { + "id": "", + "note": null, + "noteEncrypted": null, + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "createdAt": "" + } + ], + "inventoryItems": [ + { + "id": "", + "notes": "rt-MedicationInventoryItem-notes", + "notesEncrypted": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "notes": null, + "notesEncrypted": null, + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "createdAt": "", + "updatedAt": "" + } + ], + "phaseConfig": { + "id": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "inventoryEvents": [ + { + "id": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "id": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "scheduleRevisions": [ + { + "id": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "efficacyTargets": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false + } + ] + } + ], + "intakeEvents": [ + { + "id": "", + "medicationId": "", + "autoMissed": true, + "attributionSource": "USER_PIN", + "idempotencyKey": "rt-MedicationIntakeEvent-idempotencyKey", + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": "rt-MedicationIntakeEvent-doseTaken", + "inventoryConsumption": { + "roundTrip": "rt-MedicationIntakeEvent-inventoryConsumption" + }, + "externalId": "rt-MedicationIntakeEvent-externalId", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null, + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "source": "API", + "autoRecorded": true + } + ], + "moodEntries": [ + { + "note": "rt-MoodEntry-note", + "noteEncrypted": "", + "syncedAt": "", + "syncVersion": 3, + "createdAt": "", + "updatedAt": "", + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "source": "rt-MoodEntry-source", + "loggedAt": "2026-07-01T20:00:00.000Z", + "externalId": "rt-MoodEntry-externalId", + "tz": "rt-MoodEntry-tz", + "deletedAt": null, + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "notesEncrypted": "", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z" + } + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "labelEncrypted": "" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "id": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "labelEncrypted": "", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "cycleProfile": { + "id": "", + "createdAt": "", + "updatedAt": "", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false + }, + "cycles": [ + { + "id": "", + "isPredicted": true, + "syncVersion": 3, + "deletedAt": null, + "absorbedIntoId": null, + "createdAt": "", + "updatedAt": "", + "startDate": "2026-06-01", + "endDate": "rt-MenstrualCycle-endDate", + "periodEndDate": "rt-MenstrualCycle-periodEndDate", + "lengthDays": 3, + "ovulationDate": "rt-MenstrualCycle-ovulationDate", + "ovulationConfirmed": true, + "tz": "rt-MenstrualCycle-tz" + }, + { + "id": "", + "isPredicted": false, + "syncVersion": 0, + "deletedAt": "2026-06-04T07:00:00.000Z", + "absorbedIntoId": "", + "createdAt": "", + "updatedAt": "", + "startDate": "2026-06-03", + "endDate": null, + "periodEndDate": null, + "lengthDays": null, + "ovulationDate": null, + "ovulationConfirmed": false, + "tz": null + } + ], + "cycleDayLogs": [ + { + "id": "", + "cycleId": "", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "", + "date": "2026-06-02", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": "", + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "id": "", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "labelEncrypted": "" + } + ], + "labResults": [ + { + "id": "", + "biomarkerId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "note": null, + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin" + } + ], + "biomarkers": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "context": "fasted, morning draw", + "analyteKey": "rt-Biomarker-analyteKey", + "aliases": [ + { + "name": "Ferr.", + "source": "IMPORT_CHOICE", + "id": "", + "createdAt": "" + } + ] + } + ], + "biomarkerMerges": [ + { + "id": "", + "targetBiomarkerId": "", + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": null, + "noteEncrypted": "", + "bodySite": null, + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "note": null, + "noteEncrypted": "", + "tz": "rt-IllnessDayLog-tz", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ] + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "noteEncrypted": null, + "bodySite": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [] + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": null, + "note": null, + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "metadata": { + "roundTrip": "rt-Workout-metadata" + }, + "externalSourceVersion": "rt-Workout-externalSourceVersion", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId" + } + ], + "documents": [ + { + "id": "", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "status": "EXTRACTING", + "reportDate": "2026-06-30T12:34:56.789Z", + "documentDate": "2026-06-30T12:34:56.789Z", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "createdAt": "", + "updatedAt": "", + "contentEncrypted": "", + "contentSha256": "0a738470f0945033965858e9895ee721ce981a25f013514d587d0a7a1946be7a", + "contentCodec": "binary2", + "providerType": "rt-InboundDocument-providerType", + "errorReason": "rt-InboundDocument-errorReason", + "summaryEncrypted": "", + "summaryGeneratedAt": "2026-06-30T12:34:56.789Z", + "summaryState": "PENDING", + "lastIndexAttemptAt": "2026-06-30T12:34:56.789Z", + "lastIndexOutcome": "rt-InboundDocument-lastIndexOutcome", + "aiReadDeferred": true + } + ], + "manifest": { + "documents": { + "included": "encrypted-content", + "note": "Document metadata and encrypted stored bytes are included for disaster recovery." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "full", + "note": "Completed screener administrations are included with their encrypted per-item answers, for restore onto the instance that holds the key." + }, + "consent": { + "included": "full", + "note": "Consent receipts are included, for restore onto the instance the consent was given to." + } + }, + "healthProfile": { + "id": "", + "aboutMe": null, + "conditions": null, + "allergies": null, + "coachFocus": null, + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": null, + "emergencyImplants": null, + "emergencyNote": null, + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + "healthProfileFacts": [ + { + "id": "", + "kind": "SMOKING_STATUS", + "value": null, + "valueEncrypted": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-06-30T12:34:56.789Z", + "provenance": "USER_CORRECTION", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "customMetrics": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "entries": [ + { + "id": "", + "createdAt": "", + "deletedAt": null, + "noteEncrypted": null, + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride" + }, + { + "id": "", + "createdAt": "", + "deletedAt": null, + "noteEncrypted": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null + } + ] + } + ], + "correlationPatterns": [ + { + "id": "", + "updatedAt": "", + "createdAt": "", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3 + } + ], + "decryptFailures": [], + "intradayProfiles": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin" + } + ], + "healthScoreRecords": [ + { + "id": "", + "createdAt": "", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "" + } + ], + "onboardingRecord": { + "id": "", + "createdAt": "", + "updatedAt": "", + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": null, + "phone": null, + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounterDocumentLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterLabLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinationDocumentLinks": [ + { + "vaccinationId": "", + "targetId": "", + "createdAt": "" + } + ], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "title": "How is my blood pressure trending?", + "documentScoped": false, + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "titleEncrypted": "", + "documentScoped": true, + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [ + { + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ] + } + ], + "coachFacts": [ + { + "id": "", + "factEncrypted": "", + "deletedAt": null, + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "outcomeEncrypted": "", + "deletedAt": null, + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachReminders": [ + { + "id": "", + "noteEncrypted": "", + "deletedAt": null, + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "mentalHealthAssessments": [ + { + "id": "", + "instrument": "PHQ9", + "locale": "de", + "version": "rt-MentalHealthAssessment-version", + "responsesEncrypted": "", + "totalScore": 14, + "severityBand": "moderate", + "item9Flagged": true, + "crisisShownAt": "2026-07-05T18:02:00.000Z", + "takenAt": "2026-07-05T18:00:00.000Z", + "tz": "Europe/Berlin", + "source": "rt-MentalHealthAssessment-source", + "externalId": "rt-MentalHealthAssessment-externalId", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "consentReceipts": [ + { + "id": "", + "kind": "ai-processing", + "artefact": "JVBERi0xLjQKJWZpeHR1cmU=", + "signedAt": "2026-06-01T09:00:00.000Z", + "revokedAt": null, + "createdAt": "" + }, + { + "id": "", + "kind": "research-sharing", + "artefact": "eyJhbGciOiJub25lIn0.e30.", + "signedAt": "2026-06-02T09:00:00.000Z", + "revokedAt": "2026-07-10T11:00:00.000Z", + "createdAt": "" + } + ], + "documentConditionLinks": [ + { + "documentId": "", + "episodeId": "", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "extractedFacts": [ + { + "id": "", + "documentId": "", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "committedRecordId": "", + "committedRecordType": "labResult", + "dataEncrypted": "", + "provenanceEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": null, + "lon": null, + "locationEncrypted": "", + "locationLabel": null, + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": null, + "lon": null, + "locationEncrypted": "", + "locationLabel": null, + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": null, + "lon": null, + "label": null, + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": null, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "id": "", + "waveformEncrypted": "", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "symptomDefinitions": [ + { + "id": "", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "noteEncrypted": null, + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "noteEncrypted": null, + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "id": "", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "noteEncrypted": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "id": "", + "titleEncrypted": "", + "noteEncrypted": "", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "titleEncrypted": "", + "noteEncrypted": null, + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "labResultDocumentLinks": [ + { + "labResultId": "", + "documentId": "", + "createdAt": "" + } + ], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [ + { + "medicationId": "", + "documentId": "", + "createdAt": "" + } + ], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ] + }, + "builtCounts": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationPauseEras": 2, + "medicationDoseChanges": 2, + "medicationInventoryItems": 2, + "medicationInventoryEvents": 2, + "reminderPhaseConfigs": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "customMoodTagCategories": 1, + "hiddenMoodTags": 1, + "cycles": 2, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "customMetrics": 1, + "healthProfileFactRevisions": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "customVaccines": 1, + "vaccinations": 1, + "vaccinationLinks": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 1, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "documentConditionLinks": 1, + "extractedFacts": 1, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "symptomEvents": 3, + "lifeEvents": 2, + "relationLinks": 5 + }, + "streamedCounts": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationPauseEras": 2, + "medicationDoseChanges": 2, + "medicationInventoryItems": 2, + "medicationInventoryEvents": 2, + "reminderPhaseConfigs": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "customMoodTagCategories": 1, + "hiddenMoodTags": 1, + "cycles": 2, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "customMetrics": 1, + "healthProfileFactRevisions": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "customVaccines": 1, + "vaccinations": 1, + "vaccinationLinks": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 1, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "documentConditionLinks": 1, + "extractedFacts": 1, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "symptomEvents": 3, + "lifeEvents": 2, + "relationLinks": 5 + }, + "parsed": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "5", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + }, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": null, + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": "FASTING", + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deep-sleep", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": "DEEP", + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "PULSE", + "value": 61, + "valueMin": null, + "valueMax": null, + "unit": "bpm", + "measuredAt": "2026-07-02T06:30:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deleted-sample", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 4, + "deletedAt": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": 2.5, + "valueMax": 2.5, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": "rt-Measurement-notes", + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": "rt-Measurement-externalSourceVersion", + "aggregationProvenance": "HEALTHKIT_STATISTICS", + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": "IRREGULAR", + "deviceType": "rt-Measurement-deviceType", + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "medications": [ + { + "id": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "treatmentClass": "GLP1", + "dosesPerUnit": 3, + "unitsPerDose": "2.5", + "active": false, + "notificationsEnabled": false, + "pausedAt": "2026-06-30T12:34:56.789Z", + "snoozedUntil": "2026-06-30T12:34:56.789Z", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": true, + "asNeeded": true, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-06-30T12:34:56.789Z", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "rt-Medication-atcCode", + "rxNormCode": "rt-Medication-rxNormCode", + "lowStockNotifiedAt": "2026-06-30T12:34:56.789Z", + "lowStockNotifiedThresholdDays": 3, + "reorderLeadDays": 3, + "externalSource": "WEB", + "externalId": "rt-Medication-externalId", + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose", + "unitsPerDose": "2.5", + "daysOfWeek": "rt-MedicationSchedule-daysOfWeek", + "timesOfDay": [ + "rt-MedicationSchedule-timesOfDay" + ], + "reminderGraceMinutes": 3, + "rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": 3, + "cyclicOffWeeks": 3, + "doseWindows": { + "roundTrip": "rt-MedicationSchedule-doseWindows" + } + }, + { + "id": "", + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "sideEffects": [ + { + "id": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3, + "notes": "rt-MedicationSideEffect-notes", + "notesEncrypted": "", + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "id": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "doseChanges": [ + { + "id": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "note": "rt-MedicationDoseChange-note", + "noteEncrypted": "", + "createdAt": "" + }, + { + "id": "", + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "note": null, + "noteEncrypted": null, + "createdAt": "" + } + ], + "inventoryItems": [ + { + "id": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "notes": "rt-MedicationInventoryItem-notes", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [ + { + "id": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "id": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "phaseConfig": { + "id": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "efficacyTargets": [ + { + "id": "", + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false, + "createdAt": "", + "updatedAt": "" + } + ], + "scheduleRevisions": [ + { + "id": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ] + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "intakeEvents": [ + { + "id": "", + "medicationId": "", + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "autoMissed": true, + "autoRecorded": true, + "attributionSource": "USER_PIN", + "source": "API", + "idempotencyKey": "rt-MedicationIntakeEvent-idempotencyKey", + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": "rt-MedicationIntakeEvent-doseTaken", + "inventoryConsumption": { + "roundTrip": "rt-MedicationIntakeEvent-inventoryConsumption" + }, + "externalId": "rt-MedicationIntakeEvent-externalId", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null + } + ], + "moodEntries": [ + { + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "note": "rt-MoodEntry-note", + "noteEncrypted": "", + "source": "rt-MoodEntry-source", + "externalId": "rt-MoodEntry-externalId", + "loggedAt": "2026-07-01T20:00:00.000Z", + "tz": "rt-MoodEntry-tz", + "syncedAt": "", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "", + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z", + "notesEncrypted": "" + } + } + ], + "cycleProfile": { + "id": "", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false, + "createdAt": "", + "updatedAt": "" + }, + "cycles": [ + { + "id": "", + "startDate": "2026-06-01", + "endDate": "rt-MenstrualCycle-endDate", + "periodEndDate": "rt-MenstrualCycle-periodEndDate", + "lengthDays": 3, + "ovulationDate": "rt-MenstrualCycle-ovulationDate", + "ovulationConfirmed": true, + "isPredicted": true, + "tz": "rt-MenstrualCycle-tz", + "syncVersion": 3, + "deletedAt": null, + "absorbedIntoId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "startDate": "2026-06-03", + "endDate": null, + "periodEndDate": null, + "lengthDays": null, + "ovulationDate": null, + "ovulationConfirmed": false, + "isPredicted": false, + "tz": null, + "syncVersion": 0, + "deletedAt": "2026-06-04T07:00:00.000Z", + "absorbedIntoId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "cycleDayLogs": [ + { + "id": "", + "date": "2026-06-02", + "cycleId": "", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": "", + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "id": "", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "labelEncrypted": "" + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "labelEncrypted": "" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "id": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "labelEncrypted": "", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "labResults": [ + { + "id": "", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin", + "biomarkerId": "", + "note": null, + "createdAt": "", + "noteEncrypted": "", + "deletedAt": null, + "updatedAt": "" + } + ], + "biomarkers": [ + { + "id": "", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "analyteKey": "rt-Biomarker-analyteKey", + "context": "fasted, morning draw", + "aliases": [ + { + "id": "", + "name": "Ferr.", + "source": "IMPORT_CHOICE", + "createdAt": "" + } + ], + "createdAt": "", + "updatedAt": "" + } + ], + "biomarkerMerges": [ + { + "id": "", + "targetBiomarkerId": "", + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": null, + "createdAt": "", + "noteEncrypted": "", + "bodySite": null, + "bodySiteEncrypted": null, + "laterality": null, + "deletedAt": null, + "updatedAt": "", + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ], + "note": null, + "updatedAt": "", + "noteEncrypted": "", + "tz": "rt-IllnessDayLog-tz", + "createdAt": "", + "deletedAt": null + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "createdAt": "", + "noteEncrypted": null, + "bodySite": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "deletedAt": null, + "updatedAt": "", + "dayLogs": [] + } + ], + "symptomDefinitions": [ + { + "id": "", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "noteEncrypted": null, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "noteEncrypted": null, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "id": "", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "noteEncrypted": "", + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "id": "", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "titleEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "titleEncrypted": "", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": null, + "note": null, + "createdAt": "", + "reactionEncrypted": "", + "notesEncrypted": "", + "deletedAt": null, + "updatedAt": "" + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "id": "", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId", + "externalSourceVersion": "rt-Workout-externalSourceVersion", + "metadata": { + "roundTrip": "rt-Workout-metadata" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "documents": [ + { + "id": "", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "status": "EXTRACTING", + "reportDate": "2026-06-30T12:34:56.789Z", + "documentDate": "2026-06-30T12:34:56.789Z", + "contentEncrypted": "", + "contentSha256": "0a738470f0945033965858e9895ee721ce981a25f013514d587d0a7a1946be7a", + "contentCodec": "binary2", + "providerType": "rt-InboundDocument-providerType", + "errorReason": "rt-InboundDocument-errorReason", + "summaryEncrypted": "", + "summaryGeneratedAt": "2026-06-30T12:34:56.789Z", + "summaryState": "PENDING", + "lastIndexAttemptAt": "2026-06-30T12:34:56.789Z", + "lastIndexOutcome": "rt-InboundDocument-lastIndexOutcome", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "aiReadDeferred": true, + "createdAt": "", + "updatedAt": "" + } + ], + "documentConditionLinks": [ + { + "documentId": "", + "episodeId": "", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "extractedFacts": [ + { + "id": "", + "documentId": "", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "committedRecordId": "", + "committedRecordType": "labResult", + "dataEncrypted": "", + "provenanceEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ], + "healthProfile": { + "id": "", + "aboutMe": null, + "conditions": null, + "allergies": null, + "coachFocus": null, + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": null, + "emergencyImplants": null, + "emergencyNote": null, + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + "healthProfileFacts": [ + { + "id": "", + "kind": "SMOKING_STATUS", + "value": null, + "valueEncrypted": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-06-30T12:34:56.789Z", + "provenance": "USER_CORRECTION", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "customMetrics": [ + { + "id": "", + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "entries": [ + { + "id": "", + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride", + "noteEncrypted": null, + "createdAt": "", + "deletedAt": null + }, + { + "id": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + } + ] + } + ], + "correlationPatterns": [ + { + "id": "", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3, + "createdAt": "", + "updatedAt": "" + } + ], + "intradayProfiles": [ + { + "id": "", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin", + "createdAt": "", + "updatedAt": "" + } + ], + "healthScoreRecords": [ + { + "id": "", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "", + "createdAt": "" + } + ], + "onboardingRecord": { + "id": "", + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": null, + "phone": null, + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounterDocumentLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterLabLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinationDocumentLinks": [ + { + "vaccinationId": "", + "targetId": "", + "createdAt": "" + } + ], + "labResultDocumentLinks": [ + { + "labResultId": "", + "documentId": "", + "createdAt": "" + } + ], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [ + { + "medicationId": "", + "documentId": "", + "createdAt": "" + } + ], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "title": "How is my blood pressure trending?", + "documentScoped": false, + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "titleEncrypted": "", + "documentScoped": true, + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [ + { + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ] + } + ], + "mentalHealthAssessments": [ + { + "id": "", + "instrument": "PHQ9", + "locale": "de", + "version": "rt-MentalHealthAssessment-version", + "responsesEncrypted": "", + "totalScore": 14, + "severityBand": "moderate", + "item9Flagged": true, + "crisisShownAt": "2026-07-05T18:02:00.000Z", + "takenAt": "2026-07-05T18:00:00.000Z", + "tz": "Europe/Berlin", + "source": "rt-MentalHealthAssessment-source", + "externalId": "rt-MentalHealthAssessment-externalId", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "consentReceipts": [ + { + "id": "", + "kind": "ai-processing", + "artefact": "JVBERi0xLjQKJWZpeHR1cmU=", + "signedAt": "2026-06-01T09:00:00.000Z", + "revokedAt": null, + "createdAt": "" + }, + { + "id": "", + "kind": "research-sharing", + "artefact": "eyJhbGciOiJub25lIn0.e30.", + "signedAt": "2026-06-02T09:00:00.000Z", + "revokedAt": "2026-07-10T11:00:00.000Z", + "createdAt": "" + } + ], + "coachFacts": [ + { + "id": "", + "factEncrypted": "", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "outcomeEncrypted": "", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "coachReminders": [ + { + "id": "", + "noteEncrypted": "", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": null, + "lon": null, + "locationLabel": null, + "locationEncrypted": "", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": null, + "lon": null, + "locationLabel": null, + "locationEncrypted": "", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": null, + "lon": null, + "label": null, + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": null, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "id": "", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "waveformEncrypted": "", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "manifest": { + "documents": { + "included": "encrypted-content", + "note": "Document metadata and encrypted stored bytes are included for disaster recovery." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "full", + "note": "Completed screener administrations are included with their encrypted per-item answers, for restore onto the instance that holds the key." + }, + "consent": { + "included": "full", + "note": "Consent receipts are included, for restore onto the instance the consent was given to." + } + }, + "decryptFailures": [] + }, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "preview": { + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "labResults": 1, + "nutrientDays": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "keys": { + "uses": {} + } + } +} diff --git a/tests/integration/__golden__/backup-parity/export-portable.json b/tests/integration/__golden__/backup-parity/export-portable.json new file mode 100644 index 000000000..d1acb8fca --- /dev/null +++ b/tests/integration/__golden__/backup-parity/export-portable.json @@ -0,0 +1,3233 @@ +{ + "payload": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": null, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": "rt-User-insuranceNumberEncrypted", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLat": 2.5, + "homeLon": 2.5, + "homeLabel": "round-trip home", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": "rt-Measurement-notesEncrypted", + "deletedAt": null + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "medications": [ + { + "ref": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "active": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-06-30T12:34:56.789Z", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "createdAt": "", + "schedules": [ + { + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose" + }, + { + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null + } + ], + "sideEffects": [ + { + "notes": "nausea for two hours after the evening dose", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3 + } + ], + "pauseEras": [ + { + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ], + "doseChanges": [ + { + "note": "titration note, encrypted at rest", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "createdAt": "" + }, + { + "note": null, + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "createdAt": "" + } + ], + "inventoryItems": [ + { + "notes": "second pack, kept in the kitchen drawer", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "createdAt": "", + "updatedAt": "" + }, + { + "notes": null, + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "createdAt": "", + "updatedAt": "" + } + ], + "phaseConfig": { + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "inventoryEvents": [ + { + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "scheduleRevisions": [ + { + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "efficacyTargets": [ + { + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false + } + ] + } + ], + "intakeEvents": [ + { + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "source": "API", + "autoRecorded": true + } + ], + "moodEntries": [ + { + "note": "rt-MoodEntry-noteEncrypted", + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "source": "rt-MoodEntry-source", + "loggedAt": "2026-07-01T20:00:00.000Z", + "externalId": "rt-MoodEntry-externalId", + "tz": "rt-MoodEntry-tz", + "deletedAt": null, + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "note": "rt-MoodContext-notesEncrypted", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z" + } + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "label": "rt-MoodTagCategory-labelEncrypted" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "label": "rt-MoodTag-labelEncrypted", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "cycleProfile": { + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false + }, + "cycles": [], + "cycleDayLogs": [ + { + "date": "2026-06-02", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitive": "[unreadable: encrypted with a key this instance no longer holds]", + "note": "rt-CycleDayLog-notesEncrypted", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "label": "Round-trip cramps" + } + ], + "labResults": [ + { + "ref": "", + "note": "rt-LabResult-noteEncrypted", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin" + } + ], + "biomarkers": [ + { + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "context": "fasted, morning draw", + "analyteKey": "rt-Biomarker-analyteKey", + "aliases": [ + { + "name": "Ferr.", + "source": "IMPORT_CHOICE" + } + ] + } + ], + "biomarkerMerges": [ + { + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": "rt-IllnessEpisode-noteEncrypted", + "bodySite": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ], + "note": "rt-IllnessDayLog-noteEncrypted", + "updatedAt": "" + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "bodySite": "Stomach", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "dayLogs": [] + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": "rt-Allergy-reactionEncrypted", + "note": "rt-Allergy-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId" + } + ], + "documents": [ + { + "id": "", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "status": "EXTRACTING", + "reportDate": "2026-06-30", + "documentDate": "2026-06-30", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "createdAt": "", + "summary": "rt-InboundDocument-summaryEncrypted" + } + ], + "manifest": { + "documents": { + "included": "metadata-only", + "note": "Document metadata (title, filename, type, dates, and the AI-generated summary if one was generated) is included. The original uploaded files are NOT included in this export — download them individually from Settings → Documents, or via the document API." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "omitted", + "note": "Completed WHO-5, PHQ and GAD administrations are not included in this export. Their per-item answers are stored encrypted and include the PHQ-9 self-harm item, which is not written into a portable file. They are included in a disaster-recovery backup, which returns to the instance that can read them." + }, + "consent": { + "included": "omitted", + "note": "Consent receipts are not included in this export. A consent is given to one operator, and a receipt restored elsewhere would assert an agreement that operator never obtained. They are included in a disaster-recovery backup, which returns to the same instance." + } + }, + "healthProfile": { + "aboutMe": "Runs three times a week", + "conditions": "rt-UserHealthProfile-conditionsEncrypted", + "allergies": "rt-UserHealthProfile-allergiesEncrypted", + "coachFocus": "rt-UserHealthProfile-coachFocusEncrypted", + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": "rt-UserHealthProfile-emergencyContactsEncrypted", + "emergencyImplants": "rt-UserHealthProfile-emergencyImplantsEncrypted", + "emergencyNote": "rt-UserHealthProfile-emergencyNoteEncrypted" + }, + "healthProfileFacts": [], + "customMetrics": [ + { + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "entries": [ + { + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride" + }, + { + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": "right hand, rested" + } + ] + } + ], + "correlationPatterns": [ + { + "createdAt": "", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3 + } + ], + "decryptFailures": [], + "intradayProfiles": [ + { + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin" + } + ], + "healthScoreRecords": [ + { + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "" + } + ], + "onboardingRecord": { + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": "rt-Practitioner-locationEncrypted", + "phone": "rt-Practitioner-phoneEncrypted", + "note": "ring the upper bell", + "createdAt": "", + "updatedAt": "" + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reason": "annual check", + "outcome": "ferritin back in range, recheck in a year", + "bodySite": "rt-Encounter-bodySiteEncrypted", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "encounterDocumentLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterLabLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "note": "sore arm for a day, nothing else", + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinationDocumentLinks": [ + { + "vaccinationId": "", + "targetId": "", + "createdAt": "" + } + ], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "title": "How is my blood pressure trending?", + "documentScoped": false, + "summary": "earlier turns: weight trend and evening walks", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "my readings look higher this week, is that real?", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "content": "the last seven mornings average 4 mmHg above the fortnight before", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsJson": "[{\"ref\":\"r1\",\"source\":{\"tool\":\"get_metric_series\",\"domain\":\"bp\",\"window\":\"last7days\",\"period\":\"current\",\"granularity\":\"day\"},\"shape\":\"timeSeries\",\"titleKey\":\"coach.result.title.metricByPeriod\",\"title\":\"Blood pressure by day\",\"rowCount\":2,\"chartKind\":\"line\",\"displayed\":true,\"columns\":[{\"key\":\"period\",\"kind\":\"period\",\"labelKey\":\"coach.result.column.day\",\"label\":\"Day\"},{\"key\":\"sys\",\"kind\":\"number\",\"labelKey\":\"coach.result.column.systolic\",\"label\":\"Systolic\",\"unit\":\"mmHg\"}],\"rows\":[[\"2026-07-19\",131],[\"2026-07-20\",null]],\"truncated\":false,\"chart\":{\"kind\":\"line\",\"x\":\"period\",\"series\":[\"sys\"]}}]", + "trailJson": "{\"entries\":[{\"id\":\"a1\",\"title\":\"Checking the trend\",\"text\":\"Read 30 days.\"}]}", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "title": "About my June labs", + "documentScoped": true, + "summary": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "What does the ferritin mean?", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [ + { + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ] + } + ], + "coachFacts": [ + { + "id": "", + "fact": "does not tolerate ACE inhibitors", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCue": "if the evening reading is over 140", + "thenAction": "then walk twenty minutes before dinner tomorrow", + "target": "under 130 by October", + "outcome": "rt-CoachPlan-outcomeEncrypted", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachReminders": [ + { + "id": "", + "note": "ask how the evening walks are going", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "mentalHealthAssessments": [], + "consentReceipts": [], + "documentConditionLinks": [ + { + "documentId": "", + "episodeId": "", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "extractedFacts": [ + { + "id": "", + "documentId": "", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "committedRecordId": "", + "committedRecordType": "labResult", + "data": { + "label": "Ferritin", + "code": null, + "codeSystem": null, + "value": 91, + "valueText": null, + "unit": "ng/mL", + "referenceLow": 30, + "referenceHigh": 400, + "effectiveDate": "2026-06-30" + }, + "provenance": { + "sourceText": "Ferritin 91 ng/mL (30 - 400)", + "anchored": true, + "sourceOffset": 412, + "page": 2, + "confidence": 0.94 + }, + "createdAt": "", + "updatedAt": "" + } + ], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": 41.4, + "lon": 2.2, + "locationLabel": "Barcelona", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": 52.5, + "lon": 13.4, + "locationLabel": "Berlin", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": 41.4, + "lon": 2.2, + "label": "Barcelona", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": "ES", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "waveform": [ + -12, + 4, + 118, + -33, + 7, + 2, + -5, + 61 + ], + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "symptomDefinitions": [ + { + "label": "Aura", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "note": null, + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "note": null, + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "label": "Headache", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "note": "left side, behind the eye", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "title": "Moved to the coast", + "note": "the flat with the long hallway", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "createdAt": "", + "updatedAt": "" + }, + { + "title": "Parental leave", + "note": null, + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "createdAt": "", + "updatedAt": "" + } + ], + "labResultDocumentLinks": [ + { + "labResultId": "", + "documentId": "", + "createdAt": "" + } + ], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [ + { + "medicationId": "", + "documentId": "", + "createdAt": "" + } + ], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ] + }, + "builtCounts": { + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationPauseEras": 2, + "medicationDoseChanges": 2, + "medicationInventoryItems": 2, + "medicationInventoryEvents": 2, + "reminderPhaseConfigs": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "customMoodTagCategories": 1, + "hiddenMoodTags": 1, + "cycles": 0, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "customMetrics": 1, + "healthProfileFactRevisions": 0, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "customVaccines": 1, + "vaccinations": 1, + "vaccinationLinks": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 1, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "documentConditionLinks": 1, + "extractedFacts": 1, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "symptomEvents": 3, + "lifeEvents": 2, + "relationLinks": 5 + }, + "streamedCounts": { + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationPauseEras": 2, + "medicationDoseChanges": 2, + "medicationInventoryItems": 2, + "medicationInventoryEvents": 2, + "reminderPhaseConfigs": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "customMoodTagCategories": 1, + "hiddenMoodTags": 1, + "cycles": 0, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "customMetrics": 1, + "healthProfileFactRevisions": 0, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "customVaccines": 1, + "vaccinations": 1, + "vaccinationLinks": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 1, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "documentConditionLinks": 1, + "extractedFacts": 1, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "symptomEvents": 3, + "lifeEvents": 2, + "relationLinks": 5 + }, + "parsed": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": null, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": "rt-User-insuranceNumberEncrypted", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeLat": 2.5, + "homeLon": 2.5, + "homeLabel": "round-trip home", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": "rt-Measurement-notesEncrypted", + "deletedAt": null + } + ], + "medications": [ + { + "ref": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "active": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-06-30T12:34:56.789Z", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "createdAt": "", + "schedules": [ + { + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose" + }, + { + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null + } + ], + "sideEffects": [ + { + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3, + "notes": "nausea for two hours after the evening dose" + } + ], + "pauseEras": [ + { + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "doseChanges": [ + { + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "note": "titration note, encrypted at rest", + "createdAt": "" + }, + { + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "note": null, + "createdAt": "" + } + ], + "inventoryItems": [ + { + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "notes": "second pack, kept in the kitchen drawer", + "createdAt": "", + "updatedAt": "" + }, + { + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "notes": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [ + { + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "phaseConfig": { + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "efficacyTargets": [ + { + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false + } + ], + "scheduleRevisions": [ + { + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ] + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "intakeEvents": [ + { + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "autoRecorded": true, + "source": "API" + } + ], + "moodEntries": [ + { + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "note": "rt-MoodEntry-noteEncrypted", + "source": "rt-MoodEntry-source", + "externalId": "rt-MoodEntry-externalId", + "loggedAt": "2026-07-01T20:00:00.000Z", + "tz": "rt-MoodEntry-tz", + "deletedAt": null, + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z", + "note": "rt-MoodContext-notesEncrypted" + } + } + ], + "cycleProfile": { + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false + }, + "cycles": [], + "cycleDayLogs": [ + { + "date": "2026-06-02", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "note": "rt-CycleDayLog-notesEncrypted", + "sensitive": "[unreadable: encrypted with a key this instance no longer holds]", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "label": "Round-trip cramps" + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "label": "rt-MoodTagCategory-labelEncrypted" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "label": "rt-MoodTag-labelEncrypted", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "labResults": [ + { + "ref": "", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin", + "note": "rt-LabResult-noteEncrypted" + } + ], + "biomarkers": [ + { + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "analyteKey": "rt-Biomarker-analyteKey", + "context": "fasted, morning draw", + "aliases": [ + { + "name": "Ferr.", + "source": "IMPORT_CHOICE" + } + ] + } + ], + "biomarkerMerges": [ + { + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": "rt-IllnessEpisode-noteEncrypted", + "createdAt": "", + "bodySite": null, + "laterality": null, + "updatedAt": "", + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ], + "note": "rt-IllnessDayLog-noteEncrypted", + "updatedAt": "" + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "createdAt": "", + "bodySite": "Stomach", + "laterality": "BOTH", + "updatedAt": "", + "dayLogs": [] + } + ], + "symptomDefinitions": [ + { + "label": "Aura", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "note": null, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "note": null, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "label": "Headache", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "note": "left side, behind the eye", + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "title": "Moved to the coast", + "note": "the flat with the long hallway", + "createdAt": "", + "updatedAt": "" + }, + { + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "title": "Parental leave", + "note": null, + "createdAt": "", + "updatedAt": "" + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": "rt-Allergy-reactionEncrypted", + "note": "rt-Allergy-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId" + } + ], + "documents": [ + { + "id": "", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "status": "EXTRACTING", + "reportDate": "2026-06-30", + "documentDate": "2026-06-30", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "summary": "rt-InboundDocument-summaryEncrypted", + "createdAt": "" + } + ], + "documentConditionLinks": [ + { + "documentId": "", + "episodeId": "", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "extractedFacts": [ + { + "id": "", + "documentId": "", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "committedRecordId": "", + "committedRecordType": "labResult", + "data": { + "label": "Ferritin", + "code": null, + "codeSystem": null, + "value": 91, + "valueText": null, + "unit": "ng/mL", + "referenceLow": 30, + "referenceHigh": 400, + "effectiveDate": "2026-06-30" + }, + "provenance": { + "sourceText": "Ferritin 91 ng/mL (30 - 400)", + "anchored": true, + "sourceOffset": 412, + "page": 2, + "confidence": 0.94 + }, + "createdAt": "", + "updatedAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ], + "healthProfile": { + "aboutMe": "Runs three times a week", + "conditions": "rt-UserHealthProfile-conditionsEncrypted", + "allergies": "rt-UserHealthProfile-allergiesEncrypted", + "coachFocus": "rt-UserHealthProfile-coachFocusEncrypted", + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": "rt-UserHealthProfile-emergencyContactsEncrypted", + "emergencyImplants": "rt-UserHealthProfile-emergencyImplantsEncrypted", + "emergencyNote": "rt-UserHealthProfile-emergencyNoteEncrypted" + }, + "healthProfileFacts": [], + "customMetrics": [ + { + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "entries": [ + { + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride" + }, + { + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": "right hand, rested" + } + ] + } + ], + "correlationPatterns": [ + { + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3, + "createdAt": "" + } + ], + "intradayProfiles": [ + { + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin" + } + ], + "healthScoreRecords": [ + { + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "" + } + ], + "onboardingRecord": { + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": "rt-Practitioner-locationEncrypted", + "phone": "rt-Practitioner-phoneEncrypted", + "note": "ring the upper bell", + "createdAt": "", + "updatedAt": "" + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reason": "annual check", + "outcome": "ferritin back in range, recheck in a year", + "bodySite": "rt-Encounter-bodySiteEncrypted", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "encounterDocumentLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterLabLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "note": "sore arm for a day, nothing else", + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinationDocumentLinks": [ + { + "vaccinationId": "", + "targetId": "", + "createdAt": "" + } + ], + "labResultDocumentLinks": [ + { + "labResultId": "", + "documentId": "", + "createdAt": "" + } + ], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [ + { + "medicationId": "", + "documentId": "", + "createdAt": "" + } + ], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "title": "How is my blood pressure trending?", + "documentScoped": false, + "summary": "earlier turns: weight trend and evening walks", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "my readings look higher this week, is that real?", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "content": "the last seven mornings average 4 mmHg above the fortnight before", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsJson": "[{\"ref\":\"r1\",\"source\":{\"tool\":\"get_metric_series\",\"domain\":\"bp\",\"window\":\"last7days\",\"period\":\"current\",\"granularity\":\"day\"},\"shape\":\"timeSeries\",\"titleKey\":\"coach.result.title.metricByPeriod\",\"title\":\"Blood pressure by day\",\"rowCount\":2,\"chartKind\":\"line\",\"displayed\":true,\"columns\":[{\"key\":\"period\",\"kind\":\"period\",\"labelKey\":\"coach.result.column.day\",\"label\":\"Day\"},{\"key\":\"sys\",\"kind\":\"number\",\"labelKey\":\"coach.result.column.systolic\",\"label\":\"Systolic\",\"unit\":\"mmHg\"}],\"rows\":[[\"2026-07-19\",131],[\"2026-07-20\",null]],\"truncated\":false,\"chart\":{\"kind\":\"line\",\"x\":\"period\",\"series\":[\"sys\"]}}]", + "trailJson": "{\"entries\":[{\"id\":\"a1\",\"title\":\"Checking the trend\",\"text\":\"Read 30 days.\"}]}", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "title": "About my June labs", + "documentScoped": true, + "summary": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "What does the ferritin mean?", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [ + { + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ] + } + ], + "mentalHealthAssessments": [], + "consentReceipts": [], + "coachFacts": [ + { + "id": "", + "fact": "does not tolerate ACE inhibitors", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCue": "if the evening reading is over 140", + "thenAction": "then walk twenty minutes before dinner tomorrow", + "target": "under 130 by October", + "outcome": "rt-CoachPlan-outcomeEncrypted", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachReminders": [ + { + "id": "", + "note": "ask how the evening walks are going", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": 41.4, + "lon": 2.2, + "locationLabel": "Barcelona", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": 52.5, + "lon": 13.4, + "locationLabel": "Berlin", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": 41.4, + "lon": 2.2, + "label": "Barcelona", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": "ES", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "waveform": [ + -12, + 4, + 118, + -33, + 7, + 2, + -5, + 61 + ], + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "manifest": { + "documents": { + "included": "metadata-only", + "note": "Document metadata (title, filename, type, dates, and the AI-generated summary if one was generated) is included. The original uploaded files are NOT included in this export — download them individually from Settings → Documents, or via the document API." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "omitted", + "note": "Completed WHO-5, PHQ and GAD administrations are not included in this export. Their per-item answers are stored encrypted and include the PHQ-9 self-harm item, which is not written into a portable file. They are included in a disaster-recovery backup, which returns to the instance that can read them." + }, + "consent": { + "included": "omitted", + "note": "Consent receipts are not included in this export. A consent is given to one operator, and a receipt restored elsewhere would assert an agreement that operator never obtained. They are included in a disaster-recovery backup, which returns to the same instance." + } + }, + "decryptFailures": [] + }, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 0, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "preview": { + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 1, + "labResults": 1, + "nutrientDays": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 0, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "keys": { + "uses": {} + } + } +} diff --git a/tests/integration/__golden__/backup-parity/refusals.json b/tests/integration/__golden__/backup-parity/refusals.json new file mode 100644 index 000000000..48403a118 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/refusals.json @@ -0,0 +1,806 @@ +{ + "undecryptable": { + "outcome": { + "ok": false, + "status": 422, + "code": "backup.payload.undecryptable", + "message": "Backup payload could not be decrypted — either the key that wrote this copy is no longer in ENCRYPTION_KEYS, or the stored copy is not the one that was written. Nothing was changed.", + "meta": { + "errorCode": "backup.payload.undecryptable" + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "Invalid authentication tag length: 7" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "schemaInvalid": { + "outcome": { + "ok": false, + "status": 422, + "code": "schema_invalid", + "message": "Backup payload failed schema validation" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "schema_invalid", + "message": "measurements.0.type: Invalid option: expected one of \"WEIGHT\"|\"BLOOD_PRESSURE_SYS\"|\"BLOOD_PRESSURE_DIA\"|\"PULSE\"|\"BODY_FAT\"|\"SLEEP_DURATION\"|\"ACTIVITY_STEPS\"|\"BLOOD_GLUCOSE\"|\"TOTAL_BODY_WATER\"|\"BONE_MASS\"|\"OXYGEN_SATURATION\"|\"HEART_RATE_VARIABILITY\"|\"RESTING_HEART_RATE\"|\"ACTIVE_ENERGY_BURNED\"|\"FLIGHTS_CLIMBED\"|\"WALKING_RUNNING_DISTANCE\"|\"VO2_MAX\"|\"BODY_TEMPERATURE\"|\"FAT_FREE_MASS\"|\"FAT_MASS\"|\"MUSCLE_MASS\"|\"SKIN_TEMPERATURE\"|\"PULSE_WAVE_VELOCITY\"|\"VASCULAR_AGE\"|\"VISCERAL_FAT\"|\"AUDIO_EXPOSURE_ENV\"|\"AUDIO_EXPOSURE_HEADPHONE\"|\"TIME_IN_DAYLIGHT\"|\"WALKING_STEADINESS\"|\"AUDIO_EXPOSURE_EVENT\"|\"RESPIRATORY_RATE\"|\"BODY_MASS_INDEX\"|\"LEAN_BODY_MASS\"|\"WALKING_HEART_RATE_AVERAGE\"|\"WALKING_ASYMMETRY\"|\"WALKING_DOUBLE_SUPPORT\"|\"WALKING_STEP_LENGTH\"|\"WALKING_SPEED\"|\"CARDIO_RECOVERY\"|\"WRIST_TEMPERATURE\"|\"FALL_COUNT\"|\"SIX_MINUTE_WALK_DISTANCE\"|\"STAIR_ASCENT_SPEED\"|\"STAIR_DESCENT_SPEED\"|\"BREATHING_DISTURBANCES\"|\"IRREGULAR_RHYTHM_NOTIFICATION\"|\"HIGH_HEART_RATE_EVENT\"|\"LOW_HEART_RATE_EVENT\"|\"WALKING_STEADINESS_EVENT\"|\"BREATHING_DISTURBANCE_EVENT\"|\"RECOVERY_SCORE\"|\"STRESS_SCORE\"|\"STRAIN_SCORE\"|\"HRV_RMSSD\"|\"DAY_STRAIN\"|\"WORKOUT_STRAIN\"|\"SLEEP_PERFORMANCE\"|\"SLEEP_EFFICIENCY\"|\"SLEEP_CONSISTENCY\"|\"SLEEP_NEED\"|\"ENERGY_EXPENDITURE_KJ\"|\"AVERAGE_HEART_RATE\"|\"MAX_HEART_RATE\"|\"SLEEP_DISTURBANCE_COUNT\"|\"ANS_CHARGE\"|\"CARDIO_LOAD\"|\"SLEEP_SCORE\"|\"BODY_TEMPERATURE_DEVIATION\"|\"RESILIENCE\"|\"PHQ9_SCORE\"|\"GAD7_SCORE\"|\"GRIP_STRENGTH\"|\"PAIN_NRS\"|\"WAIST_CIRCUMFERENCE\"|\"WAIST_TO_HEIGHT\"|\"WHO5_SCORE\"|\"SCI_SCORE\"|\"EXERCISE_MINUTES\"|\"STAND_MINUTES\"|\"STAND_HOURS\"|\"MINDFUL_MINUTES\"|\"STATE_OF_MIND_VALENCE\"|\"INDOOR_CO2\"|\"INDOOR_TEMPERATURE\"|\"INDOOR_HUMIDITY\"|\"AFIB_BURDEN\"" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "stableIdMissing": { + "outcome": { + "ok": false, + "status": 422, + "code": "schema_invalid", + "message": "Backup payload failed schema validation" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "schema_invalid", + "message": "measurements.0.id: Canonical v2 measurements require a stable id" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "qualitativeMarkerWithNumbers": { + "outcome": { + "ok": false, + "status": 422, + "code": "schema_invalid", + "message": "Backup payload failed schema validation" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "schema_invalid", + "message": "[\n {\n \"code\": \"custom\",\n \"path\": [\n \"labResults\",\n 0,\n \"unit\"\n ],\n \"message\": \"A numeric lab reading needs its unit\"\n },\n {\n \"code\": \"custom\",\n \"path\": [\n \"biomarkers\",\n 0,\n \"unit\"\n ],\n \"message\": \"Biomarker \\\"Urine colour\\\" has numeric readings and needs its unit\"\n }\n]" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "incompatibleVersion": { + "outcome": { + "ok": false, + "status": 422, + "code": "incompatible_schema_version", + "message": "Backup schema version '99' is not supported by this server" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "incompatible_schema_version", + "schemaVersion": "99" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "ownerMismatch": { + "outcome": { + "ok": false, + "status": 409, + "code": "owner_mismatch", + "message": "Backup payload declares a different owner than the backup record" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "owner_mismatch", + "declaredOwnerId": "someone-else" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "sectionMissing": { + "outcome": { + "ok": false, + "status": 422, + "code": "backup.section.missing", + "message": "Backup is missing documents — the file's own manifest says it carries that section. Nothing was changed. Use a disaster-recovery snapshot, or export the account again.", + "meta": { + "errorCode": "backup.section.missing", + "sections": [ + "documents" + ] + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "section_missing", + "sections": [ + "documents" + ] + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "metadataOnlyDocument": { + "outcome": { + "ok": false, + "status": 422, + "code": "document_ciphertext_missing", + "message": "Document 'metadata-only-document' is metadata-only and cannot be restored" + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "document_ciphertext_missing", + "documentId": "metadata-only-document" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "keyMissing": { + "outcome": { + "ok": false, + "status": 422, + "code": "backup.key.missing", + "message": "This backup holds 1 encrypted value written under encryption key 'v9', which is not in ENCRYPTION_KEYS on this server. Add that key back to ENCRYPTION_KEYS and restart, then try again. Nothing was changed.", + "meta": { + "errorCode": "backup.key.missing", + "keyIds": [ + "v9" + ] + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 1 + } + ], + "audit": [ + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "key_missing", + "missingKeyIds": [ + "v9" + ], + "unreadableKeyIds": [], + "affectedValues": 1 + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + } + ] + } + }, + "intakeForUnknownMedication": { + "outcome": { + "ok": false, + "status": 500, + "code": "transaction_failed", + "message": "The restore could not be written and was rolled back. Nothing was changed.", + "meta": { + "cause": "other" + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "transaction_failed", + "cause": "other", + "code": null, + "message": "Unknown medication references in intake events: a medication this file never carried. The backup records doses against medications it does not carry." + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restoreFailReason": "Unknown medication references in intake events: a medication this file never carried. The backup records doses against medications it does not carry.", + "restoreFailCause": "other", + "restoreFailCode": null, + "restoreTransactionTimeoutMs": 120001 + } + } + ] + } + }, + "labForUnknownMarker": { + "outcome": { + "ok": false, + "status": 500, + "code": "transaction_failed", + "message": "The restore could not be written and was rolled back. Nothing was changed.", + "meta": { + "cause": "other" + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "transaction_failed", + "cause": "other", + "code": null, + "message": "Unknown biomarker reference: a-marker-the-file-never-carried" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restoreFailReason": "Unknown biomarker reference: a-marker-the-file-never-carried", + "restoreFailCause": "other", + "restoreFailCode": null, + "restoreTransactionTimeoutMs": 120001 + } + } + ] + } + }, + "illnessWithUnknownParent": { + "outcome": { + "ok": false, + "status": 500, + "code": "transaction_failed", + "message": "The restore could not be written and was rolled back. Nothing was changed.", + "meta": { + "cause": "other" + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 0 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 0 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore.failed", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "reason": "transaction_failed", + "cause": "other", + "code": null, + "message": "Unknown illness parent: an-episode-the-file-never-carried" + } + } + ], + "effects": { + "invalidated": [], + "unitRefresh": [], + "foldRepair": [], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restoreFailReason": "Unknown illness parent: an-episode-the-file-never-carried", + "restoreFailCause": "other", + "restoreFailCode": null, + "restoreTransactionTimeoutMs": 120001 + } + } + ] + } + } +} diff --git a/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json b/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json new file mode 100644 index 000000000..29326a9cd --- /dev/null +++ b/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json @@ -0,0 +1,406 @@ +{ + "outcome": { + "ok": true, + "response": { + "restored": true, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "cleared": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "moodEntries": 1, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 2, + "cycleDayLogs": 1, + "cycleProfile": 1, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 0, + "vaccinations": 1, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 0, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "lifeEvents": 2 + } + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 6, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 7, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 8, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 9, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 10, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 11, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 12, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 13, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 14, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 15, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 16, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "rebuilding", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-08-01T00:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "restoreInstanceSettings": false, + "cleared": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "moodEntries": 1, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 2, + "cycleDayLogs": 1, + "cycleProfile": 1, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 0, + "vaccinations": 1, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachConversationDocuments": 0, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1, + "symptomDefinitions": 2, + "lifeEvents": 2 + }, + "accountSettingsApplied": 62, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "restored": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2 + } + } + } + ], + "effects": { + "invalidated": [ + "round-trip-owner" + ], + "unitRefresh": [], + "foldRepair": [ + "round-trip-owner" + ], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restore_expired_tombstones_skipped": 0 + } + }, + { + "meta": { + "restoreSkippedLinks": 0, + "restoreSkippedKeys": "" + } + } + ] + }, + "snapshotChanges": [] +} diff --git a/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json b/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json new file mode 100644 index 000000000..b1c6ce959 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json @@ -0,0 +1,4401 @@ +{ + "outcome": { + "ok": true, + "response": { + "restored": true, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 1, + "consentReceipts": 2, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + } + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 6, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 7, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 8, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 9, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 10, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 11, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 12, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 13, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 14, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 15, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 16, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "rebuilding", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-08-01T00:00:00.000Z", + "restoreInstanceSettings": true + } + }, + { + "action": "admin.backups.restore", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "restoreInstanceSettings": true, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + }, + "accountSettingsApplied": 62, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "restored": { + "measurements": 5, + "medications": 1, + "intakeEvents": 1, + "moodEntries": 1, + "cycles": 2, + "cycleDayLogs": 1, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 1, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2 + } + } + } + ], + "effects": { + "invalidated": [ + "round-trip-owner" + ], + "unitRefresh": [ + "round-trip-owner" + ], + "foldRepair": [ + "round-trip-owner" + ], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": true + } + }, + { + "meta": { + "restore_expired_tombstones_skipped": 0 + } + }, + { + "meta": { + "restoreSkippedLinks": 0, + "restoreSkippedKeys": "" + } + } + ] + }, + "snapshot": { + "Measurement": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "source": "MANUAL", + "measuredAt": "2026-07-03T06:45:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": "FASTING", + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": 2.5, + "valueMax": 2.5, + "unit": "event", + "source": "WITHINGS", + "measuredAt": "2026-06-15T14:22:00.000Z", + "notes": null, + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": "rt-Measurement-externalSourceVersion", + "aggregationProvenance": "HEALTHKIT_STATISTICS", + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": "IRREGULAR", + "deviceType": "rt-Measurement-deviceType", + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "PULSE", + "value": 61, + "valueMin": null, + "valueMax": null, + "unit": "bpm", + "source": "APPLE_HEALTH", + "measuredAt": "2026-07-02T06:30:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deleted-sample", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 4, + "deletedAt": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "source": "APPLE_HEALTH", + "measuredAt": "2026-07-03T02:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deep-sleep", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": "DEEP", + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "IntradayCumulativeProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin", + "createdAt": "", + "updatedAt": "" + } + ], + "Medication": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip tablet", + "dose": "5 mg", + "treatmentClass": "GLP1", + "dosesPerUnit": 3, + "unitsPerDose": "decimal:2.5", + "active": false, + "notificationsEnabled": false, + "pausedAt": "2026-06-30T12:34:56.789Z", + "snoozedUntil": "2026-06-30T12:34:56.789Z", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": true, + "asNeeded": true, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "rt-Medication-atcCode", + "rxNormCode": "rt-Medication-rxNormCode", + "lowStockNotifiedAt": "2026-06-30T12:34:56.789Z", + "lowStockNotifiedThresholdDays": 3, + "reorderLeadDays": 3, + "externalSource": "WEB", + "externalId": "rt-Medication-externalId", + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationSchedule": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose", + "unitsPerDose": "decimal:2.5", + "daysOfWeek": "rt-MedicationSchedule-daysOfWeek", + "timesOfDay": [ + "rt-MedicationSchedule-timesOfDay" + ], + "reminderGraceMinutes": 3, + "rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": 3, + "cyclicOffWeeks": 3, + "doseWindows": { + "roundTrip": "rt-MedicationSchedule-doseWindows" + } + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "MedicationIntakeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "autoMissed": true, + "autoRecorded": true, + "attributionSource": "USER_PIN", + "source": "API", + "idempotencyKey": "rt-MedicationIntakeEvent-idempotencyKey", + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": "rt-MedicationIntakeEvent-doseTaken", + "inventoryConsumption": { + "roundTrip": "rt-MedicationIntakeEvent-inventoryConsumption" + }, + "externalId": "rt-MedicationIntakeEvent-externalId", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null + } + ], + "MedicationSideEffect": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3, + "notes": null, + "notesEncrypted": "", + "createdAt": "" + } + ], + "MedicationPauseEra": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "MedicationDoseChange": [ + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "note": null, + "noteEncrypted": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "note": null, + "noteEncrypted": null, + "createdAt": "" + } + ], + "MedicationCategoryAssignment": [ + { + "medicationId": "", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "updatedAt": "" + } + ], + "MedicationCategoryLabel": [ + { + "id": "", + "userId": "round-trip-owner", + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "labelEncrypted": "", + "sortOrder": 2, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationCourse": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-03-01T00:00:00.000Z", + "endsOn": "2026-03-07T00:00:00.000Z", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationIngredient": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "moodA1": 3, + "stressA2": 3, + "energyA3": 3, + "connectionA4": 3, + "stabilityA5": 3, + "tags": "[\"round-trip-tag\"]", + "note": null, + "noteEncrypted": "", + "source": "rt-MoodEntry-source", + "externalId": "rt-MoodEntry-externalId", + "moodLoggedAt": "2026-07-01T20:00:00.000Z", + "tz": "rt-MoodEntry-tz", + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null + } + ], + "MoodContext": [ + { + "moodEntryId": "", + "userId": "round-trip-owner", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntryTagLink": [ + { + "moodEntryId": "", + "moodTagId": "", + "createdAt": "", + "rating": 4 + } + ], + "MoodTag": [ + { + "id": "", + "categoryId": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "isActive": false, + "kind": "RATED", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "LabResult": [ + { + "id": "", + "userId": "round-trip-owner", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "biomarkerId": "", + "source": "rt-LabResult-source", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Biomarker": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "contextEncrypted": "", + "panel": "rt-Biomarker-panel", + "hidden": true, + "analyteKey": "rt-Biomarker-analyteKey", + "createdAt": "", + "updatedAt": "" + } + ], + "Allergy": [ + { + "id": "", + "userId": "round-trip-owner", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "FamilyHistoryEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessEpisode": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "noteEncrypted": "", + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "noteEncrypted": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "noteEncrypted": "", + "tz": "rt-IllnessDayLog-tz", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 2, + "createdAt": "" + } + ], + "SymptomDefinition": [ + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "SymptomEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "noteEncrypted": null, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "noteEncrypted": "", + "episodeId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "noteEncrypted": null, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "LifeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "titleEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "titleEncrypted": "", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "UserHealthProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": "", + "aiIncludedSections": [ + "ABOUT_ME" + ], + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthProfileFactRevision": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "SMOKING_STATUS", + "valueEncrypted": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-06-30T12:34:56.789Z", + "provenance": "USER_CORRECTION", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "CycleProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MenstrualCycle": [ + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-01", + "endDate": "rt-MenstrualCycle-endDate", + "periodEndDate": "rt-MenstrualCycle-periodEndDate", + "lengthDays": 3, + "ovulationDate": "rt-MenstrualCycle-ovulationDate", + "ovulationConfirmed": true, + "isPredicted": true, + "tz": "rt-MenstrualCycle-tz", + "syncVersion": 3, + "deletedAt": null, + "absorbedIntoId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-03", + "endDate": null, + "periodEndDate": null, + "lengthDays": null, + "ovulationDate": null, + "ovulationConfirmed": false, + "isPredicted": false, + "tz": null, + "syncVersion": 0, + "deletedAt": "2026-06-04T07:00:00.000Z", + "absorbedIntoId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "CycleDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-02", + "cycleId": "", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": "", + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "CycleSymptom": [ + { + "id": "", + "categoryId": "csc_physical", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "CycleSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 3, + "createdAt": "" + } + ], + "CustomMetric": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CustomMetricEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + } + ], + "CorrelationPattern": [ + { + "id": "", + "userId": "round-trip-owner", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthScoreRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "", + "createdAt": "" + } + ], + "Workout": [ + { + "id": "", + "userId": "round-trip-owner", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId", + "externalSourceVersion": "rt-Workout-externalSourceVersion", + "metadata": { + "roundTrip": "rt-Workout-metadata" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "NutrientIntakeDay": [ + { + "userId": "round-trip-owner", + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "", + "updatedAt": "" + } + ], + "InboundDocument": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "contentEncrypted": "", + "contentSha256": "0a738470f0945033965858e9895ee721ce981a25f013514d587d0a7a1946be7a", + "contentCodec": "binary2", + "status": "EXTRACTING", + "providerType": "rt-InboundDocument-providerType", + "reportDate": "2026-06-30T12:34:56.789Z", + "documentDate": "2026-06-30T12:34:56.789Z", + "errorReason": "rt-InboundDocument-errorReason", + "summaryEncrypted": "", + "summaryGeneratedAt": "2026-06-30T12:34:56.789Z", + "summaryState": "PENDING", + "lastIndexAttemptAt": "2026-06-30T12:34:56.789Z", + "lastIndexOutcome": "rt-InboundDocument-lastIndexOutcome", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "aiReadDeferred": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Practitioner": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": null, + "phone": null, + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Encounter": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "EncounterDocumentLink": [ + { + "id": "", + "encounterId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterLabLink": [ + { + "id": "", + "encounterId": "", + "labResultId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterConditionLink": [ + { + "id": "", + "encounterId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "VaccinationRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "VaccinationDocumentLink": [ + { + "id": "", + "vaccinationId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "CustomVaccine": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MeasurementReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "lastNotifiedAt": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MeasurementReminderEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + } + ], + "CoachConversation": [ + { + "id": "", + "userId": "round-trip-owner", + "title": null, + "titleEncrypted": "", + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "documentScoped": true + }, + { + "id": "", + "userId": "round-trip-owner", + "title": null, + "titleEncrypted": "", + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "documentScoped": false + } + ], + "CoachMessage": [ + { + "id": "", + "conversationId": "", + "role": "assistant", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "CoachConversationDocument": [ + { + "conversationId": "", + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ], + "CoachFact": [ + { + "id": "", + "userId": "round-trip-owner", + "factEncrypted": "", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "" + } + ], + "CoachPlan": [ + { + "id": "", + "userId": "round-trip-owner", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "outcomeEncrypted": "", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CoachReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "noteEncrypted": "", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MedicationInventoryItem": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "decimal:30", + "unitsRemaining": "decimal:21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "notes": null, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "decimal:60", + "unitsRemaining": "decimal:0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationInventoryEvent": [ + { + "id": "", + "medicationId": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + }, + { + "id": "", + "medicationId": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + } + ], + "MoodTagCategory": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "MoodTagHidden": [ + { + "userId": "round-trip-owner", + "moodTagId": "mt_grateful", + "createdAt": "" + } + ], + "ReminderPhaseConfig": [ + { + "id": "", + "medicationId": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + } + ], + "MentalHealthAssessment": [ + { + "id": "", + "userId": "round-trip-owner", + "instrument": "PHQ9", + "locale": "de", + "version": "rt-MentalHealthAssessment-version", + "responsesEncrypted": "", + "totalScore": 14, + "severityBand": "moderate", + "item9Flagged": true, + "crisisShownAt": "2026-07-05T18:02:00.000Z", + "takenAt": "2026-07-05T18:00:00.000Z", + "tz": "Europe/Berlin", + "source": "rt-MentalHealthAssessment-source", + "externalId": "rt-MentalHealthAssessment-externalId", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "ConsentReceipt": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "ai-processing", + "artefact": "JVBERi0xLjQKJWZpeHR1cmU=", + "signedAt": "2026-06-01T09:00:00.000Z", + "revokedAt": null, + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "kind": "research-sharing", + "artefact": "eyJhbGciOiJub25lIn0.e30.", + "signedAt": "2026-06-02T09:00:00.000Z", + "revokedAt": "2026-07-10T11:00:00.000Z", + "createdAt": "" + } + ], + "DocumentConditionLink": [ + { + "id": "", + "documentId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "ExtractedFact": [ + { + "id": "", + "documentId": "", + "userId": "round-trip-owner", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "dataEncrypted": "", + "provenanceEncrypted": "", + "committedRecordId": "", + "committedRecordType": "labResult", + "createdAt": "", + "updatedAt": "" + } + ], + "PersonalRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "UserAchievement": [ + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + } + ], + "EnvironmentContext": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "locationEncrypted": "", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "locationEncrypted": "", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "EnvironmentTravelLocation": [ + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "DawarichDay": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationScheduleRevision": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "MedicationEfficacyTarget": [ + { + "id": "", + "medicationId": "", + "measurementType": "WEIGHT", + "biomarkerId": "", + "primary": false, + "createdAt": "", + "updatedAt": "" + } + ], + "EcgRecording": [ + { + "id": "", + "userId": "round-trip-owner", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "waveformEncrypted": "", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "OnboardingRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "needsJson": { + "areas": [ + "blood-pressure", + "sleep" + ], + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + }, + "visit": "within-a-month", + "sources": [ + "withings" + ], + "medication": "yes", + "recordTarget": "me" + }, + "stepsJson": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResultJson": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "BiomarkerAlias": [ + { + "id": "", + "userId": "round-trip-owner", + "biomarkerId": "", + "name": "Ferr.", + "nameFolded": "ferr.", + "source": "IMPORT_CHOICE", + "createdAt": "" + } + ], + "BiomarkerMerge": [ + { + "id": "", + "userId": "round-trip-owner", + "targetBiomarkerId": "", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "LabResultDocumentLink": [ + { + "id": "", + "labResultId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterMedicationLink": [ + { + "id": "", + "encounterId": "", + "medicationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterVaccinationLink": [ + { + "id": "", + "encounterId": "", + "vaccinationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "MedicationDocumentLink": [ + { + "id": "", + "medicationId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "MedicationConditionLink": [ + { + "id": "", + "medicationId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "AccountGrant": [ + { + "id": "", + "grantorId": "round-trip-owner", + "granteeId": "parity-delegate", + "access": "READ", + "scopeJson": null, + "invitedAt": "", + "acceptedAt": "2026-07-03T09:00:00.000Z", + "revokedAt": null, + "revokedBy": null, + "expiresAt": null, + "lastUsedAt": null, + "createdAt": "" + } + ], + "User": { + "id": "round-trip-owner", + "username": "round-trip-owner", + "email": "round-trip-owner@example.test", + "passwordHash": null, + "role": "USER", + "oidcIssuer": null, + "oidcSub": null, + "createdAt": "", + "updatedAt": "", + "managedProfileAt": null, + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "timezone": "America/Chicago", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "environmentAqHistoryJson": null, + "codexAccessTokenEncrypted": null, + "codexRefreshTokenEncrypted": null, + "codexTokenExpiresAt": null, + "codexConnectedAt": null, + "codexConnectionStatus": "disconnected", + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsCachedAt": null, + "insightsCachedTextEncrypted": null, + "insightsCachedLocale": null, + "insightsSnapshotHash": null, + "insightsWarmFailedAt": null, + "insightsBriefingRerollDate": null, + "morningDigestRefreshedOn": null, + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "telegramBotToken": null, + "telegramChatId": null, + "telegramEnabled": false, + "withingsClientIdEncrypted": null, + "withingsClientSecretEncrypted": null, + "whoopClientIdEncrypted": null, + "whoopClientSecretEncrypted": null, + "fitbitClientIdEncrypted": null, + "fitbitClientSecretEncrypted": null, + "googleHealthClientIdEncrypted": null, + "googleHealthClientSecretEncrypted": null, + "nightscoutUrlEncrypted": null, + "nightscoutTokenEncrypted": null, + "nightscoutAllowPrivateHost": false, + "dawarichUrlEncrypted": null, + "dawarichApiKeyEncrypted": null, + "dawarichPrefsEncrypted": null, + "dawarichAllowPrivateHost": false, + "polarAccessTokenEncrypted": null, + "polarUserIdEncrypted": null, + "polarClientIdEncrypted": null, + "polarClientSecretEncrypted": null, + "ouraAccessTokenEncrypted": null, + "ouraRefreshTokenEncrypted": null, + "ouraClientIdEncrypted": null, + "ouraClientSecretEncrypted": null, + "ouraScopeDenied": null, + "ouraBackfillProgress": null, + "ouraBackfillCompletedAt": null, + "ouraUserId": null, + "clientAppSharedBy": null, + "stravaClientIdEncrypted": null, + "stravaClientSecretEncrypted": null, + "stravaAccessTokenEncrypted": null, + "stravaRefreshTokenEncrypted": null, + "stravaAthleteId": null, + "stravaLastActivityAt": null, + "stravaBackfillCompletedAt": null, + "stravaBackfillResumeBefore": null, + "locale": "fr", + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "glucoseUnit": "mmol/L", + "hasDiabetes": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "unitPreference": "imperial", + "timeFormat": "H12", + "dateFormat": "DMY", + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiAnthropicKeyEncrypted": null, + "aiLocalKeyEncrypted": null, + "aiOpenaiKeyEncrypted": null, + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatKeyEncrypted": null, + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "documentsAutoAiRead": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "healthKitLastSyncedAt": null, + "healthKitLastSyncTrigger": null, + "healthKitLastBackgroundSyncAt": null, + "displayName": "rt-User-displayName", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "lastSyncedAt": null, + "syncResetAt": "", + "moodReminderEnabled": true, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "documentQuotaBytes": null, + "coachLastSeenAt": null, + "avatarBytes": "", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "totpSecretEncrypted": null, + "totpConfirmedAt": null, + "totpLastStep": null, + "mfaEnforced": false, + "passkeyUpgradeNudgeDismissed": true, + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber" + }, + "AppSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "bigint:5", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + } + }, + "reexport": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "5", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + }, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": null, + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": "FASTING", + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deep-sleep", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": "DEEP", + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "PULSE", + "value": 61, + "valueMin": null, + "valueMax": null, + "unit": "bpm", + "measuredAt": "2026-07-02T06:30:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deleted-sample", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 4, + "deletedAt": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": 2.5, + "valueMax": 2.5, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": null, + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": "rt-Measurement-externalSourceVersion", + "aggregationProvenance": "HEALTHKIT_STATISTICS", + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": "IRREGULAR", + "deviceType": "rt-Measurement-deviceType", + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "medications": [ + { + "id": "", + "treatmentClass": "GLP1", + "dosesPerUnit": 3, + "unitsPerDose": "2.5", + "notificationsEnabled": false, + "pausedAt": "2026-06-30T12:34:56.789Z", + "snoozedUntil": "2026-06-30T12:34:56.789Z", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": true, + "asNeeded": true, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "rt-Medication-atcCode", + "rxNormCode": "rt-Medication-rxNormCode", + "lowStockNotifiedAt": "2026-06-30T12:34:56.789Z", + "lowStockNotifiedThresholdDays": 3, + "reorderLeadDays": 3, + "externalSource": "WEB", + "externalId": "rt-Medication-externalId", + "updatedAt": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "active": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "createdAt": "", + "schedules": [ + { + "id": "", + "daysOfWeek": "rt-MedicationSchedule-daysOfWeek", + "timesOfDay": [ + "rt-MedicationSchedule-timesOfDay" + ], + "reminderGraceMinutes": 3, + "rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": 3, + "cyclicOffWeeks": 3, + "doseWindows": { + "roundTrip": "rt-MedicationSchedule-doseWindows" + }, + "unitsPerDose": "2.5", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose" + }, + { + "id": "", + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "unitsPerDose": null, + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null + } + ], + "sideEffects": [ + { + "id": "", + "notes": null, + "notesEncrypted": "", + "createdAt": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3 + } + ], + "pauseEras": [ + { + "id": "", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "id": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ], + "doseChanges": [ + { + "id": "", + "note": null, + "noteEncrypted": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "createdAt": "" + }, + { + "id": "", + "note": null, + "noteEncrypted": null, + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "createdAt": "" + } + ], + "inventoryItems": [ + { + "id": "", + "notes": null, + "notesEncrypted": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "notes": null, + "notesEncrypted": null, + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "createdAt": "", + "updatedAt": "" + } + ], + "phaseConfig": { + "id": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "inventoryEvents": [ + { + "id": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "id": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "scheduleRevisions": [ + { + "id": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "id": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "efficacyTargets": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false + } + ] + } + ], + "intakeEvents": [ + { + "id": "", + "medicationId": "", + "autoMissed": true, + "attributionSource": "USER_PIN", + "idempotencyKey": "rt-MedicationIntakeEvent-idempotencyKey", + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": "rt-MedicationIntakeEvent-doseTaken", + "inventoryConsumption": { + "roundTrip": "rt-MedicationIntakeEvent-inventoryConsumption" + }, + "externalId": "rt-MedicationIntakeEvent-externalId", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null, + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "source": "API", + "autoRecorded": true + } + ], + "moodEntries": [ + { + "note": null, + "noteEncrypted": "", + "syncedAt": "", + "syncVersion": 3, + "createdAt": "", + "updatedAt": "", + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "source": "rt-MoodEntry-source", + "loggedAt": "2026-07-01T20:00:00.000Z", + "externalId": "rt-MoodEntry-externalId", + "tz": "rt-MoodEntry-tz", + "deletedAt": null, + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "notesEncrypted": "", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z" + } + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "labelEncrypted": "" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "id": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "labelEncrypted": "", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "cycleProfile": { + "id": "", + "createdAt": "", + "updatedAt": "", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false + }, + "cycles": [ + { + "id": "", + "isPredicted": true, + "syncVersion": 3, + "deletedAt": null, + "absorbedIntoId": null, + "createdAt": "", + "updatedAt": "", + "startDate": "2026-06-01", + "endDate": "rt-MenstrualCycle-endDate", + "periodEndDate": "rt-MenstrualCycle-periodEndDate", + "lengthDays": 3, + "ovulationDate": "rt-MenstrualCycle-ovulationDate", + "ovulationConfirmed": true, + "tz": "rt-MenstrualCycle-tz" + }, + { + "id": "", + "isPredicted": false, + "syncVersion": 0, + "deletedAt": "2026-06-04T07:00:00.000Z", + "absorbedIntoId": "", + "createdAt": "", + "updatedAt": "", + "startDate": "2026-06-03", + "endDate": null, + "periodEndDate": null, + "lengthDays": null, + "ovulationDate": null, + "ovulationConfirmed": false, + "tz": null + } + ], + "cycleDayLogs": [ + { + "id": "", + "cycleId": "", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "", + "date": "2026-06-02", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": "", + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "id": "", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "labelEncrypted": "" + } + ], + "labResults": [ + { + "id": "", + "biomarkerId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "note": null, + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin" + } + ], + "biomarkers": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "context": "fasted, morning draw", + "analyteKey": "rt-Biomarker-analyteKey", + "aliases": [ + { + "name": "Ferr.", + "source": "IMPORT_CHOICE", + "id": "", + "createdAt": "" + } + ] + } + ], + "biomarkerMerges": [ + { + "id": "", + "targetBiomarkerId": "", + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": null, + "noteEncrypted": "", + "bodySite": null, + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "note": null, + "noteEncrypted": "", + "tz": "rt-IllnessDayLog-tz", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ] + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "noteEncrypted": null, + "bodySite": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [] + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": null, + "note": null, + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "metadata": { + "roundTrip": "rt-Workout-metadata" + }, + "externalSourceVersion": "rt-Workout-externalSourceVersion", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId" + } + ], + "documents": [ + { + "id": "", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "status": "EXTRACTING", + "reportDate": "2026-06-30T12:34:56.789Z", + "documentDate": "2026-06-30T12:34:56.789Z", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "createdAt": "", + "updatedAt": "", + "contentEncrypted": "", + "contentSha256": "0a738470f0945033965858e9895ee721ce981a25f013514d587d0a7a1946be7a", + "contentCodec": "binary2", + "providerType": "rt-InboundDocument-providerType", + "errorReason": "rt-InboundDocument-errorReason", + "summaryEncrypted": "", + "summaryGeneratedAt": "2026-06-30T12:34:56.789Z", + "summaryState": "PENDING", + "lastIndexAttemptAt": "2026-06-30T12:34:56.789Z", + "lastIndexOutcome": "rt-InboundDocument-lastIndexOutcome", + "aiReadDeferred": true + } + ], + "manifest": { + "documents": { + "included": "encrypted-content", + "note": "Document metadata and encrypted stored bytes are included for disaster recovery." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "full", + "note": "Completed screener administrations are included with their encrypted per-item answers, for restore onto the instance that holds the key." + }, + "consent": { + "included": "full", + "note": "Consent receipts are included, for restore onto the instance the consent was given to." + } + }, + "healthProfile": { + "id": "", + "aboutMe": null, + "conditions": null, + "allergies": null, + "coachFocus": null, + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": null, + "emergencyImplants": null, + "emergencyNote": null, + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + "healthProfileFacts": [ + { + "id": "", + "kind": "SMOKING_STATUS", + "value": null, + "valueEncrypted": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-06-30T12:34:56.789Z", + "provenance": "USER_CORRECTION", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "customMetrics": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "entries": [ + { + "id": "", + "createdAt": "", + "deletedAt": null, + "noteEncrypted": "", + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": null + }, + { + "id": "", + "createdAt": "", + "deletedAt": null, + "noteEncrypted": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null + } + ] + } + ], + "correlationPatterns": [ + { + "id": "", + "updatedAt": "", + "createdAt": "", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3 + } + ], + "decryptFailures": [], + "intradayProfiles": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin" + } + ], + "healthScoreRecords": [ + { + "id": "", + "createdAt": "", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "" + } + ], + "onboardingRecord": { + "id": "", + "createdAt": "", + "updatedAt": "", + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": null, + "phone": null, + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "encounterDocumentLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterLabLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "vaccinationDocumentLinks": [ + { + "vaccinationId": "", + "targetId": "", + "createdAt": "" + } + ], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "titleEncrypted": "", + "documentScoped": false, + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "titleEncrypted": "", + "documentScoped": true, + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "contentEncrypted": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [ + { + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ] + } + ], + "coachFacts": [ + { + "id": "", + "factEncrypted": "", + "deletedAt": null, + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "outcomeEncrypted": "", + "deletedAt": null, + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachReminders": [ + { + "id": "", + "noteEncrypted": "", + "deletedAt": null, + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "mentalHealthAssessments": [ + { + "id": "", + "instrument": "PHQ9", + "locale": "de", + "version": "rt-MentalHealthAssessment-version", + "responsesEncrypted": "", + "totalScore": 14, + "severityBand": "moderate", + "item9Flagged": true, + "crisisShownAt": "2026-07-05T18:02:00.000Z", + "takenAt": "2026-07-05T18:00:00.000Z", + "tz": "Europe/Berlin", + "source": "rt-MentalHealthAssessment-source", + "externalId": "rt-MentalHealthAssessment-externalId", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "consentReceipts": [ + { + "id": "", + "kind": "ai-processing", + "artefact": "JVBERi0xLjQKJWZpeHR1cmU=", + "signedAt": "2026-06-01T09:00:00.000Z", + "revokedAt": null, + "createdAt": "" + }, + { + "id": "", + "kind": "research-sharing", + "artefact": "eyJhbGciOiJub25lIn0.e30.", + "signedAt": "2026-06-02T09:00:00.000Z", + "revokedAt": "2026-07-10T11:00:00.000Z", + "createdAt": "" + } + ], + "documentConditionLinks": [ + { + "documentId": "", + "episodeId": "", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "extractedFacts": [ + { + "id": "", + "documentId": "", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "committedRecordId": "", + "committedRecordType": "labResult", + "dataEncrypted": "", + "provenanceEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": null, + "lon": null, + "locationEncrypted": "", + "locationLabel": null, + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": null, + "lon": null, + "locationEncrypted": "", + "locationLabel": null, + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": null, + "lon": null, + "label": null, + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": null, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "id": "", + "waveformEncrypted": "", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "symptomDefinitions": [ + { + "id": "", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "noteEncrypted": null, + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "noteEncrypted": null, + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "id": "", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "id": "", + "noteEncrypted": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "id": "", + "titleEncrypted": "", + "noteEncrypted": "", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "titleEncrypted": "", + "noteEncrypted": null, + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "labResultDocumentLinks": [ + { + "labResultId": "", + "documentId": "", + "createdAt": "" + } + ], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [ + { + "medicationId": "", + "documentId": "", + "createdAt": "" + } + ], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ] + } +} diff --git a/tests/integration/__golden__/backup-parity/restore-portable.json b/tests/integration/__golden__/backup-parity/restore-portable.json new file mode 100644 index 000000000..b182b8f13 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/restore-portable.json @@ -0,0 +1,3785 @@ +{ + "outcome": { + "ok": true, + "response": { + "restored": true, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-08-01T00:00:00.000Z", + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "medicationSideEffects": 1, + "medicationEfficacyTargets": 1, + "medicationScheduleRevisions": 3, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 1, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 0, + "documentConditionLinks": 1, + "extractedFacts": 1, + "healthProfile": 1, + "healthProfileFactRevisions": 0, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "intradayProfiles": 1, + "healthScoreRecords": 1, + "onboardingRecords": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2, + "coachConversations": 2, + "coachMessages": 3, + "coachFacts": 1, + "coachPlans": 1, + "coachReminders": 1, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 3, + "userAchievements": 2, + "environmentContexts": 2, + "environmentTravelLocations": 1, + "dawarichDays": 1, + "ecgRecordings": 1 + }, + "skipped": { + "catalogueKeys": [ + { + "catalogue": "coachAttachment", + "key": "", + "links": 1 + }, + { + "catalogue": "cycleCiphertext", + "key": "cycleDayLogs.2026-06-02.sensitiveEncrypted", + "links": 1 + }, + { + "catalogue": "documentConditionLink", + "key": "", + "links": 1 + }, + { + "catalogue": "extractedFact", + "key": "", + "links": 1 + }, + { + "catalogue": "relationLink", + "key": "", + "links": 1 + }, + { + "catalogue": "relationLink", + "key": "", + "links": 1 + }, + { + "catalogue": "vaccinationReference", + "key": "", + "links": 1 + }, + { + "catalogue": "visitReference", + "key": "", + "links": 1 + }, + { + "catalogue": "visitReference", + "key": "", + "links": 1 + } + ], + "links": 9 + }, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + } + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 6, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 7, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 8, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 9, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 10, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 11, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 12, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 13, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 14, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 15, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 16, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "sections", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 4 + }, + { + "phase": "rebuilding", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 4 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-08-01T00:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "restoreInstanceSettings": false, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + }, + "accountSettingsApplied": 62, + "skipped": { + "catalogueKeys": [ + { + "catalogue": "coachAttachment", + "key": "", + "links": 1 + }, + { + "catalogue": "cycleCiphertext", + "key": "cycleDayLogs.2026-06-02.sensitiveEncrypted", + "links": 1 + }, + { + "catalogue": "documentConditionLink", + "key": "", + "links": 1 + }, + { + "catalogue": "extractedFact", + "key": "", + "links": 1 + }, + { + "catalogue": "relationLink", + "key": "", + "links": 1 + }, + { + "catalogue": "relationLink", + "key": "", + "links": 1 + }, + { + "catalogue": "vaccinationReference", + "key": "", + "links": 1 + }, + { + "catalogue": "visitReference", + "key": "", + "links": 1 + }, + { + "catalogue": "visitReference", + "key": "", + "links": 1 + } + ], + "links": 9 + }, + "restored": { + "measurements": 4, + "medications": 1, + "intakeEvents": 1, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 1, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 0, + "healthProfile": 1, + "healthProfileFactRevisions": 0, + "customMetrics": 1, + "customMetricEntries": 2, + "correlationPatterns": 1, + "practitioners": 1, + "encounters": 1, + "encounterLinks": 3, + "vaccinations": 1, + "vaccinationLinks": 1, + "relationLinks": 5, + "customVaccines": 1, + "measurementReminders": 1, + "measurementReminderEvents": 2 + } + } + } + ], + "effects": { + "invalidated": [ + "round-trip-owner" + ], + "unitRefresh": [ + "round-trip-owner" + ], + "foldRepair": [ + "round-trip-owner" + ], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restore_expired_tombstones_skipped": 0 + } + }, + { + "meta": { + "restoreSkippedLinks": 9, + "restoreSkippedKeys": "coachAttachment:,cycleCiphertext:cycleDayLogs.2026-06-02.sensitiveEncrypted,documentConditionLink:,extractedFact:,relationLink:,relationLink:,vaccinationReference:,visitReference:,visitReference:" + } + } + ] + }, + "snapshot": { + "Measurement": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "source": "MANUAL", + "measuredAt": "2026-07-03T06:45:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": null, + "valueMax": null, + "unit": "event", + "source": "WITHINGS", + "measuredAt": "2026-06-15T14:22:00.000Z", + "notes": null, + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "source": "APPLE_HEALTH", + "measuredAt": "2026-07-03T02:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "IntradayCumulativeProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin", + "createdAt": "", + "updatedAt": "" + } + ], + "Medication": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip tablet", + "dose": "5 mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "decimal:1", + "active": false, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationSchedule": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose", + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "MedicationIntakeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "autoMissed": false, + "autoRecorded": true, + "attributionSource": "AUTO", + "source": "API", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + } + ], + "MedicationSideEffect": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3, + "notes": null, + "notesEncrypted": "", + "createdAt": "" + } + ], + "MedicationPauseEra": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "MedicationDoseChange": [ + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "note": null, + "noteEncrypted": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "note": null, + "noteEncrypted": null, + "createdAt": "" + } + ], + "MedicationCategoryAssignment": [ + { + "medicationId": "", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "updatedAt": "" + } + ], + "MedicationCategoryLabel": [ + { + "id": "", + "userId": "round-trip-owner", + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "labelEncrypted": "", + "sortOrder": 2, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationCourse": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-03-01T00:00:00.000Z", + "endsOn": "2026-03-07T00:00:00.000Z", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationIngredient": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "moodA1": 3, + "stressA2": 3, + "energyA3": 3, + "connectionA4": 3, + "stabilityA5": 3, + "tags": "[\"round-trip-tag\"]", + "note": null, + "noteEncrypted": "", + "source": "rt-MoodEntry-source", + "externalId": "rt-MoodEntry-externalId", + "moodLoggedAt": "2026-07-01T20:00:00.000Z", + "tz": "rt-MoodEntry-tz", + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + } + ], + "MoodContext": [ + { + "moodEntryId": "", + "userId": "round-trip-owner", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntryTagLink": [ + { + "moodEntryId": "", + "moodTagId": "", + "createdAt": "", + "rating": 4 + } + ], + "MoodTag": [ + { + "id": "", + "categoryId": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "isActive": false, + "kind": "RATED", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "LabResult": [ + { + "id": "", + "userId": "round-trip-owner", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "biomarkerId": "", + "source": "rt-LabResult-source", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Biomarker": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "contextEncrypted": "", + "panel": "rt-Biomarker-panel", + "hidden": true, + "analyteKey": "rt-Biomarker-analyteKey", + "createdAt": "", + "updatedAt": "" + } + ], + "Allergy": [ + { + "id": "", + "userId": "round-trip-owner", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "FamilyHistoryEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessEpisode": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "noteEncrypted": "", + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "noteEncrypted": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "noteEncrypted": "", + "tz": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 2, + "createdAt": "" + } + ], + "SymptomDefinition": [ + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "SymptomEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "noteEncrypted": null, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "noteEncrypted": "", + "episodeId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "noteEncrypted": null, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "LifeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "titleEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "titleEncrypted": "", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "UserHealthProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": null, + "aiIncludedSections": [ + "ABOUT_ME" + ], + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthProfileFactRevision": [], + "CycleProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MenstrualCycle": [], + "CycleDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-02", + "cycleId": null, + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": null, + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "syncVersion": 0, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "CycleSymptom": [ + { + "id": "", + "categoryId": "csc_physical", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "CycleSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 3, + "createdAt": "" + } + ], + "CustomMetric": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CustomMetricEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + } + ], + "CorrelationPattern": [ + { + "id": "", + "userId": "round-trip-owner", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthScoreRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "", + "createdAt": "" + } + ], + "Workout": [ + { + "id": "", + "userId": "round-trip-owner", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId", + "externalSourceVersion": null, + "metadata": null, + "createdAt": "", + "updatedAt": "" + } + ], + "NutrientIntakeDay": [ + { + "userId": "round-trip-owner", + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "", + "updatedAt": "" + } + ], + "InboundDocument": [], + "Practitioner": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": null, + "phone": null, + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Encounter": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "EncounterDocumentLink": [], + "EncounterLabLink": [], + "EncounterConditionLink": [ + { + "id": "", + "encounterId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "VaccinationRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "VaccinationDocumentLink": [], + "CustomVaccine": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MeasurementReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "lastNotifiedAt": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MeasurementReminderEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + } + ], + "CoachConversation": [ + { + "id": "", + "userId": "round-trip-owner", + "title": null, + "titleEncrypted": "", + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "documentScoped": true + }, + { + "id": "", + "userId": "round-trip-owner", + "title": null, + "titleEncrypted": "", + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "documentScoped": false + } + ], + "CoachMessage": [ + { + "id": "", + "conversationId": "", + "role": "assistant", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "CoachConversationDocument": [], + "CoachFact": [ + { + "id": "", + "userId": "round-trip-owner", + "factEncrypted": "", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "" + } + ], + "CoachPlan": [ + { + "id": "", + "userId": "round-trip-owner", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "outcomeEncrypted": "", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CoachReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "noteEncrypted": "", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MedicationInventoryItem": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "decimal:30", + "unitsRemaining": "decimal:21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "notes": null, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "decimal:60", + "unitsRemaining": "decimal:0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationInventoryEvent": [ + { + "id": "", + "medicationId": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + }, + { + "id": "", + "medicationId": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + } + ], + "MoodTagCategory": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "MoodTagHidden": [ + { + "userId": "round-trip-owner", + "moodTagId": "mt_grateful", + "createdAt": "" + } + ], + "ReminderPhaseConfig": [ + { + "id": "", + "medicationId": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + } + ], + "MentalHealthAssessment": [], + "ConsentReceipt": [], + "DocumentConditionLink": [], + "ExtractedFact": [], + "PersonalRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "UserAchievement": [ + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + } + ], + "EnvironmentContext": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "locationEncrypted": "", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "locationEncrypted": "", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "EnvironmentTravelLocation": [ + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "DawarichDay": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationScheduleRevision": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "MedicationEfficacyTarget": [ + { + "id": "", + "medicationId": "", + "measurementType": "WEIGHT", + "biomarkerId": "", + "primary": false, + "createdAt": "", + "updatedAt": "" + } + ], + "EcgRecording": [ + { + "id": "", + "userId": "round-trip-owner", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "waveformEncrypted": "", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "OnboardingRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "needsJson": { + "areas": [ + "blood-pressure", + "sleep" + ], + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + }, + "visit": "within-a-month", + "sources": [ + "withings" + ], + "medication": "yes", + "recordTarget": "me" + }, + "stepsJson": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResultJson": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "BiomarkerAlias": [ + { + "id": "", + "userId": "round-trip-owner", + "biomarkerId": "", + "name": "Ferr.", + "nameFolded": "ferr.", + "source": "IMPORT_CHOICE", + "createdAt": "" + } + ], + "BiomarkerMerge": [ + { + "id": "", + "userId": "round-trip-owner", + "targetBiomarkerId": "", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "LabResultDocumentLink": [], + "EncounterMedicationLink": [ + { + "id": "", + "encounterId": "", + "medicationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterVaccinationLink": [ + { + "id": "", + "encounterId": "", + "vaccinationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "MedicationDocumentLink": [], + "MedicationConditionLink": [ + { + "id": "", + "medicationId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "AccountGrant": [ + { + "id": "", + "grantorId": "round-trip-owner", + "granteeId": "parity-delegate", + "access": "READ", + "scopeJson": null, + "invitedAt": "", + "acceptedAt": "2026-07-03T09:00:00.000Z", + "revokedAt": null, + "revokedBy": null, + "expiresAt": null, + "lastUsedAt": null, + "createdAt": "" + } + ], + "User": { + "id": "round-trip-owner", + "username": "round-trip-owner", + "email": "round-trip-owner@example.test", + "passwordHash": null, + "role": "USER", + "oidcIssuer": null, + "oidcSub": null, + "createdAt": "", + "updatedAt": "", + "managedProfileAt": null, + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "timezone": "America/Chicago", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "environmentAqHistoryJson": null, + "codexAccessTokenEncrypted": null, + "codexRefreshTokenEncrypted": null, + "codexTokenExpiresAt": null, + "codexConnectedAt": null, + "codexConnectionStatus": "disconnected", + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsCachedAt": null, + "insightsCachedTextEncrypted": null, + "insightsCachedLocale": null, + "insightsSnapshotHash": null, + "insightsWarmFailedAt": null, + "insightsBriefingRerollDate": null, + "morningDigestRefreshedOn": null, + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "telegramBotToken": null, + "telegramChatId": null, + "telegramEnabled": false, + "withingsClientIdEncrypted": null, + "withingsClientSecretEncrypted": null, + "whoopClientIdEncrypted": null, + "whoopClientSecretEncrypted": null, + "fitbitClientIdEncrypted": null, + "fitbitClientSecretEncrypted": null, + "googleHealthClientIdEncrypted": null, + "googleHealthClientSecretEncrypted": null, + "nightscoutUrlEncrypted": null, + "nightscoutTokenEncrypted": null, + "nightscoutAllowPrivateHost": false, + "dawarichUrlEncrypted": null, + "dawarichApiKeyEncrypted": null, + "dawarichPrefsEncrypted": null, + "dawarichAllowPrivateHost": false, + "polarAccessTokenEncrypted": null, + "polarUserIdEncrypted": null, + "polarClientIdEncrypted": null, + "polarClientSecretEncrypted": null, + "ouraAccessTokenEncrypted": null, + "ouraRefreshTokenEncrypted": null, + "ouraClientIdEncrypted": null, + "ouraClientSecretEncrypted": null, + "ouraScopeDenied": null, + "ouraBackfillProgress": null, + "ouraBackfillCompletedAt": null, + "ouraUserId": null, + "clientAppSharedBy": null, + "stravaClientIdEncrypted": null, + "stravaClientSecretEncrypted": null, + "stravaAccessTokenEncrypted": null, + "stravaRefreshTokenEncrypted": null, + "stravaAthleteId": null, + "stravaLastActivityAt": null, + "stravaBackfillCompletedAt": null, + "stravaBackfillResumeBefore": null, + "locale": "fr", + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "glucoseUnit": "mmol/L", + "hasDiabetes": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "unitPreference": "imperial", + "timeFormat": "H12", + "dateFormat": "DMY", + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiAnthropicKeyEncrypted": null, + "aiLocalKeyEncrypted": null, + "aiOpenaiKeyEncrypted": null, + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatKeyEncrypted": null, + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "documentsAutoAiRead": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "healthKitLastSyncedAt": null, + "healthKitLastSyncTrigger": null, + "healthKitLastBackgroundSyncAt": null, + "displayName": "rt-User-displayName", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "lastSyncedAt": null, + "syncResetAt": "", + "moodReminderEnabled": true, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "documentQuotaBytes": null, + "coachLastSeenAt": null, + "avatarBytes": "", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "totpSecretEncrypted": null, + "totpConfirmedAt": null, + "totpLastStep": null, + "mfaEnforced": false, + "passkeyUpgradeNudgeDismissed": true, + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber" + }, + "AppSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "bigint:5", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + } + }, + "reexport": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": null, + "accountSettings": { + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "hasDiabetes": true, + "displayName": "rt-User-displayName", + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumber": "rt-User-insuranceNumberEncrypted", + "insurerIkNumber": "rt-User-insurerIkNumber", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "avatarBytes": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLat": 2.5, + "homeLon": 2.5, + "homeLabel": "round-trip home", + "environmentAirQualityEnabled": false, + "timezone": "America/Chicago", + "locale": "fr", + "unitPreference": "imperial", + "glucoseUnit": "mmol/L", + "timeFormat": "H12", + "dateFormat": "DMY", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "moodReminderEnabled": true, + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "documentsAutoAiRead": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "passkeyUpgradeNudgeDismissed": true + }, + "measurements": [ + { + "id": "", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "unit": "mmol/L", + "measuredAt": "2026-07-03T06:45:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "SLEEP_DURATION", + "value": 95, + "unit": "min", + "measuredAt": "2026-07-03T02:00:00.000Z", + "source": "APPLE_HEALTH", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.2, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "deletedAt": null + }, + { + "id": "", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "unit": "event", + "measuredAt": "2026-06-15T14:22:00.000Z", + "source": "WITHINGS", + "notes": "rt-Measurement-notesEncrypted", + "deletedAt": null + } + ], + "customMedicationCategories": [ + { + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "label": "Heart and circulation", + "sortOrder": 2, + "isActive": false, + "createdAt": "" + } + ], + "medications": [ + { + "ref": "", + "name": "Round-trip tablet", + "dose": "5 mg", + "active": false, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "createdAt": "", + "schedules": [ + { + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose" + }, + { + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null + } + ], + "sideEffects": [ + { + "notes": "nausea for two hours after the evening dose", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3 + } + ], + "pauseEras": [ + { + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "ingredients": [ + { + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "" + } + ], + "courses": [ + { + "startsOn": "2026-03-01", + "endsOn": "2026-03-07", + "note": "the March flu", + "createdAt": "" + }, + { + "startsOn": "2026-06-10", + "endsOn": "2026-06-16", + "note": null, + "createdAt": "" + } + ], + "doseChanges": [ + { + "note": "titration note, encrypted at rest", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "createdAt": "" + }, + { + "note": null, + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "createdAt": "" + } + ], + "inventoryItems": [ + { + "notes": "second pack, kept in the kitchen drawer", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "30", + "unitsRemaining": "21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "createdAt": "", + "updatedAt": "" + }, + { + "notes": null, + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "60", + "unitsRemaining": "0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "createdAt": "", + "updatedAt": "" + } + ], + "phaseConfig": { + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + }, + "inventoryEvents": [ + { + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + }, + { + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + } + ], + "scheduleRevisions": [ + { + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": null, + "createdAt": "" + }, + { + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByIndex": 2, + "createdAt": "" + }, + { + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByIndex": null, + "createdAt": "" + } + ], + "efficacyTargets": [ + { + "measurementType": "WEIGHT", + "biomarkerName": "Ferritin", + "primary": false + } + ] + } + ], + "intakeEvents": [ + { + "medication": "Round-trip tablet", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "source": "API", + "autoRecorded": true + } + ], + "moodEntries": [ + { + "note": "rt-MoodEntry-noteEncrypted", + "id": "", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "a1": 3, + "a2": 3, + "a3": 3, + "a4": 3, + "a5": 3, + "tags": "[\"round-trip-tag\"]", + "source": "rt-MoodEntry-source", + "loggedAt": "2026-07-01T20:00:00.000Z", + "externalId": "rt-MoodEntry-externalId", + "tz": "rt-MoodEntry-tz", + "deletedAt": null, + "factors": [ + { + "key": "round_trip_factor", + "rating": 4 + } + ], + "structuredTags": [], + "context": { + "note": "rt-MoodContext-notesEncrypted", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z" + } + } + ], + "customMoodTagCategories": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "label": "rt-MoodTagCategory-labelEncrypted" + } + ], + "hiddenMoodTags": [ + { + "key": "grateful", + "createdAt": "" + } + ], + "customMoodTags": [ + { + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "categoryId": "", + "kind": "RATED", + "isActive": false, + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "label": "rt-MoodTag-labelEncrypted", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true + } + ], + "cycleProfile": { + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false + }, + "cycles": [], + "cycleDayLogs": [ + { + "date": "2026-06-02", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitive": null, + "note": "rt-CycleDayLog-notesEncrypted", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "symptomKeys": [ + "custom:round-trip-cramps" + ], + "symptomSeverities": [ + { + "key": "custom:round-trip-cramps", + "severity": 3 + } + ] + } + ], + "customSymptoms": [ + { + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "categoryId": "csc_physical", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "label": "Round-trip cramps" + } + ], + "labResults": [ + { + "ref": "", + "note": "rt-LabResult-noteEncrypted", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "source": "rt-LabResult-source", + "biomarkerName": "Ferritin" + } + ], + "biomarkers": [ + { + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "panel": "rt-Biomarker-panel", + "hidden": true, + "context": "fasted, morning draw", + "analyteKey": "rt-Biomarker-analyteKey", + "aliases": [ + { + "name": "Ferr.", + "source": "IMPORT_CHOICE" + } + ] + } + ], + "biomarkerMerges": [ + { + "targetName": "Ferritin", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "illnessEpisodes": [ + { + "id": "", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "note": "rt-IllnessEpisode-noteEncrypted", + "bodySite": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "dayLogs": [ + { + "id": "", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "symptoms": [ + { + "key": "round_trip_cough", + "severity": 2 + } + ], + "note": "rt-IllnessDayLog-noteEncrypted", + "updatedAt": "" + } + ] + }, + { + "id": "", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "bodySite": "Stomach", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "dayLogs": [] + } + ], + "allergies": [ + { + "id": "", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reaction": "rt-Allergy-reactionEncrypted", + "note": "rt-Allergy-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "familyHistory": [ + { + "id": "", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "note": "rt-FamilyHistoryEntry-notesEncrypted", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId" + } + ], + "documents": [], + "manifest": { + "documents": { + "included": "metadata-only", + "note": "Document metadata (title, filename, type, dates, and the AI-generated summary if one was generated) is included. The original uploaded files are NOT included in this export — download them individually from Settings → Documents, or via the document API." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "omitted", + "note": "Completed WHO-5, PHQ and GAD administrations are not included in this export. Their per-item answers are stored encrypted and include the PHQ-9 self-harm item, which is not written into a portable file. They are included in a disaster-recovery backup, which returns to the instance that can read them." + }, + "consent": { + "included": "omitted", + "note": "Consent receipts are not included in this export. A consent is given to one operator, and a receipt restored elsewhere would assert an agreement that operator never obtained. They are included in a disaster-recovery backup, which returns to the same instance." + } + }, + "healthProfile": { + "aboutMe": "Runs three times a week", + "conditions": "rt-UserHealthProfile-conditionsEncrypted", + "allergies": "rt-UserHealthProfile-allergiesEncrypted", + "coachFocus": "rt-UserHealthProfile-coachFocusEncrypted", + "aiIncludedSections": [ + "ABOUT_ME" + ], + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContacts": "rt-UserHealthProfile-emergencyContactsEncrypted", + "emergencyImplants": "rt-UserHealthProfile-emergencyImplantsEncrypted", + "emergencyNote": "rt-UserHealthProfile-emergencyNoteEncrypted" + }, + "healthProfileFacts": [], + "customMetrics": [ + { + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "entries": [ + { + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride" + }, + { + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": "right hand, rested" + } + ] + } + ], + "correlationPatterns": [ + { + "createdAt": "", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3 + } + ], + "decryptFailures": [], + "intradayProfiles": [ + { + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin" + } + ], + "healthScoreRecords": [ + { + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "" + } + ], + "onboardingRecord": { + "needs": { + "recordTarget": "me", + "areas": [ + "blood-pressure", + "sleep" + ], + "medication": "yes", + "sources": [ + "withings" + ], + "visit": "within-a-month", + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + } + }, + "steps": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "medication", + "status": "pending" + }, + { + "id": "sources", + "status": "skipped" + }, + { + "id": "visit", + "status": "pending" + }, + { + "id": "units", + "status": "pending" + }, + { + "id": "confirm", + "status": "pending" + }, + { + "id": "first-result", + "status": "pending" + }, + { + "id": "done", + "status": "pending" + } + ], + "firstResult": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z" + }, + "practitioners": [ + { + "id": "", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": "rt-Practitioner-locationEncrypted", + "phone": "rt-Practitioner-phoneEncrypted", + "note": "ring the upper bell", + "createdAt": "", + "updatedAt": "" + } + ], + "encounters": [ + { + "id": "", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reason": "annual check", + "outcome": "ferritin back in range, recheck in a year", + "bodySite": "rt-Encounter-bodySiteEncrypted", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "encounterDocumentLinks": [], + "encounterLabLinks": [], + "encounterConditionLinks": [ + { + "encounterId": "", + "targetId": "", + "createdAt": "" + } + ], + "customVaccines": [ + { + "id": "", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinations": [ + { + "id": "", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "note": "sore arm for a day, nothing else", + "createdAt": "", + "updatedAt": "" + } + ], + "vaccinationDocumentLinks": [], + "measurementReminders": [ + { + "id": "", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "measurementReminderEvents": [ + { + "id": "", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + }, + { + "id": "", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + } + ], + "coachConversations": [ + { + "id": "", + "title": "How is my blood pressure trending?", + "documentScoped": false, + "summary": "earlier turns: weight trend and evening walks", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "my readings look higher this week, is that real?", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "role": "assistant", + "content": "the last seven mornings average 4 mmHg above the fortnight before", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsJson": "[{\"ref\":\"r1\",\"source\":{\"tool\":\"get_metric_series\",\"domain\":\"bp\",\"window\":\"last7days\",\"period\":\"current\",\"granularity\":\"day\"},\"shape\":\"timeSeries\",\"titleKey\":\"coach.result.title.metricByPeriod\",\"title\":\"Blood pressure by day\",\"rowCount\":2,\"chartKind\":\"line\",\"displayed\":true,\"columns\":[{\"key\":\"period\",\"kind\":\"period\",\"labelKey\":\"coach.result.column.day\",\"label\":\"Day\"},{\"key\":\"sys\",\"kind\":\"number\",\"labelKey\":\"coach.result.column.systolic\",\"label\":\"Systolic\",\"unit\":\"mmHg\"}],\"rows\":[[\"2026-07-19\",131],[\"2026-07-20\",null]],\"truncated\":false,\"chart\":{\"kind\":\"line\",\"x\":\"period\",\"series\":[\"sys\"]}}]", + "trailJson": "{\"entries\":[{\"id\":\"a1\",\"title\":\"Checking the trend\",\"text\":\"Read 30 days.\"}]}", + "createdAt": "2026-07-20T09:59:00.000Z" + } + ], + "attachments": [] + }, + { + "id": "", + "title": "About my June labs", + "documentScoped": true, + "summary": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "createdAt": "", + "updatedAt": "", + "messages": [ + { + "id": "", + "role": "user", + "content": "What does the ferritin mean?", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsJson": null, + "trailJson": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "attachments": [] + } + ], + "coachFacts": [ + { + "id": "", + "fact": "does not tolerate ACE inhibitors", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachPlans": [ + { + "id": "", + "metric": "BLOOD_PRESSURE", + "ifCue": "if the evening reading is over 140", + "thenAction": "then walk twenty minutes before dinner tomorrow", + "target": "under 130 by October", + "outcome": "rt-CoachPlan-outcomeEncrypted", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "coachReminders": [ + { + "id": "", + "note": "ask how the evening walks are going", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "" + } + ], + "mentalHealthAssessments": [], + "consentReceipts": [], + "documentConditionLinks": [], + "extractedFacts": [], + "personalRecords": [ + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "userAchievements": [ + { + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + }, + { + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + } + ], + "environmentContexts": [ + { + "date": "2026-06-15", + "lat": 41.4, + "lon": 2.2, + "locationLabel": "Barcelona", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "date": "2026-07-01", + "lat": 52.5, + "lon": 13.4, + "locationLabel": "Berlin", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "environmentTravelLocations": [ + { + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "lat": 41.4, + "lon": 2.2, + "label": "Barcelona", + "createdAt": "", + "updatedAt": "" + } + ], + "dawarichDays": [ + { + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCode": "ES", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "ecgRecordings": [ + { + "waveform": [ + -12, + 4, + 118, + -33, + 7, + 2, + -5, + 61 + ], + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "symptomDefinitions": [ + { + "label": "Aura", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "note": null, + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "note": null, + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + }, + { + "label": "Headache", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "", + "events": [ + { + "note": "left side, behind the eye", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ] + } + ], + "lifeEvents": [ + { + "title": "Moved to the coast", + "note": "the flat with the long hallway", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "createdAt": "", + "updatedAt": "" + }, + { + "title": "Parental leave", + "note": null, + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "createdAt": "", + "updatedAt": "" + } + ], + "labResultDocumentLinks": [], + "encounterMedicationLinks": [ + { + "encounterId": "", + "medicationId": "", + "createdAt": "" + } + ], + "encounterVaccinationLinks": [ + { + "encounterId": "", + "vaccinationId": "", + "createdAt": "" + } + ], + "medicationDocumentLinks": [], + "medicationConditionLinks": [ + { + "medicationId": "", + "episodeId": "", + "createdAt": "" + } + ], + "nutrientDays": [ + { + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "" + } + ] + } +} diff --git a/tests/integration/__golden__/backup-parity/restore-skips.json b/tests/integration/__golden__/backup-parity/restore-skips.json new file mode 100644 index 000000000..339fe8c13 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/restore-skips.json @@ -0,0 +1,1015 @@ +{ + "outcome": { + "ok": true, + "response": { + "restored": true, + "summary": { + "schemaVersion": "2", + "userId": "round-trip-owner", + "exportedAt": "2026-07-20T08:00:00.000Z", + "measurements": 1, + "medications": 1, + "intakeEvents": 0, + "medicationSideEffects": 0, + "medicationEfficacyTargets": 2, + "medicationScheduleRevisions": 2, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 0, + "nutrientDays": 0, + "labResults": 0, + "biomarkers": 0, + "illnessEpisodes": 1, + "illnessDayLogs": 1, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "customMetricEntries": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0 + }, + "skipped": { + "catalogueKeys": [ + { + "catalogue": "accountSetting", + "key": "aiBaseUrl", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "globalExcludedInjectionSites.NOWHERE", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "locale", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "thresholdsJson.NOT_A_METRIC", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "timezone", + "links": 1 + }, + { + "catalogue": "illnessSymptom", + "key": "a_symptom_nobody_has", + "links": 1 + }, + { + "catalogue": "medicationTarget", + "key": "HbA1c that is not in the file", + "links": 1 + }, + { + "catalogue": "moodFactor", + "key": "a_factor_nobody_has", + "links": 1 + }, + { + "catalogue": "moodTag", + "key": "a_binary_tag_nobody_has", + "links": 1 + }, + { + "catalogue": "moodTag", + "key": "a_tag_nobody_has", + "links": 1 + }, + { + "catalogue": "scheduleRevisionLink", + "key": "medications[0].scheduleRevisions[0].supersededByIndex=7", + "links": 1 + }, + { + "catalogue": "scheduleRevisionLink", + "key": "medications[0].scheduleRevisions[1].supersededByIndex=1", + "links": 1 + } + ], + "links": 12 + }, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + } + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 6, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 7, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 8, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 9, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 10, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 11, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 12, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 13, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 14, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 15, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 16, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "sections", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 1 + }, + { + "phase": "rebuilding", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 1 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": false + } + }, + { + "action": "admin.backups.restore", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "restoreInstanceSettings": false, + "cleared": { + "measurements": 0, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 0, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + }, + "accountSettingsApplied": 4, + "skipped": { + "catalogueKeys": [ + { + "catalogue": "accountSetting", + "key": "aiBaseUrl", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "globalExcludedInjectionSites.NOWHERE", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "locale", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "thresholdsJson.NOT_A_METRIC", + "links": 1 + }, + { + "catalogue": "accountSetting", + "key": "timezone", + "links": 1 + }, + { + "catalogue": "illnessSymptom", + "key": "a_symptom_nobody_has", + "links": 1 + }, + { + "catalogue": "medicationTarget", + "key": "HbA1c that is not in the file", + "links": 1 + }, + { + "catalogue": "moodFactor", + "key": "a_factor_nobody_has", + "links": 1 + }, + { + "catalogue": "moodTag", + "key": "a_binary_tag_nobody_has", + "links": 1 + }, + { + "catalogue": "moodTag", + "key": "a_tag_nobody_has", + "links": 1 + }, + { + "catalogue": "scheduleRevisionLink", + "key": "medications[0].scheduleRevisions[0].supersededByIndex=7", + "links": 1 + }, + { + "catalogue": "scheduleRevisionLink", + "key": "medications[0].scheduleRevisions[1].supersededByIndex=1", + "links": 1 + } + ], + "links": 12 + }, + "restored": { + "measurements": 1, + "medications": 1, + "intakeEvents": 0, + "moodEntries": 1, + "cycles": 0, + "cycleDayLogs": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 1, + "illnessDayLogs": 1, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "customMetricEntries": 0, + "correlationPatterns": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0 + } + } + } + ], + "effects": { + "invalidated": [ + "round-trip-owner" + ], + "unitRefresh": [ + "round-trip-owner" + ], + "foldRepair": [ + "round-trip-owner" + ], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": false + } + }, + { + "meta": { + "restore_expired_tombstones_skipped": 0 + } + }, + { + "meta": { + "restoreSkippedLinks": 12, + "restoreSkippedKeys": "accountSetting:aiBaseUrl,accountSetting:globalExcludedInjectionSites.NOWHERE,accountSetting:locale,accountSetting:thresholdsJson.NOT_A_METRIC,accountSetting:timezone,illnessSymptom:a_symptom_nobody_has,medicationTarget:HbA1c that is not in the file,moodFactor:a_factor_nobody_has,moodTag:a_binary_tag_nobody_has,moodTag:a_tag_nobody_has,scheduleRevisionLink:medications[0].scheduleRevisions[0].supersededByIndex=7,scheduleRevisionLink:medications[0].scheduleRevisions[1].supersededByIndex=1" + } + } + ] + }, + "snapshot": { + "Measurement": [ + { + "id": "skips-measurement", + "userId": "round-trip-owner", + "type": "WEIGHT", + "value": 72, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "IntradayCumulativeProfile": [], + "Medication": [ + { + "id": "skips-medication", + "userId": "round-trip-owner", + "name": "Metformin", + "dose": "500 mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "decimal:1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "2026-06-01T00:00:00.000Z", + "updatedAt": "" + } + ], + "MedicationSchedule": [], + "MedicationIntakeEvent": [], + "MedicationSideEffect": [], + "MedicationPauseEra": [], + "MedicationDoseChange": [], + "MedicationCategoryAssignment": [], + "MedicationCategoryLabel": [], + "MedicationCourse": [], + "MedicationIngredient": [], + "MoodEntry": [ + { + "id": "skips-mood", + "userId": "round-trip-owner", + "date": "2026-07-02", + "mood": "GOOD", + "score": 4, + "moodA1": null, + "stressA2": null, + "energyA3": null, + "connectionA4": null, + "stabilityA5": null, + "tags": null, + "note": null, + "noteEncrypted": null, + "source": "MOODLOG", + "externalId": null, + "moodLoggedAt": "2026-07-02T20:00:00.000Z", + "tz": null, + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + } + ], + "MoodContext": [], + "MoodEntryTagLink": [], + "MoodTag": [ + { + "id": "", + "categoryId": "skips-mood-category", + "key": "custom:skips-mood-tag", + "labelKey": "custom", + "icon": null, + "sortOrder": 0, + "isActive": true, + "kind": "RATED", + "scaleMin": 1, + "scaleMax": 5, + "inverse": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "LabResult": [], + "Biomarker": [], + "Allergy": [], + "FamilyHistoryEntry": [], + "IllnessEpisode": [ + { + "id": "skips-episode", + "userId": "round-trip-owner", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "ACUTE", + "onsetAt": "2026-07-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "noteEncrypted": null, + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "episodeId": "skips-episode", + "date": "2026-07-01", + "functionalImpact": 1, + "feverC": 38.1, + "noteEncrypted": null, + "tz": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessSymptomLink": [], + "SymptomDefinition": [], + "SymptomEvent": [], + "LifeEvent": [], + "UserHealthProfile": [], + "HealthProfileFactRevision": [], + "CycleProfile": [], + "MenstrualCycle": [], + "CycleDayLog": [], + "CycleSymptom": [], + "CycleSymptomLink": [], + "CustomMetric": [], + "CustomMetricEntry": [], + "CorrelationPattern": [], + "HealthScoreRecord": [], + "Workout": [], + "NutrientIntakeDay": [], + "InboundDocument": [], + "Practitioner": [], + "Encounter": [], + "EncounterDocumentLink": [], + "EncounterLabLink": [], + "EncounterConditionLink": [], + "VaccinationRecord": [], + "VaccinationDocumentLink": [], + "CustomVaccine": [], + "MeasurementReminder": [], + "MeasurementReminderEvent": [], + "CoachConversation": [], + "CoachMessage": [], + "CoachConversationDocument": [], + "CoachFact": [], + "CoachPlan": [], + "CoachReminder": [], + "MedicationInventoryItem": [], + "MedicationInventoryEvent": [], + "MoodTagCategory": [ + { + "id": "skips-mood-category", + "key": "custom:skips-mood-category", + "labelKey": "custom", + "icon": null, + "sortOrder": 0, + "isActive": true, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "MoodTagHidden": [], + "ReminderPhaseConfig": [], + "MentalHealthAssessment": [], + "ConsentReceipt": [], + "DocumentConditionLink": [], + "ExtractedFact": [], + "PersonalRecord": [], + "UserAchievement": [], + "EnvironmentContext": [], + "EnvironmentTravelLocation": [], + "DawarichDay": [], + "MedicationScheduleRevision": [ + { + "id": "", + "medicationId": "skips-medication", + "validFrom": "2026-06-01T00:00:00.000Z", + "validUntil": "2026-06-15T00:00:00.000Z", + "payload": { + "schedules": [] + }, + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "skips-medication", + "validFrom": "2026-06-15T00:00:00.000Z", + "validUntil": "2026-07-01T00:00:00.000Z", + "payload": { + "schedules": [] + }, + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "MedicationEfficacyTarget": [ + { + "id": "", + "medicationId": "skips-medication", + "measurementType": "BLOOD_GLUCOSE", + "biomarkerId": null, + "primary": false, + "createdAt": "", + "updatedAt": "" + } + ], + "EcgRecording": [], + "OnboardingRecord": [], + "BiomarkerAlias": [], + "BiomarkerMerge": [], + "LabResultDocumentLink": [], + "EncounterMedicationLink": [], + "EncounterVaccinationLink": [], + "MedicationDocumentLink": [], + "MedicationConditionLink": [], + "AccountGrant": [ + { + "id": "", + "grantorId": "round-trip-owner", + "granteeId": "parity-delegate", + "access": "READ", + "scopeJson": null, + "invitedAt": "", + "acceptedAt": "2026-07-03T09:00:00.000Z", + "revokedAt": null, + "revokedBy": null, + "expiresAt": null, + "lastUsedAt": null, + "createdAt": "" + } + ], + "User": { + "id": "round-trip-owner", + "username": "round-trip-owner", + "email": "round-trip-owner@example.test", + "passwordHash": null, + "role": "USER", + "oidcIssuer": null, + "oidcSub": null, + "createdAt": "", + "updatedAt": "", + "managedProfileAt": null, + "heightCm": null, + "dateOfBirth": null, + "gender": null, + "timezone": "Europe/Berlin", + "homeTimezone": null, + "homeSince": null, + "homeLocationEncrypted": null, + "environmentAirQualityEnabled": true, + "environmentAqHistoryJson": null, + "codexAccessTokenEncrypted": null, + "codexRefreshTokenEncrypted": null, + "codexTokenExpiresAt": null, + "codexConnectedAt": null, + "codexConnectionStatus": "disconnected", + "useCentralCodex": false, + "insightsPrivacyMode": "aggregated", + "insightsCachedAt": null, + "insightsCachedTextEncrypted": null, + "insightsCachedLocale": null, + "insightsSnapshotHash": null, + "insightsWarmFailedAt": null, + "insightsBriefingRerollDate": null, + "morningDigestRefreshedOn": null, + "insightsExcludeMetrics": [], + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "telegramBotToken": null, + "telegramChatId": null, + "telegramEnabled": false, + "withingsClientIdEncrypted": null, + "withingsClientSecretEncrypted": null, + "whoopClientIdEncrypted": null, + "whoopClientSecretEncrypted": null, + "fitbitClientIdEncrypted": null, + "fitbitClientSecretEncrypted": null, + "googleHealthClientIdEncrypted": null, + "googleHealthClientSecretEncrypted": null, + "nightscoutUrlEncrypted": null, + "nightscoutTokenEncrypted": null, + "nightscoutAllowPrivateHost": false, + "dawarichUrlEncrypted": null, + "dawarichApiKeyEncrypted": null, + "dawarichPrefsEncrypted": null, + "dawarichAllowPrivateHost": false, + "polarAccessTokenEncrypted": null, + "polarUserIdEncrypted": null, + "polarClientIdEncrypted": null, + "polarClientSecretEncrypted": null, + "ouraAccessTokenEncrypted": null, + "ouraRefreshTokenEncrypted": null, + "ouraClientIdEncrypted": null, + "ouraClientSecretEncrypted": null, + "ouraScopeDenied": null, + "ouraBackfillProgress": null, + "ouraBackfillCompletedAt": null, + "ouraUserId": null, + "clientAppSharedBy": null, + "stravaClientIdEncrypted": null, + "stravaClientSecretEncrypted": null, + "stravaAccessTokenEncrypted": null, + "stravaRefreshTokenEncrypted": null, + "stravaAthleteId": null, + "stravaLastActivityAt": null, + "stravaBackfillCompletedAt": null, + "stravaBackfillResumeBefore": null, + "locale": null, + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "dashboardWidgetsJson": null, + "insightsLayoutJson": null, + "medicationListLayoutJson": null, + "documentsLayoutJson": null, + "moodTagLayoutJson": null, + "moduleListLayoutJson": null, + "previewFeaturesJson": null, + "activityGoalsJson": null, + "glucoseUnit": null, + "hasDiabetes": false, + "labsLocalOcrEnabled": false, + "storeWorkoutRoutes": false, + "unitPreference": "metric", + "timeFormat": "AUTO", + "dateFormat": "AUTO", + "aiProvider": "OPENAI", + "aiModel": null, + "aiBaseUrl": null, + "aiAnthropicKeyEncrypted": null, + "aiLocalKeyEncrypted": null, + "aiOpenaiKeyEncrypted": null, + "aiCompatBaseUrl": null, + "aiCompatKeyEncrypted": null, + "aiCompatModel": null, + "aiProviderChain": null, + "aiResponseTimeoutSeconds": null, + "documentsAutoAiRead": false, + "onboardingCompletedAt": null, + "onboardingTourCompleted": false, + "onboardingTourProgressJson": null, + "disclaimerAcknowledgedAt": null, + "disclaimerAcknowledgedVersion": null, + "healthKitConfigJson": null, + "healthKitLastSyncedAt": null, + "healthKitLastSyncTrigger": null, + "healthKitLastBackgroundSyncAt": null, + "displayName": null, + "lastReportPracticeName": null, + "coachPrefsJson": null, + "sourcePriorityJson": null, + "lastSyncedAt": null, + "syncResetAt": "", + "moodReminderEnabled": false, + "reportSelectionJson": null, + "notificationPrefs": null, + "disableCoach": false, + "aiUsageLevel": null, + "modulePreferencesJson": null, + "healthScoreConfigJson": null, + "documentQuotaBytes": null, + "coachLastSeenAt": null, + "avatarBytes": null, + "avatarContentType": null, + "avatarUpdatedAt": null, + "totpSecretEncrypted": null, + "totpConfirmedAt": null, + "totpLastStep": null, + "mfaEnforced": false, + "passkeyUpgradeNudgeDismissed": false, + "fullName": null, + "insurerName": null, + "insuranceNumberEncrypted": null, + "insurerIkNumber": null + }, + "AppSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "de", + "telegramGlobal": true, + "ntfyGlobal": false, + "webPushGlobal": true, + "webPushVapidPublicKey": null, + "webPushVapidPrivateKeyEncrypted": null, + "webPushVapidSubject": null, + "apiGlobal": true, + "umamiEnabled": false, + "umamiScriptUrl": null, + "umamiWebsiteId": null, + "glitchtipEnabled": false, + "glitchtipDsn": null, + "glitchtipEnvironment": null, + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 30, + "reminderMissedMinutes": 120, + "adminAiKeyEncrypted": null, + "adminAiModel": "gpt-legacy", + "adminAiBaseUrl": "https://api.example.com/v1", + "adminCodexAccessTokenEncrypted": null, + "adminCodexRefreshTokenEncrypted": null, + "adminCodexAccountIdEncrypted": null, + "adminCodexTokenExpiresAt": null, + "adminCodexConnectedAt": null, + "adminCodexConnectionStatus": "disconnected", + "adminAiInsightsFeedbackSummary": null, + "defaultUserTimezone": "Europe/Berlin", + "assistantEnabled": true, + "assistantCoachEnabled": true, + "assistantBriefingEnabled": true, + "assistantInsightStatusEnabled": true, + "assistantDocumentAiEnabled": true, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": true, + "aiReasoningMaxEffort": "high", + "moduleAvailabilityJson": { + "mood": "on" + }, + "documentMaxFileBytes": 10000000, + "documentQuotaBytes": "bigint:500000000", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + } + } +} diff --git a/tests/integration/__golden__/backup-parity/restore-version-1.json b/tests/integration/__golden__/backup-parity/restore-version-1.json new file mode 100644 index 000000000..cdc01f836 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/restore-version-1.json @@ -0,0 +1,1807 @@ +{ + "outcome": { + "ok": true, + "response": { + "restored": true, + "summary": { + "schemaVersion": "1", + "userId": "round-trip-owner", + "exportedAt": "2026-07-20T08:00:00.000Z", + "measurements": 5, + "medications": 2, + "intakeEvents": 2, + "medicationSideEffects": 0, + "medicationEfficacyTargets": 0, + "medicationScheduleRevisions": 0, + "moodEntries": 2, + "cycles": 0, + "cycleDayLogs": 0, + "nutrientDays": 1, + "labResults": 1, + "biomarkers": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "customMetricEntries": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0 + }, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "cleared": { + "measurements": 1, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 1, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + } + } + }, + "progress": [ + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": null + }, + { + "phase": "validating", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "clearing", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "measurements", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 0, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 1, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 2, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 3, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 4, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 5, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 6, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 7, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 8, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 9, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 10, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 11, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 12, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 13, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 14, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 15, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 16, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "sections", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + }, + { + "phase": "rebuilding", + "sectionsDone": 17, + "sectionsTotal": 17, + "measurementsTotal": 5 + } + ], + "audit": [ + { + "action": "admin.backups.restore.start", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "snapshotExportedAt": "2026-07-20T08:00:00.000Z", + "restoreInstanceSettings": true + } + }, + { + "action": "admin.backups.restore", + "userId": "", + "details": { + "backupId": "", + "ownerId": "round-trip-owner", + "ownerUsername": "round-trip-owner", + "restoreInstanceSettings": true, + "cleared": { + "measurements": 1, + "medications": 0, + "intakeEvents": 0, + "moodEntries": 1, + "notificationChannels": 0, + "pushSubscriptions": 0, + "telegramScheduledDeletions": 0, + "cycles": 0, + "cycleDayLogs": 0, + "cycleProfile": 0, + "labResults": 0, + "biomarkers": 0, + "nutrientDays": 0, + "illnessEpisodes": 0, + "allergies": 0, + "familyHistory": 0, + "workouts": 0, + "documents": 0, + "documentConditionLinks": 0, + "extractedFacts": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "correlationPatterns": 0, + "intradayProfiles": 0, + "healthScoreRecords": 0, + "onboardingRecords": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0, + "coachConversations": 0, + "coachMessages": 0, + "coachConversationDocuments": 0, + "coachFacts": 0, + "coachPlans": 0, + "coachReminders": 0, + "mentalHealthAssessments": 0, + "consentReceipts": 0, + "personalRecords": 0, + "userAchievements": 0, + "environmentContexts": 0, + "environmentTravelLocations": 0, + "dawarichDays": 0, + "ecgRecordings": 0, + "symptomDefinitions": 0, + "lifeEvents": 0 + }, + "accountSettingsApplied": 0, + "skipped": { + "catalogueKeys": [], + "links": 0 + }, + "restored": { + "measurements": 5, + "medications": 2, + "intakeEvents": 2, + "moodEntries": 2, + "cycles": 0, + "cycleDayLogs": 0, + "labResults": 1, + "biomarkers": 1, + "nutrientDays": 1, + "illnessEpisodes": 2, + "illnessDayLogs": 1, + "allergies": 1, + "familyHistory": 1, + "workouts": 1, + "documents": 0, + "healthProfile": 0, + "healthProfileFactRevisions": 0, + "customMetrics": 0, + "customMetricEntries": 0, + "correlationPatterns": 0, + "practitioners": 0, + "encounters": 0, + "encounterLinks": 0, + "vaccinations": 0, + "vaccinationLinks": 0, + "relationLinks": 0, + "customVaccines": 0, + "measurementReminders": 0, + "measurementReminderEvents": 0 + } + } + } + ], + "effects": { + "invalidated": [ + "round-trip-owner" + ], + "unitRefresh": [], + "foldRepair": [ + "round-trip-owner" + ], + "annotations": [ + { + "action": { + "name": "admin.backups.restore" + }, + "meta": { + "id": "", + "restore_instance_settings": true + } + }, + { + "meta": { + "restore_expired_tombstones_skipped": 0 + } + }, + { + "meta": { + "restoreSkippedLinks": 0, + "restoreSkippedKeys": "" + } + } + ] + }, + "snapshot": { + "Measurement": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "BLOOD_PRESSURE_SYS", + "value": 128, + "valueMin": null, + "valueMax": null, + "unit": "mmHg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:05:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "HRV_RMSSD", + "value": 40, + "valueMin": null, + "valueMax": null, + "unit": "ms", + "source": "FITBIT", + "measuredAt": "2026-07-03T04:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "fitbit-hrv-2026-07-03", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "HRV_RMSSD", + "value": 41, + "valueMin": null, + "valueMax": null, + "unit": "ms", + "source": "FITBIT", + "measuredAt": "2026-07-02T04:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "fitbit-hrv-2026-07-02", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "WEIGHT", + "value": 74.5, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:00:00.000Z", + "notes": null, + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "IntradayCumulativeProfile": [], + "Medication": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Ramipril", + "dose": "5 mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "decimal:1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "2026-07-01T07:00:00.000Z", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "name": "Vitamin D", + "dose": "1000 IU", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "decimal:1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-07-01T00:00:00.000Z", + "endsOn": "2026-08-01T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "2026-07-01T08:00:00.000Z", + "updatedAt": "" + } + ], + "MedicationSchedule": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "MedicationIntakeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "scheduledFor": "2026-07-01T07:00:00.000Z", + "takenAt": "2026-07-01T07:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + } + ], + "MedicationSideEffect": [], + "MedicationPauseEra": [], + "MedicationDoseChange": [], + "MedicationCategoryAssignment": [], + "MedicationCategoryLabel": [], + "MedicationCourse": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-07-01T00:00:00.000Z", + "endsOn": "2026-08-01T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationIngredient": [], + "MoodEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-02", + "mood": "GOOD", + "score": 4, + "moodA1": null, + "stressA2": null, + "energyA3": null, + "connectionA4": null, + "stabilityA5": null, + "tags": null, + "note": null, + "noteEncrypted": "", + "source": "MOODLOG", + "externalId": null, + "moodLoggedAt": "2026-07-02T20:00:00.000Z", + "tz": null, + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-03", + "mood": "OKAY", + "score": 3, + "moodA1": null, + "stressA2": null, + "energyA3": null, + "connectionA4": null, + "stabilityA5": null, + "tags": null, + "note": null, + "noteEncrypted": null, + "source": "MOODLOG", + "externalId": "moodlog-2026-07-03", + "moodLoggedAt": "2026-07-03T20:00:00.000Z", + "tz": null, + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null + } + ], + "MoodContext": [], + "MoodEntryTagLink": [], + "MoodTag": [], + "LabResult": [ + { + "id": "", + "userId": "round-trip-owner", + "panel": "Iron", + "analyte": "Ferritin", + "value": 91, + "valueText": null, + "unit": "ng/mL", + "referenceLow": 30, + "referenceHigh": 400, + "sourceReferenceLow": null, + "sourceReferenceHigh": null, + "sourceReferenceText": null, + "sourceValue": null, + "sourceUnit": null, + "takenAt": "2026-07-05T08:00:00.000Z", + "biomarkerId": "", + "source": "MANUAL", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Biomarker": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 30, + "upperBound": 400, + "contextEncrypted": "", + "panel": "Iron", + "hidden": false, + "analyteKey": null, + "createdAt": "", + "updatedAt": "" + } + ], + "Allergy": [ + { + "id": "legacy-allergy", + "userId": "round-trip-owner", + "substance": "Penicillin", + "category": "MEDICATION", + "type": "ALLERGY", + "severity": "SEVERE", + "status": "ACTIVE", + "onsetAt": null, + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "FamilyHistoryEntry": [ + { + "id": "legacy-family", + "userId": "round-trip-owner", + "relationship": "FATHER", + "condition": "Diabetes", + "ageAtOnset": 55, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessEpisode": [ + { + "id": "legacy-episode-child", + "userId": "round-trip-owner", + "label": "Headache", + "type": "OTHER", + "lifecycle": "ACUTE", + "onsetAt": "2026-07-01T00:00:00.000Z", + "resolvedAt": "2026-07-02T00:00:00.000Z", + "parentConditionId": "legacy-episode-parent", + "noteEncrypted": null, + "bodySiteEncrypted": "", + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "legacy-episode-parent", + "userId": "round-trip-owner", + "label": "Hypertension", + "type": "CHRONIC", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2025-01-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "noteEncrypted": "", + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "episodeId": "legacy-episode-child", + "date": "2026-07-01", + "functionalImpact": 2, + "feverC": null, + "noteEncrypted": "", + "tz": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessSymptomLink": [], + "SymptomDefinition": [], + "SymptomEvent": [], + "LifeEvent": [], + "UserHealthProfile": [], + "HealthProfileFactRevision": [], + "CycleProfile": [], + "MenstrualCycle": [], + "CycleDayLog": [], + "CycleSymptom": [], + "CycleSymptomLink": [], + "CustomMetric": [], + "CustomMetricEntry": [], + "CorrelationPattern": [], + "HealthScoreRecord": [], + "Workout": [ + { + "id": "", + "userId": "round-trip-owner", + "sportType": "RUNNING", + "startedAt": "2026-07-04T06:00:00.000Z", + "endedAt": "2026-07-04T06:40:00.000Z", + "durationSec": 2400, + "totalEnergyKcal": 410, + "totalDistanceM": 6500, + "avgHeartRate": 148, + "maxHeartRate": 171, + "minHeartRate": 98, + "stepCount": 6200, + "elevationM": 40, + "pauseDurationSec": null, + "source": "MANUAL", + "externalId": null, + "externalSourceVersion": null, + "metadata": null, + "createdAt": "", + "updatedAt": "" + } + ], + "NutrientIntakeDay": [ + { + "userId": "round-trip-owner", + "day": "2026-07-04", + "nutrient": "WATER", + "amount": 2100, + "unit": "mL", + "source": "MANUAL", + "externalSourceVersion": null, + "createdAt": "", + "updatedAt": "" + } + ], + "InboundDocument": [], + "Practitioner": [], + "Encounter": [], + "EncounterDocumentLink": [], + "EncounterLabLink": [], + "EncounterConditionLink": [], + "VaccinationRecord": [], + "VaccinationDocumentLink": [], + "CustomVaccine": [], + "MeasurementReminder": [], + "MeasurementReminderEvent": [], + "CoachConversation": [], + "CoachMessage": [], + "CoachConversationDocument": [], + "CoachFact": [], + "CoachPlan": [], + "CoachReminder": [], + "MedicationInventoryItem": [], + "MedicationInventoryEvent": [], + "MoodTagCategory": [], + "MoodTagHidden": [], + "ReminderPhaseConfig": [], + "MentalHealthAssessment": [], + "ConsentReceipt": [], + "DocumentConditionLink": [], + "ExtractedFact": [], + "PersonalRecord": [], + "UserAchievement": [], + "EnvironmentContext": [], + "EnvironmentTravelLocation": [], + "DawarichDay": [], + "MedicationScheduleRevision": [], + "MedicationEfficacyTarget": [], + "EcgRecording": [], + "OnboardingRecord": [], + "BiomarkerAlias": [], + "BiomarkerMerge": [], + "LabResultDocumentLink": [], + "EncounterMedicationLink": [], + "EncounterVaccinationLink": [], + "MedicationDocumentLink": [], + "MedicationConditionLink": [], + "AccountGrant": [ + { + "id": "", + "grantorId": "round-trip-owner", + "granteeId": "parity-delegate", + "access": "READ", + "scopeJson": null, + "invitedAt": "", + "acceptedAt": "2026-07-03T09:00:00.000Z", + "revokedAt": null, + "revokedBy": null, + "expiresAt": null, + "lastUsedAt": null, + "createdAt": "" + } + ], + "User": { + "id": "round-trip-owner", + "username": "round-trip-owner", + "email": "round-trip-owner@example.test", + "passwordHash": null, + "role": "USER", + "oidcIssuer": null, + "oidcSub": null, + "createdAt": "", + "updatedAt": "", + "managedProfileAt": null, + "heightCm": null, + "dateOfBirth": null, + "gender": null, + "timezone": "Europe/Berlin", + "homeTimezone": null, + "homeSince": null, + "homeLocationEncrypted": null, + "environmentAirQualityEnabled": true, + "environmentAqHistoryJson": null, + "codexAccessTokenEncrypted": null, + "codexRefreshTokenEncrypted": null, + "codexTokenExpiresAt": null, + "codexConnectedAt": null, + "codexConnectionStatus": "disconnected", + "useCentralCodex": false, + "insightsPrivacyMode": "aggregated", + "insightsCachedAt": null, + "insightsCachedTextEncrypted": null, + "insightsCachedLocale": null, + "insightsSnapshotHash": null, + "insightsWarmFailedAt": null, + "insightsBriefingRerollDate": null, + "morningDigestRefreshedOn": null, + "insightsExcludeMetrics": [], + "globalExcludedInjectionSites": [], + "telegramBotToken": null, + "telegramChatId": null, + "telegramEnabled": false, + "withingsClientIdEncrypted": null, + "withingsClientSecretEncrypted": null, + "whoopClientIdEncrypted": null, + "whoopClientSecretEncrypted": null, + "fitbitClientIdEncrypted": null, + "fitbitClientSecretEncrypted": null, + "googleHealthClientIdEncrypted": null, + "googleHealthClientSecretEncrypted": null, + "nightscoutUrlEncrypted": null, + "nightscoutTokenEncrypted": null, + "nightscoutAllowPrivateHost": false, + "dawarichUrlEncrypted": null, + "dawarichApiKeyEncrypted": null, + "dawarichPrefsEncrypted": null, + "dawarichAllowPrivateHost": false, + "polarAccessTokenEncrypted": null, + "polarUserIdEncrypted": null, + "polarClientIdEncrypted": null, + "polarClientSecretEncrypted": null, + "ouraAccessTokenEncrypted": null, + "ouraRefreshTokenEncrypted": null, + "ouraClientIdEncrypted": null, + "ouraClientSecretEncrypted": null, + "ouraScopeDenied": null, + "ouraBackfillProgress": null, + "ouraBackfillCompletedAt": null, + "ouraUserId": null, + "clientAppSharedBy": null, + "stravaClientIdEncrypted": null, + "stravaClientSecretEncrypted": null, + "stravaAccessTokenEncrypted": null, + "stravaRefreshTokenEncrypted": null, + "stravaAthleteId": null, + "stravaLastActivityAt": null, + "stravaBackfillCompletedAt": null, + "stravaBackfillResumeBefore": null, + "locale": null, + "thresholdsJson": null, + "dashboardWidgetsJson": null, + "insightsLayoutJson": null, + "medicationListLayoutJson": null, + "documentsLayoutJson": null, + "moodTagLayoutJson": null, + "moduleListLayoutJson": null, + "previewFeaturesJson": null, + "activityGoalsJson": null, + "glucoseUnit": null, + "hasDiabetes": false, + "labsLocalOcrEnabled": false, + "storeWorkoutRoutes": false, + "unitPreference": null, + "timeFormat": "AUTO", + "dateFormat": "AUTO", + "aiProvider": null, + "aiModel": null, + "aiBaseUrl": null, + "aiAnthropicKeyEncrypted": null, + "aiLocalKeyEncrypted": null, + "aiOpenaiKeyEncrypted": null, + "aiCompatBaseUrl": null, + "aiCompatKeyEncrypted": null, + "aiCompatModel": null, + "aiProviderChain": null, + "aiResponseTimeoutSeconds": null, + "documentsAutoAiRead": false, + "onboardingCompletedAt": null, + "onboardingTourCompleted": false, + "onboardingTourProgressJson": null, + "disclaimerAcknowledgedAt": null, + "disclaimerAcknowledgedVersion": null, + "healthKitConfigJson": null, + "healthKitLastSyncedAt": null, + "healthKitLastSyncTrigger": null, + "healthKitLastBackgroundSyncAt": null, + "displayName": null, + "lastReportPracticeName": null, + "coachPrefsJson": null, + "sourcePriorityJson": null, + "lastSyncedAt": null, + "syncResetAt": "", + "moodReminderEnabled": false, + "reportSelectionJson": null, + "notificationPrefs": null, + "disableCoach": false, + "aiUsageLevel": null, + "modulePreferencesJson": null, + "healthScoreConfigJson": null, + "documentQuotaBytes": null, + "coachLastSeenAt": null, + "avatarBytes": null, + "avatarContentType": null, + "avatarUpdatedAt": null, + "totpSecretEncrypted": null, + "totpConfirmedAt": null, + "totpLastStep": null, + "mfaEnforced": false, + "passkeyUpgradeNudgeDismissed": false, + "fullName": null, + "insurerName": null, + "insuranceNumberEncrypted": null, + "insurerIkNumber": null + }, + "AppSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "de", + "telegramGlobal": true, + "ntfyGlobal": false, + "webPushGlobal": true, + "webPushVapidPublicKey": null, + "webPushVapidPrivateKeyEncrypted": null, + "webPushVapidSubject": null, + "apiGlobal": true, + "umamiEnabled": false, + "umamiScriptUrl": null, + "umamiWebsiteId": null, + "glitchtipEnabled": false, + "glitchtipDsn": null, + "glitchtipEnvironment": null, + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 30, + "reminderMissedMinutes": 120, + "adminAiKeyEncrypted": null, + "adminAiModel": "gpt-legacy", + "adminAiBaseUrl": "https://api.example.com/v1", + "adminCodexAccessTokenEncrypted": null, + "adminCodexRefreshTokenEncrypted": null, + "adminCodexAccountIdEncrypted": null, + "adminCodexTokenExpiresAt": null, + "adminCodexConnectedAt": null, + "adminCodexConnectionStatus": "disconnected", + "adminAiInsightsFeedbackSummary": null, + "defaultUserTimezone": "Europe/Berlin", + "assistantEnabled": true, + "assistantCoachEnabled": true, + "assistantBriefingEnabled": true, + "assistantInsightStatusEnabled": true, + "assistantDocumentAiEnabled": true, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": true, + "aiReasoningMaxEffort": "high", + "moduleAvailabilityJson": { + "mood": "on" + }, + "documentMaxFileBytes": 10000000, + "documentQuotaBytes": "bigint:500000000", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + } + }, + "reexport": { + "schemaVersion": "2", + "exportedAt": "2026-08-01T00:00:00.000Z", + "userId": "round-trip-owner", + "appSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "de", + "telegramGlobal": true, + "ntfyGlobal": false, + "webPushGlobal": true, + "webPushVapidPublicKey": null, + "webPushVapidPrivateKeyEncrypted": null, + "webPushVapidSubject": null, + "apiGlobal": true, + "umamiEnabled": false, + "umamiScriptUrl": null, + "umamiWebsiteId": null, + "glitchtipEnabled": false, + "glitchtipDsn": null, + "glitchtipEnvironment": null, + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 30, + "reminderMissedMinutes": 120, + "adminAiKeyEncrypted": null, + "adminAiModel": "gpt-legacy", + "adminAiBaseUrl": "https://api.example.com/v1", + "adminCodexAccessTokenEncrypted": null, + "adminCodexRefreshTokenEncrypted": null, + "adminCodexAccountIdEncrypted": null, + "adminCodexTokenExpiresAt": null, + "adminCodexConnectedAt": null, + "adminCodexConnectionStatus": "disconnected", + "adminAiInsightsFeedbackSummary": null, + "defaultUserTimezone": "Europe/Berlin", + "assistantEnabled": true, + "assistantCoachEnabled": true, + "assistantBriefingEnabled": true, + "assistantInsightStatusEnabled": true, + "assistantDocumentAiEnabled": true, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": true, + "aiReasoningMaxEffort": "high", + "moduleAvailabilityJson": { + "mood": "on" + }, + "documentMaxFileBytes": 10000000, + "documentQuotaBytes": "500000000", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + }, + "accountSettings": { + "heightCm": null, + "dateOfBirth": null, + "gender": null, + "hasDiabetes": false, + "displayName": null, + "fullName": null, + "insurerName": null, + "insuranceNumber": null, + "insuranceNumberEncrypted": null, + "insurerIkNumber": null, + "lastReportPracticeName": null, + "avatarBytes": null, + "avatarContentType": null, + "avatarUpdatedAt": null, + "homeTimezone": null, + "homeSince": null, + "homeLocationEncrypted": null, + "environmentAirQualityEnabled": true, + "timezone": "Europe/Berlin", + "locale": null, + "unitPreference": null, + "glucoseUnit": null, + "timeFormat": "AUTO", + "dateFormat": "AUTO", + "modulePreferencesJson": null, + "thresholdsJson": null, + "healthScoreConfigJson": null, + "sourcePriorityJson": null, + "dashboardWidgetsJson": null, + "insightsLayoutJson": null, + "medicationListLayoutJson": null, + "moodTagLayoutJson": null, + "documentsLayoutJson": null, + "moduleListLayoutJson": null, + "previewFeaturesJson": null, + "activityGoalsJson": null, + "reportSelectionJson": null, + "globalExcludedInjectionSites": [], + "healthKitConfigJson": null, + "notificationPrefs": null, + "moodReminderEnabled": false, + "aiProvider": null, + "aiModel": null, + "aiBaseUrl": null, + "aiCompatBaseUrl": null, + "aiCompatModel": null, + "aiProviderChain": null, + "aiResponseTimeoutSeconds": null, + "useCentralCodex": false, + "insightsPrivacyMode": "aggregated", + "insightsExcludeMetrics": [], + "disableCoach": false, + "aiUsageLevel": null, + "coachPrefsJson": null, + "documentsAutoAiRead": false, + "labsLocalOcrEnabled": false, + "storeWorkoutRoutes": false, + "onboardingCompletedAt": null, + "onboardingTourCompleted": false, + "onboardingTourProgressJson": null, + "disclaimerAcknowledgedAt": null, + "disclaimerAcknowledgedVersion": null, + "passkeyUpgradeNudgeDismissed": false + }, + "measurements": [ + { + "id": "", + "type": "HRV_RMSSD", + "value": 40, + "valueMin": null, + "valueMax": null, + "unit": "ms", + "measuredAt": "2026-07-03T04:00:00.000Z", + "source": "FITBIT", + "notes": null, + "notesEncrypted": null, + "externalId": "fitbit-hrv-2026-07-03", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "HRV_RMSSD", + "value": 41, + "valueMin": null, + "valueMax": null, + "unit": "ms", + "measuredAt": "2026-07-02T04:00:00.000Z", + "source": "FITBIT", + "notes": null, + "notesEncrypted": null, + "externalId": "fitbit-hrv-2026-07-02", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "BLOOD_PRESSURE_SYS", + "value": 128, + "valueMin": null, + "valueMax": null, + "unit": "mmHg", + "measuredAt": "2026-07-01T07:05:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "type": "WEIGHT", + "value": 74.5, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "measuredAt": "2026-07-01T07:00:00.000Z", + "source": "MANUAL", + "notes": null, + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "customMedicationCategories": [], + "medications": [ + { + "id": "", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "updatedAt": "", + "name": "Ramipril", + "dose": "5 mg", + "active": true, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "category": "OTHER", + "createdAt": "2026-07-01T07:00:00.000Z", + "schedules": [ + { + "id": "", + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "unitsPerDose": null, + "windowStart": "07:00", + "windowEnd": "09:00", + "label": null, + "dose": null + } + ], + "sideEffects": [], + "pauseEras": [], + "ingredients": [], + "courses": [], + "doseChanges": [], + "inventoryItems": [], + "phaseConfig": null, + "inventoryEvents": [], + "scheduleRevisions": [], + "efficacyTargets": [] + }, + { + "id": "", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-07-01T00:00:00.000Z", + "endsOn": "2026-08-01T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "updatedAt": "", + "name": "Vitamin D", + "dose": "1000 IU", + "active": true, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "category": "OTHER", + "createdAt": "2026-07-01T08:00:00.000Z", + "schedules": [], + "sideEffects": [], + "pauseEras": [], + "ingredients": [], + "courses": [ + { + "startsOn": "2026-07-01", + "endsOn": "2026-08-01", + "note": null, + "createdAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [], + "phaseConfig": null, + "inventoryEvents": [], + "scheduleRevisions": [], + "efficacyTargets": [] + } + ], + "intakeEvents": [ + { + "id": "", + "medicationId": "", + "autoMissed": false, + "attributionSource": "AUTO", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null, + "medication": "Vitamin D", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "source": "WEB", + "autoRecorded": false + }, + { + "id": "", + "medicationId": "", + "autoMissed": false, + "attributionSource": "AUTO", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": 0, + "deletedAt": null, + "medication": "Ramipril", + "scheduledFor": "2026-07-01T07:00:00.000Z", + "takenAt": "2026-07-01T07:10:00.000Z", + "skipped": false, + "source": "WEB", + "autoRecorded": false + } + ], + "moodEntries": [ + { + "note": null, + "noteEncrypted": null, + "syncedAt": "", + "syncVersion": 0, + "createdAt": "", + "updatedAt": "", + "id": "", + "date": "2026-07-03", + "mood": "OKAY", + "score": 3, + "a1": null, + "a2": null, + "a3": null, + "a4": null, + "a5": null, + "tags": null, + "source": "MOODLOG", + "loggedAt": "2026-07-03T20:00:00.000Z", + "externalId": "moodlog-2026-07-03", + "tz": null, + "deletedAt": null, + "factors": [], + "structuredTags": [], + "context": null + }, + { + "note": null, + "noteEncrypted": "", + "syncedAt": "", + "syncVersion": 0, + "createdAt": "", + "updatedAt": "", + "id": "", + "date": "2026-07-02", + "mood": "GOOD", + "score": 4, + "a1": null, + "a2": null, + "a3": null, + "a4": null, + "a5": null, + "tags": null, + "source": "MOODLOG", + "loggedAt": "2026-07-02T20:00:00.000Z", + "externalId": null, + "tz": null, + "deletedAt": null, + "factors": [], + "structuredTags": [], + "context": null + } + ], + "customMoodTagCategories": [], + "hiddenMoodTags": [], + "customMoodTags": [], + "cycleProfile": null, + "cycles": [], + "cycleDayLogs": [], + "customSymptoms": [], + "labResults": [ + { + "id": "", + "biomarkerId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "note": null, + "panel": "Iron", + "analyte": "Ferritin", + "value": 91, + "valueText": null, + "unit": "ng/mL", + "referenceLow": 30, + "referenceHigh": 400, + "sourceReferenceLow": null, + "sourceReferenceHigh": null, + "sourceReferenceText": null, + "sourceValue": null, + "sourceUnit": null, + "takenAt": "2026-07-05T08:00:00.000Z", + "source": "MANUAL", + "biomarkerName": "Ferritin" + } + ], + "biomarkers": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 30, + "upperBound": 400, + "panel": "Iron", + "hidden": false, + "context": "fasted", + "analyteKey": null, + "aliases": [] + } + ], + "biomarkerMerges": [], + "illnessEpisodes": [ + { + "id": "legacy-episode-child", + "label": "Headache", + "type": "OTHER", + "lifecycle": "ACUTE", + "onsetAt": "2026-07-01T00:00:00.000Z", + "resolvedAt": "2026-07-02T00:00:00.000Z", + "parentConditionId": "legacy-episode-parent", + "note": null, + "noteEncrypted": null, + "bodySite": null, + "bodySiteEncrypted": "", + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [ + { + "id": "", + "episodeId": "legacy-episode-child", + "date": "2026-07-01", + "functionalImpact": 2, + "feverC": null, + "note": null, + "noteEncrypted": "", + "tz": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "symptoms": [] + } + ] + }, + { + "id": "legacy-episode-parent", + "label": "Hypertension", + "type": "CHRONIC", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2025-01-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "note": null, + "noteEncrypted": "", + "bodySite": null, + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "dayLogs": [] + } + ], + "allergies": [ + { + "id": "legacy-allergy", + "substance": "Penicillin", + "category": "MEDICATION", + "type": "ALLERGY", + "severity": "SEVERE", + "status": "ACTIVE", + "onsetAt": null, + "reaction": null, + "note": null, + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "familyHistory": [ + { + "id": "legacy-family", + "relationship": "FATHER", + "condition": "Diabetes", + "ageAtOnset": 55, + "note": "type 2", + "createdAt": "", + "updatedAt": "" + } + ], + "workouts": [ + { + "id": "", + "createdAt": "", + "updatedAt": "", + "externalSourceVersion": null, + "sportType": "RUNNING", + "startedAt": "2026-07-04T06:00:00.000Z", + "endedAt": "2026-07-04T06:40:00.000Z", + "durationSec": 2400, + "totalEnergyKcal": 410, + "totalDistanceM": 6500, + "avgHeartRate": 148, + "maxHeartRate": 171, + "minHeartRate": 98, + "stepCount": 6200, + "elevationM": 40, + "pauseDurationSec": null, + "source": "MANUAL", + "externalId": null + } + ], + "documents": [], + "manifest": { + "documents": { + "included": "encrypted-content", + "note": "Document metadata and encrypted stored bytes are included for disaster recovery." + }, + "workouts": { + "included": "summary-only", + "note": "Workout summary records (duration, distance, heart rate, calories, steps) are included. GPS routes and per-sample heart-rate/pace time series are not included in this export." + }, + "mentalHealth": { + "included": "full", + "note": "Completed screener administrations are included with their encrypted per-item answers, for restore onto the instance that holds the key." + }, + "consent": { + "included": "full", + "note": "Consent receipts are included, for restore onto the instance the consent was given to." + } + }, + "healthProfile": null, + "healthProfileFacts": [], + "customMetrics": [], + "correlationPatterns": [], + "decryptFailures": [], + "intradayProfiles": [], + "healthScoreRecords": [], + "onboardingRecord": null, + "practitioners": [], + "encounters": [], + "encounterDocumentLinks": [], + "encounterLabLinks": [], + "encounterConditionLinks": [], + "customVaccines": [], + "vaccinations": [], + "vaccinationDocumentLinks": [], + "measurementReminders": [], + "measurementReminderEvents": [], + "coachConversations": [], + "coachFacts": [], + "coachPlans": [], + "coachReminders": [], + "mentalHealthAssessments": [], + "consentReceipts": [], + "documentConditionLinks": [], + "extractedFacts": [], + "personalRecords": [], + "userAchievements": [], + "environmentContexts": [], + "environmentTravelLocations": [], + "dawarichDays": [], + "ecgRecordings": [], + "symptomDefinitions": [], + "lifeEvents": [], + "labResultDocumentLinks": [], + "encounterMedicationLinks": [], + "encounterVaccinationLinks": [], + "medicationDocumentLinks": [], + "medicationConditionLinks": [], + "nutrientDays": [ + { + "day": "2026-07-04", + "nutrient": "WATER", + "amount": 2100, + "unit": "mL", + "source": "MANUAL", + "externalSourceVersion": null, + "createdAt": "" + } + ] + } +} diff --git a/tests/integration/__golden__/backup-parity/schema-issues.json b/tests/integration/__golden__/backup-parity/schema-issues.json new file mode 100644 index 000000000..d693f8905 --- /dev/null +++ b/tests/integration/__golden__/backup-parity/schema-issues.json @@ -0,0 +1,454 @@ +{ + "everySectionWrong": [ + { + "code": "custom", + "path": [ + "exportedAt" + ], + "message": "Expected ISO-8601 date-time string" + }, + { + "origin": "string", + "code": "too_small", + "minimum": 1, + "inclusive": true, + "path": [ + "userId" + ], + "message": "Too small: expected string to have >=1 characters" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "accountSettings", + "heightCm" + ], + "message": "Invalid input: expected number, received string" + }, + { + "expected": "boolean", + "code": "invalid_type", + "path": [ + "accountSettings", + "hasDiabetes" + ], + "message": "Invalid input: expected boolean, received string" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "measurements", + 0, + "value" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "measurements", + 0, + "unit" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "measurements", + 0, + "measuredAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "medications", + 0, + "name" + ], + "message": "Invalid input: expected string, received number" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "medications", + 0, + "dose" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "array", + "code": "invalid_type", + "path": [ + "medications", + 0, + "schedules" + ], + "message": "Invalid input: expected array, received string" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "moodEntries", + 0, + "score" + ], + "message": "Invalid input: expected number, received string" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "moodEntries", + 0, + "loggedAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "labResults", + 0, + "analyte" + ], + "message": "Invalid input: expected string, received null" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "labResults", + 0, + "unit" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "labResults", + 0, + "takenAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "labResults", + 0, + "source" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "code": "invalid_value", + "values": [ + "DOCTOR_REPORT", + "DISCHARGE_LETTER", + "LAB_RESULT", + "IMAGING", + "PRESCRIPTION", + "REFERRAL", + "INSURANCE", + "VACCINATION", + "SICK_NOTE", + "OTHER" + ], + "path": [ + "documents", + 0, + "kind" + ], + "message": "Invalid option: expected one of \"DOCTOR_REPORT\"|\"DISCHARGE_LETTER\"|\"LAB_RESULT\"|\"IMAGING\"|\"PRESCRIPTION\"|\"REFERRAL\"|\"INSURANCE\"|\"VACCINATION\"|\"SICK_NOTE\"|\"OTHER\"" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "documents", + 0, + "mimeType" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "documents", + 0, + "byteSize" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "code": "invalid_value", + "values": [ + "STORED", + "EXTRACTING", + "EXTRACTED", + "FAILED", + "CONFIRMED", + "DISCARDED" + ], + "path": [ + "documents", + 0, + "status" + ], + "message": "Invalid option: expected one of \"STORED\"|\"EXTRACTING\"|\"EXTRACTED\"|\"FAILED\"|\"CONFIRMED\"|\"DISCARDED\"" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "vaccinations", + 0, + "occurredAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "vaccinations", + 0, + "createdAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "vaccinations", + 0, + "updatedAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "boolean", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "documentScoped" + ], + "message": "Invalid input: expected boolean, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "createdAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "updatedAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "messages", + 0, + "id" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "messages", + 0, + "role" + ], + "message": "Invalid input: expected string, received number" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "coachConversations", + 0, + "messages", + 0, + "createdAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "environmentContexts", + 0, + "date" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "environmentContexts", + 0, + "lat" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "environmentContexts", + 0, + "lon" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "environmentContexts", + 0, + "locationLabel" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "code": "invalid_value", + "values": [ + "HOME", + "TRAVEL", + "DEVICE" + ], + "path": [ + "environmentContexts", + 0, + "source" + ], + "message": "Invalid option: expected one of \"HOME\"|\"TRAVEL\"|\"DEVICE\"" + }, + { + "code": "invalid_value", + "values": [ + "MANUAL", + "WITHINGS", + "IMPORT", + "APPLE_HEALTH", + "COMPUTED", + "WHOOP", + "FITBIT", + "NIGHTSCOUT", + "POLAR", + "OURA", + "TELEGRAM", + "MCP", + "GOOGLE_HEALTH", + "STRAVA", + "EXTERNAL", + "HEALTH_CONNECT" + ], + "path": [ + "ecgRecordings", + 0, + "source" + ], + "message": "Invalid option: expected one of \"MANUAL\"|\"WITHINGS\"|\"IMPORT\"|\"APPLE_HEALTH\"|\"COMPUTED\"|\"WHOOP\"|\"FITBIT\"|\"NIGHTSCOUT\"|\"POLAR\"|\"OURA\"|\"TELEGRAM\"|\"MCP\"|\"GOOGLE_HEALTH\"|\"STRAVA\"|\"EXTERNAL\"|\"HEALTH_CONNECT\"" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "externalRecordingId" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "recordedAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "samplingFrequency" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "expected": "number", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "sampleCount" + ], + "message": "Invalid input: expected number, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "createdAt" + ], + "message": "Invalid input: expected string, received undefined" + }, + { + "expected": "string", + "code": "invalid_type", + "path": [ + "ecgRecordings", + 0, + "updatedAt" + ], + "message": "Invalid input: expected string, received undefined" + } + ] +} diff --git a/tests/integration/__golden__/backup-parity/seeded-account.json b/tests/integration/__golden__/backup-parity/seeded-account.json new file mode 100644 index 000000000..5400005db --- /dev/null +++ b/tests/integration/__golden__/backup-parity/seeded-account.json @@ -0,0 +1,2094 @@ +{ + "unfillable": [ + "AppSettings.pulseDayMeanMethod" + ], + "snapshot": { + "Measurement": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "BLOOD_GLUCOSE", + "value": 5.4, + "valueMin": null, + "valueMax": null, + "unit": "mmol/L", + "source": "MANUAL", + "measuredAt": "2026-07-03T06:45:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": "FASTING", + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "IRREGULAR_RHYTHM_NOTIFICATION", + "value": 1, + "valueMin": 2.5, + "valueMax": 2.5, + "unit": "event", + "source": "WITHINGS", + "measuredAt": "2026-06-15T14:22:00.000Z", + "notes": "rt-Measurement-notes", + "notesEncrypted": "", + "externalId": null, + "externalSourceVersion": "rt-Measurement-externalSourceVersion", + "aggregationProvenance": "HEALTHKIT_STATISTICS", + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": "IRREGULAR", + "deviceType": "rt-Measurement-deviceType", + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "PULSE", + "value": 61, + "valueMin": null, + "valueMax": null, + "unit": "bpm", + "source": "APPLE_HEALTH", + "measuredAt": "2026-07-02T06:30:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deleted-sample", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 4, + "deletedAt": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "SLEEP_DURATION", + "value": 95, + "valueMin": null, + "valueMax": null, + "unit": "min", + "source": "APPLE_HEALTH", + "measuredAt": "2026-07-03T02:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": "round-trip-deep-sleep", + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": "DEEP", + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "type": "WEIGHT", + "value": 74.2, + "valueMin": null, + "valueMax": null, + "unit": "kg", + "source": "MANUAL", + "measuredAt": "2026-07-01T07:00:00.000Z", + "notes": null, + "notesEncrypted": null, + "externalId": null, + "externalSourceVersion": null, + "aggregationProvenance": null, + "glucoseContext": null, + "sleepStage": null, + "rhythmClassification": null, + "deviceType": null, + "syncVersion": 1, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "IntradayCumulativeProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "type": "ACTIVITY_STEPS", + "dateKey": "2026-07-01", + "hourlyCumulative": [ + 0, + 350, + 700, + 1050, + 1400, + 1750, + 2100, + 2450, + 2800, + 3150, + 3500, + 3850, + 4200, + 4550, + 4900, + 5250, + 5600, + 5950, + 6300, + 6650, + 7000, + 7350, + 7700, + 8050 + ], + "dayTotal": 8050, + "sampleCount": 24, + "hourlyIncrements": [ + -1, + -1, + -1, + -1, + -1, + -1, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350, + 350 + ], + "basis": "HOUR_BUCKETS", + "bucketCount": 3, + "timezone": "Europe/Berlin", + "createdAt": "", + "updatedAt": "" + } + ], + "Medication": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip tablet", + "dose": "5 mg", + "treatmentClass": "GLP1", + "dosesPerUnit": 3, + "unitsPerDose": "decimal:2.5", + "active": false, + "notificationsEnabled": false, + "pausedAt": "2026-06-30T12:34:56.789Z", + "snoozedUntil": "2026-06-30T12:34:56.789Z", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "oneShot": true, + "asNeeded": true, + "trackIntake": false, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-06-30T12:34:56.789Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "rt-Medication-atcCode", + "rxNormCode": "rt-Medication-rxNormCode", + "lowStockNotifiedAt": "2026-06-30T12:34:56.789Z", + "lowStockNotifiedThresholdDays": 3, + "reorderLeadDays": 3, + "externalSource": "WEB", + "externalId": "rt-Medication-externalId", + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationSchedule": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09:00", + "label": "Morning", + "dose": "rt-MedicationSchedule-dose", + "unitsPerDose": "decimal:2.5", + "daysOfWeek": "rt-MedicationSchedule-daysOfWeek", + "timesOfDay": [ + "rt-MedicationSchedule-timesOfDay" + ], + "reminderGraceMinutes": 3, + "rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": 3, + "cyclicOffWeeks": 3, + "doseWindows": { + "roundTrip": "rt-MedicationSchedule-doseWindows" + } + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "21:00", + "label": "Every third evening", + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "MedicationIntakeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "scheduledFor": "2026-07-01T08:00:00.000Z", + "takenAt": "2026-07-01T08:04:00.000Z", + "skipped": true, + "autoMissed": true, + "autoRecorded": true, + "attributionSource": "USER_PIN", + "source": "API", + "idempotencyKey": "rt-MedicationIntakeEvent-idempotencyKey", + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": "rt-MedicationIntakeEvent-doseTaken", + "inventoryConsumption": { + "roundTrip": "rt-MedicationIntakeEvent-inventoryConsumption" + }, + "externalId": "rt-MedicationIntakeEvent-externalId", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null + } + ], + "MedicationSideEffect": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "occurredAt": "2026-07-01T21:00:00.000Z", + "category": "GI", + "entry": "NAUSEA", + "severity": 3, + "notes": "rt-MedicationSideEffect-notes", + "notesEncrypted": "", + "createdAt": "" + } + ], + "MedicationPauseEra": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-05-02T08:00:00.000Z", + "resumedAt": "2026-05-20T08:00:00.000Z", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "pausedAt": "2026-07-15T08:00:00.000Z", + "resumedAt": null, + "createdAt": "" + } + ], + "MedicationDoseChange": [ + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-04-01T08:00:00.000Z", + "doseValue": 5, + "doseUnit": "mg", + "note": "rt-MedicationDoseChange-note", + "noteEncrypted": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "effectiveFrom": "2026-06-01T08:00:00.000Z", + "doseValue": 10, + "doseUnit": "mg", + "note": null, + "noteEncrypted": null, + "createdAt": "" + } + ], + "MedicationCategoryAssignment": [ + { + "medicationId": "", + "category": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "updatedAt": "" + } + ], + "MedicationCategoryLabel": [ + { + "id": "", + "userId": "round-trip-owner", + "key": "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10", + "labelEncrypted": "", + "sortOrder": 2, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationCourse": [ + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-03-01T00:00:00.000Z", + "endsOn": "2026-03-07T00:00:00.000Z", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "round-trip-owner", + "startsOn": "2026-06-10T00:00:00.000Z", + "endsOn": "2026-06-16T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationIngredient": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "LABEL_AI", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "mood": "GUT", + "score": 4, + "moodA1": 3, + "stressA2": 3, + "energyA3": 3, + "connectionA4": 3, + "stabilityA5": 3, + "tags": "[\"round-trip-tag\"]", + "note": "rt-MoodEntry-note", + "noteEncrypted": "", + "source": "rt-MoodEntry-source", + "externalId": "rt-MoodEntry-externalId", + "moodLoggedAt": "2026-07-01T20:00:00.000Z", + "tz": "rt-MoodEntry-tz", + "syncedAt": "", + "createdAt": "", + "updatedAt": "", + "syncVersion": 3, + "deletedAt": null + } + ], + "MoodContext": [ + { + "moodEntryId": "", + "userId": "round-trip-owner", + "workStatus": "regular", + "workMinutes": 3, + "overtimeMinutes": 3, + "workLoad": 3, + "workSatisfaction": 3, + "contactCircles": "[\"family\"]", + "contactForm": "rt-MoodContext-contactForm", + "contactExtent": "rt-MoodContext-contactExtent", + "contactQuality": 3, + "contactSupport": 3, + "leisureCategories": "rt-MoodContext-leisureCategories", + "leisureMinutes": 3, + "leisureJoy": 6, + "leisureRecovery": 3, + "eventType": "rt-MoodContext-eventType", + "eventValence": 3, + "eventAt": "2026-06-30T12:34:56.789Z", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "MoodEntryTagLink": [ + { + "moodEntryId": "", + "moodTagId": "", + "createdAt": "", + "rating": 4 + } + ], + "MoodTag": [ + { + "id": "", + "categoryId": "", + "key": "round_trip_factor", + "labelKey": "mood.tag.roundTripFactor", + "icon": "rt-MoodTag-icon", + "sortOrder": 3, + "isActive": false, + "kind": "RATED", + "scaleMin": 3, + "scaleMax": 3, + "inverse": true, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "LabResult": [ + { + "id": "", + "userId": "round-trip-owner", + "panel": "rt-LabResult-panel", + "analyte": "Ferritin", + "value": 91, + "valueText": "rt-LabResult-valueText", + "unit": "ng/mL", + "referenceLow": 2.5, + "referenceHigh": 2.5, + "sourceReferenceLow": 2.5, + "sourceReferenceHigh": 2.5, + "sourceReferenceText": "rt-LabResult-sourceReferenceText", + "sourceValue": 2.5, + "sourceUnit": "rt-LabResult-sourceUnit", + "takenAt": "2026-06-30T09:00:00.000Z", + "biomarkerId": "", + "source": "rt-LabResult-source", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Biomarker": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Ferritin", + "unit": "ng/mL", + "lowerBound": 2.5, + "upperBound": 2.5, + "contextEncrypted": "", + "panel": "rt-Biomarker-panel", + "hidden": true, + "analyteKey": "rt-Biomarker-analyteKey", + "createdAt": "", + "updatedAt": "" + } + ], + "Allergy": [ + { + "id": "", + "userId": "round-trip-owner", + "substance": "Penicillin", + "category": "FOOD", + "type": "INTOLERANCE", + "severity": "MILD", + "status": "INACTIVE", + "onsetAt": "2026-06-30T12:34:56.789Z", + "reactionEncrypted": "", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "FamilyHistoryEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "relationship": "MOTHER", + "condition": "Type 2 diabetes", + "ageAtOnset": 3, + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessEpisode": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Cold", + "type": "INFECTION", + "lifecycle": "CHRONIC_ONGOING", + "onsetAt": "2026-06-20T00:00:00.000Z", + "resolvedAt": "2026-06-30T12:34:56.789Z", + "parentConditionId": null, + "noteEncrypted": "", + "bodySiteEncrypted": null, + "laterality": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "label": "Iron deficiency", + "type": "CHRONIC", + "lifecycle": "ACUTE", + "onsetAt": "2026-03-01T00:00:00.000Z", + "resolvedAt": null, + "parentConditionId": null, + "noteEncrypted": null, + "bodySiteEncrypted": "", + "laterality": "BOTH", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "episodeId": "", + "date": "2026-06-21", + "functionalImpact": 3, + "feverC": 2.5, + "noteEncrypted": "", + "tz": "rt-IllnessDayLog-tz", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "IllnessSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 2, + "createdAt": "" + } + ], + "SymptomDefinition": [ + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Zap", + "sortOrder": 0, + "isActive": true, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "labelEncrypted": "", + "icon": "Brain", + "sortOrder": 1, + "isActive": false, + "createdAt": "", + "updatedAt": "" + } + ], + "SymptomEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T09:00:00.000Z", + "intensity": 4, + "noteEncrypted": null, + "episodeId": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-06-21T11:00:00.000Z", + "intensity": 8, + "noteEncrypted": "", + "episodeId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "definitionId": "", + "occurredAt": "2026-07-10T18:30:00.000Z", + "intensity": 2, + "noteEncrypted": null, + "episodeId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "LifeEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "category": "HOME", + "startDate": "2023-09-01", + "endDate": null, + "precision": "MONTH", + "titleEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "category": "WORK", + "startDate": "2026-03-02", + "endDate": "2026-05-29", + "precision": "DAY", + "titleEncrypted": "", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "UserHealthProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "aboutMeEncrypted": "", + "conditionsEncrypted": "", + "allergiesEncrypted": "", + "coachFocusEncrypted": "", + "pendingQuestionsEncrypted": "", + "aiIncludedSections": [ + "ABOUT_ME" + ], + "emergencyBloodType": "A_POS", + "organDonorStatus": "YES", + "advanceDirectiveStatus": "EXISTS", + "emergencyContactsEncrypted": "", + "emergencyImplantsEncrypted": "", + "emergencyNoteEncrypted": "", + "lifeConfirmedJson": { + "roundTrip": "rt-UserHealthProfile-lifeConfirmedJson" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthProfileFactRevision": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "SMOKING_STATUS", + "valueEncrypted": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-06-30T12:34:56.789Z", + "provenance": "USER_CORRECTION", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "CycleProfile": [ + { + "id": "", + "userId": "round-trip-owner", + "goal": "AVOID_PREGNANCY", + "cycleTrackingEnabled": true, + "typicalCycleLength": 3, + "typicalPeriodLength": 3, + "lutealPhaseLength": 3, + "secondarySymptom": "CERVIX", + "predictionEnabled": false, + "rawChartMode": true, + "discreetNotifications": true, + "sensitiveCategoryEncryption": false, + "createdAt": "", + "updatedAt": "" + } + ], + "MenstrualCycle": [ + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-01", + "endDate": "rt-MenstrualCycle-endDate", + "periodEndDate": "rt-MenstrualCycle-periodEndDate", + "lengthDays": 3, + "ovulationDate": "rt-MenstrualCycle-ovulationDate", + "ovulationConfirmed": true, + "isPredicted": true, + "tz": "rt-MenstrualCycle-tz", + "syncVersion": 3, + "deletedAt": null, + "absorbedIntoId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-03", + "endDate": null, + "periodEndDate": null, + "lengthDays": null, + "ovulationDate": null, + "ovulationConfirmed": false, + "isPredicted": false, + "tz": null, + "syncVersion": 0, + "deletedAt": "2026-06-04T07:00:00.000Z", + "absorbedIntoId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "CycleDayLog": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-02", + "cycleId": "", + "flow": "HEAVY", + "intermenstrualBleeding": true, + "basalBodyTempC": 2.5, + "temperatureExcluded": true, + "ovulationTest": "NEGATIVE", + "cervicalMucus": "DRY", + "cervixPosition": "LOW", + "cervixFirmness": "FIRM", + "cervixOpening": "CLOSED", + "sexualActivity": true, + "protectedSex": true, + "pregnancyTest": "NEGATIVE", + "progesteroneTest": "NEGATIVE", + "contraceptive": "NONE", + "sensitiveEncrypted": "", + "notesEncrypted": "", + "source": "WITHINGS", + "externalId": "rt-CycleDayLog-externalId", + "tz": "rt-CycleDayLog-tz", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "CycleSymptom": [ + { + "id": "", + "categoryId": "csc_physical", + "key": "custom:round-trip-cramps", + "labelKey": "cycle.symptom.custom", + "icon": "rt-CycleSymptom-icon", + "sortOrder": 3, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "CycleSymptomLink": [ + { + "dayLogId": "", + "symptomId": "", + "severity": 3, + "createdAt": "" + } + ], + "CustomMetric": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Grip strength", + "unit": "kg", + "targetLow": 2.5, + "targetHigh": 2.5, + "decimals": 3, + "description": "rt-CustomMetric-description", + "correlationEnabled": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CustomMetricEntry": [ + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 44, + "unit": "kg", + "measuredAt": "2026-07-01T18:00:00.000Z", + "note": "left hand, after the long ride", + "noteEncrypted": null, + "createdAt": "", + "deletedAt": null + }, + { + "id": "", + "userId": "round-trip-owner", + "customMetricId": "", + "value": 45, + "unit": "kg", + "measuredAt": "2026-07-02T18:00:00.000Z", + "note": null, + "noteEncrypted": "", + "createdAt": "", + "deletedAt": null + } + ], + "CorrelationPattern": [ + { + "id": "", + "userId": "round-trip-owner", + "canonicalKey": "p1:a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", + "family": "sleep", + "factorKey": "sleep_duration", + "outcomeKey": "weight", + "lagDays": 1, + "sampleSize": 30, + "effectSize": 0.42, + "pValue": 0.01, + "qValue": 0.04, + "evidenceHash": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", + "isCurrent": false, + "lastComputedAt": "2026-07-01T00:00:00.000Z", + "dismissedAt": "2026-06-30T12:34:56.789Z", + "dismissedEvidenceHash": "abababababababababababababababababababababababababababababababab", + "dismissedEffectSize": 2.5, + "dismissedSampleSize": 3, + "createdAt": "", + "updatedAt": "" + } + ], + "HealthScoreRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "dayKey": "2026-07-01", + "timezone": "Europe/Berlin", + "composite": 71, + "band": "green", + "scoreVersion": 1, + "composition": [ + "activity", + "sleep" + ], + "pillarScores": { + "sleep": 72, + "activity": 70 + }, + "inputFingerprint": "c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", + "configVersion": 3, + "configChangedAt": "2026-06-30T12:34:56.789Z", + "computedAt": "", + "createdAt": "" + } + ], + "Workout": [ + { + "id": "", + "userId": "round-trip-owner", + "sportType": "RUNNING", + "startedAt": "2026-06-29T06:00:00.000Z", + "endedAt": "2026-06-29T06:30:00.000Z", + "durationSec": 1800, + "totalEnergyKcal": 2.5, + "totalDistanceM": 2.5, + "avgHeartRate": 3, + "maxHeartRate": 3, + "minHeartRate": 3, + "stepCount": 3, + "elevationM": 2.5, + "pauseDurationSec": 3, + "source": "WITHINGS", + "externalId": "rt-Workout-externalId", + "externalSourceVersion": "rt-Workout-externalSourceVersion", + "metadata": { + "roundTrip": "rt-Workout-metadata" + }, + "createdAt": "", + "updatedAt": "" + } + ], + "NutrientIntakeDay": [ + { + "userId": "round-trip-owner", + "day": "2026-07-01", + "nutrient": "WATER", + "amount": 2100, + "unit": "ml", + "source": "MANUAL", + "externalSourceVersion": "rt-NutrientIntakeDay-externalSourceVersion", + "createdAt": "", + "updatedAt": "" + } + ], + "InboundDocument": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "LAB_RESULT", + "title": "June labs", + "filename": "june-labs.pdf", + "mimeType": "application/pdf", + "byteSize": 57, + "contentEncrypted": "", + "contentSha256": "0a738470f0945033965858e9895ee721ce981a25f013514d587d0a7a1946be7a", + "contentCodec": "binary2", + "status": "EXTRACTING", + "providerType": "rt-InboundDocument-providerType", + "reportDate": "2026-06-30T12:34:56.789Z", + "documentDate": "2026-06-30T12:34:56.789Z", + "errorReason": "rt-InboundDocument-errorReason", + "summaryEncrypted": "", + "summaryGeneratedAt": "2026-06-30T12:34:56.789Z", + "summaryState": "PENDING", + "lastIndexAttemptAt": "2026-06-30T12:34:56.789Z", + "lastIndexOutcome": "rt-InboundDocument-lastIndexOutcome", + "sourceSystem": "PAPERLESS", + "sourceId": "4711", + "sourceInstance": "https://paperless.example.test", + "aiReadDeferred": true, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Practitioner": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip practice", + "specialty": "Internal medicine", + "practice": "rt-Practitioner-practice", + "location": "rt-Practitioner-location", + "phone": "rt-Practitioner-phone", + "locationEncrypted": "", + "phoneEncrypted": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "Encounter": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-06-30T08:00:00.000Z", + "status": "PLANNED", + "kind": "ROUTINE", + "practitionerId": "", + "reasonEncrypted": "", + "outcomeEncrypted": "", + "bodySiteEncrypted": "", + "laterality": "LEFT", + "reminderId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "EncounterDocumentLink": [ + { + "id": "", + "encounterId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterLabLink": [ + { + "id": "", + "encounterId": "", + "labResultId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterConditionLink": [ + { + "id": "", + "encounterId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "VaccinationRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "occurredAt": "2026-05-14T00:00:00.000Z", + "antigenSlug": "tdap", + "vaccineName": "Tetanus, diphtheria and pertussis", + "doseNumber": 3, + "seriesDoses": 3, + "lotNumber": "RT-4471", + "site": "LEFT_ARM", + "practitionerId": "", + "encounterId": "", + "reminderId": "", + "customVaccineId": "", + "noteEncrypted": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "VaccinationDocumentLink": [ + { + "id": "", + "vaccinationId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "CustomVaccine": [ + { + "id": "", + "userId": "round-trip-owner", + "name": "Round-trip travel combo", + "components": [ + "typhoid", + "hepatitis-a" + ], + "typicalSeriesDoses": 2, + "boosterIntervalMonths": 36, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MeasurementReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "label": "Blutdruck messen", + "measurementType": "BLOOD_PRESSURE_SYS", + "intervalDays": 7, + "rrule": "rt-MeasurementReminder-rrule", + "anchorDate": "2026-06-30T12:34:56.789Z", + "endsOn": "2026-06-30T12:34:56.789Z", + "origin": "COACH", + "notifyHour": 8, + "location": "Zuhause", + "nextDueAt": "2026-07-08T06:00:00.000Z", + "lastSatisfiedAt": "2026-07-01T06:05:00.000Z", + "enabled": false, + "vaccinationAntigen": "tetanus", + "snoozedUntil": "2026-07-08T06:00:00.000Z", + "lastSkippedAt": "2026-06-24T06:00:00.000Z", + "skipCount": 2, + "lastNotifiedAt": null, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MeasurementReminderEvent": [ + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SATISFIED", + "occurredAt": "2026-07-01T06:05:00.000Z", + "onTime": true, + "source": "manual", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "reminderId": "", + "kind": "SKIPPED", + "occurredAt": "2026-06-24T06:00:00.000Z", + "onTime": false, + "source": "skip", + "createdAt": "" + } + ], + "CoachConversation": [ + { + "id": "", + "userId": "round-trip-owner", + "title": "How is my blood pressure trending?", + "titleEncrypted": null, + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": "", + "summaryUpdatedAt": "2026-07-20T10:00:00.000Z", + "summaryTurnCount": 4, + "documentScoped": false + }, + { + "id": "", + "userId": "round-trip-owner", + "title": null, + "titleEncrypted": "", + "createdAt": "", + "updatedAt": "", + "summaryEncrypted": null, + "summaryUpdatedAt": null, + "summaryTurnCount": 0, + "documentScoped": true + } + ], + "CoachMessage": [ + { + "id": "", + "conversationId": "", + "role": "assistant", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": "anthropic", + "promptVersion": null, + "tokensUsed": 812, + "model": "claude-opus-5", + "resultsEncrypted": "", + "trailEncrypted": "", + "createdAt": "2026-07-20T09:59:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": "rt-CoachMessage-metricSourceJson", + "providerType": null, + "promptVersion": "rt-CoachMessage-promptVersion", + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-20T09:58:00.000Z" + }, + { + "id": "", + "conversationId": "", + "role": "user", + "encryptedContent": "", + "metricSourceJson": null, + "providerType": null, + "promptVersion": null, + "tokensUsed": null, + "model": null, + "resultsEncrypted": null, + "trailEncrypted": null, + "createdAt": "2026-07-21T08:00:00.000Z" + } + ], + "CoachConversationDocument": [ + { + "conversationId": "", + "documentId": "", + "addedAt": "2026-07-21T07:59:00.000Z" + } + ], + "CoachFact": [ + { + "id": "", + "userId": "round-trip-owner", + "factEncrypted": "", + "category": "constraint", + "confidence": 80, + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null, + "source": "user", + "lastUsedAt": "2026-07-20T10:00:00.000Z", + "sourceMessageId": "" + } + ], + "CoachPlan": [ + { + "id": "", + "userId": "round-trip-owner", + "metric": "BLOOD_PRESSURE", + "ifCueEncrypted": "", + "thenActionEncrypted": "", + "targetEncrypted": "", + "status": "active", + "reviewDate": "2026-10-01T00:00:00.000Z", + "outcomeEncrypted": "", + "sourceConversationId": "", + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "CoachReminder": [ + { + "id": "", + "userId": "round-trip-owner", + "noteEncrypted": "", + "metric": "BLOOD_PRESSURE", + "relatedPlanId": "", + "triggerKind": "rt-CoachReminder-triggerKind", + "dueAt": "2026-09-01T07:00:00.000Z", + "contextCue": "rt-CoachReminder-contextCue", + "status": "rt-CoachReminder-status", + "source": "extractor", + "sourceConversationId": "", + "lastSurfacedAt": "2026-06-30T12:34:56.789Z", + "surfaceCount": 2, + "createdAt": "", + "updatedAt": "", + "deletedAt": null + } + ], + "MedicationInventoryItem": [ + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "ACTIVE", + "containerType": "BLISTER", + "unitsTotal": "decimal:30", + "unitsRemaining": "decimal:21", + "firstUseAt": "2026-07-01T08:00:00.000Z", + "expiresAt": "2027-01-31T00:00:00.000Z", + "printedExpiry": "2026-06-30T12:34:56.789Z", + "purchasedAt": "2026-06-30T12:34:56.789Z", + "manufacturer": "Fixture Pharma", + "doseStrength": "10 mg", + "notes": "rt-MedicationInventoryItem-notes", + "notesEncrypted": "", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "medicationId": "", + "state": "USED_UP", + "containerType": "BOTTLE", + "unitsTotal": "decimal:60", + "unitsRemaining": "decimal:0", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": null, + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationInventoryEvent": [ + { + "id": "", + "medicationId": "", + "delta": -8, + "reason": "consumed", + "occurredAt": "2026-07-09T07:00:00.000Z" + }, + { + "id": "", + "medicationId": "", + "delta": 30, + "reason": "purchased", + "occurredAt": "2026-07-01T07:00:00.000Z" + } + ], + "MoodTagCategory": [ + { + "id": "", + "key": "round_trip_own_category", + "labelKey": "mood.category.roundTripOwn", + "icon": "rt-MoodTagCategory-icon", + "sortOrder": 90, + "isActive": false, + "userId": "round-trip-owner", + "labelEncrypted": "" + } + ], + "MoodTagHidden": [ + { + "userId": "round-trip-owner", + "moodTagId": "mt_grateful", + "createdAt": "" + } + ], + "ReminderPhaseConfig": [ + { + "id": "", + "medicationId": "", + "greenValue": 45, + "greenMode": "PERCENT", + "yellowValue": 20, + "yellowMode": "PERCENT", + "orangeValue": 5, + "orangeMode": "PERCENT", + "redValue": 180, + "redMode": "PERCENT" + } + ], + "MentalHealthAssessment": [ + { + "id": "", + "userId": "round-trip-owner", + "instrument": "PHQ9", + "locale": "de", + "version": "rt-MentalHealthAssessment-version", + "responsesEncrypted": "", + "totalScore": 14, + "severityBand": "moderate", + "item9Flagged": true, + "crisisShownAt": "2026-07-05T18:02:00.000Z", + "takenAt": "2026-07-05T18:00:00.000Z", + "tz": "Europe/Berlin", + "source": "rt-MentalHealthAssessment-source", + "externalId": "rt-MentalHealthAssessment-externalId", + "syncVersion": 3, + "deletedAt": null, + "createdAt": "", + "updatedAt": "" + } + ], + "ConsentReceipt": [ + { + "id": "", + "userId": "round-trip-owner", + "kind": "ai-processing", + "artefact": "JVBERi0xLjQKJWZpeHR1cmU=", + "signedAt": "2026-06-01T09:00:00.000Z", + "revokedAt": null, + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "kind": "research-sharing", + "artefact": "eyJhbGciOiJub25lIn0.e30.", + "signedAt": "2026-06-02T09:00:00.000Z", + "revokedAt": "2026-07-10T11:00:00.000Z", + "createdAt": "" + } + ], + "DocumentConditionLink": [ + { + "id": "", + "documentId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "2026-07-02T09:00:00.000Z" + } + ], + "ExtractedFact": [ + { + "id": "", + "documentId": "", + "userId": "round-trip-owner", + "factType": "OBSERVATION", + "status": "APPROVED", + "confidence": 0.94, + "needsReview": false, + "dataEncrypted": "", + "provenanceEncrypted": "", + "committedRecordId": "", + "committedRecordType": "labResult", + "createdAt": "", + "updatedAt": "" + } + ], + "PersonalRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_10km_time", + "direction": "MIN", + "value": 3184, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-10km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WALKING_RUNNING_DISTANCE", + "metricSlot": "running_5km_time", + "direction": "MIN", + "value": 1512, + "unit": "s", + "achievedAt": "2026-05-18T09:20:00.000Z", + "sourceMeasurementId": null, + "source": "APPLE_HEALTH", + "externalId": "workout-pr-5km", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "metricType": "WEIGHT", + "metricSlot": null, + "direction": "MIN", + "value": 74.2, + "unit": "kg", + "achievedAt": "2026-07-01T07:00:00.000Z", + "sourceMeasurementId": "", + "source": "MANUAL", + "externalId": null, + "createdAt": "" + } + ], + "UserAchievement": [ + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "intake-total-10", + "unlockedAt": "2026-02-21T10:15:00.000Z", + "createdAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "achievementId": "retired-badge-from-an-older-release", + "unlockedAt": "2025-11-05T08:00:00.000Z", + "createdAt": "" + } + ], + "EnvironmentContext": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "locationEncrypted": "", + "source": "TRAVEL", + "tempMin": 19.4, + "tempMax": 28.1, + "tempMean": 23.6, + "apparentMean": 25.2, + "sunshineSec": 39600, + "daylightSec": 52800, + "precipSum": 0, + "pressureMean": 1016.4, + "pressureDelta": 3.2, + "humidityMean": 63, + "cloudMean": 12, + "weatherCode": 1, + "apparentMax": 2.5, + "pm25Mean": 2.5, + "pm25Max": 2.5, + "pm10Mean": 2.5, + "no2Mean": 2.5, + "so2Mean": 2.5, + "coMean": 2.5, + "o3Max8h": 2.5, + "eaqiMax": 2.5, + "usaqiMax": 2.5, + "uvIndexMax": 2.5, + "dustMax": 2.5, + "aodMax": 2.5, + "pollenAlderMax": 2.5, + "pollenBirchMax": 2.5, + "pollenGrassMax": 2.5, + "pollenMugwortMax": 2.5, + "pollenOliveMax": 2.5, + "pollenRagweedMax": 2.5, + "aqDomain": "rt-EnvironmentContext-aqDomain", + "aqHours": 3, + "aqFetchedAt": "2026-06-30T12:34:56.789Z", + "fetchedAt": "2026-06-16T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-07-01", + "locationEncrypted": "", + "source": "HOME", + "tempMin": 13.1, + "tempMax": 22.7, + "tempMean": 17.9, + "apparentMean": 17.1, + "sunshineSec": 28800, + "daylightSec": 59400, + "precipSum": 4.6, + "pressureMean": 1008.9, + "pressureDelta": 7.8, + "humidityMean": 74, + "cloudMean": 68, + "weatherCode": 61, + "apparentMax": null, + "pm25Mean": null, + "pm25Max": null, + "pm10Mean": null, + "no2Mean": null, + "so2Mean": null, + "coMean": null, + "o3Max8h": null, + "eaqiMax": null, + "usaqiMax": null, + "uvIndexMax": null, + "dustMax": null, + "aodMax": null, + "pollenAlderMax": null, + "pollenBirchMax": null, + "pollenGrassMax": null, + "pollenMugwortMax": null, + "pollenOliveMax": null, + "pollenRagweedMax": null, + "aqDomain": null, + "aqHours": null, + "aqFetchedAt": null, + "fetchedAt": "2026-07-02T03:15:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "EnvironmentTravelLocation": [ + { + "id": "", + "userId": "round-trip-owner", + "startDate": "2026-06-10", + "endDate": "2026-06-20", + "locationEncrypted": "", + "createdAt": "", + "updatedAt": "" + } + ], + "DawarichDay": [ + { + "id": "", + "userId": "round-trip-owner", + "date": "2026-06-15", + "totalDistanceM": 48300, + "drivingDistanceM": 12000, + "trainDistanceM": 30500, + "placesVisited": 4, + "awayFromHomeMinutes": 1440, + "countryCodeEncrypted": "", + "isTravelDay": true, + "fetchedAt": "2026-06-16T03:20:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "MedicationScheduleRevision": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-01-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "5 mg", + "windowEnd": "09:00", + "windowStart": "07:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-02-01T00:00:00.000Z", + "validUntil": "2026-03-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "13:00", + "windowStart": "12:00" + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": "", + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-03-01T00:00:00.000Z", + "validUntil": "2026-05-01T00:00:00.000Z", + "payload": [ + { + "dose": "10 mg", + "windowEnd": "10:00", + "windowStart": "08:00" + } + ], + "source": "MANUAL", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "MedicationEfficacyTarget": [ + { + "id": "", + "medicationId": "", + "measurementType": "WEIGHT", + "biomarkerId": "", + "primary": false, + "createdAt": "", + "updatedAt": "" + } + ], + "EcgRecording": [ + { + "id": "", + "userId": "round-trip-owner", + "source": "MANUAL", + "externalRecordingId": "round-trip-signal-1", + "recordedAt": "2026-06-15T14:22:00.000Z", + "waveformEncrypted": "", + "samplingFrequency": 300, + "sampleCount": 8, + "durationSeconds": 0.02666666666666667, + "lead": "I", + "averageHeartRate": 88, + "rhythmClassification": "IRREGULAR", + "measurementId": "", + "createdAt": "", + "updatedAt": "" + } + ], + "OnboardingRecord": [ + { + "id": "", + "userId": "round-trip-owner", + "needsJson": { + "areas": [ + "blood-pressure", + "sleep" + ], + "units": { + "glucoseUnit": "mmol/L", + "unitPreference": "metric" + }, + "visit": "within-a-month", + "sources": [ + "withings" + ], + "medication": "yes", + "recordTarget": "me" + }, + "stepsJson": [ + { + "id": "who", + "status": "done" + }, + { + "id": "areas", + "status": "done" + }, + { + "id": "sources", + "status": "skipped" + } + ], + "firstResultJson": { + "task": "connect-source", + "target": "withings", + "completedAt": "2026-07-01T08:30:00.000Z" + }, + "modulesDerivedAt": "2026-07-01T08:00:00.000Z", + "completedAt": "2026-07-01T08:00:00.000Z", + "createdAt": "", + "updatedAt": "" + } + ], + "BiomarkerAlias": [ + { + "id": "", + "userId": "round-trip-owner", + "biomarkerId": "", + "name": "Ferr.", + "nameFolded": "ferr.", + "source": "IMPORT_CHOICE", + "createdAt": "" + } + ], + "BiomarkerMerge": [ + { + "id": "", + "userId": "round-trip-owner", + "targetBiomarkerId": "", + "sourceBiomarkerId": "merged-away-marker", + "sourceName": "Ferritin (Serum)", + "readingCount": 3, + "mergedAt": "" + } + ], + "LabResultDocumentLink": [ + { + "id": "", + "labResultId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterMedicationLink": [ + { + "id": "", + "encounterId": "", + "medicationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "EncounterVaccinationLink": [ + { + "id": "", + "encounterId": "", + "vaccinationId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "MedicationDocumentLink": [ + { + "id": "", + "medicationId": "", + "documentId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "MedicationConditionLink": [ + { + "id": "", + "medicationId": "", + "episodeId": "", + "userId": "round-trip-owner", + "createdAt": "" + } + ], + "AccountGrant": [ + { + "id": "", + "grantorId": "round-trip-owner", + "granteeId": "parity-delegate", + "access": "WRITE", + "scopeJson": { + "sections": [ + "measurements" + ] + }, + "invitedAt": "", + "acceptedAt": "2026-07-02T09:00:00.000Z", + "revokedAt": null, + "revokedBy": null, + "expiresAt": null, + "lastUsedAt": null, + "createdAt": "" + } + ], + "User": { + "id": "round-trip-owner", + "username": "round-trip-owner", + "email": "round-trip-owner@example.test", + "passwordHash": "rt-User-passwordHash", + "role": "USER", + "oidcIssuer": "rt-User-oidcIssuer", + "oidcSub": "rt-User-oidcSub", + "createdAt": "2026-06-30T12:34:56.789Z", + "updatedAt": "", + "managedProfileAt": "2026-06-30T12:34:56.789Z", + "heightCm": 2.5, + "dateOfBirth": "2026-06-30T12:34:56.789Z", + "gender": "FEMALE", + "timezone": "America/Chicago", + "homeTimezone": "Asia/Tokyo", + "homeSince": "2026-06-30T12:34:56.789Z", + "homeLocationEncrypted": "", + "environmentAirQualityEnabled": false, + "environmentAqHistoryJson": { + "roundTrip": "rt-User-environmentAqHistoryJson" + }, + "codexAccessTokenEncrypted": "", + "codexRefreshTokenEncrypted": "", + "codexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "codexConnectedAt": "2026-06-30T12:34:56.789Z", + "codexConnectionStatus": "rt-User-codexConnectionStatus", + "useCentralCodex": true, + "insightsPrivacyMode": "raw", + "insightsCachedAt": "2026-06-30T12:34:56.789Z", + "insightsCachedTextEncrypted": "", + "insightsCachedLocale": "rt-User-insightsCachedLocale", + "insightsSnapshotHash": "rt-User-insightsSnapshotHash", + "insightsWarmFailedAt": "2026-06-30T12:34:56.789Z", + "insightsBriefingRerollDate": "rt-User-insightsBriefingRerollDate", + "morningDigestRefreshedOn": "rt-User-morningDigestRefreshedOn", + "insightsExcludeMetrics": [ + "rt-User-insightsExcludeMetrics" + ], + "globalExcludedInjectionSites": [ + "THIGH_LEFT" + ], + "telegramBotToken": "rt-User-telegramBotToken", + "telegramChatId": "rt-User-telegramChatId", + "telegramEnabled": true, + "withingsClientIdEncrypted": "", + "withingsClientSecretEncrypted": "", + "whoopClientIdEncrypted": "", + "whoopClientSecretEncrypted": "", + "fitbitClientIdEncrypted": "", + "fitbitClientSecretEncrypted": "", + "googleHealthClientIdEncrypted": "", + "googleHealthClientSecretEncrypted": "", + "nightscoutUrlEncrypted": "", + "nightscoutTokenEncrypted": "", + "nightscoutAllowPrivateHost": true, + "dawarichUrlEncrypted": "", + "dawarichApiKeyEncrypted": "", + "dawarichPrefsEncrypted": "", + "dawarichAllowPrivateHost": true, + "polarAccessTokenEncrypted": "", + "polarUserIdEncrypted": "", + "polarClientIdEncrypted": "", + "polarClientSecretEncrypted": "", + "ouraAccessTokenEncrypted": "", + "ouraRefreshTokenEncrypted": "", + "ouraClientIdEncrypted": "", + "ouraClientSecretEncrypted": "", + "ouraScopeDenied": { + "roundTrip": "rt-User-ouraScopeDenied" + }, + "ouraBackfillProgress": { + "roundTrip": "rt-User-ouraBackfillProgress" + }, + "ouraBackfillCompletedAt": "2026-06-30T12:34:56.789Z", + "ouraUserId": "rt-User-ouraUserId", + "clientAppSharedBy": { + "roundTrip": "rt-User-clientAppSharedBy" + }, + "stravaClientIdEncrypted": "", + "stravaClientSecretEncrypted": "", + "stravaAccessTokenEncrypted": "", + "stravaRefreshTokenEncrypted": "", + "stravaAthleteId": "rt-User-stravaAthleteId", + "stravaLastActivityAt": "2026-06-30T12:34:56.789Z", + "stravaBackfillCompletedAt": "2026-06-30T12:34:56.789Z", + "stravaBackfillResumeBefore": "2026-06-30T12:34:56.789Z", + "locale": "fr", + "thresholdsJson": { + "WEIGHT": { + "max": 80, + "min": 60 + } + }, + "dashboardWidgetsJson": { + "roundTrip": "rt-User-dashboardWidgetsJson" + }, + "insightsLayoutJson": { + "roundTrip": "rt-User-insightsLayoutJson" + }, + "medicationListLayoutJson": { + "roundTrip": "rt-User-medicationListLayoutJson" + }, + "documentsLayoutJson": { + "roundTrip": "rt-User-documentsLayoutJson" + }, + "moodTagLayoutJson": { + "roundTrip": "rt-User-moodTagLayoutJson" + }, + "moduleListLayoutJson": { + "roundTrip": "rt-User-moduleListLayoutJson" + }, + "previewFeaturesJson": { + "roundTrip": "rt-User-previewFeaturesJson" + }, + "activityGoalsJson": { + "stepsPerMonth": 250000, + "workoutsPerWeek": 4 + }, + "glucoseUnit": "mmol/L", + "hasDiabetes": true, + "labsLocalOcrEnabled": true, + "storeWorkoutRoutes": true, + "unitPreference": "imperial", + "timeFormat": "H12", + "dateFormat": "DMY", + "aiProvider": "LOCAL", + "aiModel": "rt-User-aiModel", + "aiBaseUrl": "https://llm.example.com/v1", + "aiAnthropicKeyEncrypted": "", + "aiLocalKeyEncrypted": "", + "aiOpenaiKeyEncrypted": "", + "aiCompatBaseUrl": "https://gateway.example.com/v1", + "aiCompatKeyEncrypted": "", + "aiCompatModel": "rt-User-aiCompatModel", + "aiProviderChain": { + "roundTrip": "rt-User-aiProviderChain" + }, + "aiResponseTimeoutSeconds": 3, + "documentsAutoAiRead": true, + "onboardingCompletedAt": "2026-06-30T12:34:56.789Z", + "onboardingTourCompleted": true, + "onboardingTourProgressJson": { + "roundTrip": "rt-User-onboardingTourProgressJson" + }, + "disclaimerAcknowledgedAt": "2026-06-30T12:34:56.789Z", + "disclaimerAcknowledgedVersion": "rt-User-disclaimerAcknowledgedVersion", + "healthKitConfigJson": { + "roundTrip": "rt-User-healthKitConfigJson" + }, + "healthKitLastSyncedAt": "2026-06-30T12:34:56.789Z", + "healthKitLastSyncTrigger": "rt-User-healthKitLastSyncTrigger", + "healthKitLastBackgroundSyncAt": "2026-06-30T12:34:56.789Z", + "displayName": "rt-User-displayName", + "lastReportPracticeName": "rt-User-lastReportPracticeName", + "coachPrefsJson": { + "roundTrip": "rt-User-coachPrefsJson" + }, + "sourcePriorityJson": { + "roundTrip": "rt-User-sourcePriorityJson" + }, + "lastSyncedAt": "2026-06-30T12:34:56.789Z", + "syncResetAt": "2026-06-30T12:34:56.789Z", + "moodReminderEnabled": true, + "reportSelectionJson": { + "roundTrip": "rt-User-reportSelectionJson" + }, + "notificationPrefs": { + "roundTrip": "rt-User-notificationPrefs" + }, + "disableCoach": true, + "aiUsageLevel": "FRUGAL", + "modulePreferencesJson": { + "roundTrip": "rt-User-modulePreferencesJson" + }, + "healthScoreConfigJson": { + "roundTrip": "rt-User-healthScoreConfigJson" + }, + "documentQuotaBytes": "bigint:5", + "coachLastSeenAt": "2026-06-30T12:34:56.789Z", + "avatarBytes": "", + "avatarContentType": "image/png", + "avatarUpdatedAt": "2026-06-30T12:34:56.789Z", + "totpSecretEncrypted": "", + "totpConfirmedAt": "2026-06-30T12:34:56.789Z", + "totpLastStep": "bigint:5", + "mfaEnforced": true, + "passkeyUpgradeNudgeDismissed": true, + "fullName": "rt-User-fullName", + "insurerName": "rt-User-insurerName", + "insuranceNumberEncrypted": "", + "insurerIkNumber": "rt-User-insurerIkNumber" + }, + "AppSettings": { + "id": "singleton", + "registrationEnabled": false, + "mfaRequired": true, + "defaultLocale": "fr", + "telegramGlobal": false, + "ntfyGlobal": false, + "webPushGlobal": false, + "webPushVapidPublicKey": "rt-AppSettings-webPushVapidPublicKey", + "webPushVapidPrivateKeyEncrypted": "", + "webPushVapidSubject": "rt-AppSettings-webPushVapidSubject", + "apiGlobal": false, + "umamiEnabled": true, + "umamiScriptUrl": "rt-AppSettings-umamiScriptUrl", + "umamiWebsiteId": "rt-AppSettings-umamiWebsiteId", + "glitchtipEnabled": true, + "glitchtipDsn": "rt-AppSettings-glitchtipDsn", + "glitchtipEnvironment": "rt-AppSettings-glitchtipEnvironment", + "glitchtipLastOkAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureAt": "2026-06-30T12:34:56.789Z", + "glitchtipLastFailureReason": "rt-AppSettings-glitchtipLastFailureReason", + "reminderLateMinutes": 3, + "reminderMissedMinutes": 3, + "adminAiKeyEncrypted": "", + "adminAiModel": "rt-AppSettings-adminAiModel", + "adminAiBaseUrl": "rt-AppSettings-adminAiBaseUrl", + "adminCodexAccessTokenEncrypted": "", + "adminCodexRefreshTokenEncrypted": "", + "adminCodexAccountIdEncrypted": "", + "adminCodexTokenExpiresAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectedAt": "2026-06-30T12:34:56.789Z", + "adminCodexConnectionStatus": "rt-AppSettings-adminCodexConnectionStatus", + "adminAiInsightsFeedbackSummary": { + "helpful": 3 + }, + "defaultUserTimezone": "America/Chicago", + "assistantEnabled": false, + "assistantCoachEnabled": false, + "assistantBriefingEnabled": false, + "assistantInsightStatusEnabled": false, + "assistantDocumentAiEnabled": false, + "aiUsageMaxLevel": "FRUGAL", + "aiUsageDefaultLevel": "FRUGAL", + "aiSyncRegenGapHours": 3, + "aiReasoningEnabled": false, + "aiReasoningMaxEffort": "low", + "moduleAvailabilityJson": { + "mood": "off" + }, + "documentMaxFileBytes": 3, + "documentQuotaBytes": "bigint:5", + "encryptionKeyBackupConfirmedAt": "2026-06-30T12:34:56.789Z", + "encryptionKeyBackupConfirmedKeyId": "rt-AppSettings-encryptionKeyBackupConfirmedKeyId", + "encryptionKeyBackupConfirmedFingerprint": "rt-AppSettings-encryptionKeyBackupConfirmedFingerprint", + "encryptionKeyBackupConfirmedByUserId": "rt-AppSettings-encryptionKeyBackupConfirmedByUserId", + "correlationSeasonalEngineSince": "2026-06-30T12:34:56.789Z", + "pulseDayMeanMethod": "hour_mean_v1", + "pulseDayMeanAppliedAt": "2026-06-30T12:34:56.789Z", + "pulseDayMeanDryRunJson": { + "roundTrip": "rt-AppSettings-pulseDayMeanDryRunJson" + }, + "workoutClimbBackfillCursor": "rt-AppSettings-workoutClimbBackfillCursor" + } + } +} diff --git a/tests/integration/backup-fixture.ts b/tests/integration/backup-fixture.ts new file mode 100644 index 000000000..8d3b1f396 --- /dev/null +++ b/tests/integration/backup-fixture.ts @@ -0,0 +1,1573 @@ +/** + * The account the backup tests fill: one row of every two-ended model, the + * shapes a CHECK constraint ties to a particular row, and the values the + * column fill uses where a type alone would produce one the restore refuses. + * + * Shared by `backup-round-trip.test.ts`, which proves each model and column + * comes back, and `backup-parity.test.ts`, which pins the whole file and the + * restored account against a golden copy. + */ +import { createHash } from "node:crypto"; + +import type { PrismaClient } from "@/generated/prisma/client"; +import { encrypt, encryptBytes } from "@/lib/crypto"; +import { encryptToBytes } from "@/lib/ai/coach/bytes-codec"; +import { sealDayCountry } from "@/lib/dawarich/connection"; +import { sealLocation } from "@/lib/environment/location-cipher"; +import { encryptFactData, encryptFactProvenance } from "@/lib/documents/store"; +import { encryptWaveformToBytes } from "@/lib/withings/ecg-waveform-codec"; +import { encryptContextToBytes } from "@/lib/labs/biomarker-store"; +import type { AuditColumn, AuditModel } from "./backup-column-audit"; +import { cookieJar } from "./mock-next-headers"; + +export const OWNER_ID = "round-trip-owner"; +export const AT = (iso: string) => new Date(iso); +// The restore drops a measurement tombstone older than +// `TOMBSTONE_RETENTION_DAYS` on purpose, so the fixture's deletion has to stay +// recent on whatever day the suite runs. A fixed date aged out on 2026-10-03. +export const TOMBSTONE_DELETED_AT = new Date( + Math.floor((Date.now() - 10 * 86_400_000) / 1000) * 1000, +).toISOString(); +export const PHQ9_RESPONSES = JSON.stringify({ + items: [2, 1, 2, 2, 1, 1, 2, 1, 2], + schema: 1, +}); +export const CONSENT_ARTEFACT = "JVBERi0xLjQKJWZpeHR1cmU="; +export const INVENTORY_NOTE = "second pack, kept in the kitchen drawer"; +export const COACH_FACT = "does not tolerate ACE inhibitors"; +// v1.41 — the model text of a turn's trail, stored encrypted beside the turn. +export const COACH_TRAIL_JSON = JSON.stringify({ + entries: [{ id: "a1", title: "Checking the trend", text: "Read 30 days." }], +}); +export const COACH_PLAN_CUE = "if the evening reading is over 140"; +export const COACH_PLAN_ACTION = + "then walk twenty minutes before dinner tomorrow"; +export const COACH_REMINDER_NOTE = "ask how the evening walks are going"; +export const COACH_SUMMARY = "earlier turns: weight trend and evening walks"; +export const METRIC_LEGACY_NOTE = "left hand, after the long ride"; +export const METRIC_SEALED_NOTE = "right hand, rested"; +export const COACH_USER_TURN = + "my readings look higher this week, is that real?"; +export const COACH_ASSISTANT_TURN = + "the last seven mornings average 4 mmHg above the fortnight before"; +/** The table of values the assistant turn read: ciphertext at rest. */ +export const COACH_RESULTS_JSON = JSON.stringify([ + { + ref: "r1", + source: { + tool: "get_metric_series", + domain: "bp", + window: "last7days", + period: "current", + granularity: "day", + }, + shape: "timeSeries", + titleKey: "coach.result.title.metricByPeriod", + title: "Blood pressure by day", + rowCount: 2, + chartKind: "line", + displayed: true, + columns: [ + { + key: "period", + kind: "period", + labelKey: "coach.result.column.day", + label: "Day", + }, + { + key: "sys", + kind: "number", + labelKey: "coach.result.column.systolic", + label: "Systolic", + unit: "mmHg", + }, + ], + rows: [ + ["2026-07-19", 131], + ["2026-07-20", null], + ], + truncated: false, + chart: { kind: "line", x: "period", series: ["sys"] }, + }, +]); +export const ROUND_TRIP_CATEGORY_KEY = + "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10"; +export const DOSE_CHANGE_NOTE = "titration note, encrypted at rest"; +export const EXTRACTED_FACT_SPAN = "Ferritin 91 ng/mL (30 - 400)"; +export const SIDE_EFFECT_NOTE = "nausea for two hours after the evening dose"; +/** A short micro-volt strip. Long enough that a defaulted empty array shows. */ +export const ECG_SAMPLES = [-12, 4, 118, -33, 7, 2, -5, 61]; + +/** + * One row of every two-ended model, for one account. + * + * Minimal on purpose: this file asks whether a row survives the round trip, and + * a fat fixture only makes the answer slower to get. The mood factor and the + * cycle symptom are the account's OWN custom rows rather than seeded catalogue + * entries, because a catalogue row survives the account being deleted and would + * make the link tables look restored when nothing restored them. + */ +export async function seedEveryTwoEndedModel( + prisma: PrismaClient, +): Promise { + // Held rather than discarded: the personal best below points at this row + // through a column that is a real foreign key in the database, so the + // fixture needs the id to build the reference the restore has to resolve. + const weightMeasurement = await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "WEIGHT", + value: 74.2, + unit: "kg", + measuredAt: AT("2026-07-01T07:00:00.000Z"), + source: "MANUAL", + }, + }); + // A DELETED reading, kept as a tombstone. It is here because the obvious way + // to make the weekly backup cheaper — stop exporting soft-deleted rows, which + // on a real record is four rows in five — is wrong, and nothing in the tree + // said so out loud. A tombstone inside the retention window is what tells a + // synced client the row is gone (`/api/sync/changes` reads exactly these) and + // what makes a re-sent Apple Health sample a no-op instead of a resurrection. + // Drop them from a disaster-recovery file and a restore quietly brings back + // every measurement the account ever deleted on the next device sync. + await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "PULSE", + value: 61, + unit: "bpm", + measuredAt: AT("2026-07-02T06:30:00.000Z"), + source: "APPLE_HEALTH", + externalId: "round-trip-deleted-sample", + syncVersion: 4, + deletedAt: AT(TOMBSTONE_DELETED_AT), + }, + }); + // The EVENT row an ECG strip is filed against, and the strip itself. The + // pairing is the point: `EcgRecording.measurementId` is a real foreign key, + // so this is the reference whose remap has to survive the round trip rather + // than fail the transaction. + const rhythmEvent = await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "IRREGULAR_RHYTHM_NOTIFICATION", + value: 1, + unit: "event", + measuredAt: AT("2026-06-15T14:22:00.000Z"), + source: "WITHINGS", + rhythmClassification: "IRREGULAR", + }, + }); + await prisma.ecgRecording.create({ + data: { + userId: OWNER_ID, + source: "WITHINGS", + externalRecordingId: "round-trip-signal-1", + recordedAt: AT("2026-06-15T14:22:00.000Z"), + waveformEncrypted: encryptWaveformToBytes(ECG_SAMPLES), + samplingFrequency: 300, + sampleCount: ECG_SAMPLES.length, + durationSeconds: ECG_SAMPLES.length / 300, + lead: "I", + averageHeartRate: 88, + rhythmClassification: "IRREGULAR", + measurementId: rhythmEvent.id, + }, + }); + await prisma.intradayCumulativeProfile.create({ + data: { + userId: OWNER_ID, + type: "ACTIVITY_STEPS", + dateKey: "2026-07-01", + // One slot per hour — the restore refuses a profile of any other length, + // because a short row lands in the table and is dropped on read. + hourlyCumulative: Array.from({ length: 24 }, (_, hour) => hour * 350), + dayTotal: 8050, + sampleCount: 24, + timezone: "Europe/Berlin", + }, + }); + + // Two courses with a gap, and the window the row projects from them (the + // latest). The earlier course exists nowhere else once it has ended. + const medication = await prisma.medication.create({ + data: { + userId: OWNER_ID, + name: "Round-trip tablet", + dose: "5 mg", + startsOn: AT("2026-06-10T00:00:00.000Z"), + endsOn: AT("2026-06-16T00:00:00.000Z"), + schedules: { + create: { windowStart: "08:00", windowEnd: "09:00", label: "Morning" }, + }, + courses: { + create: [ + { + userId: OWNER_ID, + startsOn: AT("2026-03-01T00:00:00.000Z"), + endsOn: AT("2026-03-07T00:00:00.000Z"), + noteEncrypted: encryptToBytes("the March flu"), + }, + { + userId: OWNER_ID, + startsOn: AT("2026-06-10T00:00:00.000Z"), + endsOn: AT("2026-06-16T00:00:00.000Z"), + }, + ], + }, + }, + }); + await prisma.medicationIntakeEvent.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + scheduledFor: AT("2026-07-01T08:00:00.000Z"), + takenAt: AT("2026-07-01T08:04:00.000Z"), + }, + }); + // Not OTHER: a missing row already reads as OTHER, so only a chosen value + // proves the category came back. A category the person named, so the + // assignment can only resolve if the label came back before it. + await prisma.medicationCategoryLabel.create({ + data: { + userId: OWNER_ID, + key: ROUND_TRIP_CATEGORY_KEY, + labelEncrypted: encryptToBytes("Heart and circulation"), + sortOrder: 2, + }, + }); + await prisma.medicationCategoryAssignment.create({ + data: { medicationId: medication.id, category: ROUND_TRIP_CATEGORY_KEY }, + }); + // The one row in this fixture that is also checked field by field after the + // restore — see the assertion at the end of the test for why. + await prisma.medicationSideEffect.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + occurredAt: AT("2026-07-01T21:00:00.000Z"), + category: "GI", + entry: "NAUSEA", + severity: 3, + notesEncrypted: encryptToBytes(SIDE_EFFECT_NOTE), + }, + }); + // Two eras, and the open one carries the weight. `resumedAt: null` means the + // drug is paused right now; a restore that closed it at restore time would + // still count one row back here and read as recovered. The field-level + // assertion at the end of the test is what holds the null. + // A two-step ramp. The ORDER is the content here: same drug, same unit, + // 5 mg then 10 mg. A restore that returned them reversed would still count + // two rows back and would describe the opposite clinical story. + // One open pack and one used up, plus the two ledger rows behind the open + // one. The count on the pack is deliberately NOT the sum of its events: 30 + // in, 8 consumed, and the remaining count says 21 because the person threw + // one away without recording it. A restore that recomputed the count from + // the ledger would "fix" that to 22 and disagree with every low-stock + // reminder the account has already received. + // A PHQ-9 administration whose item 9 was answered above zero. The flag and + // the encrypted answers are seeded to DISAGREE with a naive recomputation: + // the flag says true, and a restore that decided to recompute it would have + // to decrypt the blob to do so, which is the handling this data is kept away + // from. The assertion below reads the flag and the ciphertext separately. + await prisma.mentalHealthAssessment.create({ + data: { + userId: OWNER_ID, + instrument: "PHQ9", + locale: "de", + version: "standard", + responsesEncrypted: encryptToBytes(PHQ9_RESPONSES), + totalScore: 14, + severityBand: "moderate", + item9Flagged: true, + crisisShownAt: AT("2026-07-05T18:02:00.000Z"), + takenAt: AT("2026-07-05T18:00:00.000Z"), + tz: "Europe/Berlin", + source: "WEB", + }, + }); + + // One active consent and one revoked. The revocation is the part a restore + // can quietly lose: dropping `revokedAt` turns a withdrawn agreement back + // into a standing one, and the latest-per-user lookup shortcuts on exactly + // that column. + await prisma.consentReceipt.createMany({ + data: [ + { + userId: OWNER_ID, + kind: "ai-processing", + artefact: CONSENT_ARTEFACT, + signedAt: AT("2026-06-01T09:00:00.000Z"), + }, + { + userId: OWNER_ID, + kind: "research-sharing", + artefact: "eyJhbGciOiJub25lIn0.e30.", + signedAt: AT("2026-06-02T09:00:00.000Z"), + revokedAt: AT("2026-07-10T11:00:00.000Z"), + }, + ], + }); + + // Tuned away from every default, and one threshold in PERCENT rather than + // MINUTES: a restore that fell back to the schema defaults would return four + // plausible numbers and silently change when this drug turns orange. + await prisma.reminderPhaseConfig.create({ + data: { + medicationId: medication.id, + greenValue: 45, + greenMode: "MINUTES", + yellowValue: 20, + yellowMode: "PERCENT", + orangeValue: 5, + orangeMode: "MINUTES", + redValue: 180, + redMode: "MINUTES", + }, + }); + + const openPack = await prisma.medicationInventoryItem.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + state: "ACTIVE", + containerType: "BLISTER", + unitsTotal: "30", + unitsRemaining: "21", + firstUseAt: AT("2026-07-01T08:00:00.000Z"), + expiresAt: AT("2027-01-31T00:00:00.000Z"), + manufacturer: "Fixture Pharma", + doseStrength: "10 mg", + notesEncrypted: encryptToBytes(INVENTORY_NOTE), + }, + }); + await prisma.medicationInventoryItem.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + state: "USED_UP", + containerType: "BOTTLE", + unitsTotal: "60", + unitsRemaining: "0", + }, + }); + await prisma.medicationInventoryEvent.createMany({ + data: [ + { + medicationId: medication.id, + delta: 30, + reason: "purchased", + occurredAt: AT("2026-07-01T07:00:00.000Z"), + }, + { + medicationId: medication.id, + delta: -8, + reason: "consumed", + occurredAt: AT("2026-07-09T07:00:00.000Z"), + }, + ], + }); + + await prisma.medicationDoseChange.createMany({ + data: [ + { + medicationId: medication.id, + effectiveFrom: AT("2026-04-01T08:00:00.000Z"), + doseValue: 5, + doseUnit: "mg", + noteEncrypted: encryptToBytes(DOSE_CHANGE_NOTE), + }, + { + medicationId: medication.id, + effectiveFrom: AT("2026-06-01T08:00:00.000Z"), + doseValue: 10, + doseUnit: "mg", + noteEncrypted: null, + }, + ], + }); + // Three archived eras, and the CHAIN through them is the content. The + // middle one was corrected, so it points at the third; the first and the + // third stand on their own. A restore that returned three rows with every + // link null satisfies any count and has destroyed the only thing the + // pointer says — every era consumer skips a superseded row, so the + // corrected middle era would come back live beside the correction that + // replaced it and the timeline would show the same window twice. + await prisma.medicationScheduleRevision.create({ + data: { + medicationId: medication.id, + validFrom: AT("2026-01-01T00:00:00.000Z"), + validUntil: AT("2026-03-01T00:00:00.000Z"), + payload: [{ windowStart: "07:00", windowEnd: "09:00", dose: "5 mg" }], + source: "ARCHIVED", + }, + }); + const correctionEra = await prisma.medicationScheduleRevision.create({ + data: { + medicationId: medication.id, + validFrom: AT("2026-03-01T00:00:00.000Z"), + validUntil: AT("2026-05-01T00:00:00.000Z"), + payload: [{ windowStart: "08:00", windowEnd: "10:00", dose: "10 mg" }], + source: "MANUAL", + }, + }); + await prisma.medicationScheduleRevision.create({ + data: { + medicationId: medication.id, + validFrom: AT("2026-02-01T00:00:00.000Z"), + validUntil: AT("2026-03-01T00:00:00.000Z"), + payload: [{ windowStart: "12:00", windowEnd: "13:00", dose: "10 mg" }], + source: "ARCHIVED", + supersededByRevisionId: correctionEra.id, + }, + }); + + // v1.43 — a composition entered in a non-canonical unit, so the entered + // amount and unit are set too. + await prisma.medicationIngredient.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + nutrient: "vitamin_d", + amountPerUnit: 25, + unit: "ug", + enteredAmount: 1000, + enteredUnit: "IU", + source: "LABEL_AI", + }, + }); + + await prisma.medicationPauseEra.createMany({ + data: [ + { + userId: OWNER_ID, + medicationId: medication.id, + pausedAt: AT("2026-05-02T08:00:00.000Z"), + resumedAt: AT("2026-05-20T08:00:00.000Z"), + }, + { + userId: OWNER_ID, + medicationId: medication.id, + pausedAt: AT("2026-07-15T08:00:00.000Z"), + resumedAt: null, + }, + ], + }); + + // A RATED tag the account defined itself — the export carries only rated + // links, so a BINARY tag would leave `MoodEntryTagLink` empty. + const moodCategory = await prisma.moodTagCategory.findFirstOrThrow({ + where: { userId: null }, + }); + // A category the account created itself, not a seeded one. It cascades away + // with the user, and `MoodTag.categoryId` is a real foreign key — so before + // the category travelled, this one row made the restore violate + // `mood_tags_category_id_fkey` and answer 500 with the account left empty. + const ownCategory = await prisma.moodTagCategory.create({ + data: { + userId: OWNER_ID, + key: "round_trip_own_category", + labelKey: "mood.category.roundTripOwn", + sortOrder: 90, + }, + }); + const moodTag = await prisma.moodTag.create({ + data: { + userId: OWNER_ID, + categoryId: ownCategory.id, + key: "round_trip_factor", + labelKey: "mood.tag.roundTripFactor", + kind: "RATED", + scaleMin: 1, + scaleMax: 5, + }, + }); + // A SEEDED tag the account chose to hide. The id differs per instance, so + // this is the row that proves the hidden set travels by key. + const seededTagToHide = await prisma.moodTag.findFirstOrThrow({ + where: { userId: null }, + }); + await prisma.moodTagHidden.create({ + data: { userId: OWNER_ID, moodTagId: seededTagToHide.id }, + }); + + await prisma.moodEntry.create({ + data: { + userId: OWNER_ID, + date: "2026-07-01", + mood: "GUT", + score: 4, + source: "MOODLOG", + moodLoggedAt: AT("2026-07-01T20:00:00.000Z"), + tagLinks: { create: { moodTagId: moodTag.id, rating: 4 } }, + context: { + create: { + userId: OWNER_ID, + workStatus: "regular", + contactCircles: JSON.stringify(["family"]), + leisureJoy: 6, + }, + }, + }, + }); + + const biomarker = await prisma.biomarker.create({ + data: { userId: OWNER_ID, name: "Ferritin", unit: "ng/mL" }, + }); + // Another spelling of the marker, and the ledger row of a marker that was + // merged into it: both ride the marker (D1223). + await prisma.biomarkerAlias.create({ + data: { + userId: OWNER_ID, + biomarkerId: biomarker.id, + name: "Ferr.", + nameFolded: "ferr.", + source: "IMPORT_CHOICE", + }, + }); + await prisma.biomarkerMerge.create({ + data: { + userId: OWNER_ID, + targetBiomarkerId: biomarker.id, + sourceBiomarkerId: "merged-away-marker", + sourceName: "Ferritin (Serum)", + readingCount: 3, + }, + }); + const labResult = await prisma.labResult.create({ + data: { + userId: OWNER_ID, + biomarkerId: biomarker.id, + analyte: "Ferritin", + value: 91, + unit: "ng/mL", + takenAt: AT("2026-06-30T09:00:00.000Z"), + }, + }); + // What the drug above is FOR, pinned to the analyte just created. The two + // rows are seeded at opposite ends of this fixture on purpose: the drug is + // restored hundreds of lines before the analyte, so this pairing is what + // proves the second pass runs late enough to resolve the name. + await prisma.medicationEfficacyTarget.create({ + data: { + medicationId: medication.id, + biomarkerId: biomarker.id, + primary: true, + }, + }); + await prisma.allergy.create({ + data: { userId: OWNER_ID, substance: "Penicillin" }, + }); + await prisma.familyHistoryEntry.create({ + data: { + userId: OWNER_ID, + relationship: "MOTHER", + condition: "Type 2 diabetes", + }, + }); + + const episode = await prisma.illnessEpisode.create({ + data: { + userId: OWNER_ID, + label: "Cold", + type: "INFECTION", + onsetAt: AT("2026-06-20T00:00:00.000Z"), + }, + }); + // A SECOND condition, and the one the document below is actually filed + // against. Two episodes is what makes the filing assertion mean something: + // with one, a restore that pointed every link at the first condition it + // found would return the right count and read as correct. + const filedEpisode = await prisma.illnessEpisode.create({ + data: { + userId: OWNER_ID, + label: "Iron deficiency", + type: "CHRONIC", + onsetAt: AT("2026-03-01T00:00:00.000Z"), + // v1.39.2 — a condition's body site and side travel too. + bodySiteEncrypted: encryptToBytes("Stomach"), + laterality: "BOTH", + }, + }); + const illnessSymptom = await prisma.illnessSymptom.create({ + data: { key: "round_trip_cough", labelKey: "illness.symptom.roundTrip" }, + }); + await prisma.illnessDayLog.create({ + data: { + userId: OWNER_ID, + episodeId: episode.id, + date: "2026-06-21", + symptomLinks: { create: { symptomId: illnessSymptom.id, severity: 2 } }, + }, + }); + + // v1.40 — two of the person's own symptoms and three occurrences: one filed + // against the open cold, one with a note, one on its own in the gap. + const aura = await prisma.symptomDefinition.create({ + data: { + userId: OWNER_ID, + labelEncrypted: encryptToBytes("Aura"), + icon: "Zap", + sortOrder: 0, + }, + }); + const headache = await prisma.symptomDefinition.create({ + data: { + userId: OWNER_ID, + labelEncrypted: encryptToBytes("Headache"), + icon: "Brain", + sortOrder: 1, + isActive: false, + }, + }); + await prisma.symptomEvent.create({ + data: { + userId: OWNER_ID, + definitionId: aura.id, + occurredAt: AT("2026-06-21T09:00:00.000Z"), + intensity: 4, + episodeId: episode.id, + }, + }); + await prisma.symptomEvent.create({ + data: { + userId: OWNER_ID, + definitionId: headache.id, + occurredAt: AT("2026-06-21T11:00:00.000Z"), + intensity: 8, + noteEncrypted: encryptToBytes("left side, behind the eye"), + }, + }); + await prisma.symptomEvent.create({ + data: { + userId: OWNER_ID, + definitionId: aura.id, + occurredAt: AT("2026-07-10T18:30:00.000Z"), + intensity: 2, + }, + }); + + // v1.42 — two life events: a move known to the month, with a note, and a + // period known to the day. + await prisma.lifeEvent.create({ + data: { + userId: OWNER_ID, + category: "HOME", + startDate: "2023-09-01", + precision: "MONTH", + titleEncrypted: encryptToBytes("Moved to the coast"), + noteEncrypted: encryptToBytes("the flat with the long hallway"), + }, + }); + await prisma.lifeEvent.create({ + data: { + userId: OWNER_ID, + category: "WORK", + startDate: "2026-03-02", + endDate: "2026-05-29", + precision: "DAY", + titleEncrypted: encryptToBytes("Parental leave"), + }, + }); + + await prisma.userHealthProfile.create({ + data: { + userId: OWNER_ID, + aboutMeEncrypted: encryptToBytes("Runs three times a week"), + }, + }); + await prisma.healthProfileFactRevision.create({ + data: { + userId: OWNER_ID, + kind: "SMOKING_STATUS", + valueEncrypted: encryptToBytes("never"), + validFrom: AT("2026-01-01T00:00:00.000Z"), + }, + }); + + await prisma.cycleProfile.create({ + data: { userId: OWNER_ID, cycleTrackingEnabled: true }, + }); + const cycle = await prisma.menstrualCycle.create({ + data: { userId: OWNER_ID, startDate: "2026-06-01" }, + }); + const cycleCategory = await prisma.cycleSymptomCategory.findFirstOrThrow(); + const cycleSymptom = await prisma.cycleSymptom.create({ + data: { + userId: OWNER_ID, + categoryId: cycleCategory.id, + key: "custom:round-trip-cramps", + labelKey: "cycle.symptom.custom", + labelEncrypted: encrypt("Round-trip cramps"), + }, + }); + await prisma.cycleDayLog.create({ + data: { + userId: OWNER_ID, + cycleId: cycle.id, + date: "2026-06-02", + flow: "HEAVY", + symptomLinks: { create: { symptomId: cycleSymptom.id } }, + }, + }); + + await prisma.customMetric.create({ + data: { + userId: OWNER_ID, + name: "Grip strength", + unit: "kg", + // v1.39.3 — one reading whose note is still readable (a row the + // free-text backfill has not reached) and one sealed the current way. + // Both must come back sealed, and neither readable. + entries: { + create: [ + { + userId: OWNER_ID, + value: 44, + unit: "kg", + measuredAt: AT("2026-07-01T18:00:00.000Z"), + note: METRIC_LEGACY_NOTE, + }, + { + userId: OWNER_ID, + value: 45, + unit: "kg", + measuredAt: AT("2026-07-02T18:00:00.000Z"), + noteEncrypted: encryptToBytes(METRIC_SEALED_NOTE), + }, + ], + }, + }, + }); + await prisma.correlationPattern.create({ + data: { + userId: OWNER_ID, + canonicalKey: `p1:${"a1".repeat(32)}`, + family: "sleep", + factorKey: "sleep_duration", + outcomeKey: "weight", + lagDays: 1, + sampleSize: 30, + effectSize: 0.42, + pValue: 0.01, + evidenceHash: "b2".repeat(32), + lastComputedAt: AT("2026-07-01T00:00:00.000Z"), + }, + }); + await prisma.onboardingRecord.create({ + data: { + userId: OWNER_ID, + needsJson: { + recordTarget: "me", + areas: ["blood-pressure", "sleep"], + medication: "yes", + sources: ["withings"], + visit: "within-a-month", + units: { glucoseUnit: "mmol/L", unitPreference: "metric" }, + }, + stepsJson: [ + { id: "who", status: "done" }, + { id: "areas", status: "done" }, + { id: "sources", status: "skipped" }, + ], + firstResultJson: { + task: "connect-source", + target: "withings", + completedAt: "2026-07-01T08:30:00.000Z", + }, + // The once-only latch on the module derivation. Seeded non-null so the + // assertion after the restore can show it came back rather than + // defaulting — a null here would hand the next confirm permission to + // re-apply the questionnaire over every module decision made since. + modulesDerivedAt: AT("2026-07-01T08:00:00.000Z"), + completedAt: AT("2026-07-01T08:00:00.000Z"), + }, + }); + await prisma.healthScoreRecord.create({ + data: { + userId: OWNER_ID, + dayKey: "2026-07-01", + timezone: "Europe/Berlin", + composite: 71, + band: "green", + scoreVersion: 1, + composition: ["activity", "sleep"], + pillarScores: { activity: 70, sleep: 72 }, + inputFingerprint: "c3".repeat(32), + }, + }); + + await prisma.workout.create({ + data: { + userId: OWNER_ID, + sportType: "RUNNING", + startedAt: AT("2026-06-29T06:00:00.000Z"), + endedAt: AT("2026-06-29T06:30:00.000Z"), + durationSec: 1800, + }, + }); + await prisma.nutrientIntakeDay.create({ + data: { + userId: OWNER_ID, + day: "2026-07-01", + nutrient: "WATER", + amount: 2100, + unit: "ml", + source: "MANUAL", + }, + }); + + const documentBytes = encryptBytes(Buffer.from("round-trip document bytes")); + const contentEncrypted = new Uint8Array( + new ArrayBuffer(documentBytes.byteLength), + ); + contentEncrypted.set(documentBytes); + const document = await prisma.inboundDocument.create({ + data: { + userId: OWNER_ID, + kind: "LAB_RESULT", + title: "June labs", + filename: "june-labs.pdf", + mimeType: "application/pdf", + byteSize: documentBytes.byteLength, + contentEncrypted, + contentCodec: "binary2", + // Imported (#1038): the source key has to survive the trip, or a + // re-run of the importer after a restore stores the page twice. + sourceSystem: "PAPERLESS", + sourceId: "4711", + // Held back from automatic AI reading; a restore that dropped the + // marker would hand the page to the summary catch-up. + aiReadDeferred: true, + }, + }); + + // The page filed under the SECOND condition, not the first. A restore that + // kept the count and lost the pairing would leave the vault sorted wrongly + // rather than visibly unsorted, which is harder to notice and worse. + await prisma.documentConditionLink.create({ + data: { + userId: OWNER_ID, + documentId: document.id, + episodeId: filedEpisode.id, + createdAt: AT("2026-07-02T09:00:00.000Z"), + }, + }); + + // One staged fact, already reviewed, approved and committed to the ferritin + // lab row above. Every column that records the decision is set AWAY from its + // schema default on purpose: `PENDING`, `needsReview: true` and two NULL + // commitment columns are what a restore that ignores them writes, and the + // assertion after the restore is what catches that. A fact handed back as + // PENDING is offered for review again, and approving it a second time writes + // a second lab result for a reading the account already has. + await prisma.extractedFact.create({ + data: { + userId: OWNER_ID, + documentId: document.id, + factType: "OBSERVATION", + status: "APPROVED", + confidence: 0.94, + needsReview: false, + committedRecordId: labResult.id, + committedRecordType: "labResult", + dataEncrypted: encryptFactData({ + label: "Ferritin", + code: null, + codeSystem: null, + value: 91, + valueText: null, + unit: "ng/mL", + referenceLow: 30, + referenceHigh: 400, + effectiveDate: "2026-06-30", + }), + provenanceEncrypted: encryptFactProvenance({ + sourceText: EXTRACTED_FACT_SPAN, + anchored: true, + sourceOffset: 412, + page: 2, + confidence: 0.94, + }), + }, + }); + + // Two Coach threads, and the pair is the point. One is an ordinary health + // conversation; the other is FENCED — `documentScoped` true, grounded in the + // document seeded above. A restore that let the flag default to false would + // return both threads, satisfy every count, and quietly hand the tool loop + // back to the one conversation whose history may contain document-derived + // text. That is why the assertion below reads the flag per thread rather + // than counting rows. + await prisma.coachConversation.create({ + data: { + userId: OWNER_ID, + title: "How is my blood pressure trending?", + documentScoped: false, + summaryEncrypted: encryptToBytes(COACH_SUMMARY), + summaryUpdatedAt: AT("2026-07-20T10:00:00.000Z"), + summaryTurnCount: 4, + messages: { + create: [ + { + role: "user", + encryptedContent: encryptToBytes(COACH_USER_TURN), + createdAt: AT("2026-07-20T09:58:00.000Z"), + }, + { + role: "assistant", + encryptedContent: encryptToBytes(COACH_ASSISTANT_TURN), + resultsEncrypted: encryptToBytes(COACH_RESULTS_JSON), + trailEncrypted: encryptToBytes(COACH_TRAIL_JSON), + providerType: "anthropic", + model: "claude-opus-5", + tokensUsed: 812, + createdAt: AT("2026-07-20T09:59:00.000Z"), + }, + ], + }, + }, + }); + await prisma.coachConversation.create({ + data: { + userId: OWNER_ID, + // v1.39.3 — sealed the current way; the thread above keeps a readable + // legacy title, the shape of a row the backfill has not reached. + titleEncrypted: encryptToBytes("About my June labs"), + documentScoped: true, + messages: { + create: [ + { + role: "user", + encryptedContent: encryptToBytes("What does the ferritin mean?"), + createdAt: AT("2026-07-21T08:00:00.000Z"), + }, + ], + }, + attachments: { + create: [ + { documentId: document.id, addedAt: AT("2026-07-21T07:59:00.000Z") }, + ], + }, + }, + }); + + // What the Coach keeps between threads, seeded so both references are + // exercised: the fact and the plan point back at the thread they came out + // of, and the reminder points at the plan. + const healthThread = await prisma.coachConversation.findFirstOrThrow({ + where: { userId: OWNER_ID, documentScoped: false }, + }); + const healthAnswer = await prisma.coachMessage.findFirstOrThrow({ + where: { conversationId: healthThread.id, role: "assistant" }, + }); + await prisma.coachFact.create({ + data: { + userId: OWNER_ID, + factEncrypted: encryptToBytes(COACH_FACT), + category: "constraint", + confidence: 80, + sourceConversationId: healthThread.id, + source: "user", + lastUsedAt: AT("2026-07-20T10:00:00.000Z"), + sourceMessageId: healthAnswer.id, + }, + }); + const plan = await prisma.coachPlan.create({ + data: { + userId: OWNER_ID, + metric: "BLOOD_PRESSURE", + ifCueEncrypted: encryptToBytes(COACH_PLAN_CUE), + thenActionEncrypted: encryptToBytes(COACH_PLAN_ACTION), + targetEncrypted: encryptToBytes("under 130 by October"), + status: "active", + reviewDate: AT("2026-10-01T00:00:00.000Z"), + sourceConversationId: healthThread.id, + }, + }); + await prisma.coachReminder.create({ + data: { + userId: OWNER_ID, + noteEncrypted: encryptToBytes(COACH_REMINDER_NOTE), + metric: "BLOOD_PRESSURE", + relatedPlanId: plan.id, + triggerKind: "date", + dueAt: AT("2026-09-01T07:00:00.000Z"), + status: "active", + source: "extractor", + sourceConversationId: healthThread.id, + surfaceCount: 2, + }, + }); + + // One visit, the practice it was at, and one link of each of the three + // kinds. The links reach the document, the lab result and the condition + // episode seeded above rather than fresh rows, because a link to something + // the restore did not put back is the exact case the restore reports as a + // skip — seeding it against a row that does come back is what makes a + // returning count mean the filing survived. + const practitioner = await prisma.practitioner.create({ + data: { + userId: OWNER_ID, + name: "Round-trip practice", + specialty: "Internal medicine", + noteEncrypted: encryptToBytes("ring the upper bell"), + }, + }); + + // One Vorsorge reminder with the v1.37.20 skip/snooze columns all set, and + // two completion-ledger rows — one honest satisfy, one honest skip. Fat like + // the vaccination fixture below and for the same reason: the count-back + // proves the rows returned, the column-by-column assertion after the restore + // proves they returned WHOLE. The encounter and the dose below point their + // `reminderId` here, because both references now remap against the restored + // reminders and this fixture is what proves they survive rather than drop. + const reminder = await prisma.measurementReminder.create({ + data: { + userId: OWNER_ID, + label: "Blutdruck messen", + measurementType: "BLOOD_PRESSURE_SYS", + intervalDays: 7, + notifyHour: 8, + location: "Zuhause", + nextDueAt: AT("2026-07-08T06:00:00.000Z"), + lastSatisfiedAt: AT("2026-07-01T06:05:00.000Z"), + vaccinationAntigen: "tetanus", + snoozedUntil: AT("2026-07-08T06:00:00.000Z"), + lastSkippedAt: AT("2026-06-24T06:00:00.000Z"), + skipCount: 2, + }, + }); + await prisma.measurementReminderEvent.create({ + data: { + userId: OWNER_ID, + reminderId: reminder.id, + kind: "SATISFIED", + occurredAt: AT("2026-07-01T06:05:00.000Z"), + onTime: true, + source: "manual", + }, + }); + await prisma.measurementReminderEvent.create({ + data: { + userId: OWNER_ID, + reminderId: reminder.id, + kind: "SKIPPED", + occurredAt: AT("2026-06-24T06:00:00.000Z"), + onTime: false, + source: "skip", + }, + }); + + const encounter = await prisma.encounter.create({ + data: { + userId: OWNER_ID, + occurredAt: AT("2026-06-30T08:00:00.000Z"), + status: "DONE", + kind: "ROUTINE", + practitionerId: practitioner.id, + reasonEncrypted: encryptToBytes("annual check"), + outcomeEncrypted: encryptToBytes( + "ferritin back in range, recheck in a year", + ), + reminderId: reminder.id, + }, + }); + await prisma.encounterDocumentLink.create({ + data: { + userId: OWNER_ID, + encounterId: encounter.id, + documentId: document.id, + }, + }); + await prisma.encounterLabLink.create({ + data: { + userId: OWNER_ID, + encounterId: encounter.id, + labResultId: labResult.id, + }, + }); + await prisma.encounterConditionLink.create({ + data: { + userId: OWNER_ID, + encounterId: encounter.id, + episodeId: episode.id, + }, + }); + + // One dose with every optional column filled, and the page it was + // transcribed from. Fat on purpose, against this file's own minimal-fixture + // rule: a count-back proves the row returned, and the assertion after the + // restore reads each column back so it also proves the row returned WHOLE. + // The practitioner, the encounter and the reminder are the ones seeded + // above, because all three are remapped on the way back and a reference to + // something the restore did not put back is a different case (covered by + // the skip test below). `reminderId` used to be deliberately absent here — + // it was the one reference that could never resolve — and is deliberately + // present since v1.37.20, because resolving is now the behaviour under test. + // v1.42 (#1005) — the person's own vaccine definition the dose also names. + // The catalogue slug still wins on read; the reference is what has to + // survive the trip, and it can only if the definition comes back first. + const customVaccine = await prisma.customVaccine.create({ + data: { + userId: OWNER_ID, + name: "Round-trip travel combo", + components: ["typhoid", "hepatitis-a"], + typicalSeriesDoses: 2, + boosterIntervalMonths: 36, + }, + }); + const vaccination = await prisma.vaccinationRecord.create({ + data: { + userId: OWNER_ID, + occurredAt: AT("2026-05-14T00:00:00.000Z"), + customVaccineId: customVaccine.id, + antigenSlug: "tdap", + vaccineName: "Tetanus, diphtheria and pertussis", + doseNumber: 3, + seriesDoses: 3, + lotNumber: "RT-4471", + site: "LEFT_ARM", + practitionerId: practitioner.id, + encounterId: encounter.id, + reminderId: reminder.id, + noteEncrypted: encryptToBytes("sore arm for a day, nothing else"), + }, + }); + await prisma.vaccinationDocumentLink.create({ + data: { + userId: OWNER_ID, + vaccinationId: vaccination.id, + documentId: document.id, + }, + }); + + // v1.43 — one row in each of the five relation link tables, joining the + // records seeded above. + await prisma.labResultDocumentLink.create({ + data: { + userId: OWNER_ID, + labResultId: labResult.id, + documentId: document.id, + }, + }); + await prisma.encounterMedicationLink.create({ + data: { + userId: OWNER_ID, + encounterId: encounter.id, + medicationId: medication.id, + }, + }); + await prisma.encounterVaccinationLink.create({ + data: { + userId: OWNER_ID, + encounterId: encounter.id, + vaccinationId: vaccination.id, + }, + }); + await prisma.medicationDocumentLink.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + documentId: document.id, + }, + }); + await prisma.medicationConditionLink.create({ + data: { + userId: OWNER_ID, + medicationId: medication.id, + episodeId: episode.id, + }, + }); + + // Three bests, chosen for what a count cannot see. + // + // The first points at the measurement it was found in. That column is a + // foreign key in the database while the Prisma schema declares no relation + // for it, so this row is what proves the pointer resolves against the + // measurements the restore wrote, and would prove the opposite loudly, by + // failing the constraint and taking the whole restore with it. + // + // The other two share a metric type AND an instant and differ only in the + // sport slot: the same 5 km and 10 km bests a runner has. A restore that + // dropped the slot would return two rows describing one record twice, and + // the faster time would be presented as the 10 km best. + await prisma.personalRecord.create({ + data: { + userId: OWNER_ID, + metricType: "WEIGHT", + direction: "MIN", + value: 74.2, + unit: "kg", + achievedAt: AT("2026-07-01T07:00:00.000Z"), + sourceMeasurementId: weightMeasurement.id, + source: "MANUAL", + }, + }); + await prisma.personalRecord.createMany({ + data: [ + { + userId: OWNER_ID, + metricType: "WALKING_RUNNING_DISTANCE", + metricSlot: "running_5km_time", + direction: "MIN", + value: 1512, + unit: "s", + achievedAt: AT("2026-05-18T09:20:00.000Z"), + source: "APPLE_HEALTH", + externalId: "workout-pr-5km", + }, + { + userId: OWNER_ID, + metricType: "WALKING_RUNNING_DISTANCE", + metricSlot: "running_10km_time", + direction: "MIN", + value: 3184, + unit: "s", + achievedAt: AT("2026-05-18T09:20:00.000Z"), + source: "APPLE_HEALTH", + externalId: "workout-pr-10km", + }, + ], + }); + + // Two badges, both earned long before this fixture runs. The second names a + // definition no catalogue in this build ships: a file can be older than the + // release reading it, and the restore must carry the row rather than judge + // it, exactly as it carries a retired antigen slug. + await prisma.userAchievement.createMany({ + data: [ + { + userId: OWNER_ID, + achievementId: "intake-total-10", + unlockedAt: AT("2026-02-21T10:15:00.000Z"), + }, + { + userId: OWNER_ID, + achievementId: "retired-badge-from-an-older-release", + unlockedAt: AT("2025-11-05T08:00:00.000Z"), + }, + ], + }); + + // A fortnight in Barcelona, and one day of it recorded as a reading. + // + // The pair is the fixture. The home day and the trip day carry different + // coordinates and different weather, and the trip day's reading only makes + // sense next to the period that explains it: with the period gone, the next + // refresh re-resolves 2026-06-15 to Berlin and upserts Berlin's weather over + // it. The assertion after the restore reads the two back TOGETHER. The + // coordinates are at 1 decimal, the precision the app stores since v1.39.4; + // a restore rounds anything finer, so finer values would not round-trip. + // Since v1.42 the location is stored sealed (`locationEncrypted`), the way + // the writers store it; it is the only copy since v1.43. + // v1.43 — one Dawarich day abroad, with its sealed country. + await prisma.dawarichDay.create({ + data: { + userId: OWNER_ID, + date: "2026-06-15", + totalDistanceM: 48_300, + drivingDistanceM: 12_000, + trainDistanceM: 30_500, + placesVisited: 4, + awayFromHomeMinutes: 1440, + countryCodeEncrypted: sealDayCountry("ES"), + isTravelDay: true, + fetchedAt: new Date("2026-06-16T03:20:00.000Z"), + }, + }); + await prisma.environmentTravelLocation.create({ + data: { + userId: OWNER_ID, + startDate: "2026-06-10", + endDate: "2026-06-20", + locationEncrypted: sealLocation({ + lat: 41.4, + lon: 2.2, + label: "Barcelona", + }), + }, + }); + await prisma.environmentContext.createMany({ + data: [ + { + userId: OWNER_ID, + date: "2026-06-15", + locationEncrypted: sealLocation({ + lat: 41.4, + lon: 2.2, + label: "Barcelona", + }), + source: "TRAVEL", + tempMin: 19.4, + tempMax: 28.1, + tempMean: 23.6, + apparentMean: 25.2, + sunshineSec: 39_600, + daylightSec: 52_800, + precipSum: 0, + pressureMean: 1016.4, + pressureDelta: 3.2, + humidityMean: 63, + cloudMean: 12, + weatherCode: 1, + fetchedAt: AT("2026-06-16T03:15:00.000Z"), + }, + { + userId: OWNER_ID, + date: "2026-07-01", + locationEncrypted: sealLocation({ + lat: 52.5, + lon: 13.4, + label: "Berlin", + }), + source: "HOME", + tempMin: 13.1, + tempMax: 22.7, + tempMean: 17.9, + apparentMean: 17.1, + sunshineSec: 28_800, + daylightSec: 59_400, + precipSum: 4.6, + pressureMean: 1008.9, + pressureDelta: 7.8, + humidityMean: 74, + cloudMean: 68, + weatherCode: 61, + fetchedAt: AT("2026-07-02T03:15:00.000Z"), + }, + ], + }); +} + +export async function createOwner(prisma: PrismaClient) { + return prisma.user.create({ + data: { + id: OWNER_ID, + username: "round-trip-owner", + email: "round-trip-owner@example.test", + }, + }); +} + +export async function seedAdminSession(prisma: PrismaClient) { + const admin = await prisma.user.create({ + data: { + username: "round-trip-admin", + email: "round-trip-admin@example.test", + role: "ADMIN", + }, + }); + const session = await prisma.session.create({ + data: { userId: admin.id, expiresAt: new Date(Date.now() + 60_000) }, + }); + cookieJar.set("healthlog_session", session.id); + return admin; +} + +/** + * Columns the restore is right not to bring back verbatim, by `Model.column`. + * Every other column of every two-ended model must come back with the value + * it left with. An entry here whose column no longer exists fails the run. + */ +export const COLUMN_EXCLUSIONS: Readonly> = { + "MeasurementReminder.lastNotifiedAt": + "operational repeat cursor, documented on the column as not in the backup: a restored reminder re-reminds at most once, on its next notify hour", + // When a join row was written. Nothing reads these: the links are read for + // which tag, symptom or context applies, never for when the row appeared, + // and the parent entry carries its own timestamps, which do travel. + "MoodContext.createdAt": + "insert stamp of the per-entry context row; no reader, the mood entry's own timestamps travel", + "MoodEntryTagLink.createdAt": + "insert stamp of a tag link; no reader, the mood entry's own timestamps travel", + "CycleSymptomLink.createdAt": + "insert stamp of a symptom link; no reader, the day log's own timestamps travel", + "IllnessSymptomLink.createdAt": + "insert stamp of a symptom link; no reader, the illness day log's own timestamps travel", +}; + +/** + * Columns the restore carries on purpose as "set where it was set" rather + * than the same value, each with the reason. A presence check still fails a + * column that stops coming back at all. + */ +export const COLUMN_PRESENCE_ONLY: Readonly> = { + "Medication.autoMarkTakenSince": + "the auto-take floor restarts at the restore, so doses a portable file cannot carry as removed are not filled again; pinned in the restore test for it", +}; + +/** + * Values for columns the fixture leaves empty where the type alone does not + * produce one the export and the restore accept. + */ +export const FILL_OVERRIDES: Readonly> = { + "MedicationSchedule.rrule": "FREQ=WEEKLY;BYDAY=MO,TH", + "InboundDocument.sourceInstance": "https://paperless.example.test", + // The digest of the fixture's own document bytes, so a restore that checks + // it against the content finds them consistent. + "InboundDocument.contentSha256": createHash("sha256") + .update("round-trip document bytes") + .digest("hex"), + "Biomarker.contextEncrypted": () => + encryptContextToBytes("fasted, morning draw"), + "MoodEntry.tags": JSON.stringify(["round-trip-tag"]), + "CorrelationPattern.qValue": 0.04, + "CorrelationPattern.dismissedEvidenceHash": "ab".repeat(32), + // CHECK in migration 0408: the profile is built from samples or from hour buckets. + "IntradayCumulativeProfile.basis": "HOUR_BUCKETS", + // The posted hours are a whole day of slots (-1 for an hour not posted); + // the restore refuses any other length, as it does for the curve. + "IntradayCumulativeProfile.hourlyIncrements": Array.from( + { length: 24 }, + (_, hour) => (hour < 6 ? -1 : 350), + ), +}; + +/** + * Rows for the columns a CHECK constraint ties to a shape the base fixture + * does not have: a stage only on a sleep reading, a context only on a glucose + * reading, a rolling interval only on a schedule without a calendar rule. + */ +export async function seedColumnShapes(prisma: PrismaClient): Promise { + await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "BLOOD_GLUCOSE", + value: 5.4, + unit: "mmol/L", + measuredAt: AT("2026-07-03T06:45:00.000Z"), + source: "MANUAL", + glucoseContext: "FASTING", + }, + }); + await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "SLEEP_DURATION", + value: 95, + unit: "min", + measuredAt: AT("2026-07-03T02:00:00.000Z"), + source: "APPLE_HEALTH", + externalId: "round-trip-deep-sleep", + sleepStage: "DEEP", + }, + }); + // A start logged out of order and folded into the one before it: soft + // deleted, and pointing at the start that absorbed it so that removing that + // start can bring this one back. + const absorbing = await prisma.menstrualCycle.findFirstOrThrow({ + where: { userId: OWNER_ID, startDate: "2026-06-01" }, + }); + await prisma.menstrualCycle.create({ + data: { + userId: OWNER_ID, + startDate: "2026-06-03", + deletedAt: AT("2026-06-04T07:00:00.000Z"), + absorbedIntoId: absorbing.id, + }, + }); + const medication = await prisma.medication.findFirstOrThrow({ + where: { userId: OWNER_ID }, + }); + await prisma.medicationSchedule.create({ + data: { + medicationId: medication.id, + windowStart: "20:00", + windowEnd: "21:00", + label: "Every third evening", + rollingIntervalDays: 3, + }, + }); +} + +export type Delegate = { + findMany(args: { + where: Record; + }): Promise[]>; + update(args: { + where: Record; + data: Record; + }): Promise; +}; + +export function delegateOf(prisma: PrismaClient, model: AuditModel): Delegate { + return (prisma as unknown as Record)[model.delegate]; +} + +export function primaryKeyWhere( + model: AuditModel, + row: Record, +): Record { + if (model.primaryKey.length === 1) { + return { [model.primaryKey[0]]: row[model.primaryKey[0]] }; + } + return { + [model.primaryKey.join("_")]: Object.fromEntries( + model.primaryKey.map((k) => [k, row[k]]), + ), + }; +} + +/** How a column is compared, or why it is not. */ +export function comparison( + column: AuditColumn, +): "value" | "presence" | { excluded: string } { + const key = `${column.model}.${column.name}`; + if (key in COLUMN_EXCLUSIONS) return { excluded: COLUMN_EXCLUSIONS[key] }; + if (column.isId) { + return { excluded: "primary key; the restore may mint a fresh one" }; + } + if (column.name === "userId") { + return { excluded: "owner; re-derived from the restoring account" }; + } + if (column.isUpdatedAt) { + return { excluded: "@updatedAt; Prisma stamps it on the restore's write" }; + } + // A declared foreign key may be re-pointed at a row the restore minted, so + // it is held to being set where it was set, not to the same id. + if (column.isForeignKey) return "presence"; + if (key in COLUMN_PRESENCE_ONLY) return "presence"; + return "value"; +} + +/** + * A 1x1 PNG: the smallest picture the avatar upload, and so the restore, + * accepts. + */ +export const AVATAR_PNG = Buffer.from( + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", + "base64", +); + +/** + * Values for `User` columns where the type alone would produce one the + * restore rightly refuses: a vocabulary, a time zone, an AI endpoint, a + * threshold band, an image. + */ +export const USER_FILL_OVERRIDES: Readonly> = { + "User.gender": "FEMALE", + "User.locale": "fr", + "User.timezone": "America/Chicago", + "User.homeTimezone": "Asia/Tokyo", + "User.unitPreference": "imperial", + "User.glucoseUnit": "mmol/L", + "User.insightsPrivacyMode": "raw", + "User.aiProvider": "LOCAL", + "User.aiBaseUrl": "https://llm.example.com/v1", + "User.aiCompatBaseUrl": "https://gateway.example.com/v1", + "User.thresholdsJson": { WEIGHT: { min: 60, max: 80 } }, + // The restore admits goal by goal against the goals schema, so the generic + // `{ roundTrip }` blob would be refused as an unknown key, not carried. + "User.activityGoalsJson": { workoutsPerWeek: 4, stepsPerMonth: 250_000 }, + "User.globalExcludedInjectionSites": ["THIGH_LEFT"], + "User.avatarBytes": () => { + const bytes = new Uint8Array(new ArrayBuffer(AVATAR_PNG.byteLength)); + bytes.set(AVATAR_PNG); + return bytes; + }, + "User.avatarContentType": "image/png", + // v1.42 — a sealed home the way the writers seal it, so it opens. + "User.homeLocationEncrypted": () => + sealLocation({ lat: 2.5, lon: 2.5, label: "round-trip home" }), +}; diff --git a/tests/integration/backup-parity.test.ts b/tests/integration/backup-parity.test.ts new file mode 100644 index 000000000..db96867bd --- /dev/null +++ b/tests/integration/backup-parity.test.ts @@ -0,0 +1,1436 @@ +/** + * The backup file and the restored account, pinned against golden copies. + * + * The other backup tests each prove one property: every model comes back + * (`backup-round-trip.test.ts`), every column does, a refusal happens before + * the first delete. None of them says the whole file and the whole restored + * account are what they were yesterday, and that is the claim a change to the + * backup code has to keep when it means to change nothing. This file makes it: + * + * 1. Fill one account as far as the schema allows: a row of every + * two-ended model, every column of those rows, every column of the + * account row, the instance settings, and a sharing grant beside it. + * 2. Export it both ways (disaster recovery, portable) and pin the files, + * their counts, the parsed payload and the preview. + * 3. Restore each file into a fresh account, and the disaster-recovery file + * once more over the live account, and pin what the restore answered, + * the phases it reported, the audit rows and wide-event fields it wrote, + * every row the account holds afterwards, and the file it exports then. + * 4. Restore a version-1 file in the old shapes (no ids, references by + * name, the retired heart-rate variability filing, the Coach switch in + * module availability) over an account that already holds rows. + * 5. Hand the restore malformed and unresolvable files and pin each refusal + * and each skip report, and the schema's issue list for a bad file. + * + * Values that legitimately differ between two runs are normalised, never + * dropped: ids become `` in order of first appearance, ciphertext + * becomes the text it opens to (or its length when no codec opens it), and a + * timestamp written during the run becomes ``. Key order is kept, so a + * file that carries the same values in another order differs. + * + * `BACKUP_PARITY_WRITE=1` rewrites the golden copies. Only do that for a + * change that means to alter the backup, and review the diff of + * `tests/integration/__golden__/backup-parity/` as part of it. + */ +import { Buffer } from "node:buffer"; +import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { join, resolve } from "node:path"; + +import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; + +import type { PrismaClient } from "@/generated/prisma/client"; +import { decrypt, decryptBytes, encrypt } from "@/lib/crypto"; +import { decryptFromBytes } from "@/lib/ai/coach/bytes-codec"; +import { openDayCountry } from "@/lib/dawarich/connection"; +import { openLocation } from "@/lib/environment/location-cipher"; +import { decryptFactData, decryptFactProvenance } from "@/lib/documents/store"; +import { decryptWaveformFromBytes } from "@/lib/withings/ecg-waveform-codec"; +import { decryptNoteFromBytes } from "@/lib/labs/store"; +import { decryptContextFromBytes } from "@/lib/labs/biomarker-store"; +import { buildFullBackupPayload } from "@/lib/export/full-backup-payload"; +import { streamFullBackupJson } from "@/lib/export/full-backup-stream"; +import { createBackupPreviewCollector } from "@/lib/export/backup-preview"; +import { TWO_ENDED_MODELS } from "@/lib/export/backup-plan"; +import { + restoreBackup, + type RestoreBackupOutcome, +} from "@/lib/export/restore-backup"; +import { STORED_BACKUP_SELECT } from "@/lib/export/stored-backup"; +import { parseBackupPayload } from "@/lib/validations/backup"; +import { summarizeBackup } from "@/lib/validations/backup-summary"; +import { legacyStreamedBlobFrom } from "@/__tests__/helpers/legacy-backup-blob"; +import { + type AuditModel, + enumValuesFromSchema, + isDefaultValue, + ownerWhere, + readAuditModels, + syntheticValue, +} from "./backup-column-audit"; +import { + COLUMN_PRESENCE_ONLY, + FILL_OVERRIDES, + OWNER_ID, + TOMBSTONE_DELETED_AT, + USER_FILL_OVERRIDES, + comparison, + createOwner, + delegateOf, + primaryKeyWhere, + seedAdminSession, + seedColumnShapes, + seedEveryTwoEndedModel, +} from "./backup-fixture"; +import { getPrismaClient, truncateAllTables } from "./setup"; + +vi.mock("next/headers", async () => { + const { cookieJar, headerJar } = await import("./mock-next-headers"); + return { + headers: vi.fn(async () => ({ + get: (name: string) => headerJar.get(name.toLowerCase()) ?? null, + })), + cookies: vi.fn(async () => ({ + get: (name: string) => { + const value = cookieJar.get(name); + return value ? { name, value } : undefined; + }, + set: (name: string, value: string) => cookieJar.set(name, value), + delete: (name: string) => cookieJar.delete(name), + })), + }; +}); + +vi.mock("@/lib/db-compat", () => ({ + ensureDbCompatibility: vi.fn().mockResolvedValue(undefined), +})); + +/** What the restore asked of the world outside its transaction. */ +const effects = vi.hoisted(() => ({ + invalidated: [] as string[], + unitRefresh: [] as string[], + foldRepair: [] as string[], + annotations: [] as unknown[], +})); + +vi.mock("@/lib/cache/invalidate", () => ({ + invalidateUserData: vi.fn((userId: string) => { + effects.invalidated.push(userId); + }), +})); + +vi.mock("@/lib/insights/unit-change-refresh", () => ({ + refreshTextsAfterUnitChange: vi.fn(async (userId: string) => { + effects.unitRefresh.push(userId); + }), +})); + +vi.mock("@/lib/jobs/measurement-fold-repair", async (importOriginal) => ({ + ...(await importOriginal()), + enqueueMeasurementFoldRepair: vi.fn(async (userId: string) => { + effects.foldRepair.push(userId); + }), +})); + +vi.mock("@/lib/logging/context", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + annotate: vi.fn((...args: Parameters) => { + effects.annotations.push(args[0]); + return actual.annotate(...args); + }), + }; +}); + +const GOLDEN_DIR = resolve(__dirname, "__golden__/backup-parity"); +const WRITE = process.env.BACKUP_PARITY_WRITE === "1"; +const EXPORTED_AT = new Date("2026-08-01T00:00:00.000Z"); +const RUN_STARTED = Date.now(); +const DELEGATE_ID = "parity-delegate"; +const SLOW = 240_000; + +// ── Normalisation ──────────────────────────────────────────────────────────── + +const CUID = /\bc[a-z0-9]{24}\b/g; +const ISO = /\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z\b/g; +const DAY = /^\d{4}-\d{2}-\d{2}$/; +const BASE64 = /^[A-Za-z0-9+/]+={0,2}$/; +const VERSIONED = /^[A-Za-z0-9_-]{1,32}\.[A-Za-z0-9+/=]{24,}$/; +const SEALED_KEY = /(Encrypted|Sealed)$/; + +/** Every codec a sealed byte value is written with, tried in order. */ +const BYTE_OPENERS: ReadonlyArray<(value: Uint8Array) => string> = [ + decryptFromBytes, + decryptNoteFromBytes, + decryptContextFromBytes, + (value) => JSON.stringify(openLocation(value)), + (value) => { + const code = openDayCountry(value); + if (code === null) throw new Error("not a sealed day country"); + return `country:${code}`; + }, + (value) => JSON.stringify(decryptWaveformFromBytes(value)), + (value) => JSON.stringify(decryptFactData(Buffer.from(value))), + (value) => JSON.stringify(decryptFactProvenance(Buffer.from(value))), + (value) => `bytes:${decryptBytes(Buffer.from(value)).toString("base64")}`, +]; + +function openBytes(value: Uint8Array): string | null { + for (const open of BYTE_OPENERS) { + try { + const text = open(value); + if (text !== undefined && text !== "null") return text; + } catch { + continue; + } + } + return null; +} + +function openString(value: string): string | null { + try { + return decrypt(value); + } catch { + // not the string codec; try it as base64 of a sealed byte value + } + if (value.length % 4 === 0 && BASE64.test(value)) { + return openBytes(Buffer.from(value, "base64")); + } + return null; +} + +/** + * One normalisation pass. Ids are numbered in the order this pass first meets + * them, so two documents normalised by two passes compare by shape. + */ +class Normaliser { + private readonly ids = new Map(); + private readonly windowFrom = RUN_STARTED - 5 * 60_000; + private readonly days: ReadonlySet; + + constructor() { + const today = (t: number) => new Date(t).toISOString().slice(0, 10); + this.days = new Set([today(RUN_STARTED), today(Date.now())]); + } + + private alias(id: string): string { + let alias = this.ids.get(id); + if (!alias) { + alias = ``; + this.ids.set(id, alias); + } + return alias; + } + + text(value: string): string { + const windowTo = Date.now() + 5 * 60_000; + const out = value + .replace(CUID, (id) => this.alias(id)) + .replace(ISO, (iso) => { + if (iso === TOMBSTONE_DELETED_AT) return ""; + const at = Date.parse(iso); + return at >= this.windowFrom && at <= windowTo ? "" : iso; + }); + return DAY.test(out) && this.days.has(out) ? "" : out; + } + + sealed(value: string): string { + const opened = openString(value); + return opened === null + ? `` + : ``; + } + + /** A JSON value, key order kept. */ + json(value: unknown, key = ""): unknown { + if (typeof value === "string") { + if (SEALED_KEY.test(key) || VERSIONED.test(value)) { + const opened = openString(value); + if (opened !== null || SEALED_KEY.test(key)) return this.sealed(value); + } + return this.text(value); + } + if (Array.isArray(value)) return value.map((item) => this.json(item, key)); + if (value && typeof value === "object") { + return Object.fromEntries( + Object.entries(value).map(([k, v]) => [k, this.json(v, k)]), + ); + } + return value; + } + + /** A database value: dates, bytes, decimals and big integers made JSON. */ + db(value: unknown, key = ""): unknown { + if (value === null || value === undefined) return null; + if (value instanceof Date) return this.text(value.toISOString()); + if (value instanceof Uint8Array) { + const opened = openBytes(value); + return opened === null + ? `` + : ``; + } + if (typeof value === "bigint") return `bigint:${value}`; + if ( + typeof value === "object" && + !Array.isArray(value) && + "toFixed" in value + ) { + return `decimal:${String(value)}`; + } + if (Array.isArray(value)) return value.map((item) => this.db(item, key)); + if (typeof value === "object") { + return Object.fromEntries( + Object.entries(value as object).map(([k, v]) => [k, this.db(v, k)]), + ); + } + return this.json(value, key); + } +} + +/** Rows in an order that does not depend on their ids or on the heap. */ +function sortRows(rows: Record[]): Record[] { + const keyOf = (row: Record) => + JSON.stringify(row, (_k, v) => { + if (typeof v === "bigint") return `bigint:${v}`; + if (v instanceof Uint8Array) return `bytes:${v.byteLength}`; + if (typeof v === "string") return v.replace(CUID, ""); + return v; + }); + return [...rows].sort((a, b) => keyOf(a).localeCompare(keyOf(b))); +} + +// ── Golden copies ──────────────────────────────────────────────────────────── + +/** Paths where two JSON values differ, key order included, first 40. */ +function differences(expected: unknown, actual: unknown, path = "$"): string[] { + const out: string[] = []; + const walk = (e: unknown, a: unknown, at: string) => { + if (out.length >= 40) return; + if (Array.isArray(e) && Array.isArray(a)) { + if (e.length !== a.length) { + out.push(`${at}: length ${e.length} -> ${a.length}`); + } + for (let i = 0; i < Math.min(e.length, a.length); i++) { + walk(e[i], a[i], `${at}[${i}]`); + } + return; + } + if ( + e && + a && + typeof e === "object" && + typeof a === "object" && + !Array.isArray(e) && + !Array.isArray(a) + ) { + const ek = Object.keys(e); + const ak = Object.keys(a); + for (const k of ek) if (!ak.includes(k)) out.push(`${at}.${k}: removed`); + for (const k of ak) if (!ek.includes(k)) out.push(`${at}.${k}: added`); + const shared = ek.filter((k) => ak.includes(k)); + const order = ak.filter((k) => ek.includes(k)); + if (shared.join() !== order.join()) out.push(`${at}: key order changed`); + for (const k of shared) { + walk( + (e as Record)[k], + (a as Record)[k], + `${at}.${k}`, + ); + } + return; + } + if (JSON.stringify(e) !== JSON.stringify(a)) { + out.push( + `${at}: ${JSON.stringify(e)?.slice(0, 120)} -> ${JSON.stringify(a)?.slice(0, 120)}`, + ); + } + }; + walk(expected, actual, path); + return out; +} + +function matchGolden(name: string, actual: unknown): void { + const text = `${JSON.stringify(actual, null, 2)}\n`; + const path = join(GOLDEN_DIR, `${name}.json`); + if (WRITE) { + mkdirSync(GOLDEN_DIR, { recursive: true }); + writeFileSync(path, text); + return; + } + expect( + existsSync(path), + `${path} is missing; write it with BACKUP_PARITY_WRITE=1`, + ).toBe(true); + const expected = readFileSync(path, "utf8"); + if (expected === text) return; + expect( + differences(JSON.parse(expected), actual), + `${name} differs from its golden copy`, + ).toEqual([]); + expect(text, `${name} differs from its golden copy`).toBe(expected); +} + +/** How many leaf values a document holds, so a near-empty one cannot pass. */ +function leafCount(value: unknown): number { + if (Array.isArray(value)) return value.reduce((n, v) => n + leafCount(v), 0); + if (value && typeof value === "object") { + return Object.values(value).reduce((n, v) => n + leafCount(v), 0); + } + return 1; +} + +// ── The account ────────────────────────────────────────────────────────────── + +const SNAPSHOT_EXTRA_MODELS = ["AccountGrant"] as const; + +function auditModels(prisma: PrismaClient): AuditModel[] { + return readAuditModels(prisma, TWO_ENDED_MODELS); +} + +/** + * Give every column of the fixture's rows a value that is not its default, + * the way the column round trip does, and say which ones would not take one. + */ +async function fillDefaultedColumns(prisma: PrismaClient): Promise { + const models = auditModels(prisma); + const byName = new Map(models.map((m) => [m.name, m])); + const enumValues = enumValuesFromSchema(); + const unfillable: string[] = []; + for (const model of models) { + const rows = await delegateOf(prisma, model).findMany({ + where: ownerWhere(byName, prisma, model.name, OWNER_ID), + }); + if (rows.length === 0) continue; + for (const column of model.columns) { + if ( + comparison(column) !== "value" && + !(`${model.name}.${column.name}` in COLUMN_PRESENCE_ONLY) + ) { + continue; + } + if (column.name === "deletedAt") continue; + if (rows.some((row) => !isDefaultValue(column, row[column.name]))) { + continue; + } + try { + await delegateOf(prisma, model).update({ + where: primaryKeyWhere(model, rows[0]), + data: { + [column.name]: syntheticValue(column, enumValues, FILL_OVERRIDES), + }, + }); + } catch { + unfillable.push(`${model.name}.${column.name}`); + } + } + } + return unfillable; +} + +/** Every column of one row, through its delegate, with the given overrides. */ +async function fillRow( + prisma: PrismaClient, + modelName: string, + where: Record, + overrides: Readonly>, + skip: ReadonlySet, +): Promise { + const [model] = readAuditModels(prisma, [modelName]); + const enumValues = enumValuesFromSchema(); + const unfillable: string[] = []; + for (const column of model.columns) { + if (column.isId || column.isUpdatedAt || skip.has(column.name)) continue; + try { + await delegateOf(prisma, model).update({ + where, + data: { [column.name]: syntheticValue(column, enumValues, overrides) }, + }); + } catch { + unfillable.push(`${modelName}.${column.name}`); + } + } + return unfillable; +} + +const APP_SETTINGS_OVERRIDES: Readonly> = { + "AppSettings.defaultLocale": "fr", + "AppSettings.defaultUserTimezone": "America/Chicago", + "AppSettings.moduleAvailabilityJson": { mood: "off" }, + "AppSettings.adminAiInsightsFeedbackSummary": { helpful: 3 }, + "AppSettings.aiReasoningMaxEffort": "low", +}; + +/** The whole account, and the host around it. */ +async function seedMaximalAccount(prisma: PrismaClient) { + const admin = await seedAdminSession(prisma); + await createOwner(prisma); + await prisma.illnessSymptom.deleteMany({ + where: { key: "round_trip_cough" }, + }); + await seedEveryTwoEndedModel(prisma); + await seedColumnShapes(prisma); + const unfillable = await fillDefaultedColumns(prisma); + unfillable.push( + ...(await fillRow( + prisma, + "User", + { id: OWNER_ID }, + USER_FILL_OVERRIDES, + new Set(["username", "role", "email"]), + )), + ); + await prisma.appSettings.upsert({ + where: { id: "singleton" }, + create: { id: "singleton" }, + update: {}, + }); + unfillable.push( + ...(await fillRow( + prisma, + "AppSettings", + { id: "singleton" }, + APP_SETTINGS_OVERRIDES, + new Set(), + )), + ); + // A grant the owner gave, which the file never carries and a restore into + // the same account never touches. + await prisma.user.create({ + data: { + id: DELEGATE_ID, + username: "parity-delegate", + email: "parity-delegate@example.test", + }, + }); + await prisma.accountGrant.create({ + data: { + grantorId: OWNER_ID, + granteeId: DELEGATE_ID, + access: "WRITE", + scopeJson: { sections: ["measurements"] }, + acceptedAt: new Date("2026-07-02T09:00:00.000Z"), + }, + }); + return { admin, unfillable: unfillable.sort() }; +} + +/** Every row the account holds, model by model, normalised. */ +async function snapshotAccount( + prisma: PrismaClient, + userId: string, +): Promise> { + const n = new Normaliser(); + const models = auditModels(prisma); + const byName = new Map(models.map((m) => [m.name, m])); + const out: Record = {}; + for (const model of models) { + const rows = await delegateOf(prisma, model).findMany({ + where: ownerWhere(byName, prisma, model.name, userId), + }); + out[model.name] = sortRows(rows).map((row) => n.db(row)); + } + for (const name of SNAPSHOT_EXTRA_MODELS) { + const rows = await prisma.accountGrant.findMany({ + where: { OR: [{ grantorId: userId }, { granteeId: userId }] }, + }); + out[name] = sortRows(rows as Record[]).map((row) => + n.db(row), + ); + } + out.User = n.db(await prisma.user.findUnique({ where: { id: userId } })); + out.AppSettings = n.db( + await prisma.appSettings.findUnique({ where: { id: "singleton" } }), + ); + return out; +} + +async function exportFile( + prisma: PrismaClient, + purpose: "disaster-recovery" | "portable-export", +) { + const built = await buildFullBackupPayload(prisma, OWNER_ID, { + purpose, + exportedAt: EXPORTED_AT, + }); + let json = ""; + const preview = await createBackupPreviewCollector(); + const counts = await streamFullBackupJson( + prisma, + OWNER_ID, + (chunk) => { + json += chunk; + }, + { purpose, exportedAt: EXPORTED_AT, observe: preview.observe }, + ); + // The two writers must write the same bytes; everything below is then + // about both. + expect(json).toBe(JSON.stringify(built.payload)); + return { + json, + builtCounts: built.counts, + streamedCounts: counts, + preview: preview.finish(counts), + }; +} + +function normalisedExport(file: Awaited>) { + const n = new Normaliser(); + const payload = JSON.parse(file.json); + const parsed = parseBackupPayload(payload); + return { + payload: n.json(payload), + builtCounts: file.builtCounts, + streamedCounts: file.streamedCounts, + parsed: n.json(JSON.parse(JSON.stringify(parsed))), + summary: summarizeBackup(parsed), + preview: n.json(JSON.parse(JSON.stringify(file.preview))), + }; +} + +async function storeCopy( + prisma: PrismaClient, + userId: string, + type: string, + json: string, +) { + const row = await prisma.dataBackup.create({ + data: { + userId, + type, + data: await legacyStreamedBlobFrom(async (write) => { + await write(json); + }), + }, + select: STORED_BACKUP_SELECT, + }); + return row; +} + +interface RestoreRun { + outcome: unknown; + progress: unknown[]; + audit: unknown[]; + effects: unknown; +} + +/** Restore one stored copy and record everything it reported. */ +async function runRestore( + prisma: PrismaClient, + backup: Awaited>, + actorUserId: string, + restoreInstanceSettings: boolean, +): Promise<{ run: RestoreRun; raw: RestoreBackupOutcome }> { + effects.invalidated.length = 0; + effects.unitRefresh.length = 0; + effects.foldRepair.length = 0; + effects.annotations.length = 0; + const auditFrom = new Date(); + const progress: Array> = []; + const raw = await restoreBackup({ + backup, + actorUserId, + ipAddress: null, + restoreInstanceSettings, + progress: (phase, p) => { + const entry = { + phase, + sectionsDone: p.sectionsDone, + sectionsTotal: p.sectionsTotal, + measurementsTotal: p.measurementsTotal, + }; + const last = progress[progress.length - 1]; + if (!last || JSON.stringify(last) !== JSON.stringify(entry)) { + progress.push(entry); + } + }, + }); + const audit = await prisma.auditLog.findMany({ + where: { createdAt: { gte: auditFrom }, action: { startsWith: "admin." } }, + orderBy: [{ createdAt: "asc" }, { id: "asc" }], + select: { action: true, userId: true, details: true }, + }); + const n = new Normaliser(); + return { + raw, + run: { + outcome: n.json(JSON.parse(JSON.stringify(raw))), + progress, + audit: audit.map((row) => ({ + action: row.action, + userId: row.userId === actorUserId ? "" : row.userId, + details: n.json(row.details ? JSON.parse(row.details) : null), + })), + effects: n.json({ + invalidated: [...effects.invalidated], + unitRefresh: [...effects.unitRefresh], + foldRepair: [...effects.foldRepair], + annotations: JSON.parse(JSON.stringify(effects.annotations)), + }), + }, + }; +} + +async function recreateOwner(prisma: PrismaClient) { + await prisma.user.delete({ where: { id: OWNER_ID } }); + await createOwner(prisma); + await prisma.accountGrant.create({ + data: { + grantorId: OWNER_ID, + granteeId: DELEGATE_ID, + access: "READ", + acceptedAt: new Date("2026-07-03T09:00:00.000Z"), + }, + }); +} + +// ── The cases ──────────────────────────────────────────────────────────────── + +describe("backup parity", () => { + const prisma = getPrismaClient(); + let adminId = ""; + let drJson = ""; + let portableJson = ""; + let drRestoredSnapshot: Record = {}; + + beforeAll(async () => { + await truncateAllTables(prisma); + }, SLOW); + + afterAll(async () => { + await truncateAllTables(prisma); + }, SLOW); + + it( + "exports the maximal account as it did", + async () => { + const { admin, unfillable } = await seedMaximalAccount(prisma); + adminId = admin.id; + const before = await snapshotAccount(prisma, OWNER_ID); + const dr = await exportFile(prisma, "disaster-recovery"); + const portable = await exportFile(prisma, "portable-export"); + drJson = dr.json; + portableJson = portable.json; + + const drNormalised = normalisedExport(dr); + // A near-empty file would agree with a near-empty golden copy. + expect(leafCount(drNormalised.payload)).toBeGreaterThan(1200); + expect( + Object.values(before).filter( + (rows) => Array.isArray(rows) && rows.length > 0, + ).length, + ).toBeGreaterThanOrEqual(TWO_ENDED_MODELS.length); + + matchGolden("seeded-account", { unfillable, snapshot: before }); + matchGolden("export-disaster-recovery", drNormalised); + matchGolden("export-portable", normalisedExport(portable)); + }, + SLOW, + ); + + it( + "restores the disaster-recovery file into a fresh account as it did", + async () => { + expect(drJson).not.toBe(""); + await recreateOwner(prisma); + const backup = await storeCopy(prisma, OWNER_ID, "PARITY_DR", drJson); + const { run, raw } = await runRestore(prisma, backup, adminId, true); + expect(raw.ok, JSON.stringify([raw, run.audit])).toBe(true); + drRestoredSnapshot = await snapshotAccount(prisma, OWNER_ID); + const reexport = await exportFile(prisma, "disaster-recovery"); + matchGolden("restore-disaster-recovery", { + ...run, + snapshot: drRestoredSnapshot, + reexport: new Normaliser().json(JSON.parse(reexport.json)), + }); + }, + SLOW, + ); + + it( + "restores the disaster-recovery file over the live account as it did", + async () => { + expect(drJson).not.toBe(""); + const backup = await storeCopy( + prisma, + OWNER_ID, + "PARITY_DR_LIVE", + drJson, + ); + const { run, raw } = await runRestore(prisma, backup, adminId, false); + expect(raw.ok, JSON.stringify([raw, run.audit])).toBe(true); + const snapshot = await snapshotAccount(prisma, OWNER_ID); + matchGolden("restore-disaster-recovery-over-live", { + ...run, + snapshotChanges: differences(drRestoredSnapshot, snapshot), + }); + }, + SLOW, + ); + + it( + "restores the portable file into a fresh account as it did", + async () => { + expect(portableJson).not.toBe(""); + await recreateOwner(prisma); + // A portable file carries document metadata only, which the restore + // refuses to turn into documents; the file of an account without any + // is the portable file a restore takes. + const backup = await storeCopy( + prisma, + OWNER_ID, + "PARITY_PORTABLE", + JSON.stringify({ ...JSON.parse(portableJson), documents: [] }), + ); + const { run, raw } = await runRestore(prisma, backup, adminId, false); + expect(raw.ok, JSON.stringify([raw, run.audit])).toBe(true); + const snapshot = await snapshotAccount(prisma, OWNER_ID); + const reexport = await exportFile(prisma, "portable-export"); + matchGolden("restore-portable", { + ...run, + snapshot, + reexport: new Normaliser().json(JSON.parse(reexport.json)), + }); + }, + SLOW, + ); + + it( + "restores a version-1 file in the old shapes over a live account as it did", + async () => { + await recreateOwner(prisma); + await seedLiveRowsForLegacyRestore(prisma); + const backup = await prisma.dataBackup.create({ + data: { + userId: OWNER_ID, + type: "PARITY_V1", + data: encrypt(JSON.stringify(legacyVersionOneFile())), + }, + select: STORED_BACKUP_SELECT, + }); + const { run, raw } = await runRestore(prisma, backup, adminId, true); + expect(raw.ok, JSON.stringify([raw, run.audit])).toBe(true); + const snapshot = await snapshotAccount(prisma, OWNER_ID); + const reexport = await exportFile(prisma, "disaster-recovery"); + matchGolden("restore-version-1", { + ...run, + snapshot, + reexport: new Normaliser().json(JSON.parse(reexport.json)), + }); + }, + SLOW, + ); + + it( + "names what it skips in a file it can only partly place, as it did", + async () => { + await recreateOwner(prisma); + const backup = await prisma.dataBackup.create({ + data: { + userId: OWNER_ID, + type: "PARITY_SKIPS", + data: encrypt(JSON.stringify(partlyPlaceableFile())), + }, + select: STORED_BACKUP_SELECT, + }); + const { run, raw } = await runRestore(prisma, backup, adminId, false); + expect(raw.ok, JSON.stringify([raw, run.audit])).toBe(true); + const snapshot = await snapshotAccount(prisma, OWNER_ID); + matchGolden("restore-skips", { ...run, snapshot }); + }, + SLOW, + ); + + it( + "refuses each malformed or unplaceable file as it did", + async () => { + await recreateOwner(prisma); + await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "WEIGHT", + value: 70, + unit: "kg", + source: "MANUAL", + measuredAt: new Date("2026-07-05T07:00:00.000Z"), + }, + }); + const before = await snapshotAccount(prisma, OWNER_ID); + const results: Record = {}; + for (const [name, body] of Object.entries(refusedFiles())) { + const backup = await prisma.dataBackup.create({ + data: { + userId: OWNER_ID, + type: `PARITY_REFUSE_${name}`, + data: + typeof body === "string" ? body : encrypt(JSON.stringify(body)), + }, + select: STORED_BACKUP_SELECT, + }); + const { run, raw } = await runRestore(prisma, backup, adminId, false); + expect(raw.ok, `${name} was restored`).toBe(false); + results[name] = run; + } + // Every refusal leaves the account exactly as it was. + expect( + differences(before, await snapshotAccount(prisma, OWNER_ID)), + ).toEqual([]); + matchGolden("refusals", results); + }, + SLOW, + ); + + it("reports the schema's issues for a malformed file as it did", () => { + const issues: Record = {}; + for (const [name, body] of Object.entries(schemaInvalidFiles())) { + try { + parseBackupPayload(body); + issues[name] = "parsed"; + } catch (error) { + issues[name] = JSON.parse( + JSON.stringify((error as { issues?: unknown }).issues ?? null), + ); + } + } + expect(Object.values(issues)).not.toContain("parsed"); + matchGolden("schema-issues", new Normaliser().json(issues)); + }); +}); + +// ── Hand-built files ───────────────────────────────────────────────────────── + +/** Rows the version-1 file meets: a reading it reconciles by natural key. */ +async function seedLiveRowsForLegacyRestore(prisma: PrismaClient) { + await prisma.measurement.create({ + data: { + userId: OWNER_ID, + type: "WEIGHT", + value: 99, + unit: "kg", + source: "MANUAL", + measuredAt: new Date("2026-07-01T07:00:00.000Z"), + }, + }); + await prisma.moodEntry.create({ + data: { + userId: OWNER_ID, + date: "2026-07-02", + mood: "BAD", + score: 2, + moodLoggedAt: new Date("2026-07-02T20:00:00.000Z"), + }, + }); +} + +function legacyVersionOneFile(): Record { + return { + schemaVersion: "1", + exportedAt: "2026-07-20T08:00:00.000Z", + userId: OWNER_ID, + appSettings: { + id: "singleton", + registrationEnabled: false, + mfaRequired: true, + defaultLocale: "de", + telegramGlobal: true, + ntfyGlobal: false, + webPushGlobal: true, + webPushVapidPublicKey: null, + webPushVapidPrivateKeyEncrypted: null, + webPushVapidSubject: null, + apiGlobal: true, + umamiEnabled: false, + umamiScriptUrl: null, + umamiWebsiteId: null, + glitchtipEnabled: false, + glitchtipDsn: null, + glitchtipEnvironment: null, + reminderLateMinutes: 30, + reminderMissedMinutes: 120, + adminAiKeyEncrypted: null, + adminAiModel: "gpt-legacy", + adminAiBaseUrl: "https://api.example.com/v1", + adminCodexAccessTokenEncrypted: null, + adminCodexRefreshTokenEncrypted: null, + adminCodexAccountIdEncrypted: null, + adminCodexTokenExpiresAt: null, + adminCodexConnectedAt: null, + adminCodexConnectionStatus: "disconnected", + adminAiInsightsFeedbackSummary: null, + defaultUserTimezone: "Europe/Berlin", + assistantEnabled: true, + assistantCoachEnabled: true, + assistantBriefingEnabled: true, + assistantInsightStatusEnabled: true, + moduleAvailabilityJson: { coach: "off", mood: "on" }, + documentMaxFileBytes: 10_000_000, + documentQuotaBytes: "500000000", + }, + measurements: [ + // Reconciled onto the live reading of the same type, source and instant. + { + type: "WEIGHT", + value: 74.5, + unit: "kg", + measuredAt: "2026-07-01T07:00:00.000Z", + source: "MANUAL", + notes: "after the long ride", + }, + { + type: "BLOOD_PRESSURE_SYS", + value: 128, + unit: "mmHg", + measuredAt: "2026-07-01T07:05:00.000Z", + }, + // The retired filing: Fitbit RMSSD written as the SDNN series. + { + type: "HEART_RATE_VARIABILITY", + value: 41, + unit: "ms", + measuredAt: "2026-07-02T04:00:00.000Z", + source: "FITBIT", + externalId: "fitbit-hrv-2026-07-02", + }, + { + type: "HEART_RATE_VARIABILITY", + value: 39, + unit: "ms", + measuredAt: "2026-07-03T04:00:00.000Z", + source: "FITBIT", + externalId: "fitbit-hrv-2026-07-03", + }, + { + type: "HRV_RMSSD", + value: 40, + unit: "ms", + measuredAt: "2026-07-03T04:00:00.000Z", + source: "FITBIT", + externalId: "fitbit-hrv-2026-07-03", + }, + ], + medications: [ + { + name: "Ramipril", + dose: "5 mg", + active: true, + schedules: [{ windowStart: "07:00", windowEnd: "09:00", label: null }], + }, + { + name: "Vitamin D", + dose: "1000 IU", + endsOn: "2026-08-01T00:00:00.000Z", + schedules: [], + }, + ], + intakeEvents: [ + { + medication: "Ramipril", + scheduledFor: "2026-07-01T07:00:00.000Z", + takenAt: "2026-07-01T07:10:00.000Z", + skipped: false, + }, + { + medication: "Vitamin D", + scheduledFor: "2026-07-01T08:00:00.000Z", + takenAt: null, + skipped: true, + }, + ], + moodEntries: [ + // Upserted onto the live entry of the same day and instant. + { + date: "2026-07-02", + mood: "GOOD", + score: 4, + tags: null, + note: "slept well", + loggedAt: "2026-07-02T20:00:00.000Z", + factors: [], + }, + { + date: "2026-07-03", + mood: "OKAY", + score: 3, + tags: null, + loggedAt: "2026-07-03T20:00:00.000Z", + source: "MOODLOG", + externalId: "moodlog-2026-07-03", + factors: [], + }, + ], + biomarkers: [ + { + name: "Ferritin", + unit: "ng/mL", + lowerBound: 30, + upperBound: 400, + panel: "Iron", + hidden: false, + context: "fasted", + }, + ], + labResults: [ + { + panel: "Iron", + analyte: "Ferritin", + value: 91, + valueText: null, + unit: "ng/mL", + referenceLow: 30, + referenceHigh: 400, + sourceReferenceLow: null, + sourceReferenceHigh: null, + sourceReferenceText: null, + takenAt: "2026-07-05T08:00:00.000Z", + source: "MANUAL", + biomarkerName: "Ferritin", + note: "morning draw", + }, + ], + illnessEpisodes: [ + { + id: "legacy-episode-parent", + label: "Hypertension", + type: "CHRONIC", + lifecycle: "CHRONIC_ONGOING", + onsetAt: "2025-01-01T00:00:00.000Z", + resolvedAt: null, + parentConditionId: null, + note: "since last year", + dayLogs: [], + }, + { + id: "legacy-episode-child", + label: "Headache", + type: "OTHER", + lifecycle: "ACUTE", + onsetAt: "2026-07-01T00:00:00.000Z", + resolvedAt: "2026-07-02T00:00:00.000Z", + parentConditionId: "legacy-episode-parent", + note: null, + bodySite: "forehead", + dayLogs: [ + { + date: "2026-07-01", + functionalImpact: 2, + feverC: null, + note: "afternoon", + symptoms: [], + }, + ], + }, + ], + allergies: [ + { + id: "legacy-allergy", + substance: "Penicillin", + category: "MEDICATION", + type: "ALLERGY", + severity: "SEVERE", + status: "ACTIVE", + onsetAt: null, + reaction: "rash", + note: "childhood", + }, + ], + familyHistory: [ + { + id: "legacy-family", + relationship: "FATHER", + condition: "Diabetes", + ageAtOnset: 55, + note: "type 2", + }, + ], + workouts: [ + { + sportType: "RUNNING", + startedAt: "2026-07-04T06:00:00.000Z", + endedAt: "2026-07-04T06:40:00.000Z", + durationSec: 2400, + totalEnergyKcal: 410, + totalDistanceM: 6500, + avgHeartRate: 148, + maxHeartRate: 171, + minHeartRate: 98, + stepCount: 6200, + elevationM: 40, + pauseDurationSec: null, + source: "MANUAL", + externalId: null, + }, + ], + nutrientDays: [ + { + day: "2026-07-04", + nutrient: "WATER", + amount: 2100, + unit: "mL", + source: "MANUAL", + }, + ], + }; +} + +/** A current-format file whose references this instance can only partly place. */ +function partlyPlaceableFile(): Record { + return { + schemaVersion: "2", + exportedAt: "2026-07-20T08:00:00.000Z", + userId: OWNER_ID, + accountSettings: { + locale: "xx-unknown", + timezone: "Not/AZone", + unitPreference: "metric", + thresholdsJson: { + WEIGHT: { min: 60, max: 80 }, + NOT_A_METRIC: { min: 1, max: 2 }, + }, + globalExcludedInjectionSites: ["THIGH_LEFT", "NOWHERE"], + aiProvider: "OPENAI", + aiBaseUrl: "https://llm.example.com/v1", + }, + measurements: [ + { + id: "skips-measurement", + type: "WEIGHT", + value: 72, + unit: "kg", + measuredAt: "2026-07-01T07:00:00.000Z", + source: "MANUAL", + }, + ], + medications: [ + { + id: "skips-medication", + name: "Metformin", + dose: "500 mg", + schedules: [], + scheduleRevisions: [ + { + validFrom: "2026-06-01T00:00:00.000Z", + validUntil: "2026-06-15T00:00:00.000Z", + payload: { schedules: [] }, + supersededByIndex: 7, + }, + { + validFrom: "2026-06-15T00:00:00.000Z", + validUntil: "2026-07-01T00:00:00.000Z", + payload: { schedules: [] }, + supersededByIndex: 1, + }, + ], + efficacyTargets: [ + { biomarkerName: "HbA1c that is not in the file", primary: true }, + { measurementType: "BLOOD_GLUCOSE", primary: false }, + ], + }, + ], + hiddenMoodTags: [{ key: "a_tag_nobody_has" }], + customMoodTagCategories: [ + { + id: "skips-mood-category", + key: "custom:skips-mood-category", + labelKey: "custom", + sortOrder: 0, + isActive: true, + label: "Evenings", + }, + ], + customMoodTags: [ + { + key: "custom:skips-mood-tag", + labelKey: "custom", + categoryId: "skips-mood-category", + kind: "RATED", + isActive: true, + sortOrder: 0, + label: "Quiet", + scaleMin: 1, + scaleMax: 5, + inverse: false, + }, + ], + moodEntries: [ + { + id: "skips-mood", + date: "2026-07-02", + mood: "GOOD", + score: 4, + tags: null, + loggedAt: "2026-07-02T20:00:00.000Z", + factors: [{ key: "a_factor_nobody_has", rating: 3 }], + structuredTags: ["a_binary_tag_nobody_has"], + }, + ], + illnessEpisodes: [ + { + id: "skips-episode", + label: "Cold", + type: "INFECTION", + lifecycle: "ACUTE", + onsetAt: "2026-07-01T00:00:00.000Z", + resolvedAt: null, + parentConditionId: null, + note: null, + dayLogs: [ + { + date: "2026-07-01", + functionalImpact: 1, + feverC: 38.1, + note: null, + symptoms: [{ key: "a_symptom_nobody_has", severity: 2 }], + }, + ], + }, + ], + }; +} + +/** Files every one of which the restore refuses before or by rolling back. */ +function refusedFiles(): Record { + const base = (extra: Record) => ({ + schemaVersion: "2", + exportedAt: "2026-07-20T08:00:00.000Z", + userId: OWNER_ID, + ...extra, + }); + return { + undecryptable: "v1.bm90IGEgYmFja3VwIGF0IGFsbA==", + schemaInvalid: base({ + measurements: [ + { + id: "bad-measurement", + type: "NOT_A_TYPE", + value: "high", + unit: "", + measuredAt: "yesterday", + }, + ], + }), + stableIdMissing: base({ + measurements: [ + { + type: "WEIGHT", + value: 70, + unit: "kg", + measuredAt: "2026-07-01T07:00:00.000Z", + }, + ], + }), + qualitativeMarkerWithNumbers: base({ + biomarkers: [ + { name: "Urine colour", unit: "", lowerBound: null, upperBound: null }, + ], + labResults: [ + { + analyte: "Urine colour", + value: 3, + unit: "", + takenAt: "2026-07-01T07:00:00.000Z", + source: "MANUAL", + biomarkerName: "Urine colour", + }, + ], + }), + incompatibleVersion: { ...base({}), schemaVersion: "99" }, + ownerMismatch: { ...base({}), userId: "someone-else" }, + sectionMissing: base({ + manifest: { + documents: { included: "encrypted-content", note: "carried" }, + workouts: { included: "summary-only", note: "summaries" }, + }, + workouts: [], + }), + metadataOnlyDocument: base({ + documents: [ + { + id: "metadata-only-document", + kind: "OTHER", + title: null, + filename: "scan.pdf", + mimeType: "application/pdf", + byteSize: 12, + status: "STORED", + reportDate: null, + documentDate: null, + summary: null, + createdAt: "2026-07-03T08:00:00.000Z", + }, + ], + }), + keyMissing: base({ + measurements: [ + { + id: "sealed-under-a-key-this-host-lacks", + type: "WEIGHT", + value: 70, + unit: "kg", + measuredAt: "2026-07-01T07:00:00.000Z", + notesEncrypted: Buffer.from( + `v9.${Buffer.from("x".repeat(48)).toString("base64")}`, + ).toString("base64"), + }, + ], + }), + intakeForUnknownMedication: base({ + intakeEvents: [ + { + id: "orphan-intake", + medication: "a medication this file never carried", + scheduledFor: "2026-07-04T08:00:00.000Z", + takenAt: "2026-07-04T08:05:00.000Z", + }, + ], + }), + labForUnknownMarker: base({ + labResults: [ + { + id: "orphan-lab", + analyte: "Ferritin", + value: 91, + unit: "ng/mL", + takenAt: "2026-07-01T07:00:00.000Z", + source: "MANUAL", + biomarkerId: "a-marker-the-file-never-carried", + biomarkerName: "Ferritin", + }, + ], + }), + illnessWithUnknownParent: base({ + illnessEpisodes: [ + { + id: "orphan-episode", + label: "Cough", + type: "INFECTION", + lifecycle: "ACUTE", + onsetAt: "2026-07-01T00:00:00.000Z", + resolvedAt: null, + parentConditionId: "an-episode-the-file-never-carried", + note: null, + dayLogs: [], + }, + ], + }), + }; +} + +/** Files the schema refuses, for the issue list an upload is answered with. */ +function schemaInvalidFiles(): Record { + return { + everySectionWrong: { + schemaVersion: "2", + exportedAt: "not a date", + userId: "", + measurements: [{ type: "WEIGHT" }], + medications: [{ name: 3, schedules: "none" }], + moodEntries: [{ date: "2026-07-01", mood: "GOOD", score: "four" }], + labResults: [{ analyte: null }], + documents: [{ id: "d" }], + accountSettings: { heightCm: "tall", hasDiabetes: "yes" }, + coachConversations: [{ id: "c", messages: [{ role: 1 }] }], + environmentContexts: [{ day: "July" }], + ecgRecordings: [{ id: "e" }], + vaccinations: [{ id: "v" }], + }, + }; +} diff --git a/tests/integration/backup-round-trip.test.ts b/tests/integration/backup-round-trip.test.ts index 408ed1b73..9a0c59c51 100644 --- a/tests/integration/backup-round-trip.test.ts +++ b/tests/integration/backup-round-trip.test.ts @@ -43,8 +43,6 @@ * is a thing a restore could get wrong while returning the right number of * rows, which is the only test worth writing here. */ -import { createHash } from "node:crypto"; - import { beforeEach, describe, expect, it, vi } from "vitest"; process.env.ENCRYPTION_KEY ??= @@ -53,8 +51,7 @@ process.env.ENCRYPTION_KEY ??= import type { PrismaClient } from "@/generated/prisma/client"; import { decrypt, decryptBytes, encrypt, encryptBytes } from "@/lib/crypto"; import { decryptFromBytes, encryptToBytes } from "@/lib/ai/coach/bytes-codec"; -import { sealDayCountry } from "@/lib/dawarich/connection"; -import { openLocation, sealLocation } from "@/lib/environment/location-cipher"; +import { openLocation } from "@/lib/environment/location-cipher"; import { readNote } from "@/lib/crypto/note-cipher"; import { decryptFactData, @@ -62,10 +59,7 @@ import { encryptFactData, encryptFactProvenance, } from "@/lib/documents/store"; -import { - decryptWaveformFromBytes, - encryptWaveformToBytes, -} from "@/lib/withings/ecg-waveform-codec"; +import { decryptWaveformFromBytes } from "@/lib/withings/ecg-waveform-codec"; import { buildFullBackupPayload } from "@/lib/export/full-backup-payload"; import { resolveMedicationCategories, @@ -73,10 +67,7 @@ import { } from "@/lib/medication-category"; import { UNREADABLE_EXPORT_MARKER } from "@/lib/export/unreadable-marker"; import { decryptNoteFromBytes } from "@/lib/labs/store"; -import { - decryptContextFromBytes, - encryptContextToBytes, -} from "@/lib/labs/biomarker-store"; +import { decryptContextFromBytes } from "@/lib/labs/biomarker-store"; import { legacyStreamedBlobFrom } from "@/__tests__/helpers/legacy-backup-blob"; import { streamFullBackupJson } from "@/lib/export/full-backup-stream"; import { BackupKeyIdCollector } from "@/lib/export/backup-key-ids"; @@ -101,6 +92,41 @@ import { readAuditModels, syntheticValue, } from "./backup-column-audit"; +import { + OWNER_ID, + AT, + TOMBSTONE_DELETED_AT, + PHQ9_RESPONSES, + CONSENT_ARTEFACT, + INVENTORY_NOTE, + COACH_FACT, + COACH_TRAIL_JSON, + COACH_PLAN_CUE, + COACH_PLAN_ACTION, + COACH_REMINDER_NOTE, + COACH_SUMMARY, + METRIC_LEGACY_NOTE, + METRIC_SEALED_NOTE, + COACH_USER_TURN, + COACH_ASSISTANT_TURN, + COACH_RESULTS_JSON, + ROUND_TRIP_CATEGORY_KEY, + DOSE_CHANGE_NOTE, + EXTRACTED_FACT_SPAN, + SIDE_EFFECT_NOTE, + ECG_SAMPLES, + seedEveryTwoEndedModel, + createOwner, + seedAdminSession, + COLUMN_EXCLUSIONS, + COLUMN_PRESENCE_ONLY, + FILL_OVERRIDES, + seedColumnShapes, + delegateOf, + primaryKeyWhere, + comparison, + USER_FILL_OVERRIDES, +} from "./backup-fixture"; import { cookieJar, headerJar } from "./mock-next-headers"; import { getPrismaClient, truncateAllTables } from "./setup"; @@ -130,81 +156,6 @@ vi.mock("@/lib/cache/invalidate", () => ({ invalidateUserData: vi.fn(), })); -const OWNER_ID = "round-trip-owner"; -const AT = (iso: string) => new Date(iso); -// The restore drops a measurement tombstone older than -// `TOMBSTONE_RETENTION_DAYS` on purpose, so the fixture's deletion has to stay -// recent on whatever day the suite runs. A fixed date aged out on 2026-10-03. -const TOMBSTONE_DELETED_AT = new Date( - Math.floor((Date.now() - 10 * 86_400_000) / 1000) * 1000, -).toISOString(); -const PHQ9_RESPONSES = JSON.stringify({ - items: [2, 1, 2, 2, 1, 1, 2, 1, 2], - schema: 1, -}); -const CONSENT_ARTEFACT = "JVBERi0xLjQKJWZpeHR1cmU="; -const INVENTORY_NOTE = "second pack, kept in the kitchen drawer"; -const COACH_FACT = "does not tolerate ACE inhibitors"; -// v1.41 — the model text of a turn's trail, stored encrypted beside the turn. -const COACH_TRAIL_JSON = JSON.stringify({ - entries: [{ id: "a1", title: "Checking the trend", text: "Read 30 days." }], -}); -const COACH_PLAN_CUE = "if the evening reading is over 140"; -const COACH_PLAN_ACTION = "then walk twenty minutes before dinner tomorrow"; -const COACH_REMINDER_NOTE = "ask how the evening walks are going"; -const COACH_SUMMARY = "earlier turns: weight trend and evening walks"; -const METRIC_LEGACY_NOTE = "left hand, after the long ride"; -const METRIC_SEALED_NOTE = "right hand, rested"; -const COACH_USER_TURN = "my readings look higher this week, is that real?"; -const COACH_ASSISTANT_TURN = - "the last seven mornings average 4 mmHg above the fortnight before"; -/** The table of values the assistant turn read: ciphertext at rest. */ -const COACH_RESULTS_JSON = JSON.stringify([ - { - ref: "r1", - source: { - tool: "get_metric_series", - domain: "bp", - window: "last7days", - period: "current", - granularity: "day", - }, - shape: "timeSeries", - titleKey: "coach.result.title.metricByPeriod", - title: "Blood pressure by day", - rowCount: 2, - chartKind: "line", - displayed: true, - columns: [ - { - key: "period", - kind: "period", - labelKey: "coach.result.column.day", - label: "Day", - }, - { - key: "sys", - kind: "number", - labelKey: "coach.result.column.systolic", - label: "Systolic", - unit: "mmHg", - }, - ], - rows: [ - ["2026-07-19", 131], - ["2026-07-20", null], - ], - truncated: false, - chart: { kind: "line", x: "period", series: ["sys"] }, - }, -]); -const ROUND_TRIP_CATEGORY_KEY = "custom:5f0c6a52-6a43-4f63-9b39-0c1f4d7e2a10"; -const DOSE_CHANGE_NOTE = "titration note, encrypted at rest"; -const EXTRACTED_FACT_SPAN = "Ferritin 91 ng/mL (30 - 400)"; -const SIDE_EFFECT_NOTE = "nausea for two hours after the evening dose"; -/** A short micro-volt strip. Long enough that a defaulted empty array shows. */ -const ECG_SAMPLES = [-12, 4, 118, -33, 7, 2, -5, 61]; - beforeEach(async () => { await truncateAllTables(getPrismaClient()); cookieJar.clear(); @@ -354,1272 +305,6 @@ const COUNT_BACK: Record< p.onboardingRecord.count({ where: { userId } }), }; -/** - * One row of every two-ended model, for one account. - * - * Minimal on purpose: this file asks whether a row survives the round trip, and - * a fat fixture only makes the answer slower to get. The mood factor and the - * cycle symptom are the account's OWN custom rows rather than seeded catalogue - * entries, because a catalogue row survives the account being deleted and would - * make the link tables look restored when nothing restored them. - */ -async function seedEveryTwoEndedModel(prisma: PrismaClient): Promise { - // Held rather than discarded: the personal best below points at this row - // through a column that is a real foreign key in the database, so the - // fixture needs the id to build the reference the restore has to resolve. - const weightMeasurement = await prisma.measurement.create({ - data: { - userId: OWNER_ID, - type: "WEIGHT", - value: 74.2, - unit: "kg", - measuredAt: AT("2026-07-01T07:00:00.000Z"), - source: "MANUAL", - }, - }); - // A DELETED reading, kept as a tombstone. It is here because the obvious way - // to make the weekly backup cheaper — stop exporting soft-deleted rows, which - // on a real record is four rows in five — is wrong, and nothing in the tree - // said so out loud. A tombstone inside the retention window is what tells a - // synced client the row is gone (`/api/sync/changes` reads exactly these) and - // what makes a re-sent Apple Health sample a no-op instead of a resurrection. - // Drop them from a disaster-recovery file and a restore quietly brings back - // every measurement the account ever deleted on the next device sync. - await prisma.measurement.create({ - data: { - userId: OWNER_ID, - type: "PULSE", - value: 61, - unit: "bpm", - measuredAt: AT("2026-07-02T06:30:00.000Z"), - source: "APPLE_HEALTH", - externalId: "round-trip-deleted-sample", - syncVersion: 4, - deletedAt: AT(TOMBSTONE_DELETED_AT), - }, - }); - // The EVENT row an ECG strip is filed against, and the strip itself. The - // pairing is the point: `EcgRecording.measurementId` is a real foreign key, - // so this is the reference whose remap has to survive the round trip rather - // than fail the transaction. - const rhythmEvent = await prisma.measurement.create({ - data: { - userId: OWNER_ID, - type: "IRREGULAR_RHYTHM_NOTIFICATION", - value: 1, - unit: "event", - measuredAt: AT("2026-06-15T14:22:00.000Z"), - source: "WITHINGS", - rhythmClassification: "IRREGULAR", - }, - }); - await prisma.ecgRecording.create({ - data: { - userId: OWNER_ID, - source: "WITHINGS", - externalRecordingId: "round-trip-signal-1", - recordedAt: AT("2026-06-15T14:22:00.000Z"), - waveformEncrypted: encryptWaveformToBytes(ECG_SAMPLES), - samplingFrequency: 300, - sampleCount: ECG_SAMPLES.length, - durationSeconds: ECG_SAMPLES.length / 300, - lead: "I", - averageHeartRate: 88, - rhythmClassification: "IRREGULAR", - measurementId: rhythmEvent.id, - }, - }); - await prisma.intradayCumulativeProfile.create({ - data: { - userId: OWNER_ID, - type: "ACTIVITY_STEPS", - dateKey: "2026-07-01", - // One slot per hour — the restore refuses a profile of any other length, - // because a short row lands in the table and is dropped on read. - hourlyCumulative: Array.from({ length: 24 }, (_, hour) => hour * 350), - dayTotal: 8050, - sampleCount: 24, - timezone: "Europe/Berlin", - }, - }); - - // Two courses with a gap, and the window the row projects from them (the - // latest). The earlier course exists nowhere else once it has ended. - const medication = await prisma.medication.create({ - data: { - userId: OWNER_ID, - name: "Round-trip tablet", - dose: "5 mg", - startsOn: AT("2026-06-10T00:00:00.000Z"), - endsOn: AT("2026-06-16T00:00:00.000Z"), - schedules: { - create: { windowStart: "08:00", windowEnd: "09:00", label: "Morning" }, - }, - courses: { - create: [ - { - userId: OWNER_ID, - startsOn: AT("2026-03-01T00:00:00.000Z"), - endsOn: AT("2026-03-07T00:00:00.000Z"), - noteEncrypted: encryptToBytes("the March flu"), - }, - { - userId: OWNER_ID, - startsOn: AT("2026-06-10T00:00:00.000Z"), - endsOn: AT("2026-06-16T00:00:00.000Z"), - }, - ], - }, - }, - }); - await prisma.medicationIntakeEvent.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - scheduledFor: AT("2026-07-01T08:00:00.000Z"), - takenAt: AT("2026-07-01T08:04:00.000Z"), - }, - }); - // Not OTHER: a missing row already reads as OTHER, so only a chosen value - // proves the category came back. A category the person named, so the - // assignment can only resolve if the label came back before it. - await prisma.medicationCategoryLabel.create({ - data: { - userId: OWNER_ID, - key: ROUND_TRIP_CATEGORY_KEY, - labelEncrypted: encryptToBytes("Heart and circulation"), - sortOrder: 2, - }, - }); - await prisma.medicationCategoryAssignment.create({ - data: { medicationId: medication.id, category: ROUND_TRIP_CATEGORY_KEY }, - }); - // The one row in this fixture that is also checked field by field after the - // restore — see the assertion at the end of the test for why. - await prisma.medicationSideEffect.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - occurredAt: AT("2026-07-01T21:00:00.000Z"), - category: "GI", - entry: "NAUSEA", - severity: 3, - notesEncrypted: encryptToBytes(SIDE_EFFECT_NOTE), - }, - }); - // Two eras, and the open one carries the weight. `resumedAt: null` means the - // drug is paused right now; a restore that closed it at restore time would - // still count one row back here and read as recovered. The field-level - // assertion at the end of the test is what holds the null. - // A two-step ramp. The ORDER is the content here: same drug, same unit, - // 5 mg then 10 mg. A restore that returned them reversed would still count - // two rows back and would describe the opposite clinical story. - // One open pack and one used up, plus the two ledger rows behind the open - // one. The count on the pack is deliberately NOT the sum of its events: 30 - // in, 8 consumed, and the remaining count says 21 because the person threw - // one away without recording it. A restore that recomputed the count from - // the ledger would "fix" that to 22 and disagree with every low-stock - // reminder the account has already received. - // A PHQ-9 administration whose item 9 was answered above zero. The flag and - // the encrypted answers are seeded to DISAGREE with a naive recomputation: - // the flag says true, and a restore that decided to recompute it would have - // to decrypt the blob to do so, which is the handling this data is kept away - // from. The assertion below reads the flag and the ciphertext separately. - await prisma.mentalHealthAssessment.create({ - data: { - userId: OWNER_ID, - instrument: "PHQ9", - locale: "de", - version: "standard", - responsesEncrypted: encryptToBytes(PHQ9_RESPONSES), - totalScore: 14, - severityBand: "moderate", - item9Flagged: true, - crisisShownAt: AT("2026-07-05T18:02:00.000Z"), - takenAt: AT("2026-07-05T18:00:00.000Z"), - tz: "Europe/Berlin", - source: "WEB", - }, - }); - - // One active consent and one revoked. The revocation is the part a restore - // can quietly lose: dropping `revokedAt` turns a withdrawn agreement back - // into a standing one, and the latest-per-user lookup shortcuts on exactly - // that column. - await prisma.consentReceipt.createMany({ - data: [ - { - userId: OWNER_ID, - kind: "ai-processing", - artefact: CONSENT_ARTEFACT, - signedAt: AT("2026-06-01T09:00:00.000Z"), - }, - { - userId: OWNER_ID, - kind: "research-sharing", - artefact: "eyJhbGciOiJub25lIn0.e30.", - signedAt: AT("2026-06-02T09:00:00.000Z"), - revokedAt: AT("2026-07-10T11:00:00.000Z"), - }, - ], - }); - - // Tuned away from every default, and one threshold in PERCENT rather than - // MINUTES: a restore that fell back to the schema defaults would return four - // plausible numbers and silently change when this drug turns orange. - await prisma.reminderPhaseConfig.create({ - data: { - medicationId: medication.id, - greenValue: 45, - greenMode: "MINUTES", - yellowValue: 20, - yellowMode: "PERCENT", - orangeValue: 5, - orangeMode: "MINUTES", - redValue: 180, - redMode: "MINUTES", - }, - }); - - const openPack = await prisma.medicationInventoryItem.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - state: "ACTIVE", - containerType: "BLISTER", - unitsTotal: "30", - unitsRemaining: "21", - firstUseAt: AT("2026-07-01T08:00:00.000Z"), - expiresAt: AT("2027-01-31T00:00:00.000Z"), - manufacturer: "Fixture Pharma", - doseStrength: "10 mg", - notesEncrypted: encryptToBytes(INVENTORY_NOTE), - }, - }); - await prisma.medicationInventoryItem.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - state: "USED_UP", - containerType: "BOTTLE", - unitsTotal: "60", - unitsRemaining: "0", - }, - }); - await prisma.medicationInventoryEvent.createMany({ - data: [ - { - medicationId: medication.id, - delta: 30, - reason: "purchased", - occurredAt: AT("2026-07-01T07:00:00.000Z"), - }, - { - medicationId: medication.id, - delta: -8, - reason: "consumed", - occurredAt: AT("2026-07-09T07:00:00.000Z"), - }, - ], - }); - - await prisma.medicationDoseChange.createMany({ - data: [ - { - medicationId: medication.id, - effectiveFrom: AT("2026-04-01T08:00:00.000Z"), - doseValue: 5, - doseUnit: "mg", - noteEncrypted: encryptToBytes(DOSE_CHANGE_NOTE), - }, - { - medicationId: medication.id, - effectiveFrom: AT("2026-06-01T08:00:00.000Z"), - doseValue: 10, - doseUnit: "mg", - noteEncrypted: null, - }, - ], - }); - // Three archived eras, and the CHAIN through them is the content. The - // middle one was corrected, so it points at the third; the first and the - // third stand on their own. A restore that returned three rows with every - // link null satisfies any count and has destroyed the only thing the - // pointer says — every era consumer skips a superseded row, so the - // corrected middle era would come back live beside the correction that - // replaced it and the timeline would show the same window twice. - await prisma.medicationScheduleRevision.create({ - data: { - medicationId: medication.id, - validFrom: AT("2026-01-01T00:00:00.000Z"), - validUntil: AT("2026-03-01T00:00:00.000Z"), - payload: [{ windowStart: "07:00", windowEnd: "09:00", dose: "5 mg" }], - source: "ARCHIVED", - }, - }); - const correctionEra = await prisma.medicationScheduleRevision.create({ - data: { - medicationId: medication.id, - validFrom: AT("2026-03-01T00:00:00.000Z"), - validUntil: AT("2026-05-01T00:00:00.000Z"), - payload: [{ windowStart: "08:00", windowEnd: "10:00", dose: "10 mg" }], - source: "MANUAL", - }, - }); - await prisma.medicationScheduleRevision.create({ - data: { - medicationId: medication.id, - validFrom: AT("2026-02-01T00:00:00.000Z"), - validUntil: AT("2026-03-01T00:00:00.000Z"), - payload: [{ windowStart: "12:00", windowEnd: "13:00", dose: "10 mg" }], - source: "ARCHIVED", - supersededByRevisionId: correctionEra.id, - }, - }); - - // v1.43 — a composition entered in a non-canonical unit, so the entered - // amount and unit are set too. - await prisma.medicationIngredient.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - nutrient: "vitamin_d", - amountPerUnit: 25, - unit: "ug", - enteredAmount: 1000, - enteredUnit: "IU", - source: "LABEL_AI", - }, - }); - - await prisma.medicationPauseEra.createMany({ - data: [ - { - userId: OWNER_ID, - medicationId: medication.id, - pausedAt: AT("2026-05-02T08:00:00.000Z"), - resumedAt: AT("2026-05-20T08:00:00.000Z"), - }, - { - userId: OWNER_ID, - medicationId: medication.id, - pausedAt: AT("2026-07-15T08:00:00.000Z"), - resumedAt: null, - }, - ], - }); - - // A RATED tag the account defined itself — the export carries only rated - // links, so a BINARY tag would leave `MoodEntryTagLink` empty. - const moodCategory = await prisma.moodTagCategory.findFirstOrThrow({ - where: { userId: null }, - }); - // A category the account created itself, not a seeded one. It cascades away - // with the user, and `MoodTag.categoryId` is a real foreign key — so before - // the category travelled, this one row made the restore violate - // `mood_tags_category_id_fkey` and answer 500 with the account left empty. - const ownCategory = await prisma.moodTagCategory.create({ - data: { - userId: OWNER_ID, - key: "round_trip_own_category", - labelKey: "mood.category.roundTripOwn", - sortOrder: 90, - }, - }); - const moodTag = await prisma.moodTag.create({ - data: { - userId: OWNER_ID, - categoryId: ownCategory.id, - key: "round_trip_factor", - labelKey: "mood.tag.roundTripFactor", - kind: "RATED", - scaleMin: 1, - scaleMax: 5, - }, - }); - // A SEEDED tag the account chose to hide. The id differs per instance, so - // this is the row that proves the hidden set travels by key. - const seededTagToHide = await prisma.moodTag.findFirstOrThrow({ - where: { userId: null }, - }); - await prisma.moodTagHidden.create({ - data: { userId: OWNER_ID, moodTagId: seededTagToHide.id }, - }); - - await prisma.moodEntry.create({ - data: { - userId: OWNER_ID, - date: "2026-07-01", - mood: "GUT", - score: 4, - source: "MOODLOG", - moodLoggedAt: AT("2026-07-01T20:00:00.000Z"), - tagLinks: { create: { moodTagId: moodTag.id, rating: 4 } }, - context: { - create: { - userId: OWNER_ID, - workStatus: "regular", - contactCircles: JSON.stringify(["family"]), - leisureJoy: 6, - }, - }, - }, - }); - - const biomarker = await prisma.biomarker.create({ - data: { userId: OWNER_ID, name: "Ferritin", unit: "ng/mL" }, - }); - // Another spelling of the marker, and the ledger row of a marker that was - // merged into it: both ride the marker (D1223). - await prisma.biomarkerAlias.create({ - data: { - userId: OWNER_ID, - biomarkerId: biomarker.id, - name: "Ferr.", - nameFolded: "ferr.", - source: "IMPORT_CHOICE", - }, - }); - await prisma.biomarkerMerge.create({ - data: { - userId: OWNER_ID, - targetBiomarkerId: biomarker.id, - sourceBiomarkerId: "merged-away-marker", - sourceName: "Ferritin (Serum)", - readingCount: 3, - }, - }); - const labResult = await prisma.labResult.create({ - data: { - userId: OWNER_ID, - biomarkerId: biomarker.id, - analyte: "Ferritin", - value: 91, - unit: "ng/mL", - takenAt: AT("2026-06-30T09:00:00.000Z"), - }, - }); - // What the drug above is FOR, pinned to the analyte just created. The two - // rows are seeded at opposite ends of this fixture on purpose: the drug is - // restored hundreds of lines before the analyte, so this pairing is what - // proves the second pass runs late enough to resolve the name. - await prisma.medicationEfficacyTarget.create({ - data: { - medicationId: medication.id, - biomarkerId: biomarker.id, - primary: true, - }, - }); - await prisma.allergy.create({ - data: { userId: OWNER_ID, substance: "Penicillin" }, - }); - await prisma.familyHistoryEntry.create({ - data: { - userId: OWNER_ID, - relationship: "MOTHER", - condition: "Type 2 diabetes", - }, - }); - - const episode = await prisma.illnessEpisode.create({ - data: { - userId: OWNER_ID, - label: "Cold", - type: "INFECTION", - onsetAt: AT("2026-06-20T00:00:00.000Z"), - }, - }); - // A SECOND condition, and the one the document below is actually filed - // against. Two episodes is what makes the filing assertion mean something: - // with one, a restore that pointed every link at the first condition it - // found would return the right count and read as correct. - const filedEpisode = await prisma.illnessEpisode.create({ - data: { - userId: OWNER_ID, - label: "Iron deficiency", - type: "CHRONIC", - onsetAt: AT("2026-03-01T00:00:00.000Z"), - // v1.39.2 — a condition's body site and side travel too. - bodySiteEncrypted: encryptToBytes("Stomach"), - laterality: "BOTH", - }, - }); - const illnessSymptom = await prisma.illnessSymptom.create({ - data: { key: "round_trip_cough", labelKey: "illness.symptom.roundTrip" }, - }); - await prisma.illnessDayLog.create({ - data: { - userId: OWNER_ID, - episodeId: episode.id, - date: "2026-06-21", - symptomLinks: { create: { symptomId: illnessSymptom.id, severity: 2 } }, - }, - }); - - // v1.40 — two of the person's own symptoms and three occurrences: one filed - // against the open cold, one with a note, one on its own in the gap. - const aura = await prisma.symptomDefinition.create({ - data: { - userId: OWNER_ID, - labelEncrypted: encryptToBytes("Aura"), - icon: "Zap", - sortOrder: 0, - }, - }); - const headache = await prisma.symptomDefinition.create({ - data: { - userId: OWNER_ID, - labelEncrypted: encryptToBytes("Headache"), - icon: "Brain", - sortOrder: 1, - isActive: false, - }, - }); - await prisma.symptomEvent.create({ - data: { - userId: OWNER_ID, - definitionId: aura.id, - occurredAt: AT("2026-06-21T09:00:00.000Z"), - intensity: 4, - episodeId: episode.id, - }, - }); - await prisma.symptomEvent.create({ - data: { - userId: OWNER_ID, - definitionId: headache.id, - occurredAt: AT("2026-06-21T11:00:00.000Z"), - intensity: 8, - noteEncrypted: encryptToBytes("left side, behind the eye"), - }, - }); - await prisma.symptomEvent.create({ - data: { - userId: OWNER_ID, - definitionId: aura.id, - occurredAt: AT("2026-07-10T18:30:00.000Z"), - intensity: 2, - }, - }); - - // v1.42 — two life events: a move known to the month, with a note, and a - // period known to the day. - await prisma.lifeEvent.create({ - data: { - userId: OWNER_ID, - category: "HOME", - startDate: "2023-09-01", - precision: "MONTH", - titleEncrypted: encryptToBytes("Moved to the coast"), - noteEncrypted: encryptToBytes("the flat with the long hallway"), - }, - }); - await prisma.lifeEvent.create({ - data: { - userId: OWNER_ID, - category: "WORK", - startDate: "2026-03-02", - endDate: "2026-05-29", - precision: "DAY", - titleEncrypted: encryptToBytes("Parental leave"), - }, - }); - - await prisma.userHealthProfile.create({ - data: { - userId: OWNER_ID, - aboutMeEncrypted: encryptToBytes("Runs three times a week"), - }, - }); - await prisma.healthProfileFactRevision.create({ - data: { - userId: OWNER_ID, - kind: "SMOKING_STATUS", - valueEncrypted: encryptToBytes("never"), - validFrom: AT("2026-01-01T00:00:00.000Z"), - }, - }); - - await prisma.cycleProfile.create({ - data: { userId: OWNER_ID, cycleTrackingEnabled: true }, - }); - const cycle = await prisma.menstrualCycle.create({ - data: { userId: OWNER_ID, startDate: "2026-06-01" }, - }); - const cycleCategory = await prisma.cycleSymptomCategory.findFirstOrThrow(); - const cycleSymptom = await prisma.cycleSymptom.create({ - data: { - userId: OWNER_ID, - categoryId: cycleCategory.id, - key: "custom:round-trip-cramps", - labelKey: "cycle.symptom.custom", - labelEncrypted: encrypt("Round-trip cramps"), - }, - }); - await prisma.cycleDayLog.create({ - data: { - userId: OWNER_ID, - cycleId: cycle.id, - date: "2026-06-02", - flow: "HEAVY", - symptomLinks: { create: { symptomId: cycleSymptom.id } }, - }, - }); - - await prisma.customMetric.create({ - data: { - userId: OWNER_ID, - name: "Grip strength", - unit: "kg", - // v1.39.3 — one reading whose note is still readable (a row the - // free-text backfill has not reached) and one sealed the current way. - // Both must come back sealed, and neither readable. - entries: { - create: [ - { - userId: OWNER_ID, - value: 44, - unit: "kg", - measuredAt: AT("2026-07-01T18:00:00.000Z"), - note: METRIC_LEGACY_NOTE, - }, - { - userId: OWNER_ID, - value: 45, - unit: "kg", - measuredAt: AT("2026-07-02T18:00:00.000Z"), - noteEncrypted: encryptToBytes(METRIC_SEALED_NOTE), - }, - ], - }, - }, - }); - await prisma.correlationPattern.create({ - data: { - userId: OWNER_ID, - canonicalKey: `p1:${"a1".repeat(32)}`, - family: "sleep", - factorKey: "sleep_duration", - outcomeKey: "weight", - lagDays: 1, - sampleSize: 30, - effectSize: 0.42, - pValue: 0.01, - evidenceHash: "b2".repeat(32), - lastComputedAt: AT("2026-07-01T00:00:00.000Z"), - }, - }); - await prisma.onboardingRecord.create({ - data: { - userId: OWNER_ID, - needsJson: { - recordTarget: "me", - areas: ["blood-pressure", "sleep"], - medication: "yes", - sources: ["withings"], - visit: "within-a-month", - units: { glucoseUnit: "mmol/L", unitPreference: "metric" }, - }, - stepsJson: [ - { id: "who", status: "done" }, - { id: "areas", status: "done" }, - { id: "sources", status: "skipped" }, - ], - firstResultJson: { - task: "connect-source", - target: "withings", - completedAt: "2026-07-01T08:30:00.000Z", - }, - // The once-only latch on the module derivation. Seeded non-null so the - // assertion after the restore can show it came back rather than - // defaulting — a null here would hand the next confirm permission to - // re-apply the questionnaire over every module decision made since. - modulesDerivedAt: AT("2026-07-01T08:00:00.000Z"), - completedAt: AT("2026-07-01T08:00:00.000Z"), - }, - }); - await prisma.healthScoreRecord.create({ - data: { - userId: OWNER_ID, - dayKey: "2026-07-01", - timezone: "Europe/Berlin", - composite: 71, - band: "green", - scoreVersion: 1, - composition: ["activity", "sleep"], - pillarScores: { activity: 70, sleep: 72 }, - inputFingerprint: "c3".repeat(32), - }, - }); - - await prisma.workout.create({ - data: { - userId: OWNER_ID, - sportType: "RUNNING", - startedAt: AT("2026-06-29T06:00:00.000Z"), - endedAt: AT("2026-06-29T06:30:00.000Z"), - durationSec: 1800, - }, - }); - await prisma.nutrientIntakeDay.create({ - data: { - userId: OWNER_ID, - day: "2026-07-01", - nutrient: "WATER", - amount: 2100, - unit: "ml", - source: "MANUAL", - }, - }); - - const documentBytes = encryptBytes(Buffer.from("round-trip document bytes")); - const contentEncrypted = new Uint8Array( - new ArrayBuffer(documentBytes.byteLength), - ); - contentEncrypted.set(documentBytes); - const document = await prisma.inboundDocument.create({ - data: { - userId: OWNER_ID, - kind: "LAB_RESULT", - title: "June labs", - filename: "june-labs.pdf", - mimeType: "application/pdf", - byteSize: documentBytes.byteLength, - contentEncrypted, - contentCodec: "binary2", - // Imported (#1038): the source key has to survive the trip, or a - // re-run of the importer after a restore stores the page twice. - sourceSystem: "PAPERLESS", - sourceId: "4711", - // Held back from automatic AI reading; a restore that dropped the - // marker would hand the page to the summary catch-up. - aiReadDeferred: true, - }, - }); - - // The page filed under the SECOND condition, not the first. A restore that - // kept the count and lost the pairing would leave the vault sorted wrongly - // rather than visibly unsorted, which is harder to notice and worse. - await prisma.documentConditionLink.create({ - data: { - userId: OWNER_ID, - documentId: document.id, - episodeId: filedEpisode.id, - createdAt: AT("2026-07-02T09:00:00.000Z"), - }, - }); - - // One staged fact, already reviewed, approved and committed to the ferritin - // lab row above. Every column that records the decision is set AWAY from its - // schema default on purpose: `PENDING`, `needsReview: true` and two NULL - // commitment columns are what a restore that ignores them writes, and the - // assertion after the restore is what catches that. A fact handed back as - // PENDING is offered for review again, and approving it a second time writes - // a second lab result for a reading the account already has. - await prisma.extractedFact.create({ - data: { - userId: OWNER_ID, - documentId: document.id, - factType: "OBSERVATION", - status: "APPROVED", - confidence: 0.94, - needsReview: false, - committedRecordId: labResult.id, - committedRecordType: "labResult", - dataEncrypted: encryptFactData({ - label: "Ferritin", - code: null, - codeSystem: null, - value: 91, - valueText: null, - unit: "ng/mL", - referenceLow: 30, - referenceHigh: 400, - effectiveDate: "2026-06-30", - }), - provenanceEncrypted: encryptFactProvenance({ - sourceText: EXTRACTED_FACT_SPAN, - anchored: true, - sourceOffset: 412, - page: 2, - confidence: 0.94, - }), - }, - }); - - // Two Coach threads, and the pair is the point. One is an ordinary health - // conversation; the other is FENCED — `documentScoped` true, grounded in the - // document seeded above. A restore that let the flag default to false would - // return both threads, satisfy every count, and quietly hand the tool loop - // back to the one conversation whose history may contain document-derived - // text. That is why the assertion below reads the flag per thread rather - // than counting rows. - await prisma.coachConversation.create({ - data: { - userId: OWNER_ID, - title: "How is my blood pressure trending?", - documentScoped: false, - summaryEncrypted: encryptToBytes(COACH_SUMMARY), - summaryUpdatedAt: AT("2026-07-20T10:00:00.000Z"), - summaryTurnCount: 4, - messages: { - create: [ - { - role: "user", - encryptedContent: encryptToBytes(COACH_USER_TURN), - createdAt: AT("2026-07-20T09:58:00.000Z"), - }, - { - role: "assistant", - encryptedContent: encryptToBytes(COACH_ASSISTANT_TURN), - resultsEncrypted: encryptToBytes(COACH_RESULTS_JSON), - trailEncrypted: encryptToBytes(COACH_TRAIL_JSON), - providerType: "anthropic", - model: "claude-opus-5", - tokensUsed: 812, - createdAt: AT("2026-07-20T09:59:00.000Z"), - }, - ], - }, - }, - }); - await prisma.coachConversation.create({ - data: { - userId: OWNER_ID, - // v1.39.3 — sealed the current way; the thread above keeps a readable - // legacy title, the shape of a row the backfill has not reached. - titleEncrypted: encryptToBytes("About my June labs"), - documentScoped: true, - messages: { - create: [ - { - role: "user", - encryptedContent: encryptToBytes("What does the ferritin mean?"), - createdAt: AT("2026-07-21T08:00:00.000Z"), - }, - ], - }, - attachments: { - create: [ - { documentId: document.id, addedAt: AT("2026-07-21T07:59:00.000Z") }, - ], - }, - }, - }); - - // What the Coach keeps between threads, seeded so both references are - // exercised: the fact and the plan point back at the thread they came out - // of, and the reminder points at the plan. - const healthThread = await prisma.coachConversation.findFirstOrThrow({ - where: { userId: OWNER_ID, documentScoped: false }, - }); - const healthAnswer = await prisma.coachMessage.findFirstOrThrow({ - where: { conversationId: healthThread.id, role: "assistant" }, - }); - await prisma.coachFact.create({ - data: { - userId: OWNER_ID, - factEncrypted: encryptToBytes(COACH_FACT), - category: "constraint", - confidence: 80, - sourceConversationId: healthThread.id, - source: "user", - lastUsedAt: AT("2026-07-20T10:00:00.000Z"), - sourceMessageId: healthAnswer.id, - }, - }); - const plan = await prisma.coachPlan.create({ - data: { - userId: OWNER_ID, - metric: "BLOOD_PRESSURE", - ifCueEncrypted: encryptToBytes(COACH_PLAN_CUE), - thenActionEncrypted: encryptToBytes(COACH_PLAN_ACTION), - targetEncrypted: encryptToBytes("under 130 by October"), - status: "active", - reviewDate: AT("2026-10-01T00:00:00.000Z"), - sourceConversationId: healthThread.id, - }, - }); - await prisma.coachReminder.create({ - data: { - userId: OWNER_ID, - noteEncrypted: encryptToBytes(COACH_REMINDER_NOTE), - metric: "BLOOD_PRESSURE", - relatedPlanId: plan.id, - triggerKind: "date", - dueAt: AT("2026-09-01T07:00:00.000Z"), - status: "active", - source: "extractor", - sourceConversationId: healthThread.id, - surfaceCount: 2, - }, - }); - - // One visit, the practice it was at, and one link of each of the three - // kinds. The links reach the document, the lab result and the condition - // episode seeded above rather than fresh rows, because a link to something - // the restore did not put back is the exact case the restore reports as a - // skip — seeding it against a row that does come back is what makes a - // returning count mean the filing survived. - const practitioner = await prisma.practitioner.create({ - data: { - userId: OWNER_ID, - name: "Round-trip practice", - specialty: "Internal medicine", - noteEncrypted: encryptToBytes("ring the upper bell"), - }, - }); - - // One Vorsorge reminder with the v1.37.20 skip/snooze columns all set, and - // two completion-ledger rows — one honest satisfy, one honest skip. Fat like - // the vaccination fixture below and for the same reason: the count-back - // proves the rows returned, the column-by-column assertion after the restore - // proves they returned WHOLE. The encounter and the dose below point their - // `reminderId` here, because both references now remap against the restored - // reminders and this fixture is what proves they survive rather than drop. - const reminder = await prisma.measurementReminder.create({ - data: { - userId: OWNER_ID, - label: "Blutdruck messen", - measurementType: "BLOOD_PRESSURE_SYS", - intervalDays: 7, - notifyHour: 8, - location: "Zuhause", - nextDueAt: AT("2026-07-08T06:00:00.000Z"), - lastSatisfiedAt: AT("2026-07-01T06:05:00.000Z"), - vaccinationAntigen: "tetanus", - snoozedUntil: AT("2026-07-08T06:00:00.000Z"), - lastSkippedAt: AT("2026-06-24T06:00:00.000Z"), - skipCount: 2, - }, - }); - await prisma.measurementReminderEvent.create({ - data: { - userId: OWNER_ID, - reminderId: reminder.id, - kind: "SATISFIED", - occurredAt: AT("2026-07-01T06:05:00.000Z"), - onTime: true, - source: "manual", - }, - }); - await prisma.measurementReminderEvent.create({ - data: { - userId: OWNER_ID, - reminderId: reminder.id, - kind: "SKIPPED", - occurredAt: AT("2026-06-24T06:00:00.000Z"), - onTime: false, - source: "skip", - }, - }); - - const encounter = await prisma.encounter.create({ - data: { - userId: OWNER_ID, - occurredAt: AT("2026-06-30T08:00:00.000Z"), - status: "DONE", - kind: "ROUTINE", - practitionerId: practitioner.id, - reasonEncrypted: encryptToBytes("annual check"), - outcomeEncrypted: encryptToBytes( - "ferritin back in range, recheck in a year", - ), - reminderId: reminder.id, - }, - }); - await prisma.encounterDocumentLink.create({ - data: { - userId: OWNER_ID, - encounterId: encounter.id, - documentId: document.id, - }, - }); - await prisma.encounterLabLink.create({ - data: { - userId: OWNER_ID, - encounterId: encounter.id, - labResultId: labResult.id, - }, - }); - await prisma.encounterConditionLink.create({ - data: { - userId: OWNER_ID, - encounterId: encounter.id, - episodeId: episode.id, - }, - }); - - // One dose with every optional column filled, and the page it was - // transcribed from. Fat on purpose, against this file's own minimal-fixture - // rule: a count-back proves the row returned, and the assertion after the - // restore reads each column back so it also proves the row returned WHOLE. - // The practitioner, the encounter and the reminder are the ones seeded - // above, because all three are remapped on the way back and a reference to - // something the restore did not put back is a different case (covered by - // the skip test below). `reminderId` used to be deliberately absent here — - // it was the one reference that could never resolve — and is deliberately - // present since v1.37.20, because resolving is now the behaviour under test. - // v1.42 (#1005) — the person's own vaccine definition the dose also names. - // The catalogue slug still wins on read; the reference is what has to - // survive the trip, and it can only if the definition comes back first. - const customVaccine = await prisma.customVaccine.create({ - data: { - userId: OWNER_ID, - name: "Round-trip travel combo", - components: ["typhoid", "hepatitis-a"], - typicalSeriesDoses: 2, - boosterIntervalMonths: 36, - }, - }); - const vaccination = await prisma.vaccinationRecord.create({ - data: { - userId: OWNER_ID, - occurredAt: AT("2026-05-14T00:00:00.000Z"), - customVaccineId: customVaccine.id, - antigenSlug: "tdap", - vaccineName: "Tetanus, diphtheria and pertussis", - doseNumber: 3, - seriesDoses: 3, - lotNumber: "RT-4471", - site: "LEFT_ARM", - practitionerId: practitioner.id, - encounterId: encounter.id, - reminderId: reminder.id, - noteEncrypted: encryptToBytes("sore arm for a day, nothing else"), - }, - }); - await prisma.vaccinationDocumentLink.create({ - data: { - userId: OWNER_ID, - vaccinationId: vaccination.id, - documentId: document.id, - }, - }); - - // v1.43 — one row in each of the five relation link tables, joining the - // records seeded above. - await prisma.labResultDocumentLink.create({ - data: { - userId: OWNER_ID, - labResultId: labResult.id, - documentId: document.id, - }, - }); - await prisma.encounterMedicationLink.create({ - data: { - userId: OWNER_ID, - encounterId: encounter.id, - medicationId: medication.id, - }, - }); - await prisma.encounterVaccinationLink.create({ - data: { - userId: OWNER_ID, - encounterId: encounter.id, - vaccinationId: vaccination.id, - }, - }); - await prisma.medicationDocumentLink.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - documentId: document.id, - }, - }); - await prisma.medicationConditionLink.create({ - data: { - userId: OWNER_ID, - medicationId: medication.id, - episodeId: episode.id, - }, - }); - - // Three bests, chosen for what a count cannot see. - // - // The first points at the measurement it was found in. That column is a - // foreign key in the database while the Prisma schema declares no relation - // for it, so this row is what proves the pointer resolves against the - // measurements the restore wrote, and would prove the opposite loudly, by - // failing the constraint and taking the whole restore with it. - // - // The other two share a metric type AND an instant and differ only in the - // sport slot: the same 5 km and 10 km bests a runner has. A restore that - // dropped the slot would return two rows describing one record twice, and - // the faster time would be presented as the 10 km best. - await prisma.personalRecord.create({ - data: { - userId: OWNER_ID, - metricType: "WEIGHT", - direction: "MIN", - value: 74.2, - unit: "kg", - achievedAt: AT("2026-07-01T07:00:00.000Z"), - sourceMeasurementId: weightMeasurement.id, - source: "MANUAL", - }, - }); - await prisma.personalRecord.createMany({ - data: [ - { - userId: OWNER_ID, - metricType: "WALKING_RUNNING_DISTANCE", - metricSlot: "running_5km_time", - direction: "MIN", - value: 1512, - unit: "s", - achievedAt: AT("2026-05-18T09:20:00.000Z"), - source: "APPLE_HEALTH", - externalId: "workout-pr-5km", - }, - { - userId: OWNER_ID, - metricType: "WALKING_RUNNING_DISTANCE", - metricSlot: "running_10km_time", - direction: "MIN", - value: 3184, - unit: "s", - achievedAt: AT("2026-05-18T09:20:00.000Z"), - source: "APPLE_HEALTH", - externalId: "workout-pr-10km", - }, - ], - }); - - // Two badges, both earned long before this fixture runs. The second names a - // definition no catalogue in this build ships: a file can be older than the - // release reading it, and the restore must carry the row rather than judge - // it, exactly as it carries a retired antigen slug. - await prisma.userAchievement.createMany({ - data: [ - { - userId: OWNER_ID, - achievementId: "intake-total-10", - unlockedAt: AT("2026-02-21T10:15:00.000Z"), - }, - { - userId: OWNER_ID, - achievementId: "retired-badge-from-an-older-release", - unlockedAt: AT("2025-11-05T08:00:00.000Z"), - }, - ], - }); - - // A fortnight in Barcelona, and one day of it recorded as a reading. - // - // The pair is the fixture. The home day and the trip day carry different - // coordinates and different weather, and the trip day's reading only makes - // sense next to the period that explains it: with the period gone, the next - // refresh re-resolves 2026-06-15 to Berlin and upserts Berlin's weather over - // it. The assertion after the restore reads the two back TOGETHER. The - // coordinates are at 1 decimal, the precision the app stores since v1.39.4; - // a restore rounds anything finer, so finer values would not round-trip. - // Since v1.42 the location is stored sealed (`locationEncrypted`), the way - // the writers store it; it is the only copy since v1.43. - // v1.43 — one Dawarich day abroad, with its sealed country. - await prisma.dawarichDay.create({ - data: { - userId: OWNER_ID, - date: "2026-06-15", - totalDistanceM: 48_300, - drivingDistanceM: 12_000, - trainDistanceM: 30_500, - placesVisited: 4, - awayFromHomeMinutes: 1440, - countryCodeEncrypted: sealDayCountry("ES"), - isTravelDay: true, - fetchedAt: new Date("2026-06-16T03:20:00.000Z"), - }, - }); - await prisma.environmentTravelLocation.create({ - data: { - userId: OWNER_ID, - startDate: "2026-06-10", - endDate: "2026-06-20", - locationEncrypted: sealLocation({ - lat: 41.4, - lon: 2.2, - label: "Barcelona", - }), - }, - }); - await prisma.environmentContext.createMany({ - data: [ - { - userId: OWNER_ID, - date: "2026-06-15", - locationEncrypted: sealLocation({ - lat: 41.4, - lon: 2.2, - label: "Barcelona", - }), - source: "TRAVEL", - tempMin: 19.4, - tempMax: 28.1, - tempMean: 23.6, - apparentMean: 25.2, - sunshineSec: 39_600, - daylightSec: 52_800, - precipSum: 0, - pressureMean: 1016.4, - pressureDelta: 3.2, - humidityMean: 63, - cloudMean: 12, - weatherCode: 1, - fetchedAt: AT("2026-06-16T03:15:00.000Z"), - }, - { - userId: OWNER_ID, - date: "2026-07-01", - locationEncrypted: sealLocation({ - lat: 52.5, - lon: 13.4, - label: "Berlin", - }), - source: "HOME", - tempMin: 13.1, - tempMax: 22.7, - tempMean: 17.9, - apparentMean: 17.1, - sunshineSec: 28_800, - daylightSec: 59_400, - precipSum: 4.6, - pressureMean: 1008.9, - pressureDelta: 7.8, - humidityMean: 74, - cloudMean: 68, - weatherCode: 61, - fetchedAt: AT("2026-07-02T03:15:00.000Z"), - }, - ], - }); -} - -async function createOwner(prisma: PrismaClient) { - return prisma.user.create({ - data: { - id: OWNER_ID, - username: "round-trip-owner", - email: "round-trip-owner@example.test", - }, - }); -} - -async function seedAdminSession(prisma: PrismaClient) { - const admin = await prisma.user.create({ - data: { - username: "round-trip-admin", - email: "round-trip-admin@example.test", - role: "ADMIN", - }, - }); - const session = await prisma.session.create({ - data: { userId: admin.id, expiresAt: new Date(Date.now() + 60_000) }, - }); - cookieJar.set("healthlog_session", session.id); - return admin; -} - describe("every model the plan claims two-ended survives a real restore", () => { it("carries a seeded row of each model out of the account and back in", async () => { const prisma = getPrismaClient(); @@ -3687,37 +2372,6 @@ describe("every model the plan claims two-ended survives a real restore", () => } }); -/** - * Columns the restore is right not to bring back verbatim, by `Model.column`. - * Every other column of every two-ended model must come back with the value - * it left with. An entry here whose column no longer exists fails the run. - */ -const COLUMN_EXCLUSIONS: Readonly> = { - "MeasurementReminder.lastNotifiedAt": - "operational repeat cursor, documented on the column as not in the backup: a restored reminder re-reminds at most once, on its next notify hour", - // When a join row was written. Nothing reads these: the links are read for - // which tag, symptom or context applies, never for when the row appeared, - // and the parent entry carries its own timestamps, which do travel. - "MoodContext.createdAt": - "insert stamp of the per-entry context row; no reader, the mood entry's own timestamps travel", - "MoodEntryTagLink.createdAt": - "insert stamp of a tag link; no reader, the mood entry's own timestamps travel", - "CycleSymptomLink.createdAt": - "insert stamp of a symptom link; no reader, the day log's own timestamps travel", - "IllnessSymptomLink.createdAt": - "insert stamp of a symptom link; no reader, the illness day log's own timestamps travel", -}; - -/** - * Columns the restore carries on purpose as "set where it was set" rather - * than the same value, each with the reason. A presence check still fails a - * column that stops coming back at all. - */ -const COLUMN_PRESENCE_ONLY: Readonly> = { - "Medication.autoMarkTakenSince": - "the auto-take floor restarts at the restore, so doses a portable file cannot carry as removed are not filled again; pinned in the restore test for it", -}; - /** * Columns a release adds ahead of the backup ends that carry them, so the * packages built in parallel on its branch each own their own section of the @@ -3736,140 +2390,6 @@ const READ_THROUGH: Readonly unknown>> = { "OnboardingRecord.stepsJson": parseOnboardingSteps, }; -/** - * Values for columns the fixture leaves empty where the type alone does not - * produce one the export and the restore accept. - */ -const FILL_OVERRIDES: Readonly> = { - "MedicationSchedule.rrule": "FREQ=WEEKLY;BYDAY=MO,TH", - "InboundDocument.sourceInstance": "https://paperless.example.test", - // The digest of the fixture's own document bytes, so a restore that checks - // it against the content finds them consistent. - "InboundDocument.contentSha256": createHash("sha256") - .update("round-trip document bytes") - .digest("hex"), - "Biomarker.contextEncrypted": () => - encryptContextToBytes("fasted, morning draw"), - "MoodEntry.tags": JSON.stringify(["round-trip-tag"]), - "CorrelationPattern.qValue": 0.04, - "CorrelationPattern.dismissedEvidenceHash": "ab".repeat(32), - // CHECK in migration 0408: the profile is built from samples or from hour buckets. - "IntradayCumulativeProfile.basis": "HOUR_BUCKETS", - // The posted hours are a whole day of slots (-1 for an hour not posted); - // the restore refuses any other length, as it does for the curve. - "IntradayCumulativeProfile.hourlyIncrements": Array.from( - { length: 24 }, - (_, hour) => (hour < 6 ? -1 : 350), - ), -}; - -/** - * Rows for the columns a CHECK constraint ties to a shape the base fixture - * does not have: a stage only on a sleep reading, a context only on a glucose - * reading, a rolling interval only on a schedule without a calendar rule. - */ -async function seedColumnShapes(prisma: PrismaClient): Promise { - await prisma.measurement.create({ - data: { - userId: OWNER_ID, - type: "BLOOD_GLUCOSE", - value: 5.4, - unit: "mmol/L", - measuredAt: AT("2026-07-03T06:45:00.000Z"), - source: "MANUAL", - glucoseContext: "FASTING", - }, - }); - await prisma.measurement.create({ - data: { - userId: OWNER_ID, - type: "SLEEP_DURATION", - value: 95, - unit: "min", - measuredAt: AT("2026-07-03T02:00:00.000Z"), - source: "APPLE_HEALTH", - externalId: "round-trip-deep-sleep", - sleepStage: "DEEP", - }, - }); - // A start logged out of order and folded into the one before it: soft - // deleted, and pointing at the start that absorbed it so that removing that - // start can bring this one back. - const absorbing = await prisma.menstrualCycle.findFirstOrThrow({ - where: { userId: OWNER_ID, startDate: "2026-06-01" }, - }); - await prisma.menstrualCycle.create({ - data: { - userId: OWNER_ID, - startDate: "2026-06-03", - deletedAt: AT("2026-06-04T07:00:00.000Z"), - absorbedIntoId: absorbing.id, - }, - }); - const medication = await prisma.medication.findFirstOrThrow({ - where: { userId: OWNER_ID }, - }); - await prisma.medicationSchedule.create({ - data: { - medicationId: medication.id, - windowStart: "20:00", - windowEnd: "21:00", - label: "Every third evening", - rollingIntervalDays: 3, - }, - }); -} - -type Delegate = { - findMany(args: { - where: Record; - }): Promise[]>; - update(args: { - where: Record; - data: Record; - }): Promise; -}; - -function delegateOf(prisma: PrismaClient, model: AuditModel): Delegate { - return (prisma as unknown as Record)[model.delegate]; -} - -function primaryKeyWhere( - model: AuditModel, - row: Record, -): Record { - if (model.primaryKey.length === 1) { - return { [model.primaryKey[0]]: row[model.primaryKey[0]] }; - } - return { - [model.primaryKey.join("_")]: Object.fromEntries( - model.primaryKey.map((k) => [k, row[k]]), - ), - }; -} - -/** How a column is compared, or why it is not. */ -function comparison( - column: AuditColumn, -): "value" | "presence" | { excluded: string } { - const key = `${column.model}.${column.name}`; - if (key in COLUMN_EXCLUSIONS) return { excluded: COLUMN_EXCLUSIONS[key] }; - if (column.isId) { - return { excluded: "primary key; the restore may mint a fresh one" }; - } - if (column.name === "userId") { - return { excluded: "owner; re-derived from the restoring account" }; - } - if (column.isUpdatedAt) { - return { excluded: "@updatedAt; Prisma stamps it on the restore's write" }; - } - // A declared foreign key may be re-pointed at a row the restore minted, so - // it is held to being set where it was set, not to the same id. - if (column.isForeignKey) return "presence"; - if (key in COLUMN_PRESENCE_ONLY) return "presence"; - return "value"; -} - /** Plaintext behind a sealed value, or the value itself when it is not one. */ function opened(value: unknown): string { if (value === null || value === undefined) return "null"; @@ -4213,47 +2733,6 @@ describe("every column of every two-ended model survives a real restore", () => }); }); -/** - * A 1x1 PNG: the smallest picture the avatar upload, and so the restore, - * accepts. - */ -const AVATAR_PNG = Buffer.from( - "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", - "base64", -); - -/** - * Values for `User` columns where the type alone would produce one the - * restore rightly refuses: a vocabulary, a time zone, an AI endpoint, a - * threshold band, an image. - */ -const USER_FILL_OVERRIDES: Readonly> = { - "User.gender": "FEMALE", - "User.locale": "fr", - "User.timezone": "America/Chicago", - "User.homeTimezone": "Asia/Tokyo", - "User.unitPreference": "imperial", - "User.glucoseUnit": "mmol/L", - "User.insightsPrivacyMode": "raw", - "User.aiProvider": "LOCAL", - "User.aiBaseUrl": "https://llm.example.com/v1", - "User.aiCompatBaseUrl": "https://gateway.example.com/v1", - "User.thresholdsJson": { WEIGHT: { min: 60, max: 80 } }, - // The restore admits goal by goal against the goals schema, so the generic - // `{ roundTrip }` blob would be refused as an unknown key, not carried. - "User.activityGoalsJson": { workoutsPerWeek: 4, stepsPerMonth: 250_000 }, - "User.globalExcludedInjectionSites": ["THIGH_LEFT"], - "User.avatarBytes": () => { - const bytes = new Uint8Array(new ArrayBuffer(AVATAR_PNG.byteLength)); - bytes.set(AVATAR_PNG); - return bytes; - }, - "User.avatarContentType": "image/png", - // v1.42 — a sealed home the way the writers seal it, so it opens. - "User.homeLocationEncrypted": () => - sealLocation({ lat: 2.5, lon: 2.5, label: "round-trip home" }), -}; - /** * Columns of the account row the restore writes for reasons of its own, so * "unchanged on the target" does not apply to them.