Functional standard / What is being done / Instance
Routine
A repeating duty. When it is due, the harness creates a Task.
- Kind
- routine
- Collection
- /v1/routines
- Initial state
- active
- Classification
- Operational
Scope and usage
Site-wide or for one patient. Optional duty_state limits it to on-shift or on-call.
Boundaries and relationships
- The routine does not complete the clinical work. The generated task does.
- Running routines is an explicit tick or /v1/routines/run, not a background surprise.
Resource content
Elements this resource adds. It also carries the Instance.
| Name | Card. | Type | Flags | Description |
|---|---|---|---|---|
| patient_id | 0..1 | id | — | Set when the routine is for one patient. |
| title | 1..1 | string | — | Name of the duty. |
| assignee_role | 0..1 | code | — | Role. |
| assignee_id | 0..1 | id | — | Person. |
| duty_state | 0..1 | code | — | For example on_shift or on_call. Empty means always. |
| schedule | 1..1 | Schedule | — | every_days is required. |
| task_template | 0..1 | object | — | Fields copied onto each generated task. |
State machine
active/ initial — Generating tasks.paused— Held.ended— Finished. Frozen.
active → paused, ended. paused → active, ended.
Frozen: ended.
Invariants
ccs-rou-1— A run creates tasks for due occurrences. It does not mark them done.
Operations
| Method | Path | Meaning |
|---|---|---|
| GET | /v1/routines | List routine. Filter by patient_id, status, and where the model has them, encounter_id or definition_key. |
| POST | /v1/routines | Create a routine. Body is the resource minus harness-owned elements. |
| GET | /v1/routines/{id} | Read one routine. |
| PATCH | /v1/routines/{id} | Update elements that are not immutable, frozen, or harness-owned. |
| POST | /v1/routines/{id}/transition | Move status. Body is { to, reason }. A gated move returns 202 and an Approval. |
| DELETE | /v1/routines/{id}?reason= | Soft-delete. Reason is required. Refused when the resource is not deletable or is frozen. |
| POST | /v1/routines/run | Create tasks for occurrences that are due. |
Notes
- Definition kind routine.
Example
{ "title": "Ward vitals", "assignee_role": "nurse", "schedule": { "every_days": 1 } }