{% extends "base.html" %} {% block title %}Reports & Analytics{% endblock %} {% block extra_css %} {% endblock %} {% block content %} {# ── Header + date filter ── #}

Reports & Analytics

{{ start.strftime('%b %d, %Y') }} — {{ end.strftime('%b %d, %Y') }}

Export Inspections CSV Export Issues CSV
{% if inspectors %}
{% endif %}
Reset
{# ── KPI cards ── #}
{% for label, value, color, icon in [ ('Total Inspections', total_inspections, 'primary', 'bi-clipboard-data'), ('Completed', completed, 'success', 'bi-check-circle'), ('Open Issues', flagged, 'danger', 'bi-flag'), ('Avg Score', (avg_score|string + '%') if avg_score else '—', 'info', 'bi-graph-up'), ] %}

{{ label }}

{{ value }}

{% endfor %}
{# ── Charts row 1 ── #}
Score Trend
Issues by Severity
{# ── Charts row 2 ── #}
Avg Score by Facility
Issue Status
{# ── Top inspectors table ── #} {% if top_inspectors %}
Top Inspectors
{% for row in top_inspectors %} {% endfor %}
InspectorInspectionsAvg Score
{{ row.display_name }} {{ row.count }} {% if row.avg_score %} {{ '%.1f'|format(row.avg_score|float) }}% {% else %}—{% endif %}
{# ── Critical / High open issues ── #}
Open Critical / High Issues
{% if critical_issues %}
{% for issue in critical_issues %} {% endfor %}
SeverityAreaDescription
{{ issue.severity|title }} {{ issue.area.name }} {{ issue.description[:50] }}{% if issue.description|length > 50 %}…{% endif %} View
{% else %}

No open critical or high issues. 🎉

{% endif %}
{% endif %} {% endblock %} {% block extra_js %} {% endblock %}