{% extends "base.html" %} {% block title %}{{ facility.name }} — Scorecard{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{{ facility.name }}

Facility Scorecard — last {{ days }} days

{# Period selector #}
{% for d, label in [(30,'30d'),(60,'60d'),(90,'90d'),(180,'180d'),(365,'1yr')] %} {{ label }} {% endfor %}
Full Report Reports
{# ── KPI row ── #}
Total Inspections
{{ total_inspections }}
{{ completed_insp }} completed
Avg Score
{{ avg_score|round(1) if avg_score else '—' }}{% if avg_score %}%{% endif %}
{{ days }}-day average
SLA Compliance
{{ sla_pct|round(1) if sla_pct is not none else '—' }}{% if sla_pct is not none %}%{% endif %}
{{ sla_met }}/{{ sla_total }} closed on time
Open Issues
{{ open_issues|length }}
{% if pending_verification > 0 %} {{ pending_verification }} pending verification {% else %} across all severities {% endif %}
{# ── Score trend chart ── #}
Score Trend
{% if trend_labels %}
{% else %}

No completed inspections in this period.

{% endif %}
{# ── Issue severity breakdown ── #}
Open Issues by Severity
{% for sev, color in [('critical','danger'),('high','danger'),('medium','warning'),('low','secondary')] %}
{{ sev|title }} {{ sev_counts.get(sev, 0) }}
{% endfor %} {% if pending_verification > 0 %}
Pending Verification {{ pending_verification }}
{% endif %}
{# ── Area scores ── #} {% if area_scores %}
Score by Area
{% for a in area_scores %} {% endfor %}
AreaAvg ScoreInspections
{{ a.name }} {{ a.avg|round(1) }}% {{ a.count }}
{% endif %} {# ── Follow-up required ── #} {% if followup_required %}
Follow-up Required
{% for insp in followup_required %} {% endfor %}
InspectionDateScore
#{{ insp.id }} — {{ insp.template.name }} {{ insp.inspection_date.strftime('%Y-%m-%d') }} {% if insp.overall_score %} {{ insp.overall_score|round(1) }}% {% else %}—{% endif %} View
{% endif %} {# ── Open issues list ── #} {% if open_issues %}
Open Issues
{% for issue in open_issues %} {% endfor %}
IDSeverityAreaDescriptionStatusReported
#{{ issue.id }} {{ issue.severity|title }} {{ issue.area.name }} {{ issue.description[:80] }}{% if issue.description|length > 80 %}…{% endif %} {{ issue.status|replace('_',' ')|title }} {{ issue.reported_at.strftime('%Y-%m-%d') }} View
{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}