{% extends "layouts/base.html" %} {% load i18n %} {% load static %} {% block title %}{% trans "Analytics Dashboard" %} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{% trans "Analytics Dashboard" %}

{% trans "Comprehensive overview of patient experience metrics" %}

{{ kpis.open_complaints }} {% trans "open" %}

{{ kpis.total_complaints }}

{% trans "Total Complaints" %}

{{ kpis.sla_compliance }}%

{% trans "SLA Compliance" %}

{{ kpis.avg_resolution_hours }}h

{% trans "Avg Resolution" %}

{{ kpis.open_actions }} {% trans "open" %}

{{ kpis.total_actions }}

{% trans "Total Actions" %}

{{ kpis.reopened_complaints }}

{% trans "Reopened" %}

{{ kpis.escalated_ovr_complaints }}

{% trans "Escalated OVR" %}

{{ kpis.avg_survey_score }}

{% trans "Avg Survey Score" %}

{{ kpis.nps_score }}

{% trans "NPS Score" %}

{% trans "Complaints Analytics" %}

{% trans "Status, sources, and severity breakdown" %}

{% trans "Status Distribution" %}

{% trans "Complaint Sources" %}

{% trans "Severity Levels" %}

{% trans "Cross-Module Yearly Trends" %}

{% trans "Quarterly volume trends across all modules" %}

{% trans "Complaints" %}

{% trans "Inquiries" %}

{% trans "Suggestions" %}

{% trans "Observations" %}

{% trans "Appreciations" %}

{% trans "Patient Visits" %}

{% trans "PX Actions Analytics" %}

{% trans "Action status and categories" %}

{% trans "Action Status" %}

{% trans "Action Categories" %}

{% trans "Survey Analytics" %}

{% trans "Patient satisfaction and NPS trends" %}

{% trans "Net Promoter Score" %}

{{ kpis.nps_score }}
{% trans "Industry Avg: +32" %}
{% widthratio kpis.nps_score|add:100 2 1 as nps_width %}

{% trans "Survey Score Trend" %}

{% trans "Visit Analytics" %}

{% trans "Patient visit metrics by type" %}

{% trans "Total Visits" %}

{{ total_visits }}

{% trans "All visit types" %}

{% trans "Emergency (ED)" %}

{{ visit_type_data.ED.count }}

{{ visit_type_data.ED.completion_rate }}%

{% trans "Avg Duration" %}: {{ visit_type_data.ED.avg_duration }}

{% trans "Inpatient (IP)" %}

{{ visit_type_data.IP.count }}

{{ visit_type_data.IP.completion_rate }}%

{% trans "Avg Duration" %}: {{ visit_type_data.IP.avg_duration }}

{% trans "Outpatient (OP)" %}

{{ visit_type_data.OP.count }}

{{ visit_type_data.OP.completion_rate }}%

{% trans "Avg Duration" %}: {{ visit_type_data.OP.avg_duration }}

{% trans "Visit Volume by Type" %}

{% trans "Monthly Visit Trend" %}

{% trans "Avg Time per Journey Stage" %}

{% trans "Department Performance" %}

{% trans "Performance metrics by department" %}

{% for dept in department_stats %} {% empty %} {% endfor %}
{% trans "Department" %} {% trans "Complaints" %} {% trans "Actions" %} {% trans "Survey Avg" %} {% trans "Resolution Rate" %} {% trans "Status" %}
{{ dept.name_ar }} {{ dept.complaints }} {{ dept.actions }} {{ dept.survey_avg }}
{{ dept.resolution_rate }}%
{% if dept.resolution_rate >= 80 %} {% trans "Excellent" %} {% elif dept.resolution_rate >= 60 %} {% trans "Good" %} {% else %} {% trans "Needs Work" %} {% endif %}
{% trans "No department data available" %}

{% trans "AI-Powered Insights" %}

{% trans "Predictive analytics and intelligent recommendations" %}

{% if exec_summary %}

{% trans "AI Executive Summary" %}

{% trans "Auto-generated analysis of the past 30 days" %}

{% if exec_summary.risk_level == 'high' %}{% trans "High Risk" %}{% elif exec_summary.risk_level == 'medium' %}{% trans "Medium Risk" %}{% else %}{% trans "Low Risk" %}{% endif %}

{% trans "English Summary" %}

{{ exec_summary.summary_en }}

{% if exec_summary.key_findings_en %}
    {% for finding in exec_summary.key_findings_en %}
  • {{ finding }}
  • {% endfor %}
{% endif %}

{% trans "الملخص العربي" %}

{{ exec_summary.summary_ar }}

{% if exec_summary.key_findings_ar %}
    {% for finding in exec_summary.key_findings_ar %}
  • {{ finding }}
  • {% endfor %}
{% endif %}
{% if exec_summary.recommendations_en %}

{% trans "Recommended Actions" %}

