Compare commits
1 Commits
dev-server
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
607aa2306b |
@@ -4,5 +4,7 @@ enum class TestRightResultType {
|
||||
NORMAL,
|
||||
SICKLECELLTRAIT,
|
||||
SICKLECELLDISEASE,
|
||||
POSITIVEBORDERLINE,
|
||||
NEGATIVEBORDERLINE,
|
||||
UNDEFINED
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,"")
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<vector android:height="16dp" android:tint="#BB0303"
|
||||
<vector android:height="24dp" android:tint="#BB0303"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<vector android:height="16dp" android:tint="#2E7D32"
|
||||
<vector android:height="24dp" android:tint="#2E7D32"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
|
||||
</vector>
|
||||
|
||||
@@ -86,77 +86,123 @@
|
||||
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" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_results"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_result">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_normal"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/title1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_green"
|
||||
android:drawablePadding="4dp"
|
||||
android:text="@string/normal"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_disease"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/title1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_red"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/sickle_cell_disease"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_cancel_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_trait"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
style="@style/title1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_red"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/sickle_cell_trait"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_cancel_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_undefined"
|
||||
style="@style/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/result_positive_borderline"
|
||||
style="@style/title1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_yellow"
|
||||
android:drawablePadding="4dp"
|
||||
android:background="@drawable/result_background_red"
|
||||
android:text="@string/positive_borderline"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
android:text="@string/undefined"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_circle_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_result"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_cancel_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_result"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_result" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_negative_borderline"
|
||||
style="@style/title1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/result_background_green"
|
||||
android:text="@string/negative_borderline"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_recommended"
|
||||
style="@style/title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/recommended"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toBottomOf="@id/cl_results" />
|
||||
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/result_undefined"-->
|
||||
<!-- style="@style/title3"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="16dp"-->
|
||||
<!-- android:background="@drawable/result_background_yellow"-->
|
||||
<!-- android:drawablePadding="4dp"-->
|
||||
<!-- android:text="@string/undefined"-->
|
||||
<!-- android:visibility="visible"-->
|
||||
<!-- app:drawableStartCompat="@drawable/ic_baseline_circle_24"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@+id/tv_result"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintHorizontal_bias="1"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tv_result"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/tv_result" />-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -189,8 +235,8 @@
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/ic_baseline_home_24"
|
||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
|
||||
<TextView
|
||||
@@ -209,12 +255,12 @@
|
||||
android:id="@+id/iv_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@drawable/ic_baseline_new_label_24"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_home"
|
||||
app:layout_constraintEnd_toEndOf="@id/cv_sample_details"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_home"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -79,5 +79,9 @@
|
||||
<string name="sickle_find">Sickle Find</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string name="name_error_2">Invalid character, Allowed characters are Letters, Numbers and ( ) _ - , . only</string>
|
||||
<string name="recommended">\*Result to be confirmed with laboratory test</string>
|
||||
<string name="recommended_age">\*Result to be confirmed with laboratory test as age of the patient is less than 5 years</string>
|
||||
<string name="positive_borderline">Positive Borderline</string>
|
||||
<string name="negative_borderline">Negative Borderline</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user