Skip to content

SIMPLEBACK-36: fix ltfu toggle bug#5765

Merged
Gyan-Gupta-Rtsl merged 7 commits intodm-dashboard-new-controlled-bp-statin-cardsfrom
SIMPLEBACK-36-ltfu-toggle-bug
Feb 18, 2026
Merged

SIMPLEBACK-36: fix ltfu toggle bug#5765
Gyan-Gupta-Rtsl merged 7 commits intodm-dashboard-new-controlled-bp-statin-cardsfrom
SIMPLEBACK-36-ltfu-toggle-bug

Conversation

@Gyan-Gupta-Rtsl
Copy link
Contributor

@Gyan-Gupta-Rtsl Gyan-Gupta-Rtsl commented Feb 9, 2026

Ticket: ltfu toggle bug

Because

When the LTFU toggle is ON, the first three dashboard periods were showing denominator = 0.
This happened because LTFU calculations rely on period.adjusted_period (3-month lookback), but the required historical data was not included in the query range.

This addresses

  1. Extends internal query range by REGISTRATION_BUFFER_IN_MONTHS (3 months) for denominator calculations
  2. Keeps UI window strictly limited to original 18 months
  3. Ensures first 3 periods correctly include cumulative assigned patients
  4. Maintains backward compatibility and does not expose buffer months to UI

Test Instructions

  1. Enable LTFU toggle in dashboard charts
  2. Verify first three periods show correct registered patient counts
  3. Confirm UI still displays only 18 months
  4. Run full test suite, all specs should pass

@Gyan-Gupta-Rtsl Gyan-Gupta-Rtsl requested a review from a team February 16, 2026 08:24
h[period] = counts.fetch(period.adjusted_period, 0)
end

results[region.slug] = values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug affects Hypertension dashboards as well. Shouldn't we be including this change there as well ?
This one is only correcting the diabetes denominator

@Gyan-Gupta-Rtsl Gyan-Gupta-Rtsl merged commit f27d0a3 into dm-dashboard-new-controlled-bp-statin-cards Feb 18, 2026
1 check passed
@Gyan-Gupta-Rtsl Gyan-Gupta-Rtsl deleted the SIMPLEBACK-36-ltfu-toggle-bug branch February 18, 2026 05:27
Gyan-Gupta-Rtsl pushed a commit that referenced this pull request Feb 20, 2026
Statins card

Statin colour fixes and 18month data

Minor fixes

