diff --git a/tests/integration/routes/parity/__snapshots__/medications.01-list.json.snap b/tests/integration/routes/parity/__snapshots__/medications.01-list.json.snap new file mode 100644 index 000000000..f9dd28d2e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.01-list.json.snap @@ -0,0 +1,170 @@ +{ + "status": 200, + "body": { + "data": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "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, + "resolvedUnitsPerDose": 1 + } + ], + "hasIngredients": false, + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "lastTakenAt": null, + "todayEventCount": 0, + "nextDueAt": "2026-10-16T06:00:00.000Z", + "remindersActive": true, + "nextDueOverdue": false, + "nextDueScheduleId": "", + "courseStatus": "CURRENT", + "intakeActionable": true, + "stockUnitsRemaining": null, + "stockDosesRemaining": null, + "runwayDays": null + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.list" + }, + "meta": { + "cache.medications.outcome": "miss", + "cache.medications.key_hash": "", + "count": 1 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "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 + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.02a-list-reader.json.snap b/tests/integration/routes/parity/__snapshots__/medications.02a-list-reader.json.snap new file mode 100644 index 000000000..1a1069321 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.02a-list-reader.json.snap @@ -0,0 +1,170 @@ +{ + "status": 200, + "body": { + "data": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "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, + "resolvedUnitsPerDose": 1 + } + ], + "hasIngredients": false, + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "lastTakenAt": null, + "todayEventCount": 0, + "nextDueAt": "2026-10-16T06:00:00.000Z", + "remindersActive": true, + "nextDueOverdue": false, + "nextDueScheduleId": "", + "courseStatus": "CURRENT", + "intakeActionable": true, + "stockUnitsRemaining": null, + "stockDosesRemaining": null, + "runwayDays": null + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.list" + }, + "meta": { + "cache.medications.outcome": "hit", + "cache.medications.key_hash": "", + "count": 1 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "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 + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.02b-list-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medications.02b-list-anonymous.json.snap new file mode 100644 index 000000000..45da3b863 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.02b-list-anonymous.json.snap @@ -0,0 +1,95 @@ +{ + "status": 401, + "body": { + "data": null, + "error": "Not authenticated", + "meta": { + "errorCode": "auth.missing", + "requestId": "" + } + }, + "events": [ + { + "status": 401, + "action": null, + "meta": null, + "warnings": null, + "error": { + "type": "HttpError", + "message": "Not authenticated" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "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 + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.11-plain.json.snap b/tests/integration/routes/parity/__snapshots__/medications.11-plain.json.snap new file mode 100644 index 000000000..8882ea379 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.11-plain.json.snap @@ -0,0 +1,226 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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 + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.12-full.json.snap b/tests/integration/routes/parity/__snapshots__/medications.12-full.json.snap new file mode 100644 index 000000000..24775d467 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.12-full.json.snap @@ -0,0 +1,334 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": 0.5, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": 1, + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [ + { + "id": "", + "startsOn": "2026-10-10", + "endsOn": "2026-12-31", + "status": "CURRENT", + "takenDoses": 0, + "note": null + } + ], + "courseCount": 1, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.13a-as-needed.json.snap b/tests/integration/routes/parity/__snapshots__/medications.13a-as-needed.json.snap new file mode 100644 index 000000000..c23aca305 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.13a-as-needed.json.snap @@ -0,0 +1,344 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [], + "category": "PAIN_RELIEF", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.13b-one-shot.json.snap b/tests/integration/routes/parity/__snapshots__/medications.13b-one-shot.json.snap new file mode 100644 index 000000000..a43296040 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.13b-one-shot.json.snap @@ -0,0 +1,455 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [ + { + "id": "", + "startsOn": "2026-10-20", + "endsOn": "2026-10-20", + "status": "UPCOMING", + "takenDoses": 0, + "note": null + } + ], + "courseCount": 1, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.13c-prn-and-legacy-days.json.snap b/tests/integration/routes/parity/__snapshots__/medications.13c-prn-and-legacy-days.json.snap new file mode 100644 index 000000000..81a5f1d0c --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.13c-prn-and-legacy-days.json.snap @@ -0,0 +1,599 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "", + "schedules": [], + "recordedSchedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.13d-ended-window.json.snap b/tests/integration/routes/parity/__snapshots__/medications.13d-ended-window.json.snap new file mode 100644 index 000000000..b12f37c1b --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.13d-ended-window.json.snap @@ -0,0 +1,645 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [ + { + "id": "", + "startsOn": "2026-10-05", + "endsOn": "2026-10-05", + "status": "ENDED", + "takenDoses": 0, + "note": null + } + ], + "courseCount": 1, + "previousCourseEndedOn": "2026-10-05", + "canStartCourse": true + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14a-unknown-category.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14a-unknown-category.json.snap new file mode 100644 index 000000000..b55686124 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14a-unknown-category.json.snap @@ -0,0 +1,574 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Unknown medication category", + "meta": { + "errorCode": "medications.category.unknown", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14b-course-ends-before-start.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14b-course-ends-before-start.json.snap new file mode 100644 index 000000000..5cc3ae9de --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14b-course-ends-before-start.json.snap @@ -0,0 +1,583 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "endsOn", + "code": "custom", + "message": "endsOn must be on or after startsOn" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14c-one-shot-two-schedules.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14c-one-shot-two-schedules.json.snap new file mode 100644 index 000000000..688566769 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14c-one-shot-two-schedules.json.snap @@ -0,0 +1,574 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A one-shot medication can have at most one schedule", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14d-one-shot-recurrence.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14d-one-shot-recurrence.json.snap new file mode 100644 index 000000000..85ecda70f --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14d-one-shot-recurrence.json.snap @@ -0,0 +1,574 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A one-shot medication cannot have a recurrence (rrule or rollingIntervalDays)", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14e-unstable-concept-id.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14e-unstable-concept-id.json.snap new file mode 100644 index 000000000..a2b535824 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14e-unstable-concept-id.json.snap @@ -0,0 +1,589 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "externalId", + "code": "custom", + "message": "external identifier must be stable across app restarts; received an object description (), which embeds a memory address and is a new value on every launch — serialise the identity itself, not the object's description" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medication.external_id.rejected" + }, + "meta": { + "external_id_rejected": 1, + "external_id_shapes": "object_description", + "external_id_surface": "medication.create" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.14f-invalid.json.snap b/tests/integration/routes/parity/__snapshots__/medications.14f-invalid.json.snap new file mode 100644 index 000000000..c0abd73eb --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.14f-invalid.json.snap @@ -0,0 +1,593 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "name", + "code": "too_small", + "message": "Too small: expected string to have >=1 characters" + }, + { + "path": "dose", + "code": "invalid_type", + "message": "Invalid input: expected string, received number" + }, + { + "path": "schedules", + "code": "invalid_type", + "message": "Invalid input: expected array, received string" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.15a-mirror.json.snap b/tests/integration/routes/parity/__snapshots__/medications.15a-mirror.json.snap new file mode 100644 index 000000000..302f69f2d --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.15a-mirror.json.snap @@ -0,0 +1,706 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.15b-mirror-replay.json.snap b/tests/integration/routes/parity/__snapshots__/medications.15b-mirror-replay.json.snap new file mode 100644 index 000000000..25c308749 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.15b-mirror-replay.json.snap @@ -0,0 +1,704 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "idempotent_replay": true + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.16-mirror-cap.json.snap b/tests/integration/routes/parity/__snapshots__/medications.16-mirror-cap.json.snap new file mode 100644 index 000000000..a7712a941 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.16-mirror-cap.json.snap @@ -0,0 +1,1061 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "This account already mirrors the maximum number of medications from an external source", + "meta": { + "errorCode": "medications.mirror.limit_exceeded", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medication.mirror.limit_exceeded" + }, + "meta": { + "existing": 30 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Mirror 00", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-00", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 01", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-01", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 02", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-02", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 03", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-03", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 04", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-04", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 05", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-05", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 06", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-06", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 07", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-07", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 08", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-08", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 09", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-09", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 10", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-10", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 11", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-11", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 12", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-12", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 13", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-13", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 14", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-14", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 15", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-15", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 16", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-16", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 17", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-17", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 18", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-18", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 19", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-19", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 20", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-20", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 21", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-21", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 22", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-22", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 23", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-23", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 24", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-24", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 25", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-25", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 26", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-26", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 27", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-27", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 28", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-28", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirror 29", + "dose": "1mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-cap-29", + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.17a-idempotent-first.json.snap b/tests/integration/routes/parity/__snapshots__/medications.17a-idempotent-first.json.snap new file mode 100644 index 000000000..d6d186d9a --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.17a-idempotent-first.json.snap @@ -0,0 +1,786 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Retried", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [ + { + "userId": "", + "key": "", + "method": "POST", + "path": "/api/medications", + "responseStatus": 201, + "requestFingerprint": "717bc7f22eaede79d3d0ec9e0197c6fae152d91ae21b29662ebbe2b02d7bd896", + "expiresAt": "2026-10-16T12:00:00.000Z" + } + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.17b-idempotent-replay.json.snap b/tests/integration/routes/parity/__snapshots__/medications.17b-idempotent-replay.json.snap new file mode 100644 index 000000000..478f992f5 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.17b-idempotent-replay.json.snap @@ -0,0 +1,787 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "idempotency.replay" + }, + "meta": { + "method": "POST", + "path": "/api/medications" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Retried", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [ + { + "userId": "", + "key": "", + "method": "POST", + "path": "/api/medications", + "responseStatus": 201, + "requestFingerprint": "717bc7f22eaede79d3d0ec9e0197c6fae152d91ae21b29662ebbe2b02d7bd896", + "expiresAt": "2026-10-16T12:00:00.000Z" + } + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.18a-writer.json.snap b/tests/integration/routes/parity/__snapshots__/medications.18a-writer.json.snap new file mode 100644 index 000000000..ca74c6b43 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.18a-writer.json.snap @@ -0,0 +1,856 @@ +{ + "status": 201, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Brought by a delegate", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 201, + "action": { + "name": "medication.create", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Brought by a delegate", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "name": "Brought by a delegate", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Retried", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [ + { + "userId": "", + "key": "", + "method": "POST", + "path": "/api/medications", + "responseStatus": 201, + "requestFingerprint": "717bc7f22eaede79d3d0ec9e0197c6fae152d91ae21b29662ebbe2b02d7bd896", + "expiresAt": "2026-10-16T12:00:00.000Z" + } + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.18b-reader.json.snap b/tests/integration/routes/parity/__snapshots__/medications.18b-reader.json.snap new file mode 100644 index 000000000..ee5305870 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.18b-reader.json.snap @@ -0,0 +1,799 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "Account access denied", + "meta": { + "errorCode": "sharing.access.denied", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": null, + "meta": { + "sharing_refusal": "insufficient_access" + }, + "warnings": null, + "error": { + "type": "SharingAccessDeniedError", + "message": "Account access denied" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Brought by a delegate", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "name": "Brought by a delegate", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Retried", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [ + { + "userId": "", + "key": "", + "method": "POST", + "path": "/api/medications", + "responseStatus": 201, + "requestFingerprint": "717bc7f22eaede79d3d0ec9e0197c6fae152d91ae21b29662ebbe2b02d7bd896", + "expiresAt": "2026-10-16T12:00:00.000Z" + } + ] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medications.19-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medications.19-anonymous.json.snap new file mode 100644 index 000000000..5a4de87eb --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medications.19-anonymous.json.snap @@ -0,0 +1,797 @@ +{ + "status": 401, + "body": { + "data": null, + "error": "Not authenticated", + "meta": { + "errorCode": "auth.missing", + "requestId": "" + } + }, + "events": [ + { + "status": 401, + "action": null, + "meta": null, + "warnings": null, + "error": { + "type": "HttpError", + "message": "Not authenticated" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "400mg", + "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": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Brought by a delegate", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Ended window", + "dose": "3mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Existing tablet", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Full injection", + "dose": "1 pen", + "treatmentClass": "GLP1", + "dosesPerUnit": 4, + "unitsPerDose": "0.5", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "THIGH_RIGHT" + ], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "A10BJ06", + "rxNormCode": "1991302", + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 7, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mirrored", + "dose": "50mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": "APPLE_HEALTH", + "externalId": "hk-concept-0001", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Mixed schedules", + "dose": "2mg", + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "One shot", + "dose": "1 dose", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Plain tablet", + "dose": "5mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Retried", + "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": 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": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "PRN", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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": "", + "medicationId": "", + "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": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 3, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "18:00", + "windowEnd": "20:00", + "label": "Evening", + "dose": "0.5 pen", + "unitsPerDose": "1", + "daysOfWeek": null, + "timesOfDay": [ + "18:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=WEEKLY;BYDAY=MO", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "20:00", + "start": "18:00", + "timeOfDay": "18:30" + } + ] + }, + { + "id": "", + "medicationId": "", + "windowStart": "21:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "21:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-05T00:00:00.000Z", + "endsOn": "2026-10-05T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-10T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [], + "doseChanges": [], + "inventoryItems": [], + "inventoryEvents": [], + "categories": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "PAIN_RELIEF", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [], + "audit": [ + { + "action": "medication.create", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "name": "Brought by a delegate", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "As needed", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Ended window", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Full injection", + "autoMarkTaken": true + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mirrored", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Mixed schedules", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "One shot", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Plain tablet", + "autoMarkTaken": false + }, + "ipAddress": null + }, + { + "action": "medication.create", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "Retried", + "autoMarkTaken": false + }, + "ipAddress": null + } + ], + "idempotency": [ + { + "userId": "", + "key": "", + "method": "POST", + "path": "/api/medications", + "responseStatus": 201, + "requestFingerprint": "717bc7f22eaede79d3d0ec9e0197c6fae152d91ae21b29662ebbe2b02d7bd896", + "expiresAt": "2026-10-16T12:00:00.000Z" + } + ] + } +} diff --git a/tests/integration/routes/parity/medication-state.ts b/tests/integration/routes/parity/medication-state.ts index 1103d75fa..b73829783 100644 --- a/tests/integration/routes/parity/medication-state.ts +++ b/tests/integration/routes/parity/medication-state.ts @@ -186,6 +186,21 @@ export async function medicationState(prisma: Client, userIds: string[]) { }; } +/** + * A server cache reports the hash of the key it looked up, and the key holds + * the account id, so the hash differs on every run. Its presence is kept. + */ +function withoutCacheKeyHashes(facts: unknown): unknown { + if (!facts || typeof facts !== "object") return facts; + const { meta } = facts as { meta?: unknown }; + if (!meta || typeof meta !== "object") return facts; + const cleaned: Record = {}; + for (const [k, v] of Object.entries(meta)) { + cleaned[k] = /^cache\..+\.key_hash$/.test(k) ? "" : v; + } + return { ...facts, meta: cleaned }; +} + export interface ParityCall { /** Snapshot name, `.`. */ name: string; @@ -215,7 +230,7 @@ export async function parityStep(call: ParityCall) { { status: res.status, body: res.body, - events: events.map(eventFacts), + events: events.map(eventFacts).map(withoutCacheKeyHashes), effects: effectRecorder.take(), stored: await medicationState(getPrismaClient(), call.userIds), }, diff --git a/tests/integration/routes/parity/medications.parity.test.ts b/tests/integration/routes/parity/medications.parity.test.ts new file mode 100644 index 000000000..028bfffa6 --- /dev/null +++ b/tests/integration/routes/parity/medications.parity.test.ts @@ -0,0 +1,344 @@ +/** + * Parity for `GET` and `POST /api/medications` while the create 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: the list for its owner, for a + * reading delegate and for nobody; a plain create, a full one with a custom + * category, a course window and doses recorded automatically, an as-needed + * one, a one-shot one and a PRN schedule; the refusals (an unknown category, + * a course that ends before it starts, the two one-shot shapes, an unstable + * concept id, a body the schema refuses); a mirrored create, its replay, and + * the mirror cap on a second account; an idempotent retry; and creates by a + * delegate who may write and one who may only read. After each request the + * snapshot holds the response, the wide event and every medication row of + * the accounts. + * + * 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 { GET, POST } from "@/app/api/medications/route"; +import { encryptToBytes } from "@/lib/ai/coach/bytes-codec"; + +import { anonymous, type RouteAuth } from "../../../kit/call-route"; +import { makeMedication, makeSession, 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(); + const { wideEventRecorder: recorder } = await import("../../../kit/parity"); + return { + ...actual, + emitIfSampled: (event: (typeof recorder.events)[number]) => { + recorder.events.push(event); + }, + }; +}); + +const prisma = getPrismaClient(); +const NOW = new Date("2026-10-15T12:00:00.000Z"); +const ROUTE = "/api/medications"; +/** + * The create answers without the read-model fields (reminder state, course + * status, stock and runway) the registered medication resource declares. The + * parity snapshot pins that answer as it is; the contract check is the + * route's own tests' business. + */ +const CREATE_ANSWER = { + skip: "the create answers without the read-model fields of the resource", +}; +const CUSTOM_KEY = "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13"; + +let ownerId: string; +let userIds: string[]; +let owner: RouteAuth; +let writer: { auth: RouteAuth; headers: Record }; +let reader: { auth: RouteAuth; headers: Record }; + +async function list( + name: string, + options: { auth?: RouteAuth; headers?: Record } = {}, +) { + await parityStep({ + name: `medications.${name}`, + handler: GET, + options: { + method: "GET", + route: ROUTE, + auth: options.auth ?? owner, + headers: options.headers, + }, + userIds, + now: NOW, + }); +} + +async function create( + name: string, + body: unknown, + options: { + auth?: RouteAuth; + headers?: Record; + userIds?: string[]; + } = {}, +) { + await parityStep({ + name: `medications.${name}`, + handler: POST, + options: { + method: "POST", + route: ROUTE, + body, + auth: options.auth ?? owner, + headers: options.headers, + contract: CREATE_ANSWER, + }, + userIds: options.userIds ?? userIds, + now: NOW, + }); +} + +const schedule = (windowStart: string, windowEnd: string, extra = {}) => ({ + windowStart, + windowEnd, + ...extra, +}); + +beforeAll(async () => { + vi.useFakeTimers({ toFake: ["Date"], now: NOW }); + await truncateAllTables(prisma); + const user = await makeUser({ timezone: "Europe/Berlin" }); + ownerId = user.id; + owner = await makeSession(user); + await makeMedication( + user, + { + name: "Existing tablet", + startsOn: new Date("2026-10-01"), + createdAt: new Date("2026-10-01T06:00:00.000Z"), + }, + [ + { + windowStart: "08:00", + windowEnd: "10:00", + timesOfDay: ["08:00"], + rrule: "FREQ=DAILY", + }, + ], + ); + await prisma.medicationCategoryLabel.create({ + data: { + userId: ownerId, + key: CUSTOM_KEY, + labelEncrypted: encryptToBytes("Heart and circulation"), + }, + }); + const w = await delegateOf(prisma, user, "WRITE"); + const r = await delegateOf(prisma, user, "READ"); + writer = { auth: w.auth, headers: w.headers }; + reader = { auth: r.auth, headers: r.headers }; + userIds = [ownerId, w.delegate.id, r.delegate.id]; +}); + +afterAll(() => { + vi.useRealTimers(); +}); + +describe("GET /api/medications parity", () => { + it("01 the owner's list", async () => { + await list("01-list"); + }); + + it("02 a reading delegate's view of it, and nobody's", async () => { + await list("02a-list-reader", reader); + await list("02b-list-anonymous", { auth: anonymous }); + }); +}); + +describe("POST /api/medications parity", () => { + it("11 a plain create", async () => { + await create("11-plain", { + name: "Plain tablet", + dose: "5mg", + schedules: [schedule("07:00", "09:00")], + }); + }); + + it("12 a full create with a custom category, a course and auto-take", async () => { + await create("12-full", { + name: "Full injection", + dose: "1 pen", + category: CUSTOM_KEY, + treatmentClass: "GLP1", + dosesPerUnit: 4, + unitsPerDose: 0.5, + reorderLeadDays: 7, + deliveryForm: "INJECTION", + trackInjectionSites: true, + allowedInjectionSites: ["ABDOMEN_LEFT", "THIGH_RIGHT"], + notificationsEnabled: false, + liveActivityEnabled: true, + criticalAlarmEnabled: true, + atcCode: "A10BJ06", + rxNormCode: "1991302", + startsOn: "2026-10-10", + endsOn: "2026-12-31", + autoMarkTaken: true, + schedules: [ + schedule("18:00", "20:00", { + label: "Evening", + dose: "0.5 pen", + unitsPerDose: 1, + timesOfDay: ["18:30"], + reminderGraceMinutes: 45, + rrule: "FREQ=WEEKLY;BYDAY=MO", + doseWindows: [{ timeOfDay: "18:30", start: "18:00", end: "20:00" }], + }), + ], + }); + }); + + it("13 an as-needed create, a one-shot one and a PRN schedule", async () => { + await create("13a-as-needed", { + name: "As needed", + dose: "400mg", + category: "PAIN_RELIEF", + asNeeded: true, + }); + await create("13b-one-shot", { + name: "One shot", + dose: "1 dose", + oneShot: true, + startsOn: "2026-10-20", + endsOn: "2026-11-20", + schedules: [schedule("09:00", "11:00")], + }); + await create("13c-prn-and-legacy-days", { + name: "Mixed schedules", + dose: "2mg", + trackIntake: false, + schedules: [ + schedule("06:00", "07:00", { scheduleType: "PRN" }), + schedule("21:00", "22:00", { daysOfWeek: [1, 3, 5], intervalWeeks: 2 }), + schedule("12:00", "13:00", { rollingIntervalDays: 3 }), + ], + }); + await create("13d-ended-window", { + name: "Ended window", + dose: "3mg", + endsOn: "2026-10-05", + schedules: [schedule("08:00", "09:00")], + }); + }); + + it("14 the refusals", async () => { + await create("14a-unknown-category", { + name: "Unknown category", + dose: "1mg", + category: "custom:0a6c2d4e-1111-4222-8333-944455556666", + schedules: [schedule("08:00", "09:00")], + }); + await create("14b-course-ends-before-start", { + name: "Backwards course", + dose: "1mg", + startsOn: "2026-10-20", + endsOn: "2026-10-10", + schedules: [schedule("08:00", "09:00")], + }); + await create("14c-one-shot-two-schedules", { + name: "One shot twice", + dose: "1mg", + oneShot: true, + startsOn: "2026-10-20", + schedules: [schedule("08:00", "09:00"), schedule("20:00", "21:00")], + }); + await create("14d-one-shot-recurrence", { + name: "One shot recurring", + dose: "1mg", + oneShot: true, + startsOn: "2026-10-20", + schedules: [schedule("08:00", "09:00", { rrule: "FREQ=DAILY" })], + }); + await create("14e-unstable-concept-id", { + name: "Phantom", + dose: "1mg", + externalSource: "APPLE_HEALTH", + externalId: "", + schedules: [schedule("08:00", "09:00")], + }); + await create("14f-invalid", { name: "", dose: 5, schedules: "daily" }); + }); + + it("15 a mirrored create and its replay", async () => { + const mirrored = { + name: "Mirrored", + dose: "50mg", + externalSource: "APPLE_HEALTH", + externalId: "hk-concept-0001", + schedules: [schedule("08:00", "09:00")], + }; + await create("15a-mirror", mirrored); + await create("15b-mirror-replay", { ...mirrored, name: "Renamed" }); + }); + + it("16 the mirror cap", async () => { + const capped = await makeUser({ timezone: "UTC" }); + await prisma.medication.createMany({ + data: Array.from({ length: 30 }, (_, i) => ({ + userId: capped.id, + name: `Mirror ${String(i).padStart(2, "0")}`, + dose: "1mg", + externalSource: "APPLE_HEALTH" as const, + externalId: `hk-cap-${String(i).padStart(2, "0")}`, + })), + }); + await create( + "16-mirror-cap", + { + name: "One too many", + dose: "1mg", + externalSource: "APPLE_HEALTH", + externalId: "hk-cap-30", + schedules: [schedule("08:00", "09:00")], + }, + { auth: await makeSession(capped), userIds: [capped.id] }, + ); + }); + + it("17 a retried create under one idempotency key", async () => { + const body = { + name: "Retried", + dose: "10mg", + schedules: [schedule("08:00", "09:00")], + }; + const headers = { + "idempotency-key": "6f9d2c4a-8b1e-4f3a-9d7c-5e2b1a0c9d8e", + }; + await create("17a-idempotent-first", body, { headers }); + await create("17b-idempotent-replay", body, { headers }); + }); + + it("18 a delegate who may write, and one who may only read", async () => { + const body = { + name: "Brought by a delegate", + dose: "20mg", + schedules: [schedule("08:00", "09:00")], + }; + await create("18a-writer", body, writer); + await create("18b-reader", body, reader); + }); + + it("19 no credentials", async () => { + await create( + "19-anonymous", + { name: "Nobody", dose: "1mg" }, + { + auth: anonymous, + }, + ); + }); +});