End-to-end test

Walk this sequence on the physical prototype

  1. Step 1

    Device has been provisioned and activated

    Create the device in the technical console. It starts PENDING. Device API access requires lifecycle ACTIVE and an active patient assignment.

  2. Step 2

    Authenticate

    Send X-Device-Id and Authorization: Bearer <device-secret> on every /v1/device request.

    Open notes
  3. Step 3

    Send heartbeat

    POST /v1/device/heartbeat with reportedStatus. Use schedule.updateAvailable to see if a newer version exists.

    Open notes
  4. Step 4

    Fetch current schedule

    GET /v1/device/schedule. The server resolves the patient from the active assignment.

    Open notes
  5. Step 5

    Validate/store schedule locally

    Persist schedule.id, version and items on the device before presenting medication.

  6. Step 6

    Acknowledge schedule/version

    POST /v1/device/schedule/ack with the stored scheduleId and integer version.

    Open notes
  7. Step 7

    Simulate a medication moment

    Execute the local item at plannedAt. Do not ask the platform for a patient id.

  8. Step 8

    Send the resulting event

    POST /v1/device/events with a unique eventId, eventType, occurredAt and optional scheduleItemId.

    Open notes
  9. Step 9

    Simulate temporary offline state

    Keep using the acknowledged local schedule. Buffer any new events. There is no offline API.

    Open notes
  10. Step 10

    Reconnect and synchronize buffered events

    Send heartbeat again, then POST the buffered events. Duplicate eventId values are accepted as duplicates.

    Open notes