Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

average-distances-to-clinic #520

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion project/npda/general_functions/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def get_children_by_pdu_audit_year(
if patients:
filtered_patients = patients.filter(
~Q(postcode__isnull=True)
| ~Q(postcode__exact=""), # Exclude patients with no postcode
| ~Q(postcode__exact=""), # Exclude patients with no postcode or location
~Q(location_wgs84__isnull=True),
)

filtered_patients = filtered_patients.annotate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_="on htmx:afterSwap remove #loading-spinner-imd-map">
<figure>
<div id="organisation_cases_map" style="width: 100%">
{% include 'dashboard/map_chart_partial.html' with chart_html=chart_html %}
{% include 'dashboard/map_chart_partial.html' with chart_html=chart_html aggregated_distances=aggregated_distances %}
</div>
</figure>
</div>
Expand Down
25 changes: 21 additions & 4 deletions project/npda/templates/dashboard/map_chart_partial.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
{% if error %}
<div class="alert alert-danger">
<i class="fa-solid fa-person-circle-exclamation"></i> {{ error }}
</div>
<div class="alert alert-danger">
<i class="fa-solid fa-person-circle-exclamation"></i> {{ error }}
</div>
{% elif chart_html %}
<div id='chart_html'>{{ chart_html|safe }}</div>
<div id='chart_html'>{{ chart_html|safe }}</div>
{% if aggregated_distances.max_distance_travelled_km %}
<div class="badge bg-rcpch_pink text-white badge-lg">
Distances travelled to clinic:
</div>
<div class="badge bg-rcpch_light_blue text-white badge-lg">
Maximum: {{ aggregated_distances.max_distance_travelled_km }} km ({{ aggregated_distances.max_distance_travelled_mi }} miles)
</div>
<div class="badge bg-rcpch_light_blue text-white badge-lg">
Mean: {{ aggregated_distances.mean_distance_travelled_km }} km ({{ aggregated_distances.mean_distance_travelled_mi }} miles)
</div>
<div class="badge bg-rcpch_light_blue text-white badge-lg">
Median: {{ aggregated_distances.median_distance_travelled_km }} km ({{ aggregated_distances.median_distance_travelled_mi }} miles)
</div>
<div class="badge bg-rcpch_light_blue text-white badge-lg">
Standard Deviation: {{ aggregated_distances.std_distance_travelled_km }} km ({{ aggregated_distances.std_distance_travelled_mi }} miles)
</div>
{% endif %}
{% endif %}
Loading