Skip to content

Commit 106b8f7

Browse files
Merge pull request #5829 from simpledotorg/master
2 parents 05e1e8e + 39ca3a2 commit 106b8f7

8 files changed

Lines changed: 103 additions & 42 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66

77
- Bump Coroutines to v1.11.0
88
- Bump Gradle to v9.5.1
9+
- Bump sqlCipher to v4.16.0
10+
- Bump Material Components to v1.14.0
11+
- Bump KSP to v2.3.8
12+
- Bump asm to v9.10.1
13+
- Bump Sentry Android to v6.8.1
14+
- Bump Compose BOM to v2026.05.01
15+
- Bump Sentry to v8.42.0
16+
17+
### Changes
18+
19+
- Update Titration nudge threshold for diabetic patients in SriLanka from `140/90` to `130/80`
920

1021
## 2026.05.11
1122

app/src/androidTest/java/org/simple/clinic/bp/BloodPressureRepositoryAndroidTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ class BloodPressureRepositoryAndroidTest {
453453
val newestBpForPatient3 = TestData.bloodPressureMeasurement(
454454
uuid = UUID.fromString("3d948d3b-6d8f-4608-bde0-d8750fef75d4"),
455455
patientUuid = patient3Uuid,
456-
systolic = 150,
457-
diastolic = 90,
456+
systolic = 135,
457+
diastolic = 85,
458458
createdAt = Instant.parse("2000-01-01T00:03:00Z"),
459459
recordedAt = Instant.parse("2000-01-01T00:03:00Z"),
460460
updatedAt = Instant.parse("2000-01-01T00:03:00Z"),
@@ -475,9 +475,9 @@ class BloodPressureRepositoryAndroidTest {
475475
))
476476

477477
// when
478-
val isNewestBpEntryHighForPatient1 = repository.isNewestBpEntryHigh(patient1Uuid).blockingFirst()
479-
val isNewestBpEntryHighForPatient2 = repository.isNewestBpEntryHigh(patient2Uuid).blockingFirst()
480-
val isNewestBpEntryHighForPatient3 = repository.isNewestBpEntryHigh(patient3Uuid).blockingFirst()
478+
val isNewestBpEntryHighForPatient1 = repository.isNewestBpEntryHigh(patient1Uuid, isDiabeticPatient = false, isSriLankaEnabled = false).blockingFirst()
479+
val isNewestBpEntryHighForPatient2 = repository.isNewestBpEntryHigh(patient2Uuid, isDiabeticPatient = true, isSriLankaEnabled = false).blockingFirst()
480+
val isNewestBpEntryHighForPatient3 = repository.isNewestBpEntryHigh(patient3Uuid, isDiabeticPatient = true, isSriLankaEnabled = true).blockingFirst()
481481

482482
// then
483483
assertThat(isNewestBpEntryHighForPatient1).isTrue()

app/src/main/java/org/simple/clinic/bp/BloodPressureMeasurement.kt

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,25 @@ data class BloodPressureMeasurement(
252252
fun purgeBloodPressureMeasurementWhenPatientIsNull(): Int
253253

254254
@Query("""
255-
SELECT
256-
CASE
257-
WHEN (COUNT(BP.uuid) >= 1) THEN 1
258-
ELSE 0
259-
END
260-
FROM BloodPressureMeasurement BP
261-
WHERE
262-
BP.patientUuid = :patientUuid AND
263-
date(BP.recordedAt) == :currentDate AND
264-
(BP.systolic >= 140 OR BP.diastolic >= 90) AND
265-
BP.deletedAt IS NULL
266-
ORDER BY BP.recordedAt DESC
267-
LIMIT 1
268-
""")
269-
fun isNewestBpEntryHigh(patientUuid: UUID, currentDate: LocalDate): Observable<Boolean>
255+
SELECT
256+
CASE
257+
WHEN (COUNT(BP.uuid) >= 1) THEN 1
258+
ELSE 0
259+
END
260+
FROM BloodPressureMeasurement BP
261+
WHERE
262+
BP.patientUuid = :patientUuid AND
263+
date(BP.recordedAt) == :currentDate AND
264+
(BP.systolic >= :systolicThreshold OR BP.diastolic >= :diastolicThreshold) AND
265+
BP.deletedAt IS NULL
266+
ORDER BY BP.recordedAt DESC
267+
LIMIT 1
268+
""")
269+
fun isNewestBpEntryHigh(
270+
patientUuid: UUID,
271+
currentDate: LocalDate,
272+
systolicThreshold: Int,
273+
diastolicThreshold: Int
274+
): Observable<Boolean>
270275
}
271276
}

app/src/main/java/org/simple/clinic/bp/BloodPressureRepository.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,25 @@ class BloodPressureRepository @Inject constructor(
166166
)
167167
}
168168

169-
fun isNewestBpEntryHigh(patientUuid: UUID): Observable<Boolean> {
169+
fun isNewestBpEntryHigh(
170+
patientUuid: UUID,
171+
isDiabeticPatient: Boolean,
172+
isSriLankaEnabled: Boolean
173+
): Observable<Boolean> {
174+
170175
val currentDate = LocalDate.now(utcClock)
171176

172-
return dao.isNewestBpEntryHigh(patientUuid = patientUuid, currentDate = currentDate)
177+
val systolicThreshold =
178+
if (isSriLankaEnabled && isDiabeticPatient) 130 else 140
179+
180+
val diastolicThreshold =
181+
if (isSriLankaEnabled && isDiabeticPatient) 80 else 90
182+
183+
return dao.isNewestBpEntryHigh(
184+
patientUuid = patientUuid,
185+
currentDate = currentDate,
186+
systolicThreshold = systolicThreshold,
187+
diastolicThreshold = diastolicThreshold
188+
)
173189
}
174190
}

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,38 @@ class PatientSummaryEffectHandler @AssistedInject constructor(
401401
effects
402402
.observeOn(schedulersProvider.io())
403403
.switchMap {
404+
404405
val patientUuid = it.patientUuid
405-
bloodPressureRepository.isNewestBpEntryHigh(patientUuid).map { Pair(patientUuid, it) }
406+
407+
val hasDiabetes =
408+
medicalHistoryRepository.historyForPatientOrDefaultImmediate(
409+
defaultHistoryUuid = uuidGenerator.v4(),
410+
patientUuid = patientUuid
411+
).diagnosedWithDiabetes == MedicalHistoryAnswer.Yes
412+
413+
val isSriLanka =
414+
country.isoCountryCode == Country.SRI_LANKA
415+
416+
bloodPressureRepository.isNewestBpEntryHigh(
417+
patientUuid = patientUuid,
418+
isDiabeticPatient = hasDiabetes,
419+
isSriLankaEnabled = isSriLanka
420+
).map { isNewestBpEntryHigh ->
421+
Pair(patientUuid, isNewestBpEntryHigh)
422+
}
406423
}
407424
.switchMap { (patientUuid, isNewestBpEntryHigh) ->
408-
prescriptionRepository.hasPrescriptionForPatientChangedToday(patientUuid).map { Pair(isNewestBpEntryHigh, it) }
425+
prescriptionRepository
426+
.hasPrescriptionForPatientChangedToday(patientUuid)
427+
.map { hasPrescriptionsChangedToday ->
428+
Pair(isNewestBpEntryHigh, hasPrescriptionsChangedToday)
429+
}
409430
}
410431
.map { (isNewestBpEntryHigh, hasPrescriptionsChangedToday) ->
411-
ClinicalDecisionSupportInfoLoaded(isNewestBpEntryHigh, hasPrescriptionsChangedToday)
432+
ClinicalDecisionSupportInfoLoaded(
433+
isNewestBpEntryHigh,
434+
hasPrescriptionsChangedToday
435+
)
412436
}
413437
}
414438
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,14 @@ class PatientSummaryEffectHandlerTest {
652652
// given
653653
val patientUuid = UUID.fromString("44daeb85-de4c-4807-8b31-6a88bf597cc7")
654654

655-
whenever(bloodPressureRepository.isNewestBpEntryHigh(patientUuid)).doReturn(Observable.just(true))
655+
val medicalHistory = TestData.medicalHistory()
656+
657+
whenever(medicalHistoryRepository.historyForPatientOrDefaultImmediate(
658+
defaultHistoryUuid = uuidGenerator.v4(),
659+
patientUuid = patientUuid
660+
)) doReturn medicalHistory
661+
662+
whenever(bloodPressureRepository.isNewestBpEntryHigh(patientUuid, medicalHistory.diagnosedWithDiabetes == Yes, false)).doReturn(Observable.just(true))
656663
whenever(prescriptionRepository.hasPrescriptionForPatientChangedToday(patientUuid)).doReturn(Observable.just(true))
657664

658665
// when

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import org.simple.clinic.cvdrisk.calculator.NonLabBasedCVDRiskCalculator
2424
import org.simple.clinic.drugs.DiagnosisWarningPrescriptions
2525
import org.simple.clinic.drugs.PrescriptionRepository
2626
import org.simple.clinic.facility.FacilityRepository
27-
import org.simple.clinic.feature.Feature
28-
import org.simple.clinic.feature.Features
27+
import org.simple.clinic.medicalhistory.Answer
2928
import org.simple.clinic.medicalhistory.MedicalHistoryRepository
3029
import org.simple.clinic.overdue.Appointment.Status.Cancelled
3130
import org.simple.clinic.overdue.AppointmentCancelReason
@@ -35,11 +34,9 @@ import org.simple.clinic.patient.PatientRepository
3534
import org.simple.clinic.patient.businessid.Identifier
3635
import org.simple.clinic.patient.businessid.Identifier.IdentifierType.BpPassport
3736
import org.simple.clinic.patientattribute.PatientAttributeRepository
38-
import org.simple.clinic.remoteconfig.DefaultValueConfigReader
3937
import org.simple.clinic.summary.OpenIntention.LinkIdWithPatient
4038
import org.simple.clinic.summary.OpenIntention.ViewExistingPatient
4139
import org.simple.clinic.summary.OpenIntention.ViewNewPatient
42-
import org.simple.clinic.util.NoOpRemoteConfigService
4340
import org.simple.clinic.util.RxErrorsRule
4441
import org.simple.clinic.util.TestUserClock
4542
import org.simple.clinic.util.TestUtcClock
@@ -104,16 +101,17 @@ class PatientSummaryScreenLogicTest {
104101
.atZone(userClock.zone)
105102
.toInstant()
106103

107-
whenever(bpRepository.isNewestBpEntryHigh(patientUuid)) doReturn Observable.just(true)
104+
val medicalHistory = TestData.medicalHistory(uuid = medicalHistoryUuid)
105+
whenever(medicalHistoryRepository.historyForPatientOrDefaultImmediate(
106+
defaultHistoryUuid = uuidGenerator.v4(),
107+
patientUuid = patientUuid
108+
)) doReturn medicalHistory
109+
whenever(bpRepository.isNewestBpEntryHigh(patientUuid, isDiabeticPatient = medicalHistory.diagnosedWithDiabetes == Answer.Yes, isSriLankaEnabled = false)) doReturn Observable.just(true)
108110
whenever(patientRepository.patientProfile(patientUuid)) doReturn Observable.just(Optional.of(patientProfile))
109111
whenever(patientRepository.latestPhoneNumberForPatient(patientUuid)) doReturn Optional.empty()
110112
whenever(appointmentRepository.lastCreatedAppointmentForPatient(patientUuid)) doReturn Optional.empty()
111113
whenever(bpRepository.hasBPRecordedToday(patientUuid, today)) doReturn Observable.just(true)
112114
whenever(facilityRepository.facility(assignedFacilityUuid)) doReturn Optional.of(TestData.facility())
113-
whenever(medicalHistoryRepository.historyForPatientOrDefaultImmediate(
114-
defaultHistoryUuid = uuidGenerator.v4(),
115-
patientUuid = patientUuid
116-
)) doReturn TestData.medicalHistory(uuid = medicalHistoryUuid)
117115
whenever(prescriptionRepository.newestPrescriptionsForPatientImmediate(patientUuid)) doReturn emptyList()
118116
}
119117

gradle/libs.versions.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dagger = "2.59.2"
1717
kotlin = "2.3.21"
1818
kotlinx-serialization = "1.11.0"
1919

20-
ksp = "2.3.7"
20+
ksp = "2.3.8"
2121

2222
ktlint = "0.36.0"
2323

@@ -39,11 +39,11 @@ coroutines = "1.11.0"
3939

4040
compose-compiler = "1.5.13"
4141

42-
androidx-compose-bom = "2026.05.00"
42+
androidx-compose-bom = "2026.05.01"
4343

4444
composeThemeAdapter = "0.36.0"
4545

46-
sqlCipher = "4.15.0"
46+
sqlCipher = "4.16.0"
4747

4848
[libraries]
4949
android-desugaring = "com.android.tools:desugar_jdk_libs:2.1.5"
@@ -95,7 +95,7 @@ androidx-viewmodel-savedstate = { module = "androidx.lifecycle:lifecycle-viewmod
9595

9696
androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" }
9797

98-
asm = "org.ow2.asm:asm:9.9.1"
98+
asm = "org.ow2.asm:asm:9.10.1"
9999

100100
chucker = { module = "com.github.chuckerteam.chucker:library", version.ref = "chucker" }
101101
chucker-no-op = { module = "com.github.chuckerteam.chucker:library-no-op", version.ref = "chucker" }
@@ -142,7 +142,7 @@ logback-classic = "ch.qos.logback:logback-classic:1.2.11"
142142

143143
lottie = "com.airbnb.android:lottie-compose:6.7.1"
144144

145-
material = "com.google.android.material:material:1.13.0"
145+
material = "com.google.android.material:material:1.14.0"
146146

147147
mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:6.3.0"
148148

@@ -181,7 +181,7 @@ rx-java = "io.reactivex.rxjava2:rxjava:2.2.21"
181181
rx-kotlin = "io.reactivex.rxjava2:rxkotlin:2.4.0"
182182
rx-preferences = "com.f2prateek.rx.preferences2:rx-preferences:2.0.1"
183183

184-
sentry-android = "io.sentry:sentry-android:8.41.0"
184+
sentry-android = "io.sentry:sentry-android:8.42.0"
185185

186186
signaturepad = "com.github.gcacace:signature-pad:1.3.1"
187187

@@ -231,7 +231,7 @@ kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref =
231231
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
232232
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
233233
google-services = { id = "com.google.gms.google-services", version = "4.4.4" }
234-
sentry = { id = "io.sentry.android.gradle", version = "6.6.0" }
234+
sentry = { id = "io.sentry.android.gradle", version = "6.8.1" }
235235

236236
[bundles]
237237
androidx-camera = ["androidx-camera-core", "androidx-camera-camera2", "androidx-camera-view", "androidx-camera-lifecycle"]

0 commit comments

Comments
 (0)