Skip to content

Commit 245d6b9

Browse files
siddh1004Siddharth Agarwal
andauthored
Add lab based cvd risk feature flag (#5254)
https://app.shortcut.com/simpledotorg/story/14624/add-statin-phase-3-remote-config --------- Co-authored-by: Siddharth Agarwal <[email protected]>
1 parent cab284b commit 245d6b9

File tree

8 files changed

+52
-13
lines changed

8 files changed

+52
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
- Show smoking status dialog for low and medium cvd risk.
6060
- Rename `patient_statin_nudge_v1` feature flag to `non_lab_based_statin_nudge`
6161
- Rename `cvd_risk_calculation_sheet_v0` feature flag to `non_lab_based_cvd_risk_calculation_sheet`
62+
- Add `lab_based_statin_nudge` feature flag.
6263

6364
### Fixes
6465

app/src/main/java/org/simple/clinic/feature/Feature.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ enum class Feature(
2626
OverdueInstantSearch(false, "overdue_instant_search_v2"),
2727
PatientReassignment(false, "patient_reassignment_v0"),
2828
PatientStatinNudge(false, "patient_statin_nudge_v0"),
29-
NonLabBasedStatinNudge(false, "non_lab_based_statin_nudge")
29+
NonLabBasedStatinNudge(false, "non_lab_based_statin_nudge"),
30+
LabBasedStatinNudge(false, "lab_based_statin_nudge")
3031
}

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ class NewMedicalHistoryScreen : BaseScreen<
111111

112112
override fun defaultModel() = NewMedicalHistoryModel.default(
113113
country = country,
114-
showIsSmokingQuestion = features.isEnabled(Feature.NonLabBasedStatinNudge)
114+
showIsSmokingQuestion = features.isEnabled(Feature.NonLabBasedStatinNudge) ||
115+
features.isEnabled(Feature.LabBasedStatinNudge)
115116
)
116117

117118
override fun bindView(

app/src/main/java/org/simple/clinic/summary/PatientSummaryScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ class PatientSummaryScreen :
270270
isPatientReassignmentFeatureEnabled = features.isEnabled(Feature.PatientReassignment),
271271
isPatientStatinNudgeV1Enabled = features.isEnabled(Feature.PatientStatinNudge),
272272
isNonLabBasedStatinNudgeEnabled = features.isEnabled(Feature.NonLabBasedStatinNudge),
273+
isLabBasedStatinNudgeEnabled = features.isEnabled(Feature.LabBasedStatinNudge),
273274
)
274275
}
275276

