{% extends "base.html" %}{% set active="analytics" %}{% block title %}Analytics{% endblock %}{% block page_title %}Analytics{% endblock %} {% block content %}
Total Appointments
{{ total_apts }}
🗓
Completed
{{ status_rows|selectattr('status','eq','Completed')|map(attribute='cnt')|sum }}
Cancelled
{{ status_rows|selectattr('status','eq','Cancelled')|map(attribute='cnt')|sum }}
This Month
{{ this_month }}
{{ '📈' if trend >= 0 else '📉' }}
vs Last Month
{{ '+' if trend >= 0 else '' }}{{ trend }}%
📊
Status Breakdown
{% for r in status_rows %}{% set pct = (r.cnt / total_apts * 100)|round|int if total_apts else 0 %}
{{ r.status }}
{{ r.cnt }}
{{ pct }}%
{% endfor %}
Monthly Volume
{% for m in monthly %}{% set pct = (m.cnt / max_mo * 100)|round|int %}
{{ m.mo[5:] }}
{{ m.cnt }}
{% endfor %}
Service Popularity
{% for s in services %}{% set pct = (s.cnt / max_svc * 100)|round|int %}
{{ s.name }}
{{ s.cnt }}
{% endfor %}
Busiest Days
{% for d in day_dist %}{% set pct = (d.cnt / max_day * 100)|round|int %}
{{ d.dow }}
{{ d.cnt }}
{% endfor %}
Doctor Utilization
{% for d in doc_util %}{% set rate = (d.completed / d.total * 100)|round|int if d.total else 0 %}{% endfor %}
DoctorSpecializationTotalCompletedCancelledNo-ShowRate
{{ d.name }}{{ d.specialization or '—' }} {{ d.total }}{{ d.completed }}{{ d.cancelled }}{{ d.noshow }}
{{ rate }}%
{% endblock %}