Skip to content

Commit d800bb7

Browse files
authored
DM Dashboard treatment status chart fixes - WHO standards (#5817)
- Standardised language `controlled` and `uncontrolled`, removing `<126` and `≥126` bringing into line with HEARTS360 - Removed LK-specific language; this is now the default language for any instance with this flipper flag enabled **Story card:** [SIMPLEBACK-125](https://rtsl.atlassian.net/browse/SIMPLEBACK-125) ## Because The 'Treatment status' card (containing a bar chart) was incorrectly showing wording from the non-WHO standards when the WHO dm indicator standards flipper flag was enabled. Flag: `diabetes_who_standard_indicator` This section of the website did not contain any flipper flags for this feature. ## This addresses Issues reported by the Sri Lanka team. Core fixes: - Standard format and wording implemented for all countries - Enabled by flipper flag - Removed county-specific language (currently only used in LK) ## Test instructions - Familiarise yourself with the DM dashboard wording, focusing on the 2 charts (controlled and uncontrolled) and the treatment status for patients under care card and also the footer definitions (titles). - Understand that the base setup allows for RBS and PPBS to be included in the indicators, while the next WHO standard removes RBS and PPBS from indicators (leaving only FBS and HbA1c) - Enable the `diabetes_who_standard_indicator` flipper flag - Test all 3 cards and footer show expected wording and title, also check tool tips match expected copy. - Test the dashboard on the LK instance to ensure it's identical to other country instances.
1 parent 1c99539 commit d800bb7

8 files changed

Lines changed: 77 additions & 45 deletions

File tree

app/components/dashboard/diabetes/treatment_outcomes_card_component.html.erb

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,43 @@
22
class="p-20px mt-8px mx-0px mb-16px bg-white br-4px bs-small d-lg-flex fd-lg-column
33
justify-lg-between h-lg-full w-lg-full mt-lg-0 pb-inside-avoid b-print-black w-print-16cm min-w-0 col-span-3">
44

5-
<%= render Dashboard::Card::TitleComponent.new(title: 'Treatment status of patients under care') %>
5+
<%= render Dashboard::Card::TitleComponent.new(title: t("diabetes_treatment_status_card.title")) %>
66

77
<div id="diabetesVisitDetails" class="d-flex fd-column fd-lg-row" data-period="<%= period.to_s %>">
88
<div class="pl-lg-12px w-lg-50 h-lg-auto minh-300px">
99
<canvas></canvas>
1010
</div>
1111
<div class="flex-lg-1 mt-24px ml-lg-24px mt-print-2cm">
1212
<% treatment_outcomes.each do |treatment_outcome| %>
13+
<% case treatment_outcome[:outcome]
14+
when :bs_below_200
15+
copy_key = @use_who_standard ? "diabetes_treatment_status_card.bs_below_200.who_standard" : "diabetes_treatment_status_card.bs_below_200"
16+
title_text = t("#{copy_key}.title")
17+
description_text = t("#{copy_key}.description")
18+
numerator_text = @use_who_standard ? t("bs_below_200_copy.numerator_fbs") : t("bs_below_200_copy.numerator")
19+
when :bs_200_to_299
20+
copy_key = @use_who_standard ? "diabetes_treatment_status_card.bs_200_to_299.who_standard" : "diabetes_treatment_status_card.bs_200_to_299"
21+
title_text = t("#{copy_key}.title")
22+
description_text = t("#{copy_key}.description")
23+
numerator_text = @use_who_standard ? t("bs_over_200_copy.bs_200_to_299.numerator_fbs") : t("bs_over_200_copy.bs_200_to_299.numerator")
24+
when :bs_over_300
25+
copy_key = @use_who_standard ? "diabetes_treatment_status_card.bs_over_300.who_standard" : "diabetes_treatment_status_card.bs_over_300"
26+
title_text = t("#{copy_key}.title")
27+
description_text = t("#{copy_key}.description")
28+
numerator_text = @use_who_standard ? t("bs_over_200_copy.bs_over_300.numerator_fbs") : t("bs_over_200_copy.bs_over_300.numerator")
29+
when :missed_visits
30+
title_text = t("diabetes_treatment_status_card.missed_visits.title")
31+
description_text = t("diabetes_treatment_status_card.missed_visits.description")
32+
numerator_text = t("diabetes_missed_visits_copy.numerator")
33+
when :visit_no_bs
34+
title_text = t("diabetes_treatment_status_card.visit_no_bs.title")
35+
description_text = t("diabetes_treatment_status_card.visit_no_bs.description")
36+
numerator_text = t("visit_but_no_bs_taken_copy.numerator")
37+
end %>
38+
<% tooltip = {
39+
numerator: numerator_text,
40+
denominator: t("diabetes_denominator_copy", region_name: region.name)
41+
} %>
1342
<div>
1443
<div class="mb-16px d-lg-flex align-lg-center">
1544
<p class="c-print-black <%= treatment_outcome[:class] %> graph-percent fs-28px"
@@ -18,14 +47,14 @@
1847
<div>
1948
<div class="d-flex flex-1">
2049
<p class="mb-0px mr-6px fw-bold">
21-
<%= treatment_outcome[:title] %>
50+
<%= title_text %>
2251
</p>
23-
<%= render Dashboard::Card::TooltipComponent.new(treatment_outcome[:tooltip]) %>
52+
<%= render Dashboard::Card::TooltipComponent.new(tooltip) %>
2453
</div>
2554

2655
<p class="m-0px c-black">
2756
<span data-key="<%= treatment_outcome[:count] %>" data-format="numberWithCommas"></span>
28-
<%= treatment_outcome[:description] %>
57+
<%= description_text %>
2958
from
3059
<span data-key="startDate"></span>
3160
to

app/components/dashboard/diabetes/treatment_outcomes_card_component.rb

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ class Dashboard::Diabetes::TreatmentOutcomesCardComponent < ApplicationComponent
33
attr_reader :region
44
attr_reader :period
55
attr_reader :with_ltfu
6+
attr_reader :use_who_standard
67

7-
def initialize(data:, region:, period:, with_ltfu: false)
8+
def initialize(data:, region:, period:, with_ltfu: false, use_who_standard: false)
89
@data = data
910
@region = region
1011
@period = period
1112
@with_ltfu = with_ltfu
13+
@use_who_standard = use_who_standard
1214
end
1315

1416
def graph_data
@@ -30,44 +32,23 @@ def treatment_outcomes
3032
[{key: "diabetesMissedVisitsRate",
3133
count: "diabetesMissedVisits",
3234
class: "c-blue",
33-
title: "Missed visits",
34-
description: "patients with no visit",
35-
tooltip: {
36-
numerator: t("diabetes_missed_visits_copy.numerator"),
37-
denominator: t("diabetes_denominator_copy", region_name: @region.name)
38-
}},
35+
outcome: :missed_visits},
3936
{key: "visitButNoBSMeasureRate",
4037
count: "visitButNoBSMeasure",
4138
class: "c-grey-dark",
42-
title: "Visit but no blood sugar taken",
43-
description: "patients with a visit but no blood sugar taken",
44-
tooltip: {
45-
numerator: t("visit_but_no_bs_taken_copy.numerator"),
46-
denominator: t("diabetes_denominator_copy", region_name: @region.name)
47-
}},
39+
outcome: :visit_no_bs},
4840
{key: "bsOver300Rate",
4941
count: "bsOver300Patients",
5042
class: "c-red",
51-
title: "Blood sugar &ge;300".html_safe,
52-
description: "patients with blood sugar ≥300 taken",
53-
tooltip: {
54-
numerator: t("bs_over_200_copy.bs_over_300.numerator"),
55-
denominator: t("diabetes_denominator_copy", region_name: @region.name)
56-
}},
43+
outcome: :bs_over_300},
5744
{key: "bs200to300Rate",
5845
count: "bs200to300Patients",
59-
title: "Blood sugar 200-299",
60-
description: "patients with blood sugar 200-299 taken",
6146
class: "c-amber",
62-
tooltip: {numerator: t("bs_over_200_copy.bs_200_to_299.numerator"),
63-
denominator: t("diabetes_denominator_copy", region_name: @region.name)}},
47+
outcome: :bs_200_to_299},
6448
{key: "bsBelow200Rate",
6549
count: "bsBelow200Patients",
6650
class: "c-green-dark",
67-
title: "Blood sugar &lt;200".html_safe,
68-
description: "patients with blood sugar <200 taken",
69-
tooltip: {numerator: t("bs_below_200_copy.numerator"),
70-
denominator: t("diabetes_denominator_copy", region_name: @region.name)}}]
51+
outcome: :bs_below_200}]
7152
end
7253

