Skip to content

Commit

Permalink
Better dashboard widget for appointment
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Dec 17, 2024
1 parent 050f845 commit 2ac84d9
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,7 @@ export function prepareAppointments(bundle: Bundle<WithId<Appointment | Encounte
}

export function prepareAppointmentDetails(appointment: Appointment) {
const [name, specialty] =
appointment.participant
.find((p) => fromFHIRReference(p.actor)?.resourceType === 'PractitionerRole')
?.actor?.display?.split(' - ') || [];
const appointmentDetails = [
{
title: t`Practitioner`,
value: name || '-',
},
{
title: t`Service`,
value: specialty || '-',
},
{
title: t`Date`,
value: appointment.start ? formatHumanDate(appointment.start) : '-',
Expand All @@ -292,7 +280,13 @@ export function prepareAppointmentDetails(appointment: Appointment) {
},
];

return appointmentDetails;
//TODO agree on terminology for Appointment.particioant.type and use it
const participants = appointment.participant.filter(p => p.type?.[0]?.coding?.[0]?.code !== 'patient').map(participant => ({
title: participant.type?.[0]?.text,
value: participant.actor?.display,
}))

return [...appointmentDetails, ...participants]
}

export function prepareServiceRequest(
Expand Down

0 comments on commit 2ac84d9

Please sign in to comment.