Palamond Docs

Quickstart

Sign a patient in and make your first calls in about ten minutes.

This takes you from nothing to reading a patient's record and calling your first endpoint. You need Node.js and a Palamond client ID (an OAuth client credential from your Palamond administrator).

1. Install the SDK

npm install @palamond/sdk

One package: the PalamondClient, the FHIR resource types, and the platform's code systems.

import { PalamondClient } from '@palamond/sdk';
import type { Patient, Task } from '@palamond/sdk/fhir';
import { PATIENT_TASK_TAG } from '@palamond/sdk/codes';

2. Create a client

client.ts
import { PalamondClient } from '@palamond/sdk';

export const palamond = new PalamondClient({
  clientId: 'your-client-id',
});

The client targets the production API (https://api.prd.palamond.dev/) by default; pass baseUrl for another environment, for example https://api.lab.palamond.dev/ while developing. In the browser it also handles token storage and refresh for you.

3. Sign the patient in

The API serves patient sessions: every call acts as the signed-in patient and only ever sees their record. The simplest flow is email and password:

auth.ts
import { palamond } from './client';

const login = await palamond.startLogin({ email, password, scope: 'openid offline' });
await palamond.processCode(login.code!);

Redirect-based and federated sign-in are covered in Authentication.

4. Who am I?

patient.profile() returns the signed-in Patient. It is the canonical "is my session good?" call.

const me = await palamond.patient.profile();
console.log(me.name?.[0]?.given?.join(' '), me.name?.[0]?.family);

5. Read the record

The record is FHIR. The SDK's typed helpers search it with standard FHIR search parameters:

import type { Task } from '@palamond/sdk/fhir';
import { PATIENT_TASK_TAG, searchToken } from '@palamond/sdk/codes';

// The patient's open to-dos.
const tasks: Task[] = await palamond.searchResources('Task', {
  'status:not': 'completed',
  _tag: searchToken(PATIENT_TASK_TAG),
  _sort: '-_lastUpdated',
});

6. Take an action

Every workflow change is a named method wrapping a v1 endpoint. For example, picking an assessment from the care catalog and starting it:

const catalog = await palamond.protocols.list();
const entry = catalog.find((p) => p.assessment);

const started = await palamond.assessments.start({
  healthcareService: entry.healthcareService,
});
// { episode, appointment, tasks, scope }

That one call opens the episode, creates the intake visit, and issues the patient's tasks. The full flow, including completing those tasks, is the next page: Complete an Assessment.

Next steps

On this page