Spaces:
Sleeping
Sleeping
File size: 30,677 Bytes
3f9f85b | 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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | """
Validation Rules for Trip Quality Assurance
This module implements specific validation rules that ensure travel recommendations
meet quality standards and business requirements.
"""
from datetime import datetime, timedelta
from typing import Dict, List, Any
from ..core.trip_validation import ValidationRule, ValidationResult, ValidationSeverity, ValidationLevel
class FlightValidationRule(ValidationRule):
"""Validates individual flight recommendations."""
def __init__(self):
super().__init__("flight_validation", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "flight" not in agent_outputs:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message="No flight selected",
agent_id="flight_agent",
suggestions=["Select a flight option"]
))
return results
flight = agent_outputs["flight"]
# Validate flight has required attributes
if not hasattr(flight, 'price') or flight.price <= 0:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message="Invalid flight price",
agent_id="flight_agent",
suggestions=["Select flight with valid price"]
))
# Validate duration is reasonable
if hasattr(flight, 'duration_hours') and flight.duration_hours > 24:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Very long flight duration: {flight.duration_hours}h",
agent_id="flight_agent",
suggestions=["Consider shorter flight options or breaks"]
))
return results
def get_rule_description(self) -> str:
return "Validates flight options for price, duration, and basic requirements"
class HotelValidationRule(ValidationRule):
"""Validates individual hotel recommendations."""
def __init__(self):
super().__init__("hotel_validation", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "hotel" not in agent_outputs:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message="No hotel selected",
agent_id="hotel_agent",
suggestions=["Select a hotel option"]
))
return results
hotel = agent_outputs["hotel"]
# Validate hotel rating
if hasattr(hotel, 'rating') and hotel.rating < 2.0:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Low hotel rating: {hotel.rating}/5",
agent_id="hotel_agent",
suggestions=["Consider higher-rated hotel options"]
))
# Validate location
if hasattr(hotel, 'distance_city_center_km') and hotel.distance_city_center_km > 50:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Hotel very far from city center: {hotel.distance_city_center_km}km",
agent_id="hotel_agent",
suggestions=["Consider hotels closer to city center"]
))
return results
def get_rule_description(self) -> str:
return "Validates hotel options for rating, location, and quality standards"
class POIValidationRule(ValidationRule):
"""Validates individual POI recommendations."""
def __init__(self):
super().__init__("poi_validation", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "pois" not in agent_outputs:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message="No activities selected",
agent_id="poi_agent",
suggestions=["Add activities to enhance trip experience"]
))
return results
pois = agent_outputs["pois"]
if not pois:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message="Empty activity list",
agent_id="poi_agent",
suggestions=["Select at least one activity"]
))
return results
# Check for activity diversity
categories = set()
for poi in pois:
if hasattr(poi, 'category'):
categories.add(poi.category.value if hasattr(poi.category, 'value') else str(poi.category))
if len(categories) < 2 and len(pois) > 1:
results.append(ValidationResult(
level=ValidationLevel.INDIVIDUAL,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message=f"Limited activity diversity: {len(categories)} categories",
agent_id="poi_agent",
suggestions=["Add activities from different categories"]
))
return results
def get_rule_description(self) -> str:
return "Validates POI selections for diversity and quality"
class FlightHotelCompatibilityRule(ValidationRule):
"""Validates compatibility between flight and hotel selections."""
def __init__(self):
super().__init__("flight_hotel_compatibility", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "flight" not in agent_outputs or "hotel" not in agent_outputs:
return results
flight = agent_outputs["flight"]
hotel = agent_outputs["hotel"]
# Check timing compatibility
if (hasattr(flight, 'arrival_time') and hasattr(hotel, 'check_in_time')):
arrival_time = flight.arrival_time
check_in_time = hotel.check_in_time
time_diff = (check_in_time - arrival_time).total_seconds() / 3600 # hours
if time_diff < 1:
results.append(ValidationResult(
level=ValidationLevel.CROSS_AGENT,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message=f"Insufficient time between flight arrival and hotel check-in: {time_diff:.1f}h",
agent_id="flight_agent,hotel_agent",
suggestions=[
"Select later hotel check-in time",
"Choose earlier flight arrival",
"Add buffer time for delays"
]
))
elif time_diff < 2:
results.append(ValidationResult(
level=ValidationLevel.CROSS_AGENT,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Tight schedule between flight arrival and hotel check-in: {time_diff:.1f}h",
agent_id="flight_agent,hotel_agent",
suggestions=["Consider adding buffer time for potential delays"]
))
return results
def get_rule_description(self) -> str:
return "Validates timing compatibility between flight arrival and hotel check-in"
class HotelPOICompatibilityRule(ValidationRule):
"""Validates compatibility between hotel and POI selections."""
def __init__(self):
super().__init__("hotel_poi_compatibility", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "hotel" not in agent_outputs or "pois" not in agent_outputs:
return results
hotel = agent_outputs["hotel"]
pois = agent_outputs["pois"]
if not pois:
return results
# Check distance compatibility
if hasattr(hotel, 'distance_city_center_km'):
hotel_distance = hotel.distance_city_center_km
far_activities = []
for poi in pois:
if hasattr(poi, 'distance_city_center_km'):
poi_distance = poi.distance_city_center_km
total_distance = abs(hotel_distance - poi_distance)
if total_distance > 15: # More than 15km apart
far_activities.append(poi.name if hasattr(poi, 'name') else 'Unknown')
if far_activities:
results.append(ValidationResult(
level=ValidationLevel.CROSS_AGENT,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Hotel and activities are far apart: {', '.join(far_activities[:3])}",
agent_id="hotel_agent,poi_agent",
suggestions=[
"Select hotel closer to activities",
"Choose activities closer to hotel",
"Plan for additional transportation time"
]
))
return results
def get_rule_description(self) -> str:
return "Validates location compatibility between hotel and activities"
class FlightPOICompatibilityRule(ValidationRule):
"""Validates compatibility between flight and POI selections."""
def __init__(self):
super().__init__("flight_poi_compatibility", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "flight" not in agent_outputs or "pois" not in agent_outputs:
return results
flight = agent_outputs["flight"]
pois = agent_outputs["pois"]
if not pois:
return results
# Check if activities require early arrival but flight arrives late
if hasattr(flight, 'arrival_time'):
arrival_hour = flight.arrival_time.hour
# Check for morning activities
morning_activities = []
for poi in pois:
if hasattr(poi, 'opening_hours'):
# In real implementation, parse opening hours
# For now, assume some activities are morning-only
if hasattr(poi, 'category') and 'museum' in str(poi.category).lower():
morning_activities.append(poi.name if hasattr(poi, 'name') else 'Unknown')
if morning_activities and arrival_hour > 14: # Arriving after 2 PM
results.append(ValidationResult(
level=ValidationLevel.CROSS_AGENT,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message=f"Late flight arrival may limit morning activities: {', '.join(morning_activities[:2])}",
agent_id="flight_agent,poi_agent",
suggestions=[
"Consider earlier flight arrival",
"Reschedule morning activities for later days",
"Choose activities with flexible hours"
]
))
return results
def get_rule_description(self) -> str:
return "Validates timing compatibility between flight arrival and activity schedules"
class TripCoherenceRule(ValidationRule):
"""Validates overall trip coherence and quality."""
def __init__(self):
super().__init__("trip_coherence", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
trip_context = context.get("trip_context", {})
# Check if all major components are present
required_components = ["flight", "hotel"]
missing_components = [comp for comp in required_components if comp not in agent_outputs]
if missing_components:
results.append(ValidationResult(
level=ValidationLevel.OVERALL,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message=f"Missing essential trip components: {', '.join(missing_components)}",
suggestions=[f"Add {comp} selection" for comp in missing_components]
))
# Check trip duration vs activity count
if "pois" in agent_outputs:
pois = agent_outputs["pois"]
if pois:
activity_count = len(pois)
trip_duration = trip_context.get("trip_duration_days", 3)
# Rough estimate: 2-3 activities per day is reasonable
max_recommended = trip_duration * 3
if activity_count > max_recommended:
results.append(ValidationResult(
level=ValidationLevel.OVERALL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Many activities ({activity_count}) for short trip ({trip_duration} days)",
suggestions=[
"Reduce number of activities",
"Extend trip duration",
"Prioritize most important activities"
]
))
return results
def get_rule_description(self) -> str:
return "Validates overall trip coherence and completeness"
class BudgetAdherenceRule(ValidationRule):
"""Validates budget adherence across all components."""
def __init__(self):
super().__init__("budget_adherence", ValidationSeverity.CRITICAL)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
trip_context = context.get("trip_context", {})
total_budget = trip_context.get("total_budget", 0)
if total_budget <= 0:
return results
# Calculate total cost
total_cost = 0
component_costs = {}
for agent_id, output in agent_outputs.items():
if "cost" in output:
cost = output["cost"]
total_cost += cost
component_costs[agent_id] = cost
# Check budget adherence
if total_cost > total_budget:
overage = total_cost - total_budget
overage_percentage = (overage / total_budget) * 100
severity = ValidationSeverity.CRITICAL if overage_percentage > 20 else ValidationSeverity.WARNING
results.append(ValidationResult(
level=ValidationLevel.OVERALL,
severity=severity,
rule_name=self.rule_name,
message=f"Trip exceeds budget by ${overage:.2f} ({overage_percentage:.1f}%)",
details={
"total_budget": total_budget,
"total_cost": total_cost,
"component_costs": component_costs
},
suggestions=[
"Reduce flight costs",
"Choose cheaper hotel",
"Select fewer or cheaper activities",
"Increase budget allocation"
]
))
return results
def get_rule_description(self) -> str:
return "Validates that trip stays within allocated budget"
class QualityThresholdRule(ValidationRule):
"""Validates that trip meets minimum quality thresholds."""
def __init__(self):
super().__init__("quality_threshold", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
# This rule would integrate with quality scores calculated elsewhere
# For now, provide basic quality checks
agent_outputs = context.get("agent_outputs", {})
# Check hotel quality
if "hotel" in agent_outputs:
hotel = agent_outputs["hotel"]
if hasattr(hotel, 'rating') and hotel.rating < 3.0:
results.append(ValidationResult(
level=ValidationLevel.OVERALL,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Hotel quality below recommended threshold: {hotel.rating}/5",
suggestions=["Consider higher-rated hotel options"]
))
return results
def get_rule_description(self) -> str:
return "Validates minimum quality thresholds for trip components"
class TravelTimeRule(ValidationRule):
"""Validates realistic travel times and schedules."""
def __init__(self):
super().__init__("travel_time", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
# Check flight duration reasonableness
if "flight" in agent_outputs:
flight = agent_outputs["flight"]
if hasattr(flight, 'duration_hours'):
if flight.duration_hours > 20: # Unrealistically long
results.append(ValidationResult(
level=ValidationLevel.BUSINESS_RULES,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message=f"Unrealistic flight duration: {flight.duration_hours}h",
suggestions=["Verify flight details", "Consider alternative routes"]
))
return results
def get_rule_description(self) -> str:
return "Validates realistic travel times and schedules"
class CheckInOutSequenceRule(ValidationRule):
"""Validates proper check-in/check-out sequences."""
def __init__(self):
super().__init__("checkin_checkout_sequence", ValidationSeverity.CRITICAL)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "hotel" in agent_outputs:
hotel = agent_outputs["hotel"]
# Check check-in/check-out sequence
if (hasattr(hotel, 'check_in_time') and hasattr(hotel, 'check_out_time')):
check_in = hotel.check_in_time
check_out = hotel.check_out_time
if check_out <= check_in:
results.append(ValidationResult(
level=ValidationLevel.BUSINESS_RULES,
severity=ValidationSeverity.CRITICAL,
rule_name=self.rule_name,
message="Invalid hotel stay: check-out before check-in",
suggestions=["Fix hotel check-in/check-out times"]
))
return results
def get_rule_description(self) -> str:
return "Validates proper hotel check-in/check-out sequences"
class RealisticScheduleRule(ValidationRule):
"""Validates that the schedule is realistic and achievable."""
def __init__(self):
super().__init__("realistic_schedule", ValidationSeverity.WARNING)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
# Check if too many activities are scheduled for the available time
if "pois" in agent_outputs:
pois = agent_outputs["pois"]
if pois:
total_duration = sum(
getattr(poi, 'duration_hours', 4) for poi in pois
) # Assume 4 hours per activity if not specified
trip_duration = context.get("trip_context", {}).get("trip_duration_days", 3)
available_hours = trip_duration * 12 # 12 hours per day for activities
if total_duration > available_hours:
results.append(ValidationResult(
level=ValidationLevel.BUSINESS_RULES,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message=f"Activities require {total_duration}h but only {available_hours}h available",
suggestions=[
"Reduce number of activities",
"Extend trip duration",
"Choose shorter activities"
]
))
return results
def get_rule_description(self) -> str:
return "Validates that the trip schedule is realistic and achievable"
class AirportTransferRule(ValidationRule):
"""Validates airport transfer logistics."""
def __init__(self):
super().__init__("airport_transfer", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
# Check if hotel is reasonably close to airport
if "hotel" in agent_outputs and "flight" in agent_outputs:
hotel = agent_outputs["hotel"]
flight = agent_outputs["flight"]
# In real implementation, calculate actual airport-hotel distance
# For now, use city center distance as proxy
if hasattr(hotel, 'distance_city_center_km'):
if hotel.distance_city_center_km > 30:
results.append(ValidationResult(
level=ValidationLevel.BUSINESS_RULES,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message="Hotel far from likely airport location",
suggestions=[
"Consider airport transfer logistics",
"Look for hotels closer to airport",
"Plan for additional transfer time"
]
))
return results
def get_rule_description(self) -> str:
return "Validates airport transfer logistics and distances"
class PreferenceAlignmentRule(ValidationRule):
"""Validates alignment with user preferences."""
def __init__(self):
super().__init__("preference_alignment", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
trip_context = context.get("trip_context", {})
preferences = trip_context.get("preferences", {})
# Check flight preferences
if preferences.get("prefer_direct_flights", False) and "flight" in agent_outputs:
flight = agent_outputs["flight"]
if hasattr(flight, 'stops') and flight.stops > 0:
results.append(ValidationResult(
level=ValidationLevel.USER_SATISFACTION,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message="User prefers direct flights but selected flight has stops",
suggestions=["Look for direct flight alternatives"]
))
# Check hotel preferences
if preferences.get("prefer_central_hotels", False) and "hotel" in agent_outputs:
hotel = agent_outputs["hotel"]
if hasattr(hotel, 'distance_city_center_km') and hotel.distance_city_center_km > 5:
results.append(ValidationResult(
level=ValidationLevel.USER_SATISFACTION,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message="User prefers central hotels but selected hotel is far from center",
suggestions=["Look for hotels closer to city center"]
))
return results
def get_rule_description(self) -> str:
return "Validates alignment with user preferences and travel style"
class TravelStyleRule(ValidationRule):
"""Validates alignment with travel style."""
def __init__(self):
super().__init__("travel_style", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
trip_context = context.get("trip_context", {})
agent_outputs = context.get("agent_outputs", {})
trip_type = trip_context.get("trip_type", "leisure")
# Check business trip requirements
if trip_type == "business":
if "hotel" in agent_outputs:
hotel = agent_outputs["hotel"]
if hasattr(hotel, 'rating') and hotel.rating < 4.0:
results.append(ValidationResult(
level=ValidationLevel.USER_SATISFACTION,
severity=ValidationSeverity.WARNING,
rule_name=self.rule_name,
message="Business trip may require higher-rated hotel",
suggestions=["Consider 4+ star hotel for business travel"]
))
return results
def get_rule_description(self) -> str:
return "Validates alignment with travel style and trip type"
class EnergyLevelRule(ValidationRule):
"""Validates consideration of energy levels and activity intensity."""
def __init__(self):
super().__init__("energy_level", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
agent_outputs = context.get("agent_outputs", {})
if "pois" in agent_outputs:
pois = agent_outputs["pois"]
if pois:
# Check for too many high-intensity activities
high_intensity_count = 0
for poi in pois:
if hasattr(poi, 'activity_level'):
activity_level = poi.activity_level.value if hasattr(poi.activity_level, 'value') else str(poi.activity_level)
if activity_level.lower() in ['high', 'strenuous']:
high_intensity_count += 1
if high_intensity_count > len(pois) * 0.7: # More than 70% high intensity
results.append(ValidationResult(
level=ValidationLevel.USER_SATISFACTION,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message="High proportion of strenuous activities may be exhausting",
suggestions=[
"Add some low-intensity activities",
"Space out high-intensity activities",
"Consider rest days"
]
))
return results
def get_rule_description(self) -> str:
return "Validates consideration of energy levels and activity intensity"
class AccessibilityRule(ValidationRule):
"""Validates accessibility considerations."""
def __init__(self):
super().__init__("accessibility", ValidationSeverity.INFO)
async def validate(self, context: Dict[str, Any]) -> List[ValidationResult]:
results = []
# This rule would check for accessibility requirements if specified
# For now, provide a placeholder implementation
trip_context = context.get("trip_context", {})
special_requirements = trip_context.get("special_requirements", [])
if "wheelchair_accessible" in special_requirements:
results.append(ValidationResult(
level=ValidationLevel.USER_SATISFACTION,
severity=ValidationSeverity.INFO,
rule_name=self.rule_name,
message="Accessibility requirements specified",
suggestions=["Verify all selected options are wheelchair accessible"]
))
return results
def get_rule_description(self) -> str:
return "Validates accessibility requirements and considerations"
|