Skip to main content

Update patient

MethodPath
PUT/v1/slim/patient/:id

Authentication · Access policies

Updates a resident (patient): names, gender, birth date, placement on devices, room and zone, and resident state (discharge or reactivation).

Auth: Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant Patient:update, plus Device:update when the request changes which devices the resident is on (admins and super admins skip this check). Scope: The resident must belong to the caller's project (from the token). Devices, rooms and zones you reference must be in your project, its parent project, or one of its sub-projects.

Behaviour​

The body is a full replacement of the editable fields, designed so that the result of GET /v1/slim/patient/{id} can be sent back unchanged. Fields the update does not declare, such as id, floor or admissionDate, are ignored.

  • name replaces all of the resident's names. It must contain a nickname entry with a non-blank first given value. If the nickname changes, it must be unique in the project.
  • gender and birthDate are replaced. Omitting them, or sending "", clears them.
  • Placement depends on locationId:
    • locationId omitted or "": the resident is removed from all of their devices, and deviceId and organizationId are ignored. Send the current locationId to keep the placement.
    • locationId with deviceId: the resident is placed on those devices, and the devices move to the room. The resident leaves any other device. A resident already on one of those devices is replaced.
    • locationId without deviceId: the resident is placed on the room's device. The room must have exactly one device.
    • organizationId, when it differs from the current zone, moves the resident's devices, with their rooms and residents, into that zone.
  • residentState:
    • discharged on an active resident: the resident is tagged discharged, dischargeDate is stored (default: now), the EpisodeOfCare is finished, and the resident is removed from all devices. locationId must be omitted or "".
    • discharged on a resident already discharged: only a different dischargeDate has an effect; it corrects the stored date.
    • active on a discharged resident: the resident is reactivated, the latest EpisodeOfCare is reopened and dischargeDate is removed.
    • Other values, or the current state, change nothing.
  • Any resident who loses a device in this request has their active out-of-bed notification revoked in the same write, and the device's live telemetry state is cleared afterwards.
  • Archived residents cannot be updated.
  • The write is atomic and takes a short write lock on the resident, the devices and, on a rename, the new Resident ID.
  • Change-history entries are added for each changed field and assignment.
  • The response is the resident after the update, in the same shape as GET /v1/slim/patient/{id}.

Example​

curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/patient/3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21' \
-H "Authorization: Bearer ${OVOK_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{
"name": [{ "use": "nickname", "given": ["demo-resident"] }],
"gender": "male",
"birthDate": "1940-05-01",
"deviceId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21",
"locationId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21",
"organizationId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21",
"residentState": "active"
}'

Successful response​

200 — Patient updated successfully.

Errors​

StatusMeaning
400Medplum refuses the write.
401Bearer token is missing, invalid or expired.
403You are not a practitioner, admin or System Owner, you lack Patient:update (or Device:update when the device assignment changes), the patient is outside your project, or a referenced device, location or zone does not exist or is outside your project, its parent or its sub-projects.
404No patient with this id exists.
409The project is moving to another Signals tenant, another write holds the patient, a device or the new Resident ID, or a device was reassigned while the request ran. Retry.
422The body or id fails validation, the body has no Resident ID, the new Resident ID is already in use, the patient is archived, a discharge also sets locationId, a discharged resident is placed in a room, or locationId without deviceId names a room with no device or more than one.