7354
def period_data

app/views/reports/regions/diabetes.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<%= render Dashboard::Diabetes::MissedVisitsGraphComponent.new(args_with_ltfu) %>
2727
<%= render Dashboard::Diabetes::RegistrationsAndFollowUpsGraphComponent.new(args) %>
2828
<%= render(Dashboard::Diabetes::LostToFollowUpComponent.new(args)) %>
29-
<%= render Dashboard::Diabetes::TreatmentOutcomesCardComponent.new(args) %>
29+
<%= render Dashboard::Diabetes::TreatmentOutcomesCardComponent.new(args.merge(use_who_standard: @use_who_standard)) %>
3030
</div>
3131

3232
<% if current_admin.feature_enabled?(:medications_dispensation) %>

config/locales/en.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ en:
6464
reports_card_subtitle: "Estimated adults in %{region_name} with hypertension who are registered, under care, and controlled till %{period}"
6565
bs_below_200_copy:
6666
reports_card_title: "Blood sugar <200"
67-
reports_card_title_fbs: "Blood sugar <126"
67+
reports_card_title_fbs: "Blood sugar controlled"
6868
reports_card_title_dm: "Blood Sugar <200"
6969
reports_card_title_dm_bs: "Blood sugar <200"
7070
reports_card_title_dm_fbs: "Blood sugar controlled"
@@ -87,15 +87,15 @@ en:
8787
numerator: "Patients with HbA1c <7.0 at their last visit in the last 3 months"
8888
bs_over_200_copy:
8989
reports_card_title: "Blood sugar ≥200"
90-
reports_card_title_fbs: "Blood sugar ≥126"
90+
reports_card_title_fbs: "Blood sugar uncontrolled"
9191
reports_card_title_dm: "Blood sugar ≥200"
9292
reports_card_title_dm_fbs: "Blood sugar uncontrolled"
9393
reports_card_subtitle: "Diabetes patients in %{region_name} with blood sugar 200-299 or blood sugar ≥300 at their last visit in the last 3 months"
9494
reports_card_subtitle_fbs: "Diabetes patients in %{region_name} with FBS ≥126mg/dL or HbA1c ≥7% at their last visit in the last 3 months"
9595
bs_200_to_299:
9696
title: "Blood Sugar 200-299"
9797
title_dm_bs: "Blood sugar 200-299"
98-
title_fbs: "Blood Sugar 126-199"
98+
title_fbs: "Blood sugar uncontrolled (126-199)"
9999
title_dm: "blood sugar 200-299"
100100
title_dm_fbs: "FBS 126-199mg/dL or HbA1c 7%-8.9%"
101101
reports_card_subtitle: "Diabetes patients at %{region_name} registered >3 months ago with blood sugar 200-299 at their last visit in the last 3 months."
@@ -114,7 +114,7 @@ en:
114114
numerator: "Patients with HbA1c 7.0-8.9 at their last visit in the last 3 months"
115115
bs_over_300:
116116
title: "Blood sugar ≥300"
117-
title_fbs: "Blood sugar ≥200"
117+
title_fbs: "Blood sugar uncontrolled (≥200)"
118118
title_dm_fbs: "FBS ≥200mg/dL or HbA1c ≥9%"
119119
numerator: "Patients with RBS/PPBS ≥300, FBS ≥200, or HbA1c ≥9.0 at their last visit in the last 3 months"
120120
numerator_fbs: "Patients with FBS ≥200mg/dL, or HbA1c ≥9% at their last visit in the last 3 months"
@@ -130,6 +130,32 @@ en:
130130
numerator: "Patients with FBS ≥200 at their last visit in the last 3 months"
131131
hba1c:
132132
numerator: "Patients with HbA1c ≥9.0 at their last visit in the last 3 months"
133+
diabetes_treatment_status_card:
134+
title: "Treatment status of patients under care"
135+
missed_visits:
136+
title: "Missed visits"
137+
description: "patients with no visit"
138+
visit_no_bs:
139+
title: "Visit but no blood sugar taken"
140+
description: "patients with a visit but no blood sugar taken"
141+
bs_over_300:
142+
title: "Blood sugar ≥300"
143+
description: "patients with blood sugar ≥300 taken"
144+
who_standard:
145+
title: "Blood sugar uncontrolled"
146+
description: "patients with FBS ≥200mg/dL or HbA1c ≥9% taken"
147+
bs_200_to_299:
148+
title: "Blood sugar 200-299"
149+
description: "patients with blood sugar 200-299 taken"
150+
who_standard:
151+
title: "Blood sugar uncontrolled"
152+
description: "patients with FBS 126-199mg/dL or HbA1c 7%-8.9% taken"
153+
bs_below_200:
154+
title: "Blood sugar <200"
155+
description: "patients with blood sugar <200 taken"
156+
who_standard:
157+
title: "Blood sugar controlled"
158+
description: "patients with FBS <126mg/dL or HbA1c <7% taken"
133159
missed_visits_copy:
134160
reports_card_subtitle: "Hypertension patients with no visit in the last 3 months"
135161
numerator: "Patients with no visit in the last 3 months"

