{% extends "base.html" %}{% set active="archive" %}{% block title %}Data Archive{% endblock %}{% block page_title %}Data Archive & Retention{% endblock %} {% block content %} {% if msg %}
{{ msg[1] }}
{% endif %}
Total Appointments
{{ stats.total }}
🗓
Active
{{ stats.active }}
Archived
{{ stats.archived }}
🗄
Eligible
{{ stats.eligible }}
🗄 Archive Old Records

Move completed/cancelled appointments older than N days to the archive table.

🗑️ Purge Archive

Permanent. Delete archived records older than N days.

Archive Log{{ stats.archived }} total
{% if archives %}
{% for a in archives %}{% endfor %}
IDOrig #PatientDoctorApt DateStatusArchived
#{{ a.archive_id }} {{ '#'+a.original_appointment_id|string if a.original_appointment_id else '—' }} {{ a.patient_name or '—' }}{{ a.doctor_name or '—' }} {{ a.appointment_datetime[:10] if a.appointment_datetime else '—' }} {{ a.status or '—' }} {{ a.archived_at[:10] }}
{% else %}
🗄

No archived records yet.

{% endif %}
{% endblock %}