Skip to main content

Reading Resources

Read Resource By ID

To read a resource, you will need its FHIR ID. You can then use the Plasma FHIR Client to read any resource with that ID. Note that responses are strongly typed.

const observation: r4.Observation = await plasma.read<Resources.Observation>("Observation", fhirId);

To read a patient, you can also use the following shortcut method.

const patient: r4.Patient = await plasma.readPatient(patientId);

Reading Resource History

To read a resource's history, you can either get all history or a single version.

Read Full History

Reading the full history will return an array of that resource.

const allHistory: r4.Observation[] = 
await plasma.readAllHistory<r4.Observation>("Observation", fhirId);

Read Single Version of History

To read a single version of a resource's history, pass in the version number as a string. In the example below, we are reading version 3 of the Obersvation resource.

const singleHistory: r4.Observation = 
await plasma.readHistoryByVersion<r4.Observation>("Observation", fhirId, "3");