File size: 10,324 Bytes
9794efe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Task definitions for the Government Service Application Assistant Environment.
"""
from typing import Dict, Any, List, Optional
try:
from .models import DocumentInfo, SubmittedDocument
except ImportError:
from models import DocumentInfo, SubmittedDocument
class TaskManager:
"""Manages the different tasks in the environment."""
def __init__(self):
self.tasks = {
"passport_new": self._get_passport_new_requirements(),
"passport_renewal": self._get_passport_renewal_requirements(),
"pan_new": self._get_pan_new_requirements(),
"aadhaar_update": self._get_aadhaar_update_requirements(),
"driving_license_new": self._get_driving_license_new_requirements()
}
def get_task_requirements(self, service_type: str) -> List[DocumentInfo]:
"""Get document requirements for a specific service type."""
return self.tasks.get(service_type, [])
def _get_passport_new_requirements(self) -> List[DocumentInfo]:
"""Requirements for new passport application."""
return [
DocumentInfo(
type="Proof of Address",
description="Any one: Aadhaar card, Voter ID, Utility bill (not older than 3 months), Bank passbook",
mandatory=True,
validity_period="Must be current/valid",
name_match_required=True,
format_requirements=["Clear scan/photo", "Document number visible"]
),
DocumentInfo(
type="Proof of Date of Birth",
description="Any one: Birth certificate, School leaving certificate, PAN card, Aadhaar card",
mandatory=True,
validity_period="Must be valid",
name_match_required=True,
format_requirements=["Clear scan/photo", "Date of birth clearly visible"]
),
DocumentInfo(
type="Photograph",
description="Recent passport-size photograph with white background",
mandatory=True,
validity_period="Not older than 6 months",
name_match_required=False,
format_requirements=["2x2 inches", "White background", "No glasses", "Plain clothing"]
),
DocumentInfo(
type="Annexure A (if applicable)",
description="For government/PSU/sector employees",
mandatory=False,
validity_period="Current",
name_match_required=True,
format_requirements=["Signed by authority", "Official letterhead"]
)
]
def _get_passport_renewal_requirements(self) -> List[DocumentInfo]:
"""Requirements for passport renewal."""
return [
DocumentInfo(
type="Old Passport",
description="Original passport to be renewed",
mandatory=True,
validity_period="Should have validity remaining",
name_match_required=True,
format_requirements=["Clear scan of all pages", "Not damaged"]
),
DocumentInfo(
type="Proof of Address",
description="Any one: Aadhaar card, Voter ID, Utility bill (not older than 3 months)",
mandatory=True,
validity_period="Must be current/valid",
name_match_required=True,
format_requirements=["Clear scan/photo"]
),
DocumentInfo(
type="Photograph",
description="Recent passport-size photograph with white background",
mandatory=True,
validity_period="Not older than 6 months",
name_match_required=False,
format_requirements=["2x2 inches", "White background"]
)
]
def _get_pan_new_requirements(self) -> List[DocumentInfo]:
"""Requirements for new PAN card application."""
return [
DocumentInfo(
type="Proof of Identity",
description="Any one: Aadhaar card, Voter ID, Driving license, Passport",
mandatory=True,
validity_period="Must be valid",
name_match_required=True,
format_requirements=["Clear scan/photo"]
),
DocumentInfo(
type="Proof of Address",
description="Any one: Aadhaar card, Voter ID, Utility bill, Bank statement",
mandatory=True,
validity_period="Must be current",
name_match_required=True,
format_requirements=["Clear scan/photo"]
),
DocumentInfo(
type="Proof of Date of Birth",
description="Any one: Birth certificate, Aadhaar card, Passport",
mandatory=True,
validity_period="Must be valid",
name_match_required=True,
format_requirements=["Clear scan/photo"]
)
]
def _get_aadhaar_update_requirements(self) -> List[DocumentInfo]:
"""Requirements for Aadhaar update (address)."""
return [
DocumentInfo(
type="Proof of Address",
description="Any one: Utility bill (not older than 3 months), Bank statement, Rental agreement, Insurance policy",
mandatory=True,
validity_period="Must be current (not older than 3 months for bills)",
name_match_required=True,
format_requirements=["Clear scan/photo", "Name and address clearly visible"]
),
DocumentInfo(
type="Proof of Identity",
description="Any one: PAN card, Passport, Voter ID, Driving license",
mandatory=True,
validity_period="Must be valid",
name_match_required=True,
format_requirements=["Clear scan/photo"]
)
]
def _get_driving_license_new_requirements(self) -> List[DocumentInfo]:
"""Requirements for new driving license application."""
return [
DocumentInfo(
type="Proof of Age",
description="Any one: Birth certificate, School certificate, Passport, PAN card",
mandatory=True,
validity_period="Must be valid",
name_match_required=True,
format_requirements=["Clear scan/photo"]
),
DocumentInfo(
type="Proof of Address",
description="Any one: Aadhaar card, Voter ID, Utility bill, Rental agreement",
mandatory=True,
validity_period="Must be current",
name_match_required=True,
format_requirements=["Clear scan/photo"]
),
DocumentInfo(
type="Application Form",
description="Form 2 (Learner's License) or Form 4 (Permanent License)",
mandatory=True,
validity_period="Must be current version",
name_match_required=True,
format_requirements=["Filled completely", "Signed by applicant"]
),
DocumentInfo(
type="Medical Certificate",
description="Form 1A (for transport vehicles) or Form 1 (for non-transport)",
mandatory=False, # Only for certain license types
validity_period="Must be current",
name_match_required=True,
format_requirements=["Signed by authorized medical practitioner"]
)
]
def get_seed_tasks(self) -> List[Dict[str, Any]]:
"""Get predefined seed tasks for evaluation."""
return [
{
"task_id": "passport_new_easy",
"service_type": "passport_new",
"user_profile": {"age": 30, "is_minor": False},
"description": "Identify required documents for new passport application",
"expected_difficulty": "easy",
"optimal_steps": 2
},
{
"task_id": "passport_new_medium",
"service_type": "passport_new",
"user_profile": {"age": 25, "is_minor": False},
"submitted_documents": [
{"type": "Aadhaar Card", "details": "Valid and current"},
{"type": "Birth Certificate", "details": "Issued in 1995"},
{"type": "Rent Agreement", "details": "Expired in January 2023"}
],
"description": "Validate submitted documents for passport application",
"expected_difficulty": "medium",
"optimal_steps": 3
},
{
"task_id": "passport_new_hard",
"service_type": "passport_new",
"user_profile": {"age": 28, "is_minor": False},
"submitted_documents": [
{"type": "Aadhaar Card", "details": "Valid"},
{"type": "10th Marksheet", "details": "Shows DOB"},
{"type": "Electricity Bill", "details": "In spouse's name"}
],
"validation_feedback": {
"missing_documents": ["Proof of Address"],
"invalid_documents": [
{"type": "Electricity Bill", "reason": "Not in applicant's name"},
{"type": "10th Marksheet", "reason": "Not sufficient as standalone DOB proof"}
],
"valid_documents": ["Aadhaar Card"]
},
"description": "Fix incorrect passport application",
"expected_difficulty": "hard",
"optimal_steps": 4
}
]
# Global task manager instance
task_manager = TaskManager()
|