simple-server
simple-server copied to clipboard
Use device_created_at to pick latest overdue appointment
Story card: sc-9056
Because
We use the latest scheduled_date to find a patient's latest overdue appointment. If a user creates many appointments for a patient, we should use the latest created appointment and not the one that's farthest into the future (latest scheduled appointment) to evaluate overdueness.
This addresses
Updates the "latest appointment" calculation in PatientSummary and MaterializedPatientSummary to:
- Find the latest appointment for a patient by
device_created_at - Patient is overdue if the status of this appointment is
scheduledorcancelledand thescheduled_datehas passed
This pull request has been linked to Shortcut Story #9056: Use the latest appointment by device_created_at for calculating patient overdueness.