Skip to content

Concept explainer

Events

Describes how Pensieve emits events as the record changes, what an event carries, and how other systems subscribe to act on them.

Pensieve emits an event as the record changes, and other systems subscribe to act on it. This page describes what an event carries, how a system subscribes, and why reacting through events keeps clinical work moving while back-office work keeps pace.

The event log

An event is a durable record that something happened in the platform, emitted the moment a change commits. Placing an order, verifying a result, and raising a charge each emit an event.

Every event lands in one log. Systems react to one another by subscribing to that log rather than by calling one another directly, so the reacting system reads a change once it is settled.

What an event carries

An event carries enough to act on, and points back to the record for the rest.

type
string
Required
What happened, such as an order placed or a charge raised.
subject
string
Required
The record the event concerns, such as one encounter.
at
timestamp
Required
The moment the change committed.
actor
string
Required
The person or system whose action produced the event.

An encounter is a single contact between a patient and the hospital. Because an event names its subject, a subscriber reads it against the same encounter the change was made on.

Subscribing to events

A system declares the event types it acts on, and the log delivers each matching event to it. The subscriber then does its own work in its own time.

Figure 1.Diagram showing an order placed event delivered from the log to billing and scheduling, each acting on its own.

Placing the order and reacting to it are separate steps. The order settles first, and billing and scheduling each pick the event up afterwards, so one placement fans out to the systems that care about it.

Work in parallel

Reacting through events is what lets clinical work proceed while back-office work keeps pace. Placing an order completes on its own, and billing raises its charge from the event that follows, so the ward keeps moving while the ledger stays current.

A change carries its own record

Because a committed change carries its audit entry in the same transaction, the event a subscriber reacts to always corresponds to a change that is settled and recorded. A subscriber acts on facts, and the trail already holds them.

The event that follows a placed order is what raises a charge without holding up the ward. Read how that charge is created in how a charge is created, or how one deployment scopes these systems across sites in multi-site and tenancy.