Update patient
- Sandbox: available
- Staging: available
- Production: unknown
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 (an admin or super admin who holds no access policy skips 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, each trimmed of leading and trailing spaces. 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.locationIdwithdeviceIdnull,[]or""is refused with 422 and changes nothing: a room is not a placement without a device.- A resident in a room is in the room's zone. An
organizationIdthat differs from the zone of the room the resident stays in answers 422 withpath: ["organizationId"]and changes nothing: move the room to that zone withPUT /v1/slim/location/{id}, or the resident to a room in it. A resident moving to another room takes that room's zone. When the room has no zone,organizationIdre-zones the resident's devices. - A save that puts the resident on devices in more than one zone, when they were not in exactly those zones before, is refused with 422.
- A discharged resident (
dischargedordischarged-recent) placed on a device they are not on is refused with 422 and nothing changes, with or withoutdeviceId. SendresidentState: "active"in the same save to reactivate and place them.
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. A resident replaced on a device gets one naming the device, and the room and zone they leave with it.
- 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/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": [{ "use": "nickname", "given": ["Maxi"] }], "gender": "male", "birthDate": "1940-05-01", "deviceId": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "locationId": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "organizationId": "87ea5dfc-8b8e-384d-8489-79496e706390", "residentState": "active" }'bearerAuthorizationBearer <JWT>id*stringuuidapplication/json- body
name*array<>1 <= itemsgender?|birthDate?|deviceId?|array<>organizationId?|locationId?|residentState?string"active""discharged""discharged-recent""archived"dischargeDate?stringPatient updated successfully.
application/json- response
id*stringname*array<>gender?string"male""female""other""unknown"birthDate?stringdeviceId*stringorganizationId?stringlocationId?stringfloor?stringroom?stringbed?stringresidentState*string"active""discharged-recent""discharged""archived"admissionDate?stringdischargeDate?stringcurl -X PUT 'https://api.sandbox.ovok.com/v1/slim/patient/497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "name": [ { "use": "official" } ]}'{ "id": "string", "name": [ { "use": "official", "given": [ "string" ], "family": "string" } ], "gender": "male", "birthDate": "string", "deviceId": "string", "organizationId": "string", "locationId": "string", "floor": "string", "room": "string", "bed": "string", "residentState": "active", "admissionDate": "string", "dischargeDate": "string"}Delete patient DELETE
Deletes a resident (patient) who has no device. **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:delete` and `Device:update` (an admin or super admin who holds no access policy skips this check). **Scope:** The resident must belong to the caller's project (from the token). ## Behaviour - A resident who still has a device is refused with 409 `Resident still has device <serial>. Unassign it first.`, and nothing is changed. Take the device off the resident first (`PUT /v1/slim/patient/{id}` without `locationId`), then delete. - Only the Patient resource is deleted. This route does not delete the resident's other records. - Archived residents cannot be deleted. - A change-history entry records the delete. - The response has no body. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/patient/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Check patient name exists POST
Checks whether a Resident ID (the resident's nickname) is already used in your project. Use it to validate the Resident ID field before you create or rename a resident. **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:read` (an admin or super admin who holds no access policy skips this check). **Scope:** Residents in the caller's project (from the token). ## Behaviour - Read-only. - Only the `name` entry with `use: "nickname"` is compared. Official and maiden names are ignored. Without a nickname entry the answer is `exists: false`. - A match needs the same `given` tokens in the same order and the same `family` (or no `family` on both sides). Tokens are trimmed and compared case-insensitively. - When you edit an existing resident, pass their id as `excludePatientId` so their own record does not count as a match. - The create and update routes run the same check, so a `true` here means those requests would be refused with a 422. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/slim/patient/check-name-exists' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": [{ "use": "nickname", "given": ["Maxi"] }], "excludePatientId": "c3499c27-2973-0a7f-807e-fb8676a92dcb" }' ``` ```json { "exists": false } ```