Decide an Order
Show a proposed order and record the patient's fulfilment choices.
Palamond separates authoring an order from placing it. A clinician proposes an order (a prescription, a lab) without deciding how it is fulfilled; the patient chooses: mail order or retail pickup for a medication, a home kit or an in-person draw for a lab. One call records the choices, and the platform places the accepted items.
Your app owns one step: present the options, record the decisions. The intent flips, destination stamping, and revocations are the platform's job.
Find the proposal
A proposed order is a RequestGroup whose children are MedicationRequest and ServiceRequest resources with intent: 'proposal'. Read them from the record:
import type { RequestGroup } from '@palamond/sdk/fhir';
const proposals: RequestGroup[] = await palamond.searchResources('RequestGroup', {
status: 'active',
intent: 'proposal',
});
const group = proposals[0];
// group.action[].resource references the proposed line items.Present the line items
Load each child and offer only the methods that fit its kind: mail-order or retail-pickup for a MedicationRequest, home-kit or in-person-draw for a lab ServiceRequest.
const items = await Promise.all(
(group.action ?? []).map((a) => palamond.readReference(a.resource!)),
);Record the decisions
One call per proposal, one entry per line item. Accepted items need a method; declined items need nothing.
const task = await palamond.orders.decide(group.id, [
{
item: `MedicationRequest/${items[0].id}`,
decision: 'accept',
method: 'mail-order',
performer: 'Preferred Pharmacy',
},
{
item: `ServiceRequest/${items[1].id}`,
decision: 'decline',
},
]);
// The completed decision Task.Deciding is one-way: a second call for the same order answers 409 conflict.
Confirm the order was placed
After promotion, accepted children are intent: 'order' and carry their fulfilment destination; declined children are revoked. Read it back:
const orders = await palamond.searchResources('MedicationRequest', {
intent: 'order',
_sort: '-authoredon',
});Proposing from the patient's side
The flow above starts with a clinician. Patients can also propose: a medication they want considered, a protocol from the catalog, or a treatment-option preference. requests.create records the proposal and opens the clinician review.
const { request, reviewTask } = await palamond.requests.create({
kind: 'medication',
medication: 'Tretinoin 0.05% cream',
note: 'Used this before with good results.',
});The platform forces the safe fields (intent: 'proposal', the patient as requester); a clinician decides. Track progress by reading the returned request on the record plane.
What the platform does for you
- Groups your decisions per line item and completes the decision task in the shape the workflow expects.
- Flips accepted items
proposal → order, stamps the chosen destination, and revokes declined items. - Is idempotent: an order already promoted cannot be double-placed.