Alerts
Alerts raised by evaluation. An alert opens on a breach, deduplicates on its TRIGGER:<code> key while it stays open, and closes when a trigger resolves it.
| Operation | Endpoint |
|---|---|
| List alerts, or the episodes they were folded into | GET /api/alert |
GET /api/alert
/api/alertList alerts, or the episodes they were folded into
The dashboard view.
By default this is one row per breach, in v1's alert shape plus every nest alert field, inside v1's paginate envelope (items, totalItems, page, totalPages, …) with nest's nextCursor beside it. Page with v1's page and limit (a page may start at most 10000 rows in), or walk with cursor: pass nextCursor back verbatim. sort is v1's time-desc (the default) or time-asc; ids narrows to those patients. It works whether or not the tenant has episodicAlerts. Without project it is tenant-wide: a per-facility view must send project, which keeps only patients stamped with it.
?episodes=true answers with episodes instead, as {items, nextCursor}: one row per clinical event, which opens on the first breaching reading, absorbs the rest, and closes on recovery, on going stale, or by hand. That grain REQUIRES project. It defaults to the tenant's feedCodes (PATCH /api/tenant), every code when it lists none; alerts have no code default.
codes, since and acknowledged filter either grain. until, page and ids are alerts only: sending one with episodes=true is a 422, not a filter that silently did nothing. status reads ACTIVE/RESOLVED for alerts and OPEN/CLOSED for episodes.
Episodes are newest first by sort: openedAt, the default, or lastFiringAt, the newest firing reading (the opening, for an episode that has none). since and the cursor use the same time. openedAt never changes, so walking every page lists each episode once. On lastFiringAt an episode that fires mid-walk moves above the cursor: it is never listed twice, but that walk misses it. A sort value from the other grain is a 422.
Requires Basic authentication.
Parameters
| Name | In | Required | Description |
|---|---|---|---|
episodes | query | no | Return episodes rather than the individual breaches they were folded from. An episode is one continuous clinical event for a (patient, code) pair: it opens on the first breaching reading, absorbs the rest, and closes on recovery, on going stale, or by hand. The default answers one row per breach, which is the duplication episodes exist to collapse. Requires project, and changes which of the filters below are accepted. |
project | query | no | The Medplum project that scopes the read to one facility: only patients stamped with it. Required with episodes=true; optional on alerts, whose read is otherwise tenant-wide. |
patientId | query | no | |
ids | query | no | v1's patient filter: only these patients' alerts, by Signals id. Repeat the parameter or separate with commas. Alerts only. |
status | query | no | ACTIVE or RESOLVED for alerts; OPEN or CLOSED with episodes=true. |
codes | query | no | Restrict to these LOINC codes. On episodes it defaults to the tenant's feedCodes, every code when it lists none. Alerts have no default: absent, every alert, including those that carry no code. |
since | query | no | Alerts raised, or episodes whose sort time is, at or after this instant: opened by default, last fired with sort=lastFiringAt. |
until | query | no | Alerts raised before this instant. Alerts only. |
acknowledged | query | no | Filter on whether the episode, or the alert, has been acknowledged. |
sort | query | no | On alerts, v1's order: time-desc (the default) or time-asc. On episodes, which time they are listed by, newest first; since and cursor use it too. openedAt (the default) never changes, so a walk of every page sees each episode once. lastFiringAt is the newest firing reading, or the opening for an episode that has none; an episode that fires mid-walk moves above the cursor. |
page | query | no | v1's 1-based page of limit alerts. A page may start at most 10000 rows in; walk further with cursor. Alerts only. |
limit | query | no | |
cursor | query | no | |
tags[key] | query | no | v1's tag filter: only patients whose tags.key equals one of the comma-separated values, or holds one in an array. Repeat with other keys to require them all. Keys are alphanumeric; tags.key= is accepted too. |
Responses
| Status | Meaning |
|---|---|
200 | A page of alerts, or of episodes, plus the cursor for the next one. |
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. Or: episodicAlerts is not enabled for this tenant, and episodes were requested. |
422 | An alert filter was sent with episodes=true, episodes=true arrived without project, or the page starts too deep. |
Response body
Object with no documented fields.
Updated 29 days ago