config/locales/en_LK.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ en-LK:
5757
numerator_dm_fbs: "Patients with FBS <126mg/dL or HbA1c <7% at their last visit in the last 3 months"
5858
reports_card_title: "Blood Sugar <200"
5959
reports_card_title_dm_bs: "Blood sugar <200"
60-
reports_card_title_fbs: "Blood sugar controlled"
61-
reports_card_title_dm: "Blood Sugar <200"
6260
reports_card_title_dm_fbs: "Blood sugar controlled"
6361
report_card_lower_bar: "blood sugar <200"
6462
report_card_lower_bar_fbs: "FBS <126mg/dL or HbA1c <7%"
@@ -70,8 +68,6 @@ en-LK:
7068
summary_fbs: "patients with blood sugar controlled from"
7169
bs_over_200_copy:
7270
reports_card_title: "Blood sugar 200-299 or ≥300"
73-
reports_card_title_dm: "Blood sugar ≥200"
74-
reports_card_title_fbs: "Blood sugar uncontrolled"
7571
reports_card_title_dm_fbs: "Blood sugar uncontrolled"
7672
reports_card_subtitle: "Diabetes patients in %{region_name} with blood sugar 200-299 or blood sugar ≥300 at their last visit in the last 3 months"
7773
reports_card_subtitle_fbs: "Diabetes patients in %{region_name} with FBS ≥126mg/dL or HbA1c ≥7% at their last visit in the last 3 months"

