EHR Connectivity

Overview

Open in Claude

Interacting with EHR data through the SDK

The sdk.ehr namespace is the primary interface for interacting with EHR data. It provides four main capabilities, each suited to different use cases:

Workflow Events

Subscribe to one-time events fired when the provider navigates the EHR — such as opening a patient chart or starting an encounter. Use these for triggering actions.

sdk.ehr.workflow.on('chart_open', (event) => {
  console.log('Patient chart opened:', event.entities.patient);
});

Learn more about Workflow Events

Context

Track real-time changes to entity data as the provider interacts with the EHR. Unlike workflow events (which fire once), context callbacks fire continuously as data is extracted and updated.

sdk.ehr.context.onChange('encounter_open:patient', (prev, curr) => {
  if (curr) console.log('Patient data updated:', curr);
});

Learn more about Context

Entity API

Read entity data through typed API methods. Use this to fetch additional data beyond what's available in the context (e.g., full patient demographics, problem list, insurance).

const result = await sdk.ehr.api.patient.getPatient();

Learn more about Entity API

Writeback

Update EHR data with permission-aware, typed write operations. Some operations are disruptive (they interrupt the provider's workflow) and require explicit permission.

await sdk.ehr.context.encounter.update({ subjective: { chiefComplaintNotes: 'Headache' } });

Learn more about Writeback

When to Use What

I want to...Use
Know when a chart opens or encounter startsWorkflow Events
Track patient/encounter data as it changesContext
Fetch data not available in the contextEntity API
Write data back to the EHRWriteback

On this page