from typing import Dict, List, Union, Any, Optional, Callable from urllib.parse import quote from breed_health_info import breed_health_info from breed_noise_info import breed_noise_info def get_akc_breeds_link(breed: str) -> str: """Generate AKC breed page URL with intelligent name handling.""" breed_name = breed.lower() breed_name = breed_name.replace('_', '-') breed_name = breed_name.replace("'", '') breed_name = breed_name.replace(" ", '-') special_cases = { 'mexican-hairless': 'xoloitzcuintli', 'brabancon-griffon': 'brussels-griffon', 'bull-mastiff': 'bullmastiff', 'walker-hound': 'treeing-walker-coonhound' } breed_name = special_cases.get(breed_name, breed_name) return f"https://www.akc.org/dog-breeds/{breed_name}/" def get_color_scheme(is_single_dog: bool) -> Union[str, List[str]]: """Get color scheme for dog detection visualization.""" single_dog_color = '#34C759' # 適當淺度的綠色當作為單一品種的顏色 color_list = [ '#FF5733', # 珊瑚紅 '#28A745', # 深綠色 '#3357FF', # 寶藍色 '#FF33F5', # 粉紫色 '#FFB733', # 橙黃色 '#33FFF5', # 青藍色 '#A233FF', # 紫色 '#FF3333', # 紅色 '#33FFB7', # 青綠色 '#FFE033' # 金黃色 ] return single_dog_color if is_single_dog else color_list def format_hint_html(message: str) -> str: """ 提示訊息的 HTML。 Args: message: str, 要顯示的提示訊息 Returns: str: 格式化後的 HTML 字符串 """ return f'''
{description}
" fields_order = [ "Size", "Lifespan", "Temperament", "Exercise Needs", "Grooming Needs", "Care Level", "Good with Children", "Description" ] html_parts = [] for field in fields_order: if field in description: value = description[field] tooltip_html = format_tooltip(field, value) html_parts.append(f'{description.get('Description', '')}
Source: Compiled from various breed behavior resources, 2024
Individual dogs may vary in their vocalization patterns.
Training can significantly influence barking behavior.
Environmental factors may affect noise levels.
Source: Compiled from veterinary resources and breed health studies, 2024
Regular vet check-ups are essential for all breeds.
Early detection and prevention are key to managing health issues.
Not all dogs will develop these conditions.
{description.get('Description', '')}
Size: {original_data.get('Size', 'N/A')}
Exercise Needs: {original_data.get('Exercise Needs', 'N/A')}
Care Level: {original_data.get('Care Level', 'N/A')}
Grooming Needs: {original_data.get('Grooming Needs', 'N/A')}
Good with Children: {original_data.get('Good with Children', 'N/A')}
Temperament: {original_data.get('Temperament', 'N/A')}