{% for rec in exec_summary.recommendations_en %}
{{ rec }}
{% endfor %}
{% endif %}
{% endif %} {% if visit_efficiency %}

{% trans "Visit Efficiency Insights" %}

{% trans "AI-powered patient flow analysis and bottleneck detection" %}

{% if visit_efficiency.efficiency_score %} {% trans "Efficiency" %}: {{ visit_efficiency.efficiency_score }}/100 {% endif %} {% if visit_efficiency.priority_type %} {% trans "Priority" %}: {{ visit_efficiency.priority_type }} {% endif %}
{% if visit_efficiency.summary_en %}

{% trans "Operational Summary" %}

{{ visit_efficiency.summary_en }}

{% trans "الملخص التشغيلي" %}

{{ visit_efficiency.summary_ar }}

{% endif %} {% if visit_efficiency.bottlenecks_en %}

{% trans "Top Bottlenecks Identified" %}

{% for bn in visit_efficiency.bottlenecks_en %}
{{ bn }}
{% endfor %}
{% endif %} {% if visit_efficiency.recommendations_en %}

{% trans "Efficiency Recommendations" %}

{% for rec in visit_efficiency.recommendations_en %}
{{ rec }}
{% endfor %}
{% if visit_efficiency.recommendations_ar %}
{% for rec in visit_efficiency.recommendations_ar %}
{{ rec }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %} {% if early_warnings %}

{% trans "Early Warning System" %}

{% trans "Departments showing risk signals across multiple channels" %}

{{ early_warnings|length }} {% trans "at risk" %}
{% for dept in early_warnings %} {% endfor %}
{% trans "Department" %} {% trans "Risk Score" %} {% trans "Risk Level" %} {% trans "Active Signals" %} {% trans "Complaint Δ" %} {% trans "Survey Δ" %} {% trans "SLA Δ" %}
{{ dept.department_name }}
{{ dept.risk_score }}%
{{ dept.risk_level|title }} {{ dept.active_signals }}/5 {% if dept.complaint_volume_spike.change_pct > 0 %}+{% endif %}{{ dept.complaint_volume_spike.change_pct }}% {{ dept.survey_score_decline.change_pct }}% +{{ dept.sla_breach_increase.change_pp }}pp
{% endif %} {% if complaint_forecast.labels %}

{% trans "Predicted Complaint Volume" %}

{% trans "30-day forecast with confidence bands" %}

{% trans "Predicted" %}

{{ complaint_forecast.total_predicted_30d }}

{% trans "vs Recent" %}

{% if complaint_forecast.change_pct > 0 %}+{% endif %}{{ complaint_forecast.change_pct }}%

{% if complaint_forecast.confidence_level == 'high' %}{% trans "High Confidence" %}{% elif complaint_forecast.confidence_level == 'medium' %}{% trans "Medium Confidence" %}{% else %}{% trans "Low Confidence" %}{% endif %}
{% if complaint_forecast.day_of_week_pattern %}

{% trans "Day-of-Week Pattern Detected" %}

{% for day, pattern in complaint_forecast.day_of_week_pattern.items %} {{ day }}: {{ pattern|title }} {% endfor %}
{% endif %}
{% endif %} {% if sla_breach_predictions %}

{% trans "SLA Breach Risk" %}

{% trans "Complaints at risk of breaching SLA deadline" %}

{{ sla_breach_predictions|length }} {% trans "at risk" %}
{% for pred in sla_breach_predictions %} {% endfor %}
{% trans "Complaint" %} {% trans "Breach Risk" %} {% trans "Severity" %} {% trans "Hours Left" %} {% trans "Department" %} {% trans "Risk Factors" %} {% trans "Recommendation" %}
{{ pred.title }}
{{ pred.breach_probability }}%
{{ pred.severity|title }} {% if pred.hours_remaining < 0 %}{% trans "EXPIRED" %}{% else %}{{ pred.hours_remaining }}h{% endif %} {{ pred.department|default:"—" }}
    {% for factor in pred.risk_factors %}
  • {{ factor }}
  • {% endfor %}
{{ pred.recommendation }}
{% endif %} {% if action_recommendations %}

{% trans "AI-Recommended Actions" %}

{% trans "Systemic issues identified from complaint pattern analysis" %}

{% if action_recommendations.0.source == "ai_generated" %} {% trans "AI Generated" %} {% else %} {% trans "Rule-Based" %} {% endif %}
{% for rec in action_recommendations %}
{{ rec.priority|title }} {{ rec.category }}
{{ rec.complaint_count }} {% trans "complaints" %}

{{ rec.problem_summary_en }}

{% if rec.recommended_actions_en %}
{% for action in rec.recommended_actions_en %}
{{ action }}
{% endfor %}
{% endif %} {% if rec.expected_impact_en %}

{{ rec.expected_impact_en }}

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