# observation.derived

Canonical page: https://docs.ovok.com/signals/standalone/webhooks/observation-derived

A rule computed a value from readings, such as a score, and stored it as a reading.

## Payload [#payload]

Every delivery is the envelope `type`, `timestamp`, `sequence` and `data`; the delivery's id is the `webhook-id` header. See [Verify webhooks](/signals/standalone/verify-webhooks).

```json
{
  "type": "observation.derived",
  "timestamp": "2026-10-25T08:00:02.000Z",
  "sequence": 1052,
  "data": {
    "patient": "6f1c2a8e-3b7d-4c55-9a0e-2d4b8f6e1a90",
    "patientRefId": "resident-001",
    "observation": {
      "id": "3c1d9f20-7a64-4b8e-8d52-5e0a1b2c3d4e",
      "patient": "6f1c2a8e-3b7d-4c55-9a0e-2d4b8f6e1a90",
      "status": "final",
      "code": {
        "coding": [
          {
            "code": "readiness-score"
          }
        ]
      },
      "valueQuantity": {
        "value": 82
      },
      "component": [],
      "observedAt": "2026-10-25T08:00:00.000Z",
      "createdAt": "2026-10-25T08:00:02.000Z",
      "updatedAt": "2026-10-25T08:00:02.000Z"
    }
  }
}
```

The same alert that fires on this code carries the reading in `derivedObservation`.

| Field | Meaning |
| --- | --- |
| `patient`, `patientRefId` | The patient, by Signals id and by your own `refId`. |
| `observation` | The derived reading, in the shape of [`observation.created`](/signals/standalone/webhooks/observation-created#payload). |

## Handle the event [#handle-the-event]

Verify the delivery first ([Verify webhooks](/signals/standalone/verify-webhooks)), then act on the verified event as in [Handle an event](/signals/standalone/webhooks#handle-an-event).

<Tabs items={["Node.js", "Python", "Java"]} groupId="language" persist>
<Tab value="Node.js">

```js title="observation-derived.js"
export async function handle(webhookId, event) {
  if (!(await firstTime(webhookId))) return;
  const { data } = event;
  switch (event.type) {
    case 'observation.derived':
      await storeScore(data.patientRefId, data.observation);
      break;
    default:
      break;
  }
}
```

</Tab>
<Tab value="Python">

```python title="observation_derived.py"
def handle(webhook_id: str, event: dict) -> None:
    if not first_time(webhook_id):
        return
    data = event["data"]
    match event["type"]:
        case "observation.derived":
            store_score(data["patientRefId"], data["observation"])
```

</Tab>
<Tab value="Java">

```java title="ObservationDerivedHandler.java"
void handle(String webhookId, JsonNode event) {
  if (!firstTime(webhookId)) return;
  JsonNode data = event.get("data");
  switch (event.get("type").asText()) {
    case "observation.derived" -> {
      storeScore(data.get("patientRefId").asText(), data.get("observation"));
    }
    default -> {}
  }
}
```

</Tab>
</Tabs>

## Related [#related]

- [Webhooks basics](/signals/standalone/webhooks)
- [Verify webhooks](/signals/standalone/verify-webhooks)
