Bear in mind that the appointment is different than the encounter. We may need to do some combination of the looking at the appointment status, the encounter state (signed / vs unsigned), and possibly the date of the encounter if its an unsigned encounter but the last updated date is way past the appointment checkout date.
We’re going to be overhauling the encounters as part of our 2025 ASTP EHR updates so we’ll add this in as part of a work item.