Merge keys into a patient's own rule settings

Merges the top-level keys of settings into the stored object in one statement: a key sent replaces the stored one, a key sent as null is removed, every other key is kept, and the row is created when the patient has none. Audited as UPDATE_PATIENT_SETTINGS, with the stored document before and after.

For each patient the write reaches, judged by its own settings over the org's: a band changed ends the episode judged under the old one THRESHOLD_CHANGED; a code switched off (its band "NO_THRESHOLD", or out of bed enabled: false) has its active alert resolved and its open episode closed THRESHOLD_CHANGED at the save, the other codes' left alone; an acknowledged out-of-bed absence, whose episode the ack closed, has its still-active alert resolved; a band deleted closes nothing.

The body may carry resolvedAt (ISO 8601), when the caller resolved this write: it lands only over a stored write resolved earlier, or stored without one, and is otherwise refused 409 STALE_SETTINGS with nothing written or audited. A write without resolvedAt always lands and keeps the stored stamp.

Signals stores settings as given and reads it only through the triggers it holds (triggers, the home's and the resident's own): what each other key means is theirs, so the object is checked for shape and size only. The default pack reads bands — per code { low?, high? }, { mode: 'baseline', pct, low?, high? } (outside either band fires; a patient's own baseline band with no sides of its own is judged alone) or "NO_THRESHOLD" — and outOfBed: { limitSeconds, enabled?, window?: { start: 'HH:MM', end: 'HH:MM', timeZone } }. A patient's own key wins over the org's; extra keys are ignored. See tech/RULES-ENGINE.md.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required

The Signals patient id.

Body Params
string
settings
object
required
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/problem+json