Definitions / active_patient
Active patient
A patient the group counts as its own. The registration list counts everyone registered and not merged away; clinical teams count only patients seen in the last 90 days.
Unit: patients · parameters: seen within days 90 · also said as: active patient, active patients, patients, registered patients, patient list, list size, patient count
Registration
Records manager (records) · version 1, changed 2026-11-02
Registered by now and not merged into another record.
First version.
SELECT p.id AS patient_id, p.home_clinic_id AS clinic_id
FROM patients p
WHERE p.registered_at <= {now} AND NOT (p.merged_into IS NOT NULL AND p.merged_at <= {now})
Tests: count_between
Clinical
Medical director (clinical governance) · version 1, changed 2026-11-02
At least one attended appointment in the last seen_within_days.
First version.
SELECT a.patient_id, arg_max(a.clinic_id, a.completed_at) AS clinic_id
FROM appointments a
WHERE a.completed_at <= {now} AND a.completed_at >= {now} - to_days({seen_within_days})
GROUP BY a.patient_id
Tests: count_between