Skip to main content

clinik.tasks

Tasks represent clinical workflow items — lab orders, referral follow-ups, care coordination activities, and other actionable items that need to be tracked through a lifecycle.

create

const { data, meta } = await clinik.tasks.create(request): Promise<ApiResponse<Task>>
FieldTypeRequiredDescription
statusstringYesdraft, requested, received, accepted, rejected, ready, cancelled, in-progress, on-hold, failed, completed
intentstringYesunknown, proposal, plan, order, original-order, reflex-order, filler-order, instance-order, option
statusReasonstringNoReason for current status
businessStatusstringNoBusiness-specific status (e.g. “Specimen collected”)
prioritystringNoroutine, urgent, asap, stat
codestringNoTask type code
descriptionstringNoHuman-readable description
focusIdstringNoWhat the task is acting on
patientIdstringNoBeneficiary of the task
encounterIdstringNoEncounter context
executionPeriod{ start?, end? }NoExecution time window
authoredOnstringNoWhen authored (defaults to now)
requesterIdstringNoWho is requesting
ownerIdstringNoWho is responsible
reasonCodestringNoWhy the task is needed
notestringNoAdditional notes
basedOnstring[]NoRequest IDs this task fulfills
partOfstring[]NoParent task IDs
inputTaskInputOutput[]NoTask inputs
outputTaskInputOutput[]NoTask outputs
restrictionobjectNoFulfillment restrictions

Example

const { data: task } = await clinik.tasks.create({
  status: 'requested',
  intent: 'order',
  priority: 'urgent',
  code: 'lab-order',
  description: 'Order CBC and CMP for pre-operative assessment',
  patientId: 'pt_abc123',
  encounterId: 'enc_xyz789',
  requesterId: 'prac_def456',
  ownerId: 'prac_lab_tech',
  executionPeriod: {
    start: '2025-02-01T08:00:00Z',
    end: '2025-02-01T17:00:00Z',
  },
  input: [
    { type: 'lab-panel', valueString: 'CBC' },
    { type: 'lab-panel', valueString: 'CMP' },
  ],
  note: 'Patient is NPO after midnight. Draw labs before 10am.',
});
Same pattern as other resources. Search supports patientId, ownerId, requesterId, status, priority, code filters.