def proficiency_to_level(proficiency: int) -> str: """Map proficiency integer (0-100) to skill level string. Boundaries (inclusive on the upper edge): 0-40 → BEGINNER 41-60 → INTERMEDIATE 61-100 → ADVANCED Note: these boundaries are the *display* mapping for the UI. The gap analysis engine uses separate `LEVEL_THRESHOLDS` (BEGINNER=40, INTERMEDIATE=60, ADVANCED=100) against raw proficiency — see `apps.analysis.services`. """ if proficiency <= 40: return 'BEGINNER' elif proficiency <= 60: return 'INTERMEDIATE' else: return 'ADVANCED'