Skip to content

Commit

Permalink
Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Oct 22, 2024
1 parent d44c1bc commit 8573106
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class PatientSummaryModel(
val hasPrescribedDrugsChangedToday: Boolean?,
val scheduledAppointment: ParcelableOptional<Appointment>?,
val hasShownDiagnosisWarningDialog: Boolean,
val statin: StatinModel?,
val canPrescribeStatin: Boolean?,
) : Parcelable, PatientSummaryChildModel {

companion object {
Expand All @@ -46,7 +46,7 @@ data class PatientSummaryModel(
hasPrescribedDrugsChangedToday = null,
scheduledAppointment = null,
hasShownDiagnosisWarningDialog = false,
statin = null,
canPrescribeStatin = null,
)
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ data class PatientSummaryModel(
get() = scheduledAppointment != null && scheduledAppointment.isPresent()

val hasStatinInfoLoaded: Boolean
get() = statin != null
get() = canPrescribeStatin != null

override fun readyToRender(): Boolean {
return hasLoadedPatientSummaryProfile && hasLoadedCurrentFacility && hasPatientRegistrationData != null
Expand Down Expand Up @@ -128,7 +128,7 @@ data class PatientSummaryModel(
return copy(scheduledAppointment = appointment.toOptional().parcelable())
}

fun updateStatinInfo(statin: StatinModel): PatientSummaryModel {
return copy(statin = statin)
fun updateStatinInfo(canPrescribeStatin: Boolean): PatientSummaryModel {
return copy(canPrescribeStatin = canPrescribeStatin)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,9 @@ class PatientSummaryScreen :
private val clinicalDecisionSupportAlertView
get() = binding.clinicalDecisionSupportBpHighAlert.rootView

private val statinAlertView
get() = binding.statinAlert.rootView

private val statinComposeView
get() = binding.statinComposeView

private val statinAlertDescription
get() = binding.statinAlert.statinAlertSubtitle

@Inject
lateinit var router: Router

Expand Down Expand Up @@ -762,22 +756,14 @@ class PatientSummaryScreen :
clinicalDecisionSupportAlertView.visibility = GONE
}

override fun showStatinAlert(statin: StatinModel) {
override fun showStatinAlert() {
shouldShowStatinNudge.value = true
}

override fun hideStatinAlert() {
shouldShowStatinNudge.value = false
}

private fun getCVDString(hasDiabetes: Boolean): String {
return if (hasDiabetes) {
getString(R.string.statin_alert_cvd_with_diabetes)
} else {
getString(R.string.statin_alert_cvd)
}
}

private fun showWithAnimation(view: View) {
view.translationY = view.height.unaryMinus().toFloat()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ interface PatientSummaryScreenUi {
fun showClinicalDecisionSupportAlert()
fun hideClinicalDecisionSupportAlert()
fun hideClinicalDecisionSupportAlertWithoutAnimation()
fun showStatinAlert(statin: StatinModel)
fun showStatinAlert()
fun hideStatinAlert()
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,7 @@ class PatientSummaryUpdate(
hasStatinsPrescribedAlready.not() &&
isPatientEligibleForStatin

val updatedModel = model.updateStatinInfo(
StatinModel(
canPrescribeStatin = canPrescribeStatin,
age = event.age,
hasDiabetes = hasDiabetes,
hasHadStroke = hasHadStroke,
hasHadHeartAttack = hasHadHeartAttack,
)
)
val updatedModel = model.updateStatinInfo(canPrescribeStatin)
return next(updatedModel)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PatientSummaryViewRenderer(
}

private fun renderClinicalDecisionBasedOnAppointment(model: PatientSummaryModel) {
if (model.statin?.canPrescribeStatin == true)
if (model.canPrescribeStatin == true)
return

if (model.hasScheduledAppointment) {
Expand Down Expand Up @@ -154,8 +154,8 @@ class PatientSummaryViewRenderer(
private fun renderStatinAlert(model: PatientSummaryModel) {
if (model.hasStatinInfoLoaded.not()) return

if (model.statin!!.canPrescribeStatin) {
ui.showStatinAlert(model.statin)
if (model.canPrescribeStatin == true) {
ui.showStatinAlert()
ui.hideClinicalDecisionSupportAlertWithoutAnimation()
} else {
ui.hideStatinAlert()
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/res/drawable/background_statin_alert.xml

This file was deleted.

27 changes: 0 additions & 27 deletions app/src/main/res/drawable/ic_statin_alert.xml

This file was deleted.

4 changes: 0 additions & 4 deletions app/src/main/res/layout/screen_patient_summary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />

<include
android:id="@+id/statinAlert"
layout="@layout/view_statin_alert" />

<org.simple.clinic.widgets.PatientStatusView
android:id="@+id/patientDiedStatusView"
android:layout_width="match_parent"
Expand Down
56 changes: 0 additions & 56 deletions app/src/main/res/layout/view_statin_alert.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/values-bn-rBD/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -916,14 +916,4 @@

<string name="htn_warning_dialog_negative_button">এখন নয়</string>

<!-- Statin Alerts -->
<string name="statin_alert_title">উচ্চ ঝুঁকিতে, স্ট্যাটিন ওষুধ যোগ করুন</string>
<string name="statin_alert_patient">রোগী</string>
<string name="statin_alert_has_diabetes">ডায়াবেটিসে আক্রান্ত, বয়স %s </string>
<string name="statin_alert_and_seperator">এবং</string>
<string name="statin_alert_cvd_with_diabetes">, হার্ট অ্যাটাক এবং স্ট্রোকের ইতিহাস রয়েছে।</string>
<string name="statin_alert_cvd"> হার্ট অ্যাটাক এবং স্ট্রোকের ইতিহাস রয়েছে।</string>
<string name="statin_alert_heart_attack">হার্ট অ্যাটাকের ইতিহাস আছে।</string>
<string name="statin_alert_stroke">স্ট্রোকের ইতিহাস আছে</string>

</resources>
1 change: 0 additions & 1 deletion app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
<item name="spring_animation_scrollx" type="id" />
<item name="spring_animation_scrollY" type="id" />
<item name="tag_clinical_decision_pending_end_listener" type="id" />
<item name="tag_statin_alert_end_listener" type="id" />
</resources>
8 changes: 0 additions & 8 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,6 @@ The Simple app contains private health information of patients (“Data”).\n\n
<string name="htn_warning_dialog_negative_button">Not now</string>

<!-- Statin Alerts -->
<string name="statin_alert_title">High risk. Add statin medicine</string>
<string name="statin_alert_patient">Patient</string>
<string name="statin_alert_has_diabetes">is %s with diabetes</string>
<string name="statin_alert_and_seperator">and</string>
<string name="statin_alert_cvd_with_diabetes">, has history of heart attack and stroke</string>
<string name="statin_alert_cvd">has history of heart attack and stroke</string>
<string name="statin_alert_heart_attack">has history of heart attack</string>
<string name="statin_alert_stroke">has history of stroke</string>
<string name="statin_alert_at_risk_patient">AT RISK PATIENT</string>
<string name="statin_alert_refer_to_doctor_for">Refer to doctor for</string>
<string name="statin_alert_statin_medicine">statin medicine</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2129,15 +2129,7 @@ class PatientSummaryUpdateTest {
),
))
.then(assertThatNext(
hasModel(defaultModel.updateStatinInfo(
StatinModel(
canPrescribeStatin = true,
age = 50,
hasDiabetes = true,
hasHadStroke = false,
hasHadHeartAttack = false,
)
)),
hasModel(defaultModel.updateStatinInfo(true)),
hasNoEffects()
))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,17 +795,9 @@ class PatientSummaryViewRendererTest {
@Test
fun `when statin info is loaded and can prescribe statin then show the statin alert`() {
//given
val statinModel = StatinModel(
canPrescribeStatin = true,
age = 40,
hasDiabetes = true,
hasHadStroke = false,
hasHadHeartAttack = false,
)

val model = defaultModel
.currentFacilityLoaded(facilityWithDiabetesManagementDisabled)
.updateStatinInfo(statinModel)
.updateStatinInfo(true)

// when
uiRenderer.render(model)
Expand All @@ -815,24 +807,16 @@ class PatientSummaryViewRendererTest {
verify(ui).hideTeleconsultButton()
verify(ui).hideNextAppointmentCard()
verify(ui, times(2)).hideClinicalDecisionSupportAlertWithoutAnimation()
verify(ui).showStatinAlert(statinModel)
verify(ui).showStatinAlert()
verifyNoMoreInteractions(ui)
}

@Test
fun `when statin info is loaded and can not prescribe statin then hide the statin alert`() {
//given
val statinModel = StatinModel(
canPrescribeStatin = false,
age = 40,
hasDiabetes = false,
hasHadStroke = false,
hasHadHeartAttack = false,
)

val model = defaultModel
.currentFacilityLoaded(facilityWithDiabetesManagementDisabled)
.updateStatinInfo(statinModel)
.updateStatinInfo(false)

// when
uiRenderer.render(model)
Expand Down Expand Up @@ -877,21 +861,13 @@ class PatientSummaryViewRendererTest {
scheduledDate = LocalDate.parse("2018-01-01")
)

val statinModel = StatinModel(
canPrescribeStatin = true,
age = 40,
hasDiabetes = true,
hasHadStroke = false,
hasHadHeartAttack = false,
)

val updatedModel = defaultModel
.patientRegistrationDataLoaded(hasPatientRegistrationData = true)
.currentFacilityLoaded(facility = facility)
.patientSummaryProfileLoaded(patientSummaryProfile = patientSummaryProfile)
.clinicalDecisionSupportInfoLoaded(isNewestBpEntryHigh = true, hasPrescribedDrugsChangedToday = false)
.scheduledAppointmentLoaded(appointment)
.updateStatinInfo(statinModel)
.updateStatinInfo(true)


val uiRenderer = PatientSummaryViewRenderer(
Expand All @@ -912,7 +888,7 @@ class PatientSummaryViewRendererTest {
verify(ui).showPatientDiedStatus()
verify(ui).hideDiabetesView()
verify(ui).hideTeleconsultButton()
verify(ui).showStatinAlert(statinModel)
verify(ui).showStatinAlert()
verify(ui).hideClinicalDecisionSupportAlertWithoutAnimation()
verify(ui).hideNextAppointmentCard()
verifyNoMoreInteractions(ui)
Expand Down
4 changes: 0 additions & 4 deletions common-ui/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@
<color name="simple_red_100_alpha_50">#80FFD6DD</color>

<color name="simple_yellow_600">#B48E00</color>
<color name="simple_yellow_550">#E0B000</color>
<color name="simple_yellow_500">#FFC800</color>
<color name="simple_yellow_100">#FFF8E0</color>

<color name="simple_brown_600">#874D00</color>
<color name="simple_brown_600_alpha_80">#CC874D00</color>

<color name="white">#FFFFFF</color>
<color name="white_72">#B8FFFFFF</color>

Expand Down

0 comments on commit 8573106

Please sign in to comment.