mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
test(medications): pin the bulk dose ingest before it moves
One walk through POST /api/medications/intake/bulk: a mixed batch with one entry per per-entry outcome (unknown and record-only medications, unstable keys, band, pinned and refused pins, named-slot skips, pending echoes, a standalone dose with site, override and key and its replay, a disallowed site, Apple doses with an in-batch repeat and an extra dose on a held slot, a skip converging onto the standalone dose), the same batch again, a background and a backfill sync with the arrival rows and checkpoint they write, the batch refusals, and the callers the route admits and refuses.
This commit is contained in:
1 parent
2fcc2bdab2
commit
2a7833d7dc
12 files changed
+7645
No files matched your search
+701
@@ -0,0 +1,701 @@
|
||||
{
|
||||
"status": 200,
|
||||
"body": {
|
||||
"data": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": [
|
||||
{
|
||||
"index": 0,
|
||||
"reason": "medication_not_found"
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"reason": "intake_not_tracked"
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"reason": "force_slot_invalid"
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"reason": "force_slot_occupied"
|
||||
},
|
||||
{
|
||||
"index": 12,
|
||||
"reason": "injection_site_not_allowed"
|
||||
},
|
||||
{
|
||||
"index": 16,
|
||||
"reason": "unstable_external_id"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": "skipped",
|
||||
"reason": "medication_not_found"
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"status": "skipped",
|
||||
"reason": "intake_not_tracked"
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"status": "skipped",
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"status": "updated",
|
||||
"id": "<id:1>"
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"status": "inserted",
|
||||
"id": "<id:2>"
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"status": "skipped",
|
||||
"reason": "force_slot_invalid"
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"status": "skipped",
|
||||
"reason": "force_slot_occupied"
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"status": "inserted",
|
||||
"id": "<id:3>"
|
||||
},
|
||||
{
|
||||
"index": 8,
|
||||
"status": "duplicate",
|
||||
"id": "<id:4>"
|
||||
},
|
||||
{
|
||||
"index": 9,
|
||||
"status": "inserted",
|
||||
"id": "<id:5>"
|
||||
},
|
||||
{
|
||||
"index": 10,
|
||||
"status": "inserted",
|
||||
"id": "<id:6>"
|
||||
},
|
||||
{
|
||||
"index": 11,
|
||||
"status": "duplicate",
|
||||
"id": "<id:6>"
|
||||
},
|
||||
{
|
||||
"index": 12,
|
||||
"status": "skipped",
|
||||
"reason": "injection_site_not_allowed"
|
||||
},
|
||||
{
|
||||
"index": 13,
|
||||
"status": "inserted",
|
||||
"id": "<id:7>"
|
||||
},
|
||||
{
|
||||
"index": 14,
|
||||
"status": "duplicate",
|
||||
"id": "<id:7>"
|
||||
},
|
||||
{
|
||||
"index": 15,
|
||||
"status": "inserted",
|
||||
"id": "<id:8>"
|
||||
},
|
||||
{
|
||||
"index": 16,
|
||||
"status": "skipped",
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 17,
|
||||
"status": "updated",
|
||||
"id": "<id:6>"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 200,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.ingest"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"medication_id": "<id:9>",
|
||||
"units": 0,
|
||||
"item_ids": [],
|
||||
"auto_opened": 0,
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7,
|
||||
"extra_doses_unscheduled": 1,
|
||||
"external_id_rejected": 2,
|
||||
"external_id_shapes": "object_description",
|
||||
"external_id_surface": "medication.intake.bulk",
|
||||
"sync_checkpoint_at": "<now>"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"effect": "queueMedicationIntakeSync",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:10>",
|
||||
"originDeviceToken": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "countOutstandingDosesToday",
|
||||
"args": [
|
||||
"<id:10>",
|
||||
"UTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "dispatchMedicationIntakeWebClearBulk",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:10>",
|
||||
"slots": [
|
||||
{
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:12>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:9>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:9>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z"
|
||||
}
|
||||
],
|
||||
"badgeCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"userId": "<id:10>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:10>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:10>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:10>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"medicationId": "<id:13>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"medicationId": "<id:11>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"medicationId": "<id:9>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"medicationId": "<id:11>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:2>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:18>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:9>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:9>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:18>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:9>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:12>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:10>",
|
||||
"medicationId": "<id:11>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:10>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "foreground",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+702
@@ -0,0 +1,702 @@
|
||||
{
|
||||
"status": 200,
|
||||
"body": {
|
||||
"data": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": [
|
||||
{
|
||||
"index": 0,
|
||||
"reason": "medication_not_found"
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"reason": "intake_not_tracked"
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"reason": "force_slot_invalid"
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"reason": "force_slot_occupied"
|
||||
},
|
||||
{
|
||||
"index": 12,
|
||||
"reason": "injection_site_not_allowed"
|
||||
},
|
||||
{
|
||||
"index": 16,
|
||||
"reason": "unstable_external_id"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": "skipped",
|
||||
"reason": "medication_not_found"
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"status": "skipped",
|
||||
"reason": "intake_not_tracked"
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"status": "skipped",
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"status": "updated",
|
||||
"id": "<id:1>"
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"status": "updated",
|
||||
"id": "<id:2>"
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"status": "skipped",
|
||||
"reason": "force_slot_invalid"
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"status": "skipped",
|
||||
"reason": "force_slot_occupied"
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"status": "updated",
|
||||
"id": "<id:3>"
|
||||
},
|
||||
{
|
||||
"index": 8,
|
||||
"status": "duplicate",
|
||||
"id": "<id:4>"
|
||||
},
|
||||
{
|
||||
"index": 9,
|
||||
"status": "updated",
|
||||
"id": "<id:5>"
|
||||
},
|
||||
{
|
||||
"index": 10,
|
||||
"status": "duplicate",
|
||||
"id": "<id:6>"
|
||||
},
|
||||
{
|
||||
"index": 11,
|
||||
"status": "duplicate",
|
||||
"id": "<id:6>"
|
||||
},
|
||||
{
|
||||
"index": 12,
|
||||
"status": "skipped",
|
||||
"reason": "injection_site_not_allowed"
|
||||
},
|
||||
{
|
||||
"index": 13,
|
||||
"status": "duplicate",
|
||||
"id": "<id:7>"
|
||||
},
|
||||
{
|
||||
"index": 14,
|
||||
"status": "duplicate",
|
||||
"id": "<id:7>"
|
||||
},
|
||||
{
|
||||
"index": 15,
|
||||
"status": "duplicate",
|
||||
"id": "<id:8>"
|
||||
},
|
||||
{
|
||||
"index": 16,
|
||||
"status": "skipped",
|
||||
"reason": "unstable_external_id"
|
||||
},
|
||||
{
|
||||
"index": 17,
|
||||
"status": "updated",
|
||||
"id": "<id:6>"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 200,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.ingest"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7,
|
||||
"extra_doses_unscheduled": 0,
|
||||
"external_id_rejected": 2,
|
||||
"external_id_shapes": "object_description",
|
||||
"external_id_surface": "medication.intake.bulk",
|
||||
"sync_checkpoint_at": "<now>"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"effect": "queueMedicationIntakeSync",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:9>",
|
||||
"originDeviceToken": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "countOutstandingDosesToday",
|
||||
"args": [
|
||||
"<id:9>",
|
||||
"UTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "dispatchMedicationIntakeWebClearBulk",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:9>",
|
||||
"slots": [
|
||||
{
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"badgeCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:9>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:9>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:9>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:9>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"medicationId": "<id:13>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"medicationId": "<id:10>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"medicationId": "<id:12>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"medicationId": "<id:10>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:2>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:18>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:12>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:12>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:18>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:12>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:11>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:9>",
|
||||
"medicationId": "<id:10>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:9>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:9>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "foreground",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+607
@@ -0,0 +1,607 @@
|
||||
{
|
||||
"status": 200,
|
||||
"body": {
|
||||
"data": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": [],
|
||||
"entries": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": "inserted",
|
||||
"id": "<id:1>"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 200,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.ingest"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"medication_id": "<id:2>",
|
||||
"units": 0,
|
||||
"item_ids": [],
|
||||
"auto_opened": 0,
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0,
|
||||
"extra_doses_unscheduled": 0,
|
||||
"sync_checkpoint_at": "<now>"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"effect": "queueMedicationIntakeSync",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:3>",
|
||||
"originDeviceToken": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "countOutstandingDosesToday",
|
||||
"args": [
|
||||
"<id:3>",
|
||||
"UTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "dispatchMedicationIntakeWebClearBulk",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:3>",
|
||||
"slots": [
|
||||
{
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"badgeCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:2>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:3>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:6>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:2>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"medicationId": "<id:6>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:4>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+648
@@ -0,0 +1,648 @@
|
||||
{
|
||||
"status": 200,
|
||||
"body": {
|
||||
"data": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": [],
|
||||
"entries": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": "inserted",
|
||||
"id": "<id:1>"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 200,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.ingest"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"medication_id": "<id:2>",
|
||||
"units": 0,
|
||||
"item_ids": [],
|
||||
"auto_opened": 0,
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0,
|
||||
"extra_doses_unscheduled": 0
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"effect": "queueMedicationIntakeSync",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:3>",
|
||||
"originDeviceToken": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "countOutstandingDosesToday",
|
||||
"args": [
|
||||
"<id:3>",
|
||||
"UTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "dispatchMedicationIntakeWebClearBulk",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:3>",
|
||||
"slots": [
|
||||
{
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"badgeCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:2>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:3>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"userId": "<id:3>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:6>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:2>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"medicationId": "<id:6>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:4>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:3>",
|
||||
"medicationId": "<id:6>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:3>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+595
@@ -0,0 +1,595 @@
|
||||
{
|
||||
"status": 422,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "Batch exceeds the 500-entry limit",
|
||||
"meta": {
|
||||
"errorCode": "medications.intake.bulk.too_large",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 422,
|
||||
"action": null,
|
||||
"meta": {
|
||||
"write_bucket": "own"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+630
@@ -0,0 +1,630 @@
|
||||
{
|
||||
"status": 422,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "Validation failed",
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small",
|
||||
"message": "Too small: expected string to have >=1 characters"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format",
|
||||
"message": "Invalid ISO datetime"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"errorCode": "medications.intake.bulk.invalid",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 422,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.validation-failed"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"issue_count": 2
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+613
@@ -0,0 +1,613 @@
|
||||
{
|
||||
"status": 422,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "An APPLE_HEALTH entry may only target a medication mirrored from Apple Health",
|
||||
"meta": {
|
||||
"errorCode": "medications.intake.bulk.apple_health_not_mirrored",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 422,
|
||||
"action": null,
|
||||
"meta": {
|
||||
"write_bucket": "own"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:12>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "28",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+708
@@ -0,0 +1,708 @@
|
||||
{
|
||||
"status": 200,
|
||||
"body": {
|
||||
"data": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": [],
|
||||
"entries": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": "inserted",
|
||||
"id": "<id:1>"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 200,
|
||||
"action": {
|
||||
"name": "medications.intake.bulk.ingest"
|
||||
},
|
||||
"meta": {
|
||||
"write_bucket": "own",
|
||||
"medication_id": "<id:2>",
|
||||
"units": 1,
|
||||
"item_ids": [
|
||||
"<id:3>"
|
||||
],
|
||||
"auto_opened": 0,
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0,
|
||||
"extra_doses_unscheduled": 0,
|
||||
"sync_checkpoint_at": "<now>"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": null
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"effect": "queueMedicationIntakeSync",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:4>",
|
||||
"originDeviceToken": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "countOutstandingDosesToday",
|
||||
"args": [
|
||||
"<id:4>",
|
||||
"UTC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"effect": "dispatchMedicationIntakeWebClearBulk",
|
||||
"args": [
|
||||
{
|
||||
"userId": "<id:4>",
|
||||
"slots": [
|
||||
{
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-12T08:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"badgeCount": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:4>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"userId": "<id:4>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"userId": "<id:4>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:2>",
|
||||
"userId": "<id:4>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:7>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:2>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"medicationId": "<id:2>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-12T08:00:00.000Z",
|
||||
"takenAt": "2026-10-12T08:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:3>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:3>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:3>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:6>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:22>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:4>",
|
||||
"medicationId": "<id:2>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "27",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:4>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+663
@@ -0,0 +1,663 @@
|
||||
{
|
||||
"status": 403,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "Insufficient permissions",
|
||||
"meta": {
|
||||
"errorCode": "auth.scope.insufficient",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 403,
|
||||
"action": null,
|
||||
"meta": null,
|
||||
"warnings": null,
|
||||
"error": {
|
||||
"type": "HttpError",
|
||||
"message": "Insufficient permissions"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-12T08:00:00.000Z",
|
||||
"takenAt": "2026-10-12T08:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:22>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "27",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "auth.bearer.failure",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"reason": "undeclared_scope",
|
||||
"tokenId": "<id:23>"
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+665
@@ -0,0 +1,665 @@
|
||||
{
|
||||
"status": 403,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "This endpoint cannot be used while acting on another account",
|
||||
"meta": {
|
||||
"errorCode": "sharing.not_permitted",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 403,
|
||||
"action": null,
|
||||
"meta": {
|
||||
"sharing_refusal": "undeclared_mode"
|
||||
},
|
||||
"warnings": null,
|
||||
"error": {
|
||||
"type": "SharingNotPermittedError",
|
||||
"message": "This endpoint cannot be used while acting on another account"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-12T08:00:00.000Z",
|
||||
"takenAt": "2026-10-12T08:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:22>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "27",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "auth.bearer.failure",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"reason": "undeclared_scope",
|
||||
"tokenId": "<id:23>"
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+663
@@ -0,0 +1,663 @@
|
||||
{
|
||||
"status": 401,
|
||||
"body": {
|
||||
"data": null,
|
||||
"error": "Not authenticated",
|
||||
"meta": {
|
||||
"errorCode": "auth.missing",
|
||||
"requestId": "<requestId>"
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"status": 401,
|
||||
"action": null,
|
||||
"meta": null,
|
||||
"warnings": null,
|
||||
"error": {
|
||||
"type": "HttpError",
|
||||
"message": "Not authenticated"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effects": [],
|
||||
"stored": {
|
||||
"medications": [
|
||||
{
|
||||
"id": "<id:1>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Apple mirror",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "APPLE_HEALTH",
|
||||
"externalId": "hk-concept-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:3>",
|
||||
"userId": "<id:2>",
|
||||
"name": "As-needed pen",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": true,
|
||||
"trackIntake": true,
|
||||
"autoMarkTaken": false,
|
||||
"autoMarkTakenSince": null,
|
||||
"deliveryForm": "INJECTION",
|
||||
"trackInjectionSites": true,
|
||||
"allowedInjectionSites": [
|
||||
"ABDOMEN_LEFT",
|
||||
"ABDOMEN_RIGHT"
|
||||
],
|
||||
"liveActivityEnabled": false,
|
||||
"criticalAlarmEnabled": false,
|
||||
"atcCode": null,
|
||||
"rxNormCode": null,
|
||||
"lowStockNotifiedAt": null,
|
||||
"lowStockNotifiedThresholdDays": null,
|
||||
"reorderLeadDays": null,
|
||||
"externalSource": null,
|
||||
"externalId": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:4>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Record only",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": null,
|
||||
"endsOn": null,
|
||||
"oneShot": false,
|
||||
"asNeeded": false,
|
||||
"trackIntake": false,
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
},
|
||||
{
|
||||
"id": "<id:5>",
|
||||
"userId": "<id:2>",
|
||||
"name": "Twice daily",
|
||||
"dose": "10mg",
|
||||
"treatmentClass": "GENERIC",
|
||||
"dosesPerUnit": null,
|
||||
"unitsPerDose": "1",
|
||||
"active": true,
|
||||
"notificationsEnabled": true,
|
||||
"pausedAt": null,
|
||||
"snoozedUntil": null,
|
||||
"startsOn": "2026-10-01T00:00:00.000Z",
|
||||
"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": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"schedules": [
|
||||
{
|
||||
"id": "<id:6>",
|
||||
"medicationId": "<id:4>",
|
||||
"windowStart": "07:00",
|
||||
"windowEnd": "08:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"07:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:7>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "08:00",
|
||||
"windowEnd": "10:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"08:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:8>",
|
||||
"medicationId": "<id:1>",
|
||||
"windowStart": "09:00",
|
||||
"windowEnd": "11:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"09:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
},
|
||||
{
|
||||
"id": "<id:9>",
|
||||
"medicationId": "<id:5>",
|
||||
"windowStart": "20:00",
|
||||
"windowEnd": "22:00",
|
||||
"label": null,
|
||||
"dose": null,
|
||||
"unitsPerDose": null,
|
||||
"daysOfWeek": null,
|
||||
"timesOfDay": [
|
||||
"20:00"
|
||||
],
|
||||
"reminderGraceMinutes": null,
|
||||
"rrule": "FREQ=DAILY",
|
||||
"rollingIntervalDays": null,
|
||||
"scheduleType": "SCHEDULED",
|
||||
"cyclicOnWeeks": null,
|
||||
"cyclicOffWeeks": null,
|
||||
"doseWindows": null
|
||||
}
|
||||
],
|
||||
"revisions": [],
|
||||
"pauseEras": [],
|
||||
"courses": [],
|
||||
"intakes": [
|
||||
{
|
||||
"id": "<id:10>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-12T08:00:00.000Z",
|
||||
"takenAt": "2026-10-12T08:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:12>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-12T09:00:00.000Z",
|
||||
"takenAt": "2026-10-12T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0004",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:13>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-13T08:00:00.000Z",
|
||||
"takenAt": "2026-10-13T11:00:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "USER_PIN",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:14>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-13T09:00:00.000Z",
|
||||
"takenAt": "2026-10-13T09:10:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0003",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:15>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:00:00.000Z",
|
||||
"takenAt": "2026-10-14T09:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": "hk-dose-0000",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:16>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-14T09:30:00.000Z",
|
||||
"takenAt": "2026-10-14T09:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0002",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:17>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-14T20:00:00.000Z",
|
||||
"takenAt": "2026-10-14T20:05:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:18>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T08:00:00.000Z",
|
||||
"takenAt": "2026-10-15T08:30:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "REMINDER",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [
|
||||
{
|
||||
"units": 1,
|
||||
"itemId": "<id:11>"
|
||||
}
|
||||
],
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:19>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:1>",
|
||||
"scheduledFor": "2026-10-15T09:00:00.000Z",
|
||||
"takenAt": "2026-10-15T09:20:00.000Z",
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "APPLE_HEALTH",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": [],
|
||||
"externalId": "hk-dose-0001",
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:20>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:3>",
|
||||
"scheduledFor": "2026-10-15T10:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": "bulk-key-0001",
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": "ABDOMEN_LEFT",
|
||||
"doseTaken": "0.5 pen",
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:21>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-15T20:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": true,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
},
|
||||
{
|
||||
"id": "<id:22>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"scheduledFor": "2026-10-16T08:00:00.000Z",
|
||||
"takenAt": null,
|
||||
"skipped": false,
|
||||
"autoMissed": false,
|
||||
"autoRecorded": false,
|
||||
"attributionSource": "AUTO",
|
||||
"source": "API",
|
||||
"idempotencyKey": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"injectionSite": null,
|
||||
"doseTaken": null,
|
||||
"inventoryConsumption": null,
|
||||
"externalId": null,
|
||||
"updatedAt": "<updatedAt>",
|
||||
"syncVersion": "<syncVersion>",
|
||||
"deletedAt": null
|
||||
}
|
||||
],
|
||||
"doseChanges": [],
|
||||
"inventoryItems": [
|
||||
{
|
||||
"id": "<id:11>",
|
||||
"userId": "<id:2>",
|
||||
"medicationId": "<id:5>",
|
||||
"state": "IN_USE",
|
||||
"containerType": "OTHER",
|
||||
"unitsTotal": "30",
|
||||
"unitsRemaining": "27",
|
||||
"firstUseAt": "2026-10-15T08:30:00.000Z",
|
||||
"expiresAt": null,
|
||||
"printedExpiry": null,
|
||||
"purchasedAt": "2026-10-01T06:00:00.000Z",
|
||||
"manufacturer": null,
|
||||
"doseStrength": null,
|
||||
"notes": null,
|
||||
"notesEncrypted": null,
|
||||
"createdAt": "<createdAt>",
|
||||
"updatedAt": "<updatedAt>"
|
||||
}
|
||||
],
|
||||
"inventoryEvents": [],
|
||||
"categories": [],
|
||||
"ingredients": [],
|
||||
"audit": [
|
||||
{
|
||||
"action": "auth.bearer.failure",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"reason": "undeclared_scope",
|
||||
"tokenId": "<id:23>"
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 1,
|
||||
"inserted": 1,
|
||||
"updated": 0,
|
||||
"duplicates": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 0,
|
||||
"updated": 5,
|
||||
"duplicates": 6,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.ingest",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"processed": 18,
|
||||
"inserted": 6,
|
||||
"updated": 2,
|
||||
"duplicates": 3,
|
||||
"skipped": 7
|
||||
},
|
||||
"ipAddress": null
|
||||
},
|
||||
{
|
||||
"action": "medications.intake.bulk.validation-failed",
|
||||
"userId": "<id:2>",
|
||||
"actorUserId": null,
|
||||
"details": {
|
||||
"issues": [
|
||||
{
|
||||
"path": "entries.0.medicationId",
|
||||
"code": "too_small"
|
||||
},
|
||||
{
|
||||
"path": "entries.0.takenAt",
|
||||
"code": "invalid_format"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipAddress": null
|
||||
}
|
||||
],
|
||||
"idempotency": []
|
||||
},
|
||||
"extra": {
|
||||
"lastSyncedAt": "<now>",
|
||||
"arrivals": [
|
||||
{
|
||||
"type": "MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": "background",
|
||||
"lastNewSampleAt": "<now>",
|
||||
"lastBackgroundAt": "<now>",
|
||||
"lastSeenDuplicateAt": "<now>"
|
||||
},
|
||||
{
|
||||
"type": "backfill:MEDICATION_DOSE",
|
||||
"lastReceivedAt": "<now>",
|
||||
"lastTrigger": null,
|
||||
"lastNewSampleAt": null,
|
||||
"lastBackgroundAt": null,
|
||||
"lastSeenDuplicateAt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
/**
|
||||
* Parity for `POST /api/medications/intake/bulk` while the batch ingest moves
|
||||
* into `src/lib/medications/`.
|
||||
*
|
||||
* One record walks through the cases the route tells apart, in order, each
|
||||
* request seeing what the earlier ones stored. A first mixed batch carries
|
||||
* one entry per per-entry outcome: an unknown medication, a record-only one,
|
||||
* an unstable idempotency key and an unstable external id, a take inside its
|
||||
* band, a pinned take and both pin refusals, a skip on a named slot, a
|
||||
* pending echo onto a recorded dose and one onto a fresh slot, a standalone
|
||||
* take with a site, a dose override and a key, its replay, a disallowed
|
||||
* site, an Apple dose and its repeat inside the batch, an Apple dose whose
|
||||
* slot another dose holds, and a skip that converges onto the standalone
|
||||
* dose. Then the same batch again, a background and a backfill sync, the
|
||||
* refusals (too large, a body the schema refuses, an Apple entry on a native
|
||||
* medication), a native client, a narrow token, a delegate and nobody.
|
||||
*
|
||||
* After each request the snapshot holds the response, the wide event, the
|
||||
* recorded tails, every medication row of the accounts, and the sync
|
||||
* checkpoint and Apple Health arrival rows the batch writes. The clock is
|
||||
* pinned (`Date` only), so the snapshot is the same on every day it runs.
|
||||
*/
|
||||
import { afterAll, beforeAll, describe, it, vi } from "vitest";
|
||||
|
||||
import { POST } from "@/app/api/medications/intake/bulk/route";
|
||||
|
||||
import { anonymous, type RouteAuth } from "../../../kit/call-route";
|
||||
import {
|
||||
makeMedication,
|
||||
makeSession,
|
||||
makeToken,
|
||||
makeUser,
|
||||
} from "../../../kit/factories";
|
||||
import { getPrismaClient, truncateAllTables } from "../../setup";
|
||||
import { delegateOf, parityStep } from "./medication-state";
|
||||
|
||||
vi.mock("@/lib/logging/transports", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import("@/lib/logging/transports")>();
|
||||
const { wideEventRecorder: recorder } = await import("../../../kit/parity");
|
||||
return {
|
||||
...actual,
|
||||
emitIfSampled: (event: (typeof recorder.events)[number]) => {
|
||||
recorder.events.push(event);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// The tails the route starts without awaiting them (the cross-device push,
|
||||
// the web-push dose clear with its badge count), recorded instead of run
|
||||
// (see `effectRecorder`).
|
||||
vi.mock(
|
||||
"@/lib/notifications/medication-intake-sync",
|
||||
async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<
|
||||
typeof import("@/lib/notifications/medication-intake-sync")
|
||||
>();
|
||||
const { effectRecorder } = await import("../../../kit/parity");
|
||||
return {
|
||||
...actual,
|
||||
queueMedicationIntakeSync: (...args: unknown[]) => {
|
||||
effectRecorder.record("queueMedicationIntakeSync", args);
|
||||
},
|
||||
};
|
||||
},
|
||||
);
|
||||
vi.mock("@/lib/notifications/web-push-clear", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import("@/lib/notifications/web-push-clear")>();
|
||||
const { effectRecorder } = await import("../../../kit/parity");
|
||||
return {
|
||||
...actual,
|
||||
dispatchMedicationIntakeWebClearBulk: async (...args: unknown[]) => {
|
||||
effectRecorder.record("dispatchMedicationIntakeWebClearBulk", args);
|
||||
},
|
||||
};
|
||||
});
|
||||
vi.mock("@/lib/medications/outstanding-doses", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<
|
||||
typeof import("@/lib/medications/outstanding-doses")
|
||||
>();
|
||||
const { effectRecorder } = await import("../../../kit/parity");
|
||||
return {
|
||||
...actual,
|
||||
countOutstandingDosesToday: async (...args: unknown[]) => {
|
||||
effectRecorder.record("countOutstandingDosesToday", args);
|
||||
return 2;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const prisma = getPrismaClient();
|
||||
const NOW = new Date("2026-10-15T12:00:00.000Z");
|
||||
const ROUTE = "/api/medications/intake/bulk";
|
||||
const INVALID_ACTION = "medications.intake.bulk.validation-failed";
|
||||
|
||||
let ownerId: string;
|
||||
let userIds: string[];
|
||||
let owner: RouteAuth;
|
||||
let ownerBearer: RouteAuth;
|
||||
let narrowBearer: RouteAuth;
|
||||
let writer: { auth: RouteAuth; headers: Record<string, string> };
|
||||
const med: Record<string, string> = {};
|
||||
|
||||
type Caller = { auth?: RouteAuth; headers?: Record<string, string> };
|
||||
|
||||
/** The sync checkpoint and the Apple Health arrival rows of the owner. */
|
||||
async function syncState() {
|
||||
const [user, arrivals] = await Promise.all([
|
||||
prisma.user.findUniqueOrThrow({
|
||||
where: { id: ownerId },
|
||||
select: { lastSyncedAt: true },
|
||||
}),
|
||||
prisma.healthKitTypeSync.findMany({
|
||||
where: { userId: ownerId },
|
||||
orderBy: { type: "asc" },
|
||||
select: {
|
||||
type: true,
|
||||
lastReceivedAt: true,
|
||||
lastTrigger: true,
|
||||
lastNewSampleAt: true,
|
||||
lastBackgroundAt: true,
|
||||
lastSeenDuplicateAt: true,
|
||||
},
|
||||
}),
|
||||
]);
|
||||
return { lastSyncedAt: user.lastSyncedAt, arrivals };
|
||||
}
|
||||
|
||||
/**
|
||||
* An audit row a refusal writes without awaiting it: the schema refusal's
|
||||
* own, and the narrow token's `auth.bearer.failure`.
|
||||
*/
|
||||
async function auditRows(action: string, count: number): Promise<void> {
|
||||
// Polled on the real timer: the pinned clock stamps the rows read back,
|
||||
// and nothing here may move it.
|
||||
for (let attempt = 0; attempt < 250; attempt += 1) {
|
||||
const rows = await prisma.auditLog.count({ where: { action } });
|
||||
if (rows >= count) return;
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
}
|
||||
throw new Error(`fewer than ${count} ${action} rows landed`);
|
||||
}
|
||||
|
||||
async function post(
|
||||
name: string,
|
||||
body: unknown,
|
||||
options: Caller & { settle?: () => Promise<void> } = {},
|
||||
) {
|
||||
await parityStep({
|
||||
name: `medication-intake-bulk.${name}`,
|
||||
handler: POST,
|
||||
options: {
|
||||
method: "POST",
|
||||
route: ROUTE,
|
||||
body,
|
||||
auth: options.auth ?? owner,
|
||||
headers: options.headers,
|
||||
},
|
||||
userIds,
|
||||
now: NOW,
|
||||
settle: options.settle,
|
||||
extra: syncState,
|
||||
});
|
||||
}
|
||||
|
||||
async function intake(
|
||||
medicationId: string,
|
||||
data: {
|
||||
scheduledFor: string;
|
||||
takenAt?: string;
|
||||
source?: "REMINDER" | "APPLE_HEALTH";
|
||||
externalId?: string;
|
||||
},
|
||||
) {
|
||||
await prisma.medicationIntakeEvent.create({
|
||||
data: {
|
||||
userId: ownerId,
|
||||
medicationId,
|
||||
scheduledFor: new Date(data.scheduledFor),
|
||||
takenAt: data.takenAt ? new Date(data.takenAt) : null,
|
||||
source: data.source ?? "REMINDER",
|
||||
externalId: data.externalId ?? null,
|
||||
createdAt: new Date("2026-10-01T06:00:00.000Z"),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const daily = (time: string, windowEnd: string) => ({
|
||||
windowStart: time,
|
||||
windowEnd,
|
||||
timesOfDay: [time],
|
||||
rrule: "FREQ=DAILY",
|
||||
});
|
||||
|
||||
/** One entry per per-entry outcome the loop tells apart. */
|
||||
function mixedBatch() {
|
||||
return {
|
||||
syncTrigger: "foreground",
|
||||
entries: [
|
||||
{ medicationId: med.foreign, takenAt: "2026-10-15T08:10:00.000Z" },
|
||||
{ medicationId: med.recordOnly, takenAt: "2026-10-15T07:10:00.000Z" },
|
||||
{
|
||||
medicationId: med.daily,
|
||||
takenAt: "2026-10-15T08:20:00.000Z",
|
||||
idempotencyKey: "<HKDoseEvent: 0x600003a1c0c0>",
|
||||
},
|
||||
{ medicationId: med.daily, takenAt: "2026-10-15T08:30:00.000Z" },
|
||||
{
|
||||
medicationId: med.daily,
|
||||
takenAt: "2026-10-13T11:00:00.000Z",
|
||||
forceSlotInstant: "2026-10-13T08:00:00.000Z",
|
||||
},
|
||||
{
|
||||
medicationId: med.daily,
|
||||
takenAt: "2026-10-13T16:00:00.000Z",
|
||||
forceSlotInstant: "2026-10-13T15:00:00.000Z",
|
||||
},
|
||||
{
|
||||
medicationId: med.daily,
|
||||
takenAt: "2026-10-14T23:00:00.000Z",
|
||||
forceSlotInstant: "2026-10-14T20:00:00.000Z",
|
||||
},
|
||||
{
|
||||
medicationId: med.daily,
|
||||
skipped: true,
|
||||
scheduledFor: "2026-10-15T20:00:00.000Z",
|
||||
},
|
||||
{ medicationId: med.daily, scheduledFor: "2026-10-14T20:00:00.000Z" },
|
||||
{ medicationId: med.daily, scheduledFor: "2026-10-16T08:00:00.000Z" },
|
||||
{
|
||||
medicationId: med.pen,
|
||||
takenAt: "2026-10-15T10:00:00.000Z",
|
||||
injectionSite: "ABDOMEN_LEFT",
|
||||
doseTaken: "0.5 pen",
|
||||
idempotencyKey: "bulk-key-0001",
|
||||
},
|
||||
{
|
||||
medicationId: med.pen,
|
||||
takenAt: "2026-10-15T10:00:00.000Z",
|
||||
idempotencyKey: "bulk-key-0001",
|
||||
},
|
||||
{
|
||||
medicationId: med.pen,
|
||||
takenAt: "2026-10-15T10:30:00.000Z",
|
||||
injectionSite: "ABDOMEN_RIGHT",
|
||||
},
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-15T09:20:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0001",
|
||||
},
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-15T09:20:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0001",
|
||||
},
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-14T09:30:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0002",
|
||||
},
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-14T10:00:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "<HKMedicationDoseEvent: 0x600003b2d0d0>",
|
||||
},
|
||||
{
|
||||
medicationId: med.pen,
|
||||
skipped: true,
|
||||
scheduledFor: "2026-10-15T10:00:00.000Z",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.useFakeTimers({ toFake: ["Date"], now: NOW });
|
||||
await truncateAllTables(prisma);
|
||||
const user = await makeUser({
|
||||
timezone: "UTC",
|
||||
globalExcludedInjectionSites: ["ABDOMEN_RIGHT"],
|
||||
});
|
||||
ownerId = user.id;
|
||||
owner = await makeSession(user);
|
||||
ownerBearer = await makeToken(user, { name: "kit-phone" });
|
||||
narrowBearer = await makeToken(user, {
|
||||
name: "kit-ingest",
|
||||
permissions: ["medication:ingest"],
|
||||
});
|
||||
const created = new Date("2026-10-01T06:00:00.000Z");
|
||||
|
||||
const dailyMed = await makeMedication(
|
||||
user,
|
||||
{
|
||||
name: "Twice daily",
|
||||
startsOn: new Date("2026-10-01"),
|
||||
createdAt: created,
|
||||
snoozedUntil: new Date("2026-10-15T12:30:00.000Z"),
|
||||
},
|
||||
[daily("08:00", "10:00"), daily("20:00", "22:00")],
|
||||
);
|
||||
med.daily = dailyMed.id;
|
||||
await prisma.medicationInventoryItem.create({
|
||||
data: {
|
||||
userId: ownerId,
|
||||
medicationId: dailyMed.id,
|
||||
unitsTotal: 30,
|
||||
unitsRemaining: 30,
|
||||
purchasedAt: created,
|
||||
},
|
||||
});
|
||||
await intake(dailyMed.id, { scheduledFor: "2026-10-15T08:00:00.000Z" });
|
||||
await intake(dailyMed.id, {
|
||||
scheduledFor: "2026-10-14T20:00:00.000Z",
|
||||
takenAt: "2026-10-14T20:05:00.000Z",
|
||||
});
|
||||
|
||||
med.pen = (
|
||||
await makeMedication(
|
||||
user,
|
||||
{
|
||||
name: "As-needed pen",
|
||||
createdAt: created,
|
||||
asNeeded: true,
|
||||
deliveryForm: "INJECTION",
|
||||
trackInjectionSites: true,
|
||||
allowedInjectionSites: ["ABDOMEN_LEFT", "ABDOMEN_RIGHT"],
|
||||
},
|
||||
[],
|
||||
)
|
||||
).id;
|
||||
|
||||
const apple = await makeMedication(
|
||||
user,
|
||||
{
|
||||
name: "Apple mirror",
|
||||
startsOn: new Date("2026-10-01"),
|
||||
createdAt: created,
|
||||
externalSource: "APPLE_HEALTH",
|
||||
externalId: "hk-concept-0001",
|
||||
},
|
||||
[daily("09:00", "11:00")],
|
||||
);
|
||||
med.apple = apple.id;
|
||||
await intake(apple.id, {
|
||||
scheduledFor: "2026-10-14T09:00:00.000Z",
|
||||
takenAt: "2026-10-14T09:05:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0000",
|
||||
});
|
||||
|
||||
med.recordOnly = (
|
||||
await makeMedication(
|
||||
user,
|
||||
{ name: "Record only", createdAt: created, trackIntake: false },
|
||||
[daily("07:00", "08:00")],
|
||||
)
|
||||
).id;
|
||||
|
||||
const stranger = await makeUser({ timezone: "UTC" });
|
||||
med.foreign = (await makeMedication(stranger, { name: "Not yours" })).id;
|
||||
|
||||
const w = await delegateOf(prisma, user, "WRITE");
|
||||
writer = { auth: w.auth, headers: w.headers };
|
||||
userIds = [ownerId, w.delegate.id];
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
describe("POST /api/medications/intake/bulk parity", () => {
|
||||
it("01 a mixed first batch", async () => {
|
||||
await post("01-mixed", mixedBatch());
|
||||
});
|
||||
|
||||
it("02 the same batch again", async () => {
|
||||
await post("02-mixed-again", mixedBatch());
|
||||
});
|
||||
|
||||
it("03 a background sync and a backfill", async () => {
|
||||
await post("03a-background", {
|
||||
syncTrigger: "background",
|
||||
entries: [
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-13T09:10:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0003",
|
||||
},
|
||||
],
|
||||
});
|
||||
await post("03b-backfill", {
|
||||
syncTrigger: "backfill",
|
||||
entries: [
|
||||
{
|
||||
medicationId: med.apple,
|
||||
takenAt: "2026-10-12T09:10:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0004",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("04 the batch refusals", async () => {
|
||||
await post("04a-too-large", {
|
||||
entries: Array.from({ length: 501 }, () => ({
|
||||
medicationId: med.daily,
|
||||
})),
|
||||
});
|
||||
await post(
|
||||
"04b-invalid",
|
||||
{ entries: [{ medicationId: "", takenAt: "never" }] },
|
||||
{ settle: () => auditRows(INVALID_ACTION, 1) },
|
||||
);
|
||||
await post("04c-apple-not-mirrored", {
|
||||
entries: [
|
||||
{
|
||||
medicationId: med.daily,
|
||||
takenAt: "2026-10-12T08:10:00.000Z",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: "hk-dose-0005",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("05 a native client, a narrow token, a delegate and nobody", async () => {
|
||||
const batch = {
|
||||
entries: [
|
||||
{ medicationId: med.daily, takenAt: "2026-10-12T08:10:00.000Z" },
|
||||
],
|
||||
};
|
||||
await post("05a-native", batch, { auth: ownerBearer });
|
||||
await post("05b-narrow-token", batch, {
|
||||
auth: narrowBearer,
|
||||
settle: () => auditRows("auth.bearer.failure", 1),
|
||||
});
|
||||
await post("05c-delegate", batch, writer);
|
||||
await post("05d-anonymous", batch, { auth: anonymous });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user