from app.specialties.cardiology import CARDIOLOGY_CONFIG from app.specialties.dermatology import DERMATOLOGY_CONFIG from app.specialties.diabetology import DIABETOLOGY_CONFIG from app.specialties.gastroenterology import GASTROENTEROLOGY_CONFIG from app.specialties.general import GENERAL_CONFIG from app.specialties.mental_health import MENTAL_HEALTH_CONFIG from app.specialties.neurology import NEUROLOGY_CONFIG from app.specialties.orthopedics import ORTHOPEDICS_CONFIG from app.specialties.pulmonology import PULMONOLOGY_CONFIG SPECIALTIES = { "cardiology": CARDIOLOGY_CONFIG, "dermatology": DERMATOLOGY_CONFIG, "diabetology": DIABETOLOGY_CONFIG, "gastroenterology": GASTROENTEROLOGY_CONFIG, "general": GENERAL_CONFIG, "mental_health": MENTAL_HEALTH_CONFIG, "neurology": NEUROLOGY_CONFIG, "orthopedics": ORTHOPEDICS_CONFIG, "pulmonology": PULMONOLOGY_CONFIG, } CANONICAL_ALIASES = { "general_medicine": "general", "psychiatry": "mental_health", } def get_specialty_config(code: str) -> dict: canonical_code = CANONICAL_ALIASES.get(code, code) return SPECIALTIES.get( canonical_code, GENERAL_CONFIG, ) def validate_specialty_registry() -> dict: """ Automated validation for specialty registry completeness and integrity. """ canonical_codes = set(SPECIALTIES.keys()) missing_configs = [] for code, config in SPECIALTIES.items(): if not config or not isinstance(config, dict) or config.get("code") != code: missing_configs.append(code) return { "valid": len(missing_configs) == 0, "registered_count": len(SPECIALTIES), "canonical_codes": list(canonical_codes), "missing_configs": missing_configs, }