Update location
- Sandbox: available
- Staging: available
- Production: unknown
Updates a location: its name, floor, room, bed and zone, the devices at it, and the resident on those devices.
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 Location:update and Device:update (an admin or super admin who holds no access policy skips this check).
Scope: The location must belong to the caller's project (from the token). Devices and residents you attach must be in your project or one of its sub-projects. The zone must be in your project, a sub-project, or the parent project.
Behaviour
nameis required and must be unique among the locations your token can search, not counting this one.floor,room,bed: an omitted field keeps its current value. If the zone, floor, room or bed changes, the new combination must not match another location's.organizationId:- omitted: the zone is unchanged.
null: the zone is removed from the location and from every device at it.- an id: the location and every device at it move to that zone. Residents on those devices move too.
deviceId(one id or a list):- omitted: the devices at the location are unchanged.
- a list: it becomes the full set of devices at the location. Devices not in the list are detached; new ones are attached.
nullor[]detaches all devices. - Devices that hold a discharged resident cannot be attached.
patientId:- an id: that resident is assigned to the devices in
deviceId, or, whendeviceIdis omitted or empty, to the single device at the location. The resident is first removed from any other device. A resident already on a target device is replaced. A discharged resident is refused. - omitted: every resident is removed from every device at the location and every device in
deviceId. To keep the current resident, send theirpatientId.
- an id: that resident is assigned to the devices in
- A resident who loses a device has their active out-of-bed notification revoked in the same write, and the device's live telemetry state is cleared afterwards.
- Device use history is updated for every device whose resident changes.
- The write is atomic and takes a short write lock. A concurrent write to the same resources, or a device reassigned by someone else while this request ran, gets a 409.
- Every save adds a location-updated entry to the change history. Residents who move into a new zone, or lose a device, also get an entry in their own change history.
- The response is the location after the update, in the same shape as
GET /v1/slim/location/{id}. - If another location has the same zone, floor, room and bed, the request is refused with 409 and the body carries
existingLocationIdandexistingLocationName.
Example
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": "Room 201", "floor": "2", "room": "201", "bed": "A", "organizationId": "87ea5dfc-8b8e-384d-8489-79496e706390", "deviceId": ["c3499c27-2973-0a7f-807e-fb8676a92dcb"], "patientId": "c3499c27-2973-0a7f-807e-fb8676a92dcb" }'bearerAuthorizationBearer <JWT>id*stringuuidapplication/json- body
name*string1 <= lengthfloor?stringroom?stringbed?stringorganizationId?stringdeviceId?|array<>patientId?stringuuidLocation updated successfully.
application/json- response
id*stringLocation id.
name*stringfloor?stringroom?stringbed?stringorganizationId?stringorganizationName?stringdeviceId?array<string>Every device at the location. Omitted when the location has none.
deviceName?stringAlphabetically first name among the devices at the location.
patientId?stringResident on the first device at the location that has one.
patientName?stringcurl -X PUT 'https://api.sandbox.ovok.com/v1/slim/location/497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "name": "string"}'{ "id": "string", "name": "string", "floor": "string", "room": "string", "bed": "string", "organizationId": "string", "organizationName": "string", "deviceId": [ "string" ], "deviceName": "string", "patientId": "string", "patientName": "string"}Delete location DELETE
Deletes a location that has no devices attached. **Auth:** Bearer token. The caller must be a Medplum project admin or super admin. The access policy must grant `Location:delete` and `Device:update` (an admin or super admin who holds no access policy skips the access-policy check). **Scope:** The location must belong to the caller's project (from the token). ## Behaviour - Detach every device first (`PUT /v1/slim/location/{id}` with `"deviceId": []`). A location with a device attached is refused. - The Location resource is deleted. - The write is atomic and takes a short write lock. A concurrent write to the same location gets a 409. - A location-deleted entry is added to the change history. A failure to write that entry does not fail the request. - The response has no body. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
List recent notifications GET
Lists the newest active notifications stored as CommunicationRequests for your project, of every type (such as out-of-bed, device alarms and attention presses). Use it for a notification bell. For filtered or paged history, use the out-of-bed and alarm feeds. **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 `CommunicationRequest:read` and `CommunicationRequest:search` (an admin or super admin who holds no access policy skips this check). **Scope:** The caller's project (from the token). ## Behaviour - Returns at most `count` rows (1 to 50, default 20), newest first by event time. - Rows come from a Redis copy of the active notifications when that copy is enabled and loaded, and from a FHIR store search otherwise. `warm` is `true` and `source` is `redis` for the first case; `warm` is `false` and `source` is `fhirStore` for the second. A cold read also starts loading the Redis copy in the background, so a later call can be warm. - The Medplum search returns `active` notifications updated within the last year. - `total` counts the active notifications the source knows about, capped at the list result cap (1,000 by default). From Medplum it is an estimate. - `locationName` is the room's current name, read from the Location as on the notification lists, so a renamed room shows its new name on every row, old alerts and new. When rows come from Redis, that lookup is cached per caller for up to a minute and dropped when a room is renamed through this API. If the caller cannot read the Location, or the lookup takes more than 2 seconds, a row keeps the name it was raised with. - Rows whose notification type cannot be resolved are left out. - Medical notifications (heart rate, respiratory rate and other vitals) are decided by Signals and served by `GET /v1/slim/notifications/recent/medical`. To show one type only, use `GET /v1/slim/notifications/recent/oob` or `GET /v1/slim/notifications/recent/alarms`. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/notifications/recent?count=20' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```