Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/live' into eatyourpeas/issue585
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas committed Feb 10, 2025
2 parents 60bfb6b + 85960da commit 38d43de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
Ethnicity
{% endblock card_title%}
{% block card_body %}
<div
hx-get="{% url 'get_treemap_chart_partial' %}"
hx-vals='{{ charts.pt_ethnicity_tree_map_data }}'
hx-trigger="load" hx-swap="innerHTML"
_="on htmx:afterSwap remove #loading-spinner-ethnicity-card"></div>
{% if charts.pt_ethnicity_tree_map_data.no_eligible_patients %}
<div class="alert alert-info">
<i class="fa-solid fa-person-circle-exclamation"></i> No eligible patients.
</div>
{% else %}
<div
hx-get="{% url 'get_treemap_chart_partial' %}"
hx-vals='{{ charts.pt_ethnicity_tree_map_data }}'
hx-trigger="load" hx-swap="innerHTML"
_="on htmx:afterSwap remove #loading-spinner-ethnicity-card"></div>

<div id="loading-spinner-ethnicity-card"
class="loading loading-spinner text-rcpch_dark_blue flex flex-grow-1 justify-center items-center h-full w-1/5 mx-auto bg-center">
</div>
<div id="loading-spinner-ethnicity-card"
class="loading loading-spinner text-rcpch_dark_blue flex flex-grow-1 justify-center items-center h-full w-1/5 mx-auto bg-center">
</div>
{% endif %}
{% endblock %}


Expand Down
3 changes: 3 additions & 0 deletions project/npda/views/dashboard/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def dashboard(request):
},
"pt_ethnicity_tree_map_data": json.dumps(
{
"no_eligible_patients": not pt_ethnicity_value_counts,
"data": pt_ethnicity_value_counts,
"parent_color_map": constants.ethnicities.ETHNICITY_PARENT_COLOR_MAP,
"child_parent_map": constants.ethnicities.ETHNICITY_CHILD_PARENT_MAP,
Expand Down Expand Up @@ -354,4 +355,6 @@ def dashboard(request):
"aggregation_level": "pdu",
}

print(f"!! {context['charts']['pt_ethnicity_tree_map_data']}")

return render(request, template_name=template, context=context)
4 changes: 2 additions & 2 deletions project/npda/views/dashboard/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ def get_pt_demographic_value_counts(
"sex", "ethnicity", "index_of_multiple_deprivation_quintile"
)
sex_map = dict(SEX_TYPE)
sex_counts = Counter(sex_map.get(item["sex"]) for item in all_values)
sex_counts = Counter(sex_map[item["sex"]] for item in all_values if item["sex"] in sex_map)
ethnicity_map = dict(ETHNICITIES)
ethnicity_counts = Counter(ethnicity_map.get(item["ethnicity"]) for item in all_values)
ethnicity_counts = Counter(ethnicity_map[item["ethnicity"]] for item in all_values if item["ethnicity"] in ethnicity_map)
imd_map = {
1: "1st Quintile",
2: "2nd Quintile",
Expand Down

0 comments on commit 38d43de

Please sign in to comment.