Patient config
v1's config writes addressed by a list of patient ids. A trigger is stored as sent in the patient's settings, where it judges its code; one without logic is rejected and reported. Reads are POSTs here too — a thousand ids do not fit in a query string.
| Operation | Endpoint |
|---|---|
| Write one config to many patients | POST /api/patient/config |
| Write a different config to each of many patients | POST /api/patient/config/batch |
| Read the config status of many patients | POST /api/patient/config/bulk-status |
POST /api/patient/config
/api/patient/configWrite one config to many patients
Applies the same triggers, flags and metadata to every id named. An id may be the Signals id or the refId.
Unknown ids are reported in misses[] rather than failing the batch. modifiedCount counts patients where a row actually changed; status.triggerWrites gives the row counts behind it. Trigger metadata is MERGED and left untouched when absent.
Send resolvedAt (the instant the configuration was COMPUTED, not sent) to have this push refused rather than applied when the patient already carries a configuration resolved strictly later. Refusal is a silent no-op reported as staleIgnoredCount, never an error. Omitting it applies the push unconditionally.
Requires Basic authentication.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
resolvedAt | string | no | ISO-8601 instant at which this configuration was COMPUTED (not sent). A push carrying one is ignored if the patient already has a configuration resolved strictly later. Optional: a push without it is applied unconditionally, exactly as before. |
triggers | V1ConfigTriggerSchema[] | no | |
ids | string[] | yes | |
metadata | object | no | Stamped onto the Patient rows named by ids, merged not replaced. |
alertIfEmpty | boolean | no | |
alertIfNote | boolean | no | |
alertInactiveDays | number | no |
Responses
| Status | Meaning |
|---|---|
200 | v1's envelope: the ids echoed back and the match and modify counts. |
401 | Missing, malformed or unrecognised Basic credentials. |
403 | Authenticated, but the client's role does not permit this, or it is not attached to the patient. |
422 | The payload failed validation. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
ids | string[] | yes | The ids the request named, echoed back. |
status | V1ConfigResultSchema | yes |
POST /api/patient/config/batch
/api/patient/config/batchWrite a different config to each of many patients
The per-patient form, each entry with its own triggers, flags, metadata and resolvedAt. results[] has v1's {id, matched, modified} per entry; staleIgnored and misses are additions.
Requires Basic authentication.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
patients | V1BatchConfigEntrySchema[] | yes |
Responses
| Status | Meaning |
|---|---|
200 | Match and modify totals, per-patient results, and the ids that missed. |
401 | Missing, malformed or unrecognised Basic credentials. |
403 | Authenticated, but the client's role does not permit this, or it is not attached to the patient. |
422 | The payload failed validation. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
matched | number | yes | |
modified | number | yes | |
staleIgnored | number | yes | Entries refused for carrying a configuration resolved before the one already applied, summed across the batch. |
results | object[] | yes | Per-patient match and modify counts. |
misses | string[] | yes | |
rejected | V1RejectedTriggerSchema[] | yes | Triggers without logic, per patient, so nothing was stored for them. |
POST /api/patient/config/bulk-status
/api/patient/config/bulk-statusRead the config status of many patients
Each patient's configUpdatedAt and trigger codes, so a caller can confirm a push landed without re-reading every trigger; triggerFingerprints adds what each rule says.
Exactly one row per requested id, in the order asked. An id that resolves to nothing answers refId: null with no codes, as v1 did.
A POST because the id list is the request; it writes nothing.
Requires Basic authentication.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
ids | string[] | yes |
Responses
| Status | Meaning |
|---|---|
200 | One status row per requested id, in request order. |
401 | Missing, malformed or unrecognised Basic credentials. |
403 | Authenticated, but the client's role does not permit this, or it is not attached to the patient. |
422 | The payload failed validation. |
Response body
An array of:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
refId | string | null | yes | Null for an id that resolved to no patient. |
configUpdatedAt | date-time | null | yes | Example: "2026-08-27T09:15:00.000Z". |
triggerCodes | string[] | yes | The codes the patient's own settings hold a trigger or a band for, and out of bed (103214-3) when they hold its limit. |
triggerFingerprints | V1TriggerFingerprintSchema[] | yes | The CONTENT behind each code, so a caller can compare configuration instead of only checking that a code is present. Added beside triggerCodes, which keeps its exact old meaning. |
Updated about 1 month ago