# 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()