EHR Connectivity

Context

Open in Claude

Track real-time entity data changes

Context subscriptions track real-time changes to entity data. Unlike workflow events (which fire once), context callbacks fire continuously as data is extracted and updated.

Subscribing to Context Changes

sdk.ehr.context.onChange('chart_open:patient', (prev, curr) => {
  if (!prev && curr) {
    console.log('Patient opened:', curr);
  } else if (prev && curr) {
    console.log('Patient data updated');
  } else if (prev && !curr) {
    console.log('Patient closed');
  }
});

Available Context Keys

Loading from CDN...

Change Patterns

prevcurrMeaning
undefineddefinedEntity opened / entered context
defineddefinedEntity data changed
definedundefinedEntity closed / left context

Tracking Updatable Entities

const unsubscribe = sdk.ehr.context.getUpdatableEntities((entities) => {
  console.log('Updatable entities:', entities);
  // e.g., { patient: false, encounter: true, referral: false }
});

On this page