import type { Patient } from 'fhir/r4'; import { calculateAge, patientAgeLabel } from '../../../../utils/dateUtils'; const SEX: Record = { male: 'Male', female: 'Female', other: 'Other' }; /** Who a patient is at a glance in the directory: age and sex, in the shared wording. */ export const patientDirectoryLine = (patient: Patient): string | undefined => { const parts = [ patientAgeLabel(patient.birthDate ? calculateAge(patient.birthDate) : null), patient.gender ? SEX[patient.gender] : undefined, ].filter(Boolean); return parts.length ? parts.join(' ยท ') : undefined; };