app/src/main/java/org/simple/clinic/summary/PatientSummaryUpdate.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class PatientSummaryUpdate(
3131
private val isPatientReassignmentFeatureEnabled: Boolean,
3232
private val isPatientStatinNudgeV1Enabled: Boolean,
3333
private val isNonLabBasedStatinNudgeEnabled: Boolean,
34+
private val isLabBasedStatinNudgeEnabled: Boolean,
3435
private val minAgeForStatin: Int = 40,
3536
private val maxAgeForCVDRisk: Int = 74
3637
) : Update<PatientSummaryModel, PatientSummaryEvent, PatientSummaryEffect> {
@@ -384,7 +385,9 @@ class PatientSummaryUpdate(
384385
val effects = mutableSetOf<PatientSummaryEffect>()
385386

386387
when {
387-
isNonLabBasedStatinNudgeEnabled || isPatientStatinNudgeV1Enabled -> {
388+
isPatientStatinNudgeV1Enabled ||
389+
isNonLabBasedStatinNudgeEnabled ||
390+
isLabBasedStatinNudgeEnabled -> {
388391
effects.add(LoadStatinPrescriptionCheckInfo(patient = event.patientSummaryProfile.patient))
389392
}
390393
}

app/src/main/java/org/simple/clinic/summary/medicalhistory/MedicalHistorySummaryView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class MedicalHistorySummaryView(
107107
events = events.ofType(),
108108
defaultModel = MedicalHistorySummaryModel.create(
109109
patientUuid = screenKey.patientUuid,
110-
showIsSmokingQuestion = features.isEnabled(Feature.NonLabBasedStatinNudge)
110+
showIsSmokingQuestion = features.isEnabled(Feature.NonLabBasedStatinNudge) ||
111+
features.isEnabled(Feature.LabBasedStatinNudge)
111112
),
112113
update = MedicalHistorySummaryUpdate(),
113114
init = MedicalHistorySummaryInit(),

app/src/test/java/org/simple/clinic/summary/PatientSummaryScreenLogicTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ class PatientSummaryScreenLogicTest {
243243
update = PatientSummaryUpdate(
244244
isPatientReassignmentFeatureEnabled = false,
245245
isPatientStatinNudgeV1Enabled = false,
246-
isNonLabBasedStatinNudgeEnabled = false
246+
isNonLabBasedStatinNudgeEnabled = false,
247+
isLabBasedStatinNudgeEnabled = false,
247248
),
248249
effectHandler = effectHandler.build(),
249250
modelUpdateListener = viewRenderer::render

app/src/test/java/org/simple/clinic/summary/PatientSummaryUpdateTest.kt

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class PatientSummaryUpdateTest {
8787
isPatientReassignmentFeatureEnabled = true,
8888
isPatientStatinNudgeV1Enabled = true,
8989
isNonLabBasedStatinNudgeEnabled = true,
90+
isLabBasedStatinNudgeEnabled = true,
9091
))
9192

9293
@Test
@@ -112,6 +113,7 @@ class PatientSummaryUpdateTest {
112113
isPatientReassignmentFeatureEnabled = true,
113114
isPatientStatinNudgeV1Enabled = false,
114115
isNonLabBasedStatinNudgeEnabled = false,
116+
isLabBasedStatinNudgeEnabled = false,
115117
))
116118

117119
updateSpec
@@ -129,6 +131,7 @@ class PatientSummaryUpdateTest {
129131
isPatientReassignmentFeatureEnabled = true,
130132
isPatientStatinNudgeV1Enabled = true,
131133
isNonLabBasedStatinNudgeEnabled = false,
134+
isLabBasedStatinNudgeEnabled = false,
132135
))
133136

134137
updateSpec
@@ -141,11 +144,30 @@ class PatientSummaryUpdateTest {
141144
}
142145

143146
@Test
144-
fun `when the patient summary profile is loaded and statin nudge v2 feature flag is enabled, then update the UI and load statin check info`() {
147+
fun `when the patient summary profile is loaded and non lab based statin nudge feature flag is enabled, then update the UI and load statin check info`() {
145148
val updateSpec = UpdateSpec(PatientSummaryUpdate(
146149
isPatientReassignmentFeatureEnabled = true,
147150
isPatientStatinNudgeV1Enabled = false,
148151
isNonLabBasedStatinNudgeEnabled = true,
152+
isLabBasedStatinNudgeEnabled = false,
153+
))
154+
155+
updateSpec
156+
.given(defaultModel)
157+
.whenEvent(PatientSummaryProfileLoaded(patientSummaryProfile))
158+
.then(assertThatNext(
159+
hasModel(defaultModel.patientSummaryProfileLoaded(patientSummaryProfile)),
160+
hasEffects(LoadStatinPrescriptionCheckInfo(patient = patientSummaryProfile.patient))
161+
))
162+
}
163+
164+
@Test
165+
fun `when the patient summary profile is loaded and lab based statin nudge feature flag is enabled, then update the UI and load statin check info`() {
166+
val updateSpec = UpdateSpec(PatientSummaryUpdate(
167+
isPatientReassignmentFeatureEnabled = true,
168+
isPatientStatinNudgeV1Enabled = false,
169+
isNonLabBasedStatinNudgeEnabled = false,
170+
isLabBasedStatinNudgeEnabled = true,
149171
))
150172

151173
updateSpec
@@ -1694,7 +1716,8 @@ class PatientSummaryUpdateTest {
16941716
val updateSpec = UpdateSpec(PatientSummaryUpdate(
16951717
isPatientReassignmentFeatureEnabled = false,
16961718
isPatientStatinNudgeV1Enabled = false,
1697-
isNonLabBasedStatinNudgeEnabled = false
1719+
isNonLabBasedStatinNudgeEnabled = false,
1720+
isLabBasedStatinNudgeEnabled = false,
16981721
))
16991722
val model = defaultModel
17001723
.currentFacilityLoaded(facility)
@@ -1724,6 +1747,7 @@ class PatientSummaryUpdateTest {
17241747
isPatientReassignmentFeatureEnabled = false,
17251748
isPatientStatinNudgeV1Enabled = false,
17261749
isNonLabBasedStatinNudgeEnabled = false,
1750+
isLabBasedStatinNudgeEnabled = false,
17271751
))
17281752
val model = defaultModel
17291753
.currentFacilityLoaded(facility)
@@ -1752,7 +1776,8 @@ class PatientSummaryUpdateTest {
17521776
val updateSpec = UpdateSpec(PatientSummaryUpdate(
17531777
isPatientReassignmentFeatureEnabled = false,
17541778
isPatientStatinNudgeV1Enabled = false,
1755-
isNonLabBasedStatinNudgeEnabled = false
1779+
isNonLabBasedStatinNudgeEnabled = false,
1780+
isLabBasedStatinNudgeEnabled = false,
17561781
))
17571782
val model = defaultModel
17581783
.currentFacilityLoaded(facility)
@@ -2142,7 +2167,8 @@ class PatientSummaryUpdateTest {
21422167
val updateSpec = UpdateSpec(PatientSummaryUpdate(
21432168
isPatientReassignmentFeatureEnabled = false,
21442169
isPatientStatinNudgeV1Enabled = true,
2145-
isNonLabBasedStatinNudgeEnabled = true
2170+
isNonLabBasedStatinNudgeEnabled = true,
2171+
isLabBasedStatinNudgeEnabled = false,
21462172
))
21472173
updateSpec
21482174
.given(defaultModel)
@@ -2174,7 +2200,8 @@ class PatientSummaryUpdateTest {
21742200
val updateSpec = UpdateSpec(PatientSummaryUpdate(
21752201
isPatientReassignmentFeatureEnabled = false,
21762202
isPatientStatinNudgeV1Enabled = true,
2177-
isNonLabBasedStatinNudgeEnabled = true
2203+
isNonLabBasedStatinNudgeEnabled = true,
2204+
isLabBasedStatinNudgeEnabled = false,
21782205
))
21792206
updateSpec
21802207
.given(defaultModel)
@@ -2206,7 +2233,8 @@ class PatientSummaryUpdateTest {
22062233
val updateSpec = UpdateSpec(PatientSummaryUpdate(
22072234
isPatientReassignmentFeatureEnabled = false,
22082235
isPatientStatinNudgeV1Enabled = true,
2209-
isNonLabBasedStatinNudgeEnabled = true
2236+
isNonLabBasedStatinNudgeEnabled = true,
2237+
isLabBasedStatinNudgeEnabled = false,
22102238
))
22112239
updateSpec
22122240
.given(defaultModel)
@@ -2238,7 +2266,8 @@ class PatientSummaryUpdateTest {
22382266
val updateSpec = UpdateSpec(PatientSummaryUpdate(
22392267
isPatientReassignmentFeatureEnabled = false,
22402268
isPatientStatinNudgeV1Enabled = true,
2241-
isNonLabBasedStatinNudgeEnabled = true
2269+
isNonLabBasedStatinNudgeEnabled = true,
2270+
isLabBasedStatinNudgeEnabled = false,
22422271
))
22432272

22442273
val model = defaultModel.patientSummaryProfileLoaded(patientSummaryProfile)
@@ -2273,7 +2302,8 @@ class PatientSummaryUpdateTest {
22732302
val updateSpec = UpdateSpec(PatientSummaryUpdate(
22742303
isPatientReassignmentFeatureEnabled = false,
22752304
isPatientStatinNudgeV1Enabled = true,
2276-
isNonLabBasedStatinNudgeEnabled = true
2305+
isNonLabBasedStatinNudgeEnabled = true,
2306+
isLabBasedStatinNudgeEnabled = false,
22772307
))
22782308
val model = defaultModel.patientSummaryProfileLoaded(patientSummaryProfile)
22792309

0 commit comments

Comments
 (0)