Skip to content

Commit

Permalink
handle no eligible pts for cards
Browse files Browse the repository at this point in the history
Signed-off-by: anchit-chandran <[email protected]>
  • Loading branch information
anchit-chandran committed Jan 3, 2025
1 parent 3465630 commit c283697
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Admissions
{% endblock card_title%}
{% block card_body %}
{% if charts.admissions_value_counts_absolute.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
{% else %}
<div class="grid grid-cols-2 text-center flex-grow justify-center items-center">
<div class="d-flex justify-self-center items-center w-full border-r border-r-rcpch_mid_grey">
<h1>Total</h1>
Expand All @@ -13,6 +18,7 @@ <h1>With DKA</h1>
<p class="text-sm py-1">{{ charts.admissions_value_counts_absolute.data.kpi_47_number_of_dka_admissions }} patients</p>
</div>
</div>
{% endif %}
{% endblock %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
</div>
{% include 'dashboard/hr_with_text.html' with hr_rule_text='Current Quarter' %}
<div class="flex flex-col justify-center items-center">
<p class="text-7xl">Q{{ current_quarter }}</p>
<p class="text-4xl">Q{{ current_quarter }}</p>
<p>({{ current_date }})</p>
</div>
{% include 'dashboard/hr_with_text.html' with hr_rule_text='Days Remaining' %}
<div class="flex flex-col justify-center items-center pb-4">
<p class="text-7xl">{{ days_remaining_until_audit_end_date }}</p>
<p class="text-4xl">{{ days_remaining_until_audit_end_date }}</p>
</div>

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Care at Diagnosis
{% endblock card_title%}
{% block card_body %}
{% if charts.care_at_diagnosis_value_count.data.coeliac_disease_screening.total_eligible == 0 %}
{% if charts.care_at_diagnosis_value_count.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Glucose Monitoring
{% endblock card_title%}
{% block card_body %}
{% if charts.care_at_diagnosis_value_count.data.coeliac_disease_screening.total_eligible == 0 %}
{% if charts.glucose_monitoring_value_counts_pct.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
HbA1c
{% endblock card_title%}
{% block card_body %}

{% if charts.hba1c_value_counts.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
{% else %}
<div class="grid grid-cols-2 text-center flex-grow justify-center items-center ">
<div class="d-flex justify-self-center items-center w-full border-r border-r-rcpch_mid_grey">
<h1>T1DM</h1>
Expand All @@ -16,6 +20,7 @@ <h1>T2DM</h1>
<p class="text-sm py-1">Median: {{ charts.hba1c_value_counts.data.t2dm.median }} mmol/mol</p>
</div>
</div>
{% endif %}
{% endblock %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Hybrid Closed Loop Use
{% endblock card_title%}
{% block card_body %}
{% if charts.care_at_diagnosis_value_count.data.coeliac_disease_screening.total_eligible == 0 %}
{% if charts.hcl_use_per_quarter_value_counts_pct.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Treatment Regimen
{% endblock card_title%}
{% block card_body %}
{% if charts.care_at_diagnosis_value_count.data.coeliac_disease_screening.total_eligible == 0 %}

{% if charts.tx_regimen_value_counts_pct.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
Expand Down
10 changes: 10 additions & 0 deletions project/npda/views/dashboard/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,23 @@ def dashboard(request):
"data": pt_characteristics_value_counts_with_figure_counts,
},
"tx_regimen_value_counts_pct": {
"no_eligible_patients": kpi_calculations_object["calculated_kpi_values"]["kpi_1_total_eligible"]["total_eligible"] == 0,
"data": json.dumps(tx_regimen_value_counts_pct),
},
"glucose_monitoring_value_counts_pct": {
"no_eligible_patients": kpi_calculations_object["calculated_kpi_values"]["kpi_1_total_eligible"]["total_eligible"] == 0,
"data": json.dumps(glucose_monitoring_value_counts_pct),
},
"hcl_use_per_quarter_value_counts_pct": {
"no_eligible_patients": kpi_calculations_object["calculated_kpi_values"]["kpi_1_total_eligible"]["total_eligible"] == 0,
"data": json.dumps(hcl_use_per_quarter_value_counts_pct),
},
"care_at_diagnosis_value_count": {
"no_eligible_patients": all([
care_at_diagnosis_value_counts_pct['coeliac_disease_screening']['total_eligible'] == 0,
care_at_diagnosis_value_counts_pct['thyroid_disease_screening']['total_eligible'] == 0,
care_at_diagnosis_value_counts_pct['carbohydrate_counting_education']['total_eligible'] == 0,
]),
"data": json.dumps(care_at_diagnosis_value_counts_pct),
},
"additional_care_processes_value_counts_pct": {
Expand All @@ -312,10 +320,12 @@ def dashboard(request):
"data": json.dumps(hc_completion_rate_value_counts_pct),
},
"hba1c_value_counts": {
"no_eligible_patients": kpi_calculations_object["calculated_kpi_values"]["kpi_1_total_eligible"]["total_eligible"] == 0,
# No need to json-ify as data ready to render in template
"data": hba1c_value_counts_stratified_by_diabetes_type,
},
"admissions_value_counts_absolute": {
"no_eligible_patients": kpi_calculations_object["calculated_kpi_values"]["kpi_1_total_eligible"]["total_eligible"] == 0,
"data": admissions_value_counts_absolute,
},
"pt_sex_value_counts_pct": {
Expand Down

0 comments on commit c283697

Please sign in to comment.