Skip to content

Commit

Permalink
Merge pull request #434 from rcpch:eatyourpeas/issue432
Browse files Browse the repository at this point in the history
view_preference not updating dashboard on change fix
  • Loading branch information
eatyourpeas authored Dec 14, 2024
2 parents c312b79 + b8c6189 commit 5a81224
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 64 deletions.
65 changes: 1 addition & 64 deletions project/npda/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,5 @@
{% load static %}
{% load npda_tags %}
{% block content %}
{% url 'dashboard' as hx_get %}
{% comment %} ADDS KONVA FOR WAFFLE PLOTS JUST WHEN THIS TEMPLATE IS RENDERED {% endcomment %}
<script src="https://unpkg.com/konva@9/konva.min.js"></script>
<div class="container mx-auto p-4 font-montserrat text-rcpch_dark_blue">
<div class="my-6">
<h1 class="text-5xl text-center">
PDU Dashboard for {{ pdu_lead_organisation.name }} ({{ pdu_object.pz_code }})
</h1>
<p class="text-center text-gray-500 mt-2">
Calculated at {{ kpi_calculations_object.calculation_datetime }}
</p>
<p class="text-center">This data has not been validated by the NPDA team.</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<!-- PDU Information Card -->
{% include 'dashboard/components/cards/pdu_card.html' %}
<!-- Audit Details Card -->
{% include 'dashboard/components/cards/audit_details_card.html' %}
<!-- Total Eligible Patients Card -->
{% include 'dashboard/components/cards/total_eligible_patients_card.html' %}
</div>
<!-- UNIT REPORT -->
<h1 class="text-5xl text-center my-6">Unit Report</h1>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
<!-- PATIENT CHARACTERISTICS CARD -->
{% include 'dashboard/components/cards/patient_characteristics_card.html' %}
<!-- TREATMENT REGIMEN CARD -->
{% include 'dashboard/components/cards/treatment_regimen_card.html' %}
<div class="flex flex-col gap-3">
<!-- HCL CARD -->
{% include 'dashboard/components/cards/hcl_use_card.html' %}
<!-- care at diagnosis CARD -->
{% include 'dashboard/components/cards/care_at_diagnosis_card.html' %}
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-4">
<!-- HEALTH CHECKS COMPLETION RATE CARD -->
{% include 'dashboard/components/cards/health_checks_completion_rate_card.html' %}
<!-- ADDITIONAL CARE PROCESSES CARD -->
{% include 'dashboard/components/cards/additional_care_processes_card.html' %}
<div class="flex flex-col gap-3">
<!-- HBa1c CARD -->
{% include 'dashboard/components/cards/hba1c_card.html' %}
<!-- ADMISSIONS CARD -->
{% include 'dashboard/components/cards/admissions_card.html' %}
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-4">
<!-- SEX CARD -->
{% include 'dashboard/components/cards/sex_card.html' %}
<!-- ETHNICITY CARD -->
{% include 'dashboard/components/cards/ethnicity_card.html' %}
<!-- IMD CARD -->
{% include 'dashboard/components/cards/imd_card.html' %}
</div>
<!-- IMD MAP CARD -->
<div class="grid grid-cols-1 min-h-80">
{% include 'dashboard/components/cards/imd_map_card.html' with scatterplot_of_cases_for_selected_organisation=charts.scatterplot_of_cases_for_selected_organisation pdu_lead_organisation=pdu_lead_organisation pdu_object=pdu_object %}
</div>
<!-- PATIENT LEVEL REPORT -->
<h1 class="text-5xl text-center my-6">Patient-Level Report</h1>
<!-- SELECT TABS & TABLE -->
{% include 'dashboard/pt_level_report_table_partial.html' with text=default_pt_level_menu_text selected=default_pt_level_menu_tab_selected highlight=default_highlight %}
</div>
{% include 'dashboard/dashboard_base.html' %}
{% endblock content %}
68 changes: 68 additions & 0 deletions project/npda/templates/dashboard/dashboard_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% url 'dashboard' as hx_get %}
{% comment %} ADDS KONVA FOR WAFFLE PLOTS JUST WHEN THIS TEMPLATE IS RENDERED {% endcomment %}
<script src="https://unpkg.com/konva@9/konva.min.js"></script>
<div class="container mx-auto p-4 font-montserrat text-rcpch_dark_blue"
id="dashboard"
hx-get="{{ hx_get }}"
hx-trigger="dashboard from:body"
hx-swap="innerHTML">
<div class="my-6">
<h1 class="text-5xl text-center">
PDU Dashboard for {{ pdu_lead_organisation.name }} ({{ pdu_object.pz_code }})
</h1>
<p class="text-center text-gray-500 mt-2">
Calculated at {{ kpi_calculations_object.calculation_datetime }}
</p>
<p class="text-center">This data has not been validated by the NPDA team.</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<!-- PDU Information Card -->
{% include 'dashboard/components/cards/pdu_card.html' %}
<!-- Audit Details Card -->
{% include 'dashboard/components/cards/audit_details_card.html' %}
<!-- Total Eligible Patients Card -->
{% include 'dashboard/components/cards/total_eligible_patients_card.html' %}
</div>
<!-- UNIT REPORT -->
<h1 class="text-5xl text-center my-6">Unit Report</h1>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
<!-- PATIENT CHARACTERISTICS CARD -->
{% include 'dashboard/components/cards/patient_characteristics_card.html' %}
<!-- TREATMENT REGIMEN CARD -->
{% include 'dashboard/components/cards/treatment_regimen_card.html' %}
<div class="flex flex-col gap-3">
<!-- HCL CARD -->
{% include 'dashboard/components/cards/hcl_use_card.html' %}
<!-- care at diagnosis CARD -->
{% include 'dashboard/components/cards/care_at_diagnosis_card.html' %}
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-4">
<!-- HEALTH CHECKS COMPLETION RATE CARD -->
{% include 'dashboard/components/cards/health_checks_completion_rate_card.html' %}
<!-- ADDITIONAL CARE PROCESSES CARD -->
{% include 'dashboard/components/cards/additional_care_processes_card.html' %}
<div class="flex flex-col gap-3">
<!-- HBa1c CARD -->
{% include 'dashboard/components/cards/hba1c_card.html' %}
<!-- ADMISSIONS CARD -->
{% include 'dashboard/components/cards/admissions_card.html' %}
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-4">
<!-- SEX CARD -->
{% include 'dashboard/components/cards/sex_card.html' %}
<!-- ETHNICITY CARD -->
{% include 'dashboard/components/cards/ethnicity_card.html' %}
<!-- IMD CARD -->
{% include 'dashboard/components/cards/imd_card.html' %}
</div>
<!-- IMD MAP CARD -->
<div class="grid grid-cols-1 min-h-80">
{% include 'dashboard/components/cards/imd_map_card.html' with scatterplot_of_cases_for_selected_organisation=charts.scatterplot_of_cases_for_selected_organisation pdu_lead_organisation=pdu_lead_organisation pdu_object=pdu_object %}
</div>
<!-- PATIENT LEVEL REPORT -->
<h1 class="text-5xl text-center my-6">Patient-Level Report</h1>
<!-- SELECT TABS & TABLE -->
{% include 'dashboard/pt_level_report_table_partial.html' with text=default_pt_level_menu_text selected=default_pt_level_menu_tab_selected highlight=default_highlight %}
</div>
2 changes: 2 additions & 0 deletions project/npda/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def dashboard(request):
Dashboard view for the KPIs.
"""
template = "dashboard.html"
if request.htmx:
template = "dashboard/dashboard_base.html"
pz_code = request.session.get("pz_code")
refresh_session_object_synchronously(
request=request, user=request.user, pz_code=pz_code
Expand Down

0 comments on commit 5a81224

Please sign in to comment.