Daniel S. Demoz · Responsible AI in practice All projects  ·  Code

Clinic booking and reminders

A clinic booking system with privacy built in, and a no-show model that needs real data

A Flask application for clinic appointments, risk-based reminders, consent and audit logging. This page shows what works today and what does not yet.

Working app · model not ready Flask + SQLite Consent and audit log PIPEDA-minded design

What the system does

A Flask and SQLAlchemy application for clinic appointments.

Appointments

Patients, clinics and appointments in SQLite, with a dashboard and a REST API.

No-show risk

A random forest scores each appointment Low, Medium or High risk.

Reminders

SMS and email reminders through Twilio and SendGrid, scheduled by risk level.

Privacy controls

Consent records, field encryption (Fernet), retention rules and an audit log of every access.

How good is the no-show model?

With no real appointment history, the app trains on 1,000 generated appointments. This is how the model scores on them (5-fold cross-validation).

MeasureValue
No-show rate in the generated data10.8%
Accuracy of always guessing "will attend"89.2%
Model accuracy83.8%
Model AUC (0.5 is random)0.48
Share of no-shows the model catches5%

What this means

  • The model is no better than a coin toss on this data, and less accurate than always guessing that patients attend.
  • The generated no-show signal is very weak, so there is little for any model to learn.
  • The earlier demo showed 87.2% accuracy and a 94.2% reminder success rate. Those were typed into the page, not measured, and were removed.
Honest finding: the software works, but the prediction does not yet. It needs real, consented appointment history from a clinic before any risk score can be trusted.

Privacy by design

Health appointments are sensitive. The design follows PIPEDA principles. It has not had a legal review.

In the code

  • Consent is recorded per patient before reminders are sent.
  • Contact fields can be encrypted at rest with a key from the environment.
  • Every read and change is written to an audit log.
  • Retention settings mark old records for deletion.
  • A privacy impact assessment is in docs/privacy_impact_assessment.md.

Before a real clinic uses it

  • Have the privacy impact assessment reviewed for the clinic's province. Some provinces have their own health privacy laws.
  • Train only on real history, test on a later period, and check results by patient group.
  • Never use a risk score to refuse or double-book care. Use it only to choose who gets an extra reminder.
  • Keep message content free of health details.

Reliable AI checklist

The six questions of the Reliable AI Adoption Framework, answered for this project.

Business problem

Reduce missed appointments with timely reminders, without treating any patient worse.

Data readiness

No real appointment history yet. The model trains on generated data, and its scores reflect that.

Governance and risk

Health information under PIPEDA and provincial laws. Consent, encryption, audit and retention are built in.

Technology and tools

Flask, SQLAlchemy and a random forest. Simple enough for a clinic's IT provider to run and inspect.

People and adoption

Front-desk staff see the risk level and decide on extra contact. The score never blocks a booking.

Outcomes and monitoring

With real data, track no-show rates for reminded and not-reminded patients, by group.