Introducing the Oystehr Client Library
TL; DR - As a product made by and for developers, we prioritized API documentation, public status pages, open-source sample projects — and today we are releasing our first Oystehr client library.
Oystehr is a cloud service for building health applications and EHRs. As a product made by and for developers, we prioritized API documentation, public status pages, open-source sample projects — and today we are releasing our first Oystehr client library.
The library helps you call common Oystehr API endpoints.
Get started by installing the SDK:
npm i @zapehr/sdk
You’ll need an access token: Authenticating Oystehr API Requests Via Access Tokens
Let’s use the library to create a new Patient record:
import { formatHumanName, FhirClient } from '@zapehr/sdk';
import { Patient } from 'fhir/r4';
const fhirClient = new FhirClient({
accessToken: 'ACCESS_TOKEN_GOES_HERE',
});
async function example(): Promise<void> {
// Create a patient
const createdPatient: Patient = await fhirClient.createResource({
resourceType: 'Patient',
name: [
{
given: ['Jon'],
family: 'Snow',
},
],
});
if (!createdPatient || !createdPatient.name) {
throw new Error('Error creating a Patient');
}
console.log(`Created a Patient with name
${formatHumanName(createdPatient.name[0])} and id ${createdPatient.id}`);
}
example().catch((error) => console.log(error));
Running this will output something like:
Created a Patient with name Jon Snow and id 3e8c2d7a-a466-4836-b13d-c0e4e5335e6c
The client library includes wrappers for all Oystehr endpoints and helps you invoke your Zambda Functions. Need more help getting started? Find us on Oystehr Slack or send us an email.