DEV Community

freelancing
freelancing

Posted on

Designing a Privacy-Conscious Appointment Reminder

Appointment reminders are a common feature in scheduling applications. Although the idea seems simple, a reliable reminder service needs to handle time zones, duplicate messages, cancellations, and personal information carefully.

In this tutorial, we'll explore a small scheduling function and the design decisions needed to turn it into a production feature.

1. Define an Appointment

Start with a minimal data structure.

const appointment = {
  id: "APT-204",
  startAt: "2026-11-02T09:30:00+11:00",
  status: "confirmed",
  reminderSentAt: null
};
Enter fullscreen mode Exit fullscreen mode

The example intentionally excludes names, contact details, diagnoses, and treatment information.

2. Check Whether a Reminder Is Due

function isReminderDue(
  appointment,
  now,
  leadTimeMs
) {
  const appointmentTime = Date.parse(
    appointment.startAt
  );

  if (!Number.isFinite(appointmentTime)) {
    return false;
  }

  if (appointment.status !== "confirmed") {
    return false;
  }

  if (appointment.reminderSentAt !== null) {
    return false;
  }

  const remaining = appointmentTime - now;

  return remaining > 0 && remaining <= leadTimeMs;
}
Enter fullscreen mode Exit fullscreen mode

The function checks whether an appointment is confirmed, has not already been marked as reminded, and falls within a configured time window.

This is a simplified example. A production scheduler also needs to handle malformed records and define how reminder state is updated.

3. Avoid Duplicate Messages

A common mistake is checking whether a reminder has been sent and then sending the message in a separate step.

If two workers process the same appointment simultaneously, both might observe that the reminder has not been sent.

A production implementation should use an atomic database operation, transaction, or job-claiming mechanism to prevent concurrent workers from sending duplicate reminders.

Retries also need careful handling. A message provider may accept a request even when the application does not receive the expected response.

4. Keep Notification Content Minimal

A reminder might say:

"You have an appointment scheduled for Monday at 9:30 AM. Please contact the practice if you need to change your booking."

Avoid including sensitive details unless they are necessary and appropriately authorised.

Consider shared devices, notification previews, and whether the recipient has consented to the selected communication channel.

5. Protect the Entire Workflow

A secure reminder system should consider authentication, least-privilege access, encrypted communication, secret management, data retention, and operational logging.

Logs should contain enough information to diagnose delivery problems without unnecessarily exposing personal information.

Requirements depend on the jurisdiction and application. A real healthcare-related system should receive an appropriate privacy and security review before deployment.

Conclusion

Appointment reminders illustrate an important software engineering principle: a feature that appears simple to users can require careful design behind the scenes.

By considering duplicate prevention, scheduling, data minimisation, and access controls from the beginning, developers can build systems that are more reliable and respectful of user privacy.

Top comments (0)