import type { Task } from 'fhir/r4'; import { AKASHIC_TASK_TYPE_SYSTEM } from './referralQueue'; /** * The name a practice gave a task, carried in code.text. Tasks without one fall back to the type's * own label there ("Custom task"), which is not a name, so it reads as absent. */ export const taskName = (task: Task): string | undefined => { const text = task.code?.text?.trim(); if (!text) return undefined; const typeLabel = task.code?.coding?.find((coding) => coding.system === AKASHIC_TASK_TYPE_SYSTEM)?.display; return text === typeLabel ? undefined : text; };