Skip to main content

Overview

Encounter data is the most important piece of contextual information. It is used to pre-populate the web SDK with patient and provider details. You can dynamically set the encounter data in the web SDK by passing the encounter data to the SukiAssistant component.

Code Example

The example below demonstrates how to dynamically set the encounter data in the web SDK.
React
import { SukiAssistant, SukiProvider, useSuki } from "@suki-sdk/react";

function DynamicEncounterComponent() {
  const [currentEncounter, setCurrentEncounter] = useState(initialEncounter); // Replace with your initial encounter data

  const switchToNewPatient = () => {
    const newEncounter = {
      identifier: "6ec3920f-b0b1-499d-a4e9-889bf788e5ab",
      patient: {
        identifier: "905c2521-25eb-4324-9978-724636df3436",
        name: {
          use: "usual",
          family: "Wilson",
          given: ["Emma"],
          suffix: [],
        },
        birthDate: "1992-07-10",
        gender: "female",
      },
    };

    setCurrentEncounter(newEncounter);
  };

  return (
    <div>
      <button onClick={switchToNewPatient}>Switch to New Patient</button>

      <SukiAssistant
        encounter={currentEncounter}
        // rest of the props
      />
    </div>
  );
}

Next Steps

Refer to Ambient Events to learn more about how to track and manage ambient interactions in the web SDK.