Fix Aadhaar question branching logic
All checks were successful
build-and-deploy / build-deploy (push) Successful in 32s

This commit is contained in:
androidlover5842
2026-01-31 01:29:09 +05:30
parent d09c25d678
commit 52d4c5a167

View File

@@ -24,8 +24,6 @@ import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.*
import org.springframework.http.MediaType
import jakarta.servlet.http.HttpServletResponse
import org.aspectj.weaver.patterns.TypePatternQuestions
import org.hibernate.validator.constraints.URL
import org.springframework.web.multipart.MultipartFile
import org.springframework.web.server.ResponseStatusException
import java.time.OffsetDateTime
@@ -33,11 +31,6 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.util.UUID
import java.security.MessageDigest
import kotlin.collections.component1
import kotlin.collections.component2
import kotlin.collections.iterator
import kotlin.collections.set
import kotlin.text.set
@RestController
@RequestMapping("/properties/{propertyId}/guests/{guestId}/documents")
@@ -225,30 +218,30 @@ class GuestDocuments(
if (hasAadhar) {
val aadharQuestions = linkedMapOf(
"hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.",
"hasGender" to "GENDER PRESENT? Answer YES or NO only.",
"hasDob" to "DOB? Reply YES or NO.",
"hasGender" to "GENDER MENTIONED? Reply YES or NO.",
)
"hasGenderMentioned" to "GENDER MENTIONED? Reply YES or NO."
)
for ((key, question) in aadharQuestions) {
results[key] = llamaClient.ask(imageUrl, question)
}
val hashAddress=isYes("hasAddress")
if (hashAddress){
val hasAddress = isYes(results["hasAddress"])
if (hasAddress) {
val addressQuestions = linkedMapOf(
"pinCode" to "POSTAL ADDRESS PIN CODE (6 digit)? Reply only pin or NONE.",
"address" to "POSTAL ADDRESS? Reply only address or NONE.")
"address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE."
)
for ((key, question) in addressQuestions) {
results[key] = llamaClient.ask(imageUrl, question)
}
}
val hasDOB=isYes("hasDob")
val hasGender=isYes("hasGender")
if (hasDOB && hasGender){
val hasDob = isYes(results["hasDob"])
val hasGender = isYes(results["hasGenderMentioned"])
if (hasDob && hasGender) {
val aadharFrontQuestions = linkedMapOf(
"name" to "NAME? Reply only the name or NONE.",
"dob" to "DOB? Reply only date or NONE.",
"idNumber" to "ID NUMBER? Reply only number or NONE.",
"gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.",
"gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE."
)
for ((key, question) in aadharFrontQuestions) {
results[key] = llamaClient.ask(imageUrl, question)
@@ -379,4 +372,4 @@ private fun GuestDocument.toResponse(objectMapper: ObjectMapper): GuestDocumentR
private fun isYes(value: String?): Boolean {
return value.orEmpty().contains("YES", ignoreCase = true)
}
}