Sc 17708 (#5753)

**Story card:**
[sc-17708](https://app.shortcut.com/simpledotorg/story/17708/wire-dm-patients-with-controlled-bp-chart-to-dashboard)

The DM dashboard "DM patients with controlled BP" card was using dummy
data and needed backend support to display real metrics.

1. Adds backend methods in RegionSummarySchema to calculate DM patients
with controlled BP (<140/90 and <130/80)
2. Wires DmBpControlledComponent to use real data from
RepositoryPresenter
3. Adds specs for the new metrics

Suit test cases.

sc-17709: add backend for DM patients ≥40 prescribed statins chart (#5759)

**Story card:**
[sc-17709](https://app.shortcut.com/simpledotorg/story/17709/wire-dm-patients-40-prescribed-statins-chart-to-dashboard)
**Metabase report:** [Diabetes patients aged >=40 prescribed statins at
latest visit in past 12
months](https://metabase.bd.simple.org/question/647-diabetes-patients-aged-40-prescribed-statins-at-latest-visit-in-past-12-months)

The dashboard needs backend data to display DM patients aged ≥40 who are
prescribed statins, in order to track statin prescription rates for
diabetes management.

1. Adds backend methods to calculate DM patients ≥40 under care and
those prescribed statins
2. Wires these metrics into the dashboard data source for the “DM
patients ≥40 prescribed statins” chart
3. Applies facility group and eligibility filters
(months_since_registration >= 3, htn_care_state = 'under_care', age >=
40)

1. Run test cases

Add LTFU toggle to statins card

Add denominator string change when LTFU enable

SIMPLEBACK-36: fix ltfu toggle bug (#5765)

**Ticket**:  [ltfu toggle bug
](https://rtsl.atlassian.net/browse/SIMPLEBACK-36)

When the LTFU toggle is ON, the first three dashboard periods were
showing denominator = 0.
This happened because LTFU calculations rely on period.adjusted_period
(3-month lookback), but the required historical data was not included in
the query range.

1. Extends internal query range by REGISTRATION_BUFFER_IN_MONTHS (3
months) for denominator calculations
2. Keeps UI window strictly limited to original 18 months
3. Ensures first 3 periods correctly include cumulative assigned
patients
4. Maintains backward compatibility and does not expose buffer months to
UI

1. Enable LTFU toggle in [dashboard
charts](https://api-sandbox.simple.org/reports/regions/facility/chc-lonand-gaon/diabetes?period%5Btype%5D=month&period%5Bvalue%5D=2025-10-01&with_ltfu=true)
2. Verify first three periods show correct registered patient counts
3. Confirm UI still displays only 18 months
4. Run full test suite, all specs should pass

Adding flipper flag to new CVD and statins section

list issue
Gyan-Gupta-Rtsl pushed a commit that referenced this pull request Feb 26, 2026
Statins card

Statin colour fixes and 18month data

Minor fixes

Sc 17708 (#5753)

**Story card:**
[sc-17708](https://app.shortcut.com/simpledotorg/story/17708/wire-dm-patients-with-controlled-bp-chart-to-dashboard)

The DM dashboard "DM patients with controlled BP" card was using dummy
data and needed backend support to display real metrics.

1. Adds backend methods in RegionSummarySchema to calculate DM patients
with controlled BP (<140/90 and <130/80)
2. Wires DmBpControlledComponent to use real data from
RepositoryPresenter
3. Adds specs for the new metrics

Suit test cases.

sc-17709: add backend for DM patients ≥40 prescribed statins chart (#5759)

**Story card:**
[sc-17709](https://app.shortcut.com/simpledotorg/story/17709/wire-dm-patients-40-prescribed-statins-chart-to-dashboard)
**Metabase report:** [Diabetes patients aged >=40 prescribed statins at
latest visit in past 12
months](https://metabase.bd.simple.org/question/647-diabetes-patients-aged-40-prescribed-statins-at-latest-visit-in-past-12-months)

The dashboard needs backend data to display DM patients aged ≥40 who are
prescribed statins, in order to track statin prescription rates for
diabetes management.

1. Adds backend methods to calculate DM patients ≥40 under care and
those prescribed statins
2. Wires these metrics into the dashboard data source for the “DM
patients ≥40 prescribed statins” chart
3. Applies facility group and eligibility filters
(months_since_registration >= 3, htn_care_state = 'under_care', age >=
40)

1. Run test cases

Add LTFU toggle to statins card

Add denominator string change when LTFU enable

SIMPLEBACK-36: fix ltfu toggle bug (#5765)

**Ticket**:  [ltfu toggle bug
](https://rtsl.atlassian.net/browse/SIMPLEBACK-36)

When the LTFU toggle is ON, the first three dashboard periods were
showing denominator = 0.
This happened because LTFU calculations rely on period.adjusted_period
(3-month lookback), but the required historical data was not included in
the query range.

1. Extends internal query range by REGISTRATION_BUFFER_IN_MONTHS (3
months) for denominator calculations
2. Keeps UI window strictly limited to original 18 months
3. Ensures first 3 periods correctly include cumulative assigned
patients
4. Maintains backward compatibility and does not expose buffer months to
UI

1. Enable LTFU toggle in [dashboard
charts](https://api-sandbox.simple.org/reports/regions/facility/chc-lonand-gaon/diabetes?period%5Btype%5D=month&period%5Bvalue%5D=2025-10-01&with_ltfu=true)
2. Verify first three periods show correct registered patient counts
3. Confirm UI still displays only 18 months
4. Run full test suite, all specs should pass

Adding flipper flag to new CVD and statins section

list issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants