Palamond Docs
Guides

Capture a Vital

Complete a measurement task and let the platform store the observations.

Patients report vitals (blood pressure, weight, and so on) by completing a measurement task. Your app collects the values and sends them on the completion call; the platform validates each reading against its definition and stores the Observations. You never create observations yourself, which is exactly why units and coding always match the clinician's chart.

Find the measurement task

Measurement tasks reference their capture definition on Task.focus. Query the patient's open tasks and pick them out:

import type { Task } from '@palamond/sdk/fhir';

const tasks: Task[] = await palamond.searchResources('Task', {
  status: 'requested,in-progress',
});
const captureTask = tasks.find((t) => t.focus?.reference?.startsWith('ActivityDefinition/'));

Collect the values

Show the patient the panel and collect a numeric value per member, in the unit the panel expects. A blood-pressure panel is two members, systolic and diastolic, each with its own LOINC code.

Complete the task with the readings

One entry per panel member, keyed by LOINC. Omit a member the patient could not measure; the platform skips it rather than storing an empty reading.

await palamond.tasks.complete(captureTask.id, {
  measurements: [
    { loinc: '8480-6', value: 118, unit: 'mmHg', code: 'mm[Hg]' }, // systolic
    { loinc: '8462-4', value: 76, unit: 'mmHg', code: 'mm[Hg]' },  // diastolic
  ],
});

code is the UCUM unit code, when you know it. A task that is already closed or not yet due answers 409; see Errors and Limits.

Read the stored observations back

The platform stores one Observation per reading, status: 'final', categorized as a vital sign, linked to the visit encounter:

const observations = await palamond.searchResources('Observation', {
  category: 'vital-signs',
  _sort: '-date',
});

What the platform does for you

  • Matches each reading to its panel member by LOINC and validates the value against the member's ObservationDefinition.
  • Writes the Observation with the definition's coding, the vital-signs category, and the visit encounter.
  • Is idempotent per task and member: a retried completion cannot duplicate observations.

You collect values; the platform owns the chart.

On this page