SlimSlim/Patient

Update patient

  • Sandbox: available
  • Staging: available
  • Production: unknown
PUT
/v1/slim/patient/{id}

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.

  • name replaces all of the resident's names, each trimmed of leading and trailing spaces. 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.
    • locationId with deviceId null, [] 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 organizationId that differs from the zone of the room the resident stays in answers 422 with path: ["organizationId"] and changes nothing: move the room to that zone with PUT /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, organizationId re-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 (discharged or discharged-recent) placed on a device they are not on is refused with 422 and nothing changes, with or without deviceId. Send residentState: "active" in the same save to reactivate and place them.
  • 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. 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"  }'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

id*string
Formatuuid

Request Body

application/json
  1. body
name*array<>
Items1 <= items
gender?|
birthDate?|
deviceId?|array<>
organizationId?|
locationId?|
residentState?string
Value in"active""discharged""discharged-recent""archived"
dischargeDate?string

Response Body

Patient updated successfully.

application/json
  1. response
id*string
name*array<>
gender?string
Value in"male""female""other""unknown"
birthDate?string
deviceId*string
organizationId?string
locationId?string
floor?string
room?string
bed?string
residentState*string
Value in"active""discharged-recent""discharged""archived"
admissionDate?string
dischargeDate?string
Example Request
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/patient/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "name": [    {      "use": "official"    }  ]}'
Example Response
{  "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 } ```