Practical Python · Beginner Python
Analyse missed appointments with Python
Use synthetic data to calculate weekly missed-appointment rates and plan one small improvement.
What you’ll have at the end
A checked weekly table, a simple chart and an annotated improvement plan.
How to begin
- Define attended, DNA, cancelled and unknown statuses, and which slot types belong in the analysis. Do not mix incompatible appointment definitions.
- Develop using the supplied synthetic dataset. For a real pilot, ask an authorised analyst for approved weekly aggregates, never patient-level exports into this site.
- Run the starter script locally with Python 3. It checks exact columns, non-negative whole-number counts, dates and duplicated groups. DNA rate is defined here as DNA / (attended + DNA); unknown statuses remain separate.
- Plot the resulting weekly rates in a spreadsheet, alongside denominators. Investigate recording changes before interpreting trends and keep groups large enough for safe comparison.
- Test one practical change, such as clearer cancellation instructions. Annotate the date and compare later observations without claiming an uncontrolled before/after comparison proves causation.
What to measure
- Outcome: the explicitly defined DNA rate.
- Process: status completeness and timely cancellation.
- Balancing: administrative burden, complaints and whether released slots are reused.
Try it with synthetic data
Download both files into one folder, then run:
python analyse_appointments.py synthetic_appointments.csvDownload Python starter Download synthetic CSVOutput is a weekly CSV on your computer. Your data does not travel to this website.
Before using real data
Aggregates can still identify people through small groups. Agree suppression and generalisation locally. Do not create patient-level non-attender scores or punitive access decisions. The starter uses synthetic data only.
Agree scope, data handling, supervision and escalation with your practice. Use approved systems. Do not upload patient information to this website or a public AI tool.