From c49f94b201c5500bc717f4aa261278c4bb178d0b Mon Sep 17 00:00:00 2001 From: androidlover5842 Date: Sat, 31 Jan 2026 01:39:12 +0530 Subject: [PATCH] Branch non-Aadhaar questions by document type --- .../controller/GuestDocuments.kt | 92 ++++++++++++++++--- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt b/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt index b51b938..ea3f37b 100644 --- a/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt +++ b/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt @@ -217,7 +217,7 @@ class GuestDocuments( val hasAadhar = isYes(results["hasAadhar"]) || isYes(results["hasUidai"]) if (hasAadhar) { val aadharQuestions = linkedMapOf( - "hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.", + "hasAddress" to "POSTAL ADDRESS PRESENT? Answer YES or NO only.", "hasDob" to "DOB? Reply YES or NO.", "hasGenderMentioned" to "GENDER MENTIONED? Reply YES or NO." ) @@ -249,7 +249,7 @@ class GuestDocuments( } } else { - val generalQuestions = linkedMapOf( + val detectionQuestions = linkedMapOf( "hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.", "hasIncomeTaxDept" to "CONTAINS INCOME TAX DEPARTMENT? Answer YES or NO only.", "hasElectionCommission" to "CONTAINS ELECTION COMMISSION OF INDIA? Answer YES or NO only.", @@ -260,21 +260,85 @@ class GuestDocuments( "hasHighCourt" to "CONTAINS HIGH COURT? Answer YES or NO only.", "hasSupremeCourt" to "CONTAINS SUPREME COURT? Answer YES or NO only.", "hasJudiciary" to "CONTAINS JUDICIARY? Answer YES or NO only.", - "hasNationality" to "NATIONALITY PRESENT? Answer YES or NO only.", - "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.", - "address" to "ADDRESS? Reply only address or NONE.", - "vehicleNumber" to "VEHICLE NUMBER? Reply only number or NONE.", - "isVehiclePhoto" to "IS THIS A VEHICLE PHOTO? Answer YES or NO only.", - "pinCode" to "PIN CODE? Reply only pin or NONE.", - "city" to "CITY? Reply only city or NONE.", - "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", - "nationality" to "NATIONALITY? Reply only nationality or NONE." + "isVehiclePhoto" to "IS THIS A VEHICLE PHOTO? Answer YES or NO only." ) - for ((key, question) in generalQuestions) { + for ((key, question) in detectionQuestions) { results[key] = llamaClient.ask(imageUrl, question) } + + val isDriving = isYes(results["hasDrivingLicence"]) || isYes(results["hasTransportDept"]) + if (isDriving) { + val drivingQuestions = linkedMapOf( + "name" to "NAME? Reply only the name or NONE.", + "dob" to "DOB? Reply only date or NONE.", + "idNumber" to "DL NUMBER? Reply only number or NONE.", + "address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE.", + "pinCode" to "PIN CODE? Reply only pin or NONE.", + "city" to "CITY? Reply only city or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + "nationality" to "NATIONALITY? Reply only nationality or NONE." + ) + for ((key, question) in drivingQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } else if (isYes(results["hasElectionCommission"])) { + val voterQuestions = linkedMapOf( + "name" to "NAME? Reply only the name or NONE.", + "dob" to "DOB? Reply only date or NONE.", + "idNumber" to "VOTER ID NUMBER? Reply only number or NONE.", + "address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE.", + "pinCode" to "PIN CODE? Reply only pin or NONE.", + "city" to "CITY? Reply only city or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + "nationality" to "NATIONALITY? Reply only nationality or NONE." + ) + for ((key, question) in voterQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } else if (isYes(results["hasIncomeTaxDept"])) { + val panQuestions = linkedMapOf( + "name" to "NAME? Reply only the name or NONE.", + "dob" to "DOB? Reply only date or NONE.", + "idNumber" to "PAN NUMBER? Reply only number or NONE.", + "address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE.", + "pinCode" to "PIN CODE? Reply only pin or NONE.", + "city" to "CITY? Reply only city or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + "nationality" to "NATIONALITY? Reply only nationality or NONE." + ) + for ((key, question) in panQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } else if (isYes(results["hasPassport"])) { + val passportQuestions = linkedMapOf( + "name" to "NAME? Reply only the name or NONE.", + "dob" to "DOB? Reply only date or NONE.", + "idNumber" to "PASSPORT NUMBER? Reply only number or NONE.", + "address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE.", + "pinCode" to "PIN CODE? Reply only pin or NONE.", + "city" to "CITY? Reply only city or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + "nationality" to "NATIONALITY? Reply only nationality or NONE." + ) + for ((key, question) in passportQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } else { + val generalQuestions = 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.", + "address" to "POSTAL ADDRESS ONLY (street/area/city/state). Ignore IDs, UUIDs, and codes. Reply only address or NONE.", + "vehicleNumber" to "VEHICLE NUMBER? Reply only number or NONE.", + "pinCode" to "PIN CODE? Reply only pin or NONE.", + "city" to "CITY? Reply only city or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + "nationality" to "NATIONALITY? Reply only nationality or NONE." + ) + for ((key, question) in generalQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } } results["docType"] = when {