RoundsCorrowmere Clinics · Estmark synthetic data · seed 23

Post-discharge follow-up not booked

A hospital discharge notice that asked the clinic for a follow-up, with nothing booked three days after the notice arrived.

Unit: discharges · parameters: book within days 3 · also said as: discharge follow-up, post discharge follow up, follow-up after discharge, discharge not booked, overdue discharge follow-up

Booking

Head of booking (booking) · version 1, changed 2026-11-02

Notice received at least book_within_days ago (and within the last 45 days), no follow-up booking recorded by now. Severity is high once the follow-up's own deadline is less than two days away.

First version.

SELECT 'discharge' AS subject_type, d.id AS subject_id, d.id AS discharge_id, d.patient_id, d.clinic_id,
       d.specialty_id, d.notified_at + to_days({book_within_days}) AS started_at,
       CASE WHEN d.discharged_at + to_days(d.follow_up_within_days) <= {now} + INTERVAL 2 DAY THEN 'high'
            ELSE 'medium' END AS severity,
       json_object(
         'unit', d.unit, 'discharged_at', d.discharged_at, 'notified_at', d.notified_at,
         'follow_up_within_days', d.follow_up_within_days,
         'follow_up_due_by', d.discharged_at + to_days(d.follow_up_within_days),
         'days_since_notice', round(date_diff('hour', d.notified_at, {now}) / 24.0, 1),
         'specialty', s.name, 'clinic', c.name
       ) AS evidence
FROM discharges d
JOIN specialties s ON s.id = d.specialty_id
JOIN clinics c ON c.id = d.clinic_id
WHERE d.notified_at <= {now} - to_days({book_within_days}) AND d.notified_at >= {now} - INTERVAL 45 DAY
  AND (d.booked_at IS NULL OR d.booked_at > {now})
ORDER BY started_at, d.id

Tests: count_between, unique