diff --git a/app/src/main/java/com/example/hpos/data/model/TestRightResultType.kt b/app/src/main/java/com/example/hpos/data/model/TestRightResultType.kt index 3ca397e..e8f83c5 100644 --- a/app/src/main/java/com/example/hpos/data/model/TestRightResultType.kt +++ b/app/src/main/java/com/example/hpos/data/model/TestRightResultType.kt @@ -4,5 +4,7 @@ enum class TestRightResultType { NORMAL, SICKLECELLTRAIT, SICKLECELLDISEASE, + POSITIVEBORDERLINE, + NEGATIVEBORDERLINE, UNDEFINED } \ No newline at end of file diff --git a/app/src/main/java/com/example/hpos/domain/ResultCalculationWithMaxImpl.kt b/app/src/main/java/com/example/hpos/domain/ResultCalculationWithMaxImpl.kt index a6a999b..ce85d84 100644 --- a/app/src/main/java/com/example/hpos/domain/ResultCalculationWithMaxImpl.kt +++ b/app/src/main/java/com/example/hpos/domain/ResultCalculationWithMaxImpl.kt @@ -61,20 +61,20 @@ class ResultCalculationWithMaxImpl : TestRightResultCalculation { testRightCalculationData.ratioMinRange = 0.0 testRightCalculationData.ratioMaxRange = 0.28 return TestRightResultType.NORMAL - } else if (value >= 0.28 && value < 0.285) { + } else if (value >= 0.28 && value < 0.33) { testRightCalculationData.ratioMinRange = 0.28 - testRightCalculationData.ratioMaxRange = 0.285 - return TestRightResultType.UNDEFINED - } else if (value >= 0.285 && value < 0.52) { - testRightCalculationData.ratioMinRange = 0.285 + testRightCalculationData.ratioMaxRange = 0.33 + return TestRightResultType.NEGATIVEBORDERLINE + } else if (value >= 0.33 && value < 0.52) { + testRightCalculationData.ratioMinRange = 0.33 testRightCalculationData.ratioMaxRange = 0.52 return TestRightResultType.SICKLECELLTRAIT - } else if (value >= 0.52 && value < 0.525) { + } else if (value >= 0.52 && value < 0.57) { testRightCalculationData.ratioMinRange = 0.52 - testRightCalculationData.ratioMaxRange = 0.525 - return TestRightResultType.UNDEFINED - }else if (value >= 0.525) { - testRightCalculationData.ratioMinRange = 0.525 + testRightCalculationData.ratioMaxRange = 0.57 + return TestRightResultType.POSITIVEBORDERLINE + }else if (value >= 0.57) { + testRightCalculationData.ratioMinRange = 0.57 testRightCalculationData.ratioMaxRange = 999.0 return TestRightResultType.SICKLECELLDISEASE } diff --git a/app/src/main/java/com/example/hpos/presentation/testRight/TestRightResults.kt b/app/src/main/java/com/example/hpos/presentation/testRight/TestRightResults.kt index 62e8748..e10e786 100644 --- a/app/src/main/java/com/example/hpos/presentation/testRight/TestRightResults.kt +++ b/app/src/main/java/com/example/hpos/presentation/testRight/TestRightResults.kt @@ -55,6 +55,64 @@ class TestRightResults : Fragment() { } } + private fun updateResults() { + binding.tvName.text = getString(R.string.name_in_textview, viewModel.patientDetails.name) + binding.tvAge.text = + getString(R.string.age_in_textview, viewModel.patientDetails.age.toString()) + binding.tvGender.text = + getString(R.string.gender_in_textview, viewModel.patientDetails.gender) + + //TODO: remove + viewModel.patientDetails.results = TestRightResultType.NEGATIVEBORDERLINE + + if (DataHolder.selectedTestType == TestType.SICKLECERT){ + when (viewModel.patientDetails.results) { + TestRightResultType.NORMAL -> { + binding.resultNormal.visibility = View.VISIBLE + } + TestRightResultType.SICKLECELLDISEASE -> { + binding.resultDisease.visibility = View.VISIBLE + } + TestRightResultType.SICKLECELLTRAIT -> { + binding.resultTrait.visibility = View.VISIBLE + } + TestRightResultType.POSITIVEBORDERLINE -> { + binding.resultPositiveBorderline.visibility = View.VISIBLE + binding.tvRecommended.visibility = View.VISIBLE + } + TestRightResultType.NEGATIVEBORDERLINE -> { + binding.resultNegativeBorderline.visibility = View.VISIBLE + binding.tvRecommended.visibility = View.VISIBLE + } + else -> { +// binding.resultUndefined.visibility = View.VISIBLE + Toast.makeText(requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG).show() + moveToSamplePage() + } + } + } else { + when (viewModel.patientDetails.results) { + TestRightResultType.SICKLECELLDISEASE -> { + binding.resultDisease.visibility = View.VISIBLE + binding.resultDisease.text = "Positive" + } + TestRightResultType.NORMAL -> { + binding.resultNormal.visibility = View.VISIBLE + binding.resultNormal.text = "Negative" + } + else -> { + Toast.makeText(requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG).show() + moveToSamplePage() + } + } + } + if (viewModel.patientDetails.age < 5) { + binding.tvRecommended.visibility = View.VISIBLE + binding.tvRecommended.text = getString(R.string.recommended_age) + } + } + + fun moveToSamplePage() { if (DataHolder.sampleReadCounter > Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE) { DataHolder.sampleReadCounter = 0 @@ -127,77 +185,4 @@ class TestRightResults : Fragment() { viewModel.saveCsvForTesting(requireContext().applicationContext, "testing$fileName") } - private fun updateResults() { - binding.tvName.text = getString(R.string.name_in_textview, viewModel.patientDetails.name) - binding.tvAge.text = - getString(R.string.age_in_textview, viewModel.patientDetails.age.toString()) - binding.tvGender.text = - getString(R.string.gender_in_textview, viewModel.patientDetails.gender) - - if (DataHolder.selectedTestType == TestType.SICKLECERT){ - when (viewModel.patientDetails.results) { - TestRightResultType.NORMAL -> { - binding.resultNormal.visibility = View.VISIBLE - } - TestRightResultType.SICKLECELLDISEASE -> { - binding.resultDisease.visibility = View.VISIBLE - } - TestRightResultType.SICKLECELLTRAIT -> { - binding.resultTrait.visibility = View.VISIBLE - } - else -> { -// binding.resultUndefined.visibility = View.VISIBLE - Toast.makeText(requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG).show() - moveToSamplePage() - // val i = Intent(requireContext().applicationContext, MainActivity::class.java) -// startActivity(i) - } - } - } else { - when (viewModel.patientDetails.results) { - TestRightResultType.SICKLECELLDISEASE -> { - binding.resultDisease.visibility = View.VISIBLE - binding.resultDisease.text = "Positive" - } - TestRightResultType.NORMAL -> { - binding.resultNormal.visibility = View.VISIBLE - binding.resultNormal.text = "Negative" - } - else -> { - Toast.makeText(requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG).show() - moveToSamplePage() -// val i = Intent(requireContext().applicationContext, MainActivity::class.java) -// startActivity(i) - } - } - } - -// when (viewModel.patientDetails.results) { -// TestRightResultType.NORMAL -> { -// binding.resultNormal.visibility = View.VISIBLE -// } -// TestRightResultType.SICKLECELLDISEASE -> { -// binding.resultDisease.visibility = View.VISIBLE -// } -// TestRightResultType.SICKLECELLTRAIT -> { -// binding.resultTrait.visibility = View.VISIBLE -// } -// else -> { -// binding.resultUndefined.visibility = View.VISIBLE -// } -// } - -// Log.d(TAG, "\n\n\n\nFor intensity Reference array size = ${DataHolder.intensityReferenceArray.size}") -// for (each in DataHolder.intensityReferenceArray){ -// Log.d(TAG, "${each}") -// } -// -// Log.d(TAG, "\n\n\n\nFor intensity Reference array size = ${viewModel.intensitySampleArray.size}") -// for (each in viewModel.intensitySampleArray){ -// Log.d(TAG, "${each}") -// } -// Log.d(TAG,"") - - - } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_baseline_cancel_24.xml b/app/src/main/res/drawable/ic_baseline_cancel_24.xml index c07ff57..6217e72 100644 --- a/app/src/main/res/drawable/ic_baseline_cancel_24.xml +++ b/app/src/main/res/drawable/ic_baseline_cancel_24.xml @@ -1,5 +1,5 @@ - + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/app/src/main/res/drawable/ic_baseline_check_circle_24.xml b/app/src/main/res/drawable/ic_baseline_check_circle_24.xml index 81e7d49..f4f01d5 100644 --- a/app/src/main/res/drawable/ic_baseline_check_circle_24.xml +++ b/app/src/main/res/drawable/ic_baseline_check_circle_24.xml @@ -1,5 +1,5 @@ - + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/app/src/main/res/layout/fragment_test_right_results.xml b/app/src/main/res/layout/fragment_test_right_results.xml index 2a14a9c..8fd1e89 100644 --- a/app/src/main/res/layout/fragment_test_right_results.xml +++ b/app/src/main/res/layout/fragment_test_right_results.xml @@ -86,101 +86,147 @@ android:layout_marginTop="12dp" android:layout_marginBottom="16dp" android:text="@string/results_in_textview" - app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/line" /> - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_result"> + + + + + + + + + + + + + android:text="@string/recommended" + android:textStyle="bold" + app:layout_constraintTop_toBottomOf="@id/cl_results" /> - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + Sickle Find Submit Invalid character, Allowed characters are Letters, Numbers and ( ) _ - , . only + \*Result to be confirmed with laboratory test + \*Result to be confirmed with laboratory test as age of the patient is less than 5 years + Positive Borderline + Negative Borderline \ No newline at end of file