Update patient
| Method | Path |
|---|---|
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.
namereplaces all of the resident's names. It must contain anicknameentry with a non-blank firstgivenvalue. If the nickname changes, it must be unique in the project.genderandbirthDateare replaced. Omitting them, or sending"", clears them.- Placement depends on
locationId:locationIdomitted or"": the resident is removed from all of their devices, anddeviceIdandorganizationIdare ignored. Send the currentlocationIdto keep the placement.locationIdwithdeviceId: 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.locationIdwithoutdeviceId: 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:dischargedon an active resident: the resident is tagged discharged,dischargeDateis stored (default: now), theEpisodeOfCareis finished, and the resident is removed from all devices.locationIdmust be omitted or"".dischargedon a resident already discharged: only a differentdischargeDatehas an effect; it corrects the stored date.activeon a discharged resident: the resident is reactivated, the latestEpisodeOfCareis reopened anddischargeDateis 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
| Status | Meaning |
|---|---|
400 | Medplum refuses the write. |
401 | Bearer token is missing, invalid or expired. |
403 | You 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. |
404 | No patient with this id exists. |
409 | The 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. |
422 | The 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. |