spec/components/dashboard/diabetes/bs_below200_graph_component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
it "has the updated labels" do
3333
render_inline(bs_below200_graph_component)
34-
expect(page.find(:css, "h3").text.strip).to eq("Blood sugar <126")
34+
expect(page.find(:css, "h3").text.strip).to eq("Blood sugar controlled")
3535
expect(page.find("#bsBelow200PatientsTrend").find(:xpath, "div/p").text.strip).to eq("Diabetes patients in Test District with FBS <126 mg/dL or HbA1c <7% at their last visit in the last 3 months")
3636
expect(Capybara.string(page.find("#bsBelow200PatientsTrend i")[:title]).first("p").text).to eq("Numerator: Patients with FBS <126mg/dL, or HbA1c <7% at their last visit in the last 3 months")
3737
expect(page.find("#bsBelow200PatientsTrend").find(:xpath, "div/div[2]/div/p[1]").text).to match(/patients with a blood sugar <126mg\/dL from/)

spec/components/dashboard/diabetes/bs_over200_graph_component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
it "has the updated labels" do
3636
render_inline(bs_over200_graph_component)
37-
expect(page.find(:css, "h3").text.strip).to eq("Blood sugar ≥126")
37+
expect(page.find(:css, "h3").text.strip).to eq("Blood sugar uncontrolled")
3838
expect(page.find("#bsOver200PatientsTrend").find(:xpath, "div/p[1]").text.strip).to eq("Diabetes patients in Test District with FBS ≥126mg/dL or HbA1c ≥7% at their last visit in the last 3 months")
3939
expect(Capybara.string(page.find("#bsOver200PatientsTrend i")[:title]).all("p")[0].text).to eq("Blood sugar 126-199 numerator: Patients with FBS 126-199mg/dL, or HbA1c 7%-8.9% at their last visit in the last 3 months")
4040
expect(Capybara.string(page.find("#bsOver200PatientsTrend i")[:title]).all("p")[1].text).to eq("Blood sugar ≥200 numerator: Patients with FBS ≥200mg/dL, or HbA1c ≥9% at their last visit in the last 3 months")

spec/views/reports/regions/_diabetes_footnotes.html.erb_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
assign(:use_who_standard, use_who_standard)
2727
render
2828
all_texts = Capybara.string(rendered).all("p")
29-
expect(all_texts[8].text.strip).to eq("Blood sugar <126")
29+
expect(all_texts[8].text.strip).to eq("Blood sugar controlled")
3030
expect(all_texts[9].text.strip).to eq("Numerator: Patients with FBS <126mg/dL, or HbA1c <7% at their last visit in the last 3 months")
31-
expect(all_texts[11].text.strip).to eq("Blood Sugar 126-199")
31+
expect(all_texts[11].text.strip).to eq("Blood sugar uncontrolled (126-199)")
3232
expect(all_texts[12].text.strip).to eq("Numerator: Patients with FBS 126-199mg/dL, or HbA1c 7%-8.9% at their last visit in the last 3 months")
33-
expect(all_texts[14].text.strip).to eq("Blood sugar ≥200")
33+
expect(all_texts[14].text.strip).to eq("Blood sugar uncontrolled (≥200)")
3434
expect(all_texts[15].text.strip).to eq("Numerator: Patients with FBS ≥200mg/dL, or HbA1c ≥9% at their last visit in the last 3 months")
3535
end
3636
end

0 commit comments

Comments
 (0)