Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/AddPrescription-View' into AddPr…
Browse files Browse the repository at this point in the history
…escription-View
  • Loading branch information
E211439A authored and E211439A committed Jan 12, 2024
2 parents d039429 + dd692bd commit dad5e5e
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -22,6 +25,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.FileProvider
import androidx.lifecycle.ViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand Down Expand Up @@ -313,7 +317,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
onResult = { success: Boolean ->
hasImage = success

if (imageUri != null) {
if (imageUri != null && success) {
loading.value = true
val prescriptionAI = PrescriptionAI.getInstance(context)
val prediction = prescriptionAI.analyse(
Expand All @@ -334,7 +338,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
"DrugQuantity" -> treatment.posology += " $word"
"DrugForm" -> treatment.posology += " $word"
"DrugFrequency" -> treatment.posology += " $word"
"DrugDuration" -> treatment.posology += " $word"
"DrugDuration" -> treatment.renew += " $word"
}
}

Expand All @@ -344,7 +348,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
"DrugQuantity" -> treatment.posology += " $word"
"DrugForm" -> treatment.posology += " $word"
"DrugFrequency" -> treatment.posology += " $word"
"DrugDuration" -> treatment.posology += " $word"
"DrugDuration" -> treatment.renew += " $word"
}
}
}
Expand All @@ -367,6 +371,9 @@ fun NavGraphBuilder.prescriptionNavGraph(
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = "Traitement de l'ordonnance en cours...")

Spacer(modifier = Modifier.height(10.dp))

LinearProgressIndicator()
}
}
Expand Down

0 comments on commit dad5e5e

Please sign in to comment.