Skip to content

Commit

Permalink
Update statin risk text for cvd patient
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Jan 16, 2025
1 parent 0a1755c commit f6a3f9c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/org/simple/clinic/cvdrisk/StatinInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class StatinInfo(
val cvdRisk: CVDRiskRange? = null,
val isSmoker: Answer = Answer.Unanswered,
val bmiReading: BMIReading? = null,
val hasCVD: Boolean = false,
) : Parcelable {
companion object {
fun default(): StatinInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class PatientSummaryEffectHandler @AssistedInject constructor(
canPrescribeStatin = canPrescribeStatin,
cvdRisk = cvdRisk?.riskScore,
isSmoker = medicalHistory.isSmoking,
bmiReading = bmiReading?.bmiReading
bmiReading = bmiReading?.bmiReading,
))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ class PatientSummaryUpdate(
}

event.age > maxAgeForCVDRisk -> {
val updatedModel = model.updateStatinInfo(StatinInfo(canPrescribeStatin = hasCVD || hasDiabetes))
val updatedModel = model.updateStatinInfo(StatinInfo(canPrescribeStatin = hasCVD || hasDiabetes, hasCVD = hasCVD))
next(updatedModel)
}

hasCVD || hasDiabetes -> {
val updatedModel = model.updateStatinInfo(StatinInfo(canPrescribeStatin = true))
val updatedModel = model.updateStatinInfo(StatinInfo(canPrescribeStatin = true, hasCVD = hasCVD))
next(updatedModel)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fun StatinNudge(
startOffset = startOffset,
endOffset = endOffset,
cvdRiskRange = statinInfo.cvdRisk,
hasCVD = statinInfo.hasCVD,
parentWidth = constraints.maxWidth,
)
Spacer(modifier = Modifier.height(12.dp))
Expand Down Expand Up @@ -103,6 +104,7 @@ fun RiskText(
startOffset: Float,
endOffset: Float,
cvdRiskRange: CVDRiskRange?,
hasCVD: Boolean,
parentWidth: Int,
parentPadding: Float = 16f
) {
Expand All @@ -115,6 +117,7 @@ fun RiskText(
}

val riskText = when {
hasCVD -> stringResource(R.string.statin_alert_very_high_risk_patient)
cvdRiskRange == null -> stringResource(R.string.statin_alert_at_risk_patient)
cvdRiskRange.min > 10 -> stringResource(R.string.statin_alert_high_risk_patient_x, riskPercentage)
else -> stringResource(R.string.statin_alert_medium_high_risk_patient_x, riskPercentage)
Expand Down Expand Up @@ -251,7 +254,7 @@ fun DescriptionText(

val textColor = when {
statinInfo.cvdRisk == null -> SimpleTheme.colors.material.error
statinInfo.isSmoker == Answer.Unanswered || statinInfo.bmiReading == null -> Color(0XFF6C737A)
statinInfo.isSmoker == Answer.Unanswered || statinInfo.bmiReading == null -> SimpleTheme.colors.onSurface67
else -> SimpleTheme.colors.material.error
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import androidx.compose.ui.graphics.Color

@Immutable
data class SimpleColors(
val toolbarPrimary: Color = Color.Unspecified,
val toolbarPrimaryVariant: Color = Color.Unspecified,
val onToolbarPrimary: Color = Color.Unspecified,
val material: Colors = lightColors(),
val toolbarPrimary: Color = Color.Unspecified,
val toolbarPrimaryVariant: Color = Color.Unspecified,
val onToolbarPrimary: Color = Color.Unspecified,
val material: Colors = lightColors(),
val onSurface67: Color = material.onSurface.copy(alpha = 0.67f)
)

internal val LocalSimpleColors = staticCompositionLocalOf { SimpleColors() }

0 comments on commit f6a3f9c

Please sign in to comment.