|
219 | 219 | "metadata": {}, |
220 | 220 | "outputs": [], |
221 | 221 | "source": [ |
222 | | - "from redis_context_course.models import StudentProfile\n", |
| 222 | + "# Import StudentProfile with error handling\n", |
| 223 | + "try:\n", |
| 224 | + " from redis_context_course.models import StudentProfile\n", |
| 225 | + " MODELS_AVAILABLE = True\n", |
| 226 | + "except ImportError:\n", |
| 227 | + " print(\"⚠️ StudentProfile not available. Creating mock for demonstration...\")\n", |
| 228 | + " \n", |
| 229 | + " # Create mock classes\n", |
| 230 | + " class CourseFormat:\n", |
| 231 | + " ONLINE = \"online\"\n", |
| 232 | + " IN_PERSON = \"in_person\"\n", |
| 233 | + " HYBRID = \"hybrid\"\n", |
| 234 | + " \n", |
| 235 | + " class DifficultyLevel:\n", |
| 236 | + " BEGINNER = \"beginner\"\n", |
| 237 | + " INTERMEDIATE = \"intermediate\"\n", |
| 238 | + " ADVANCED = \"advanced\"\n", |
| 239 | + " \n", |
| 240 | + " class StudentProfile:\n", |
| 241 | + " def __init__(self, name, email, major, year, completed_courses, current_courses, \n", |
| 242 | + " interests, preferred_format, preferred_difficulty, max_credits_per_semester):\n", |
| 243 | + " self.name = name\n", |
| 244 | + " self.email = email\n", |
| 245 | + " self.major = major\n", |
| 246 | + " self.year = year\n", |
| 247 | + " self.completed_courses = completed_courses\n", |
| 248 | + " self.current_courses = current_courses\n", |
| 249 | + " self.interests = interests\n", |
| 250 | + " self.preferred_format = preferred_format\n", |
| 251 | + " self.preferred_difficulty = preferred_difficulty\n", |
| 252 | + " self.max_credits_per_semester = max_credits_per_semester\n", |
| 253 | + " \n", |
| 254 | + " MODELS_AVAILABLE = False\n", |
223 | 255 | "\n", |
224 | 256 | "print(\"🎯 Feature 2: Personalized Recommendations\")\n", |
225 | 257 | "print(\"=\" * 50)\n", |
|
242 | 274 | "print(f\" Name: {sample_student.name}\")\n", |
243 | 275 | "print(f\" Major: {sample_student.major} (Year {sample_student.year})\")\n", |
244 | 276 | "print(f\" Interests: {', '.join(sample_student.interests)}\")\n", |
245 | | - "print(f\" Preferences: {sample_student.preferred_format.value}, {sample_student.preferred_difficulty.value}\")\n", |
| 277 | + "print(f\" Preferences: {sample_student.preferred_format}, {sample_student.preferred_difficulty}\")\n", |
246 | 278 | "print(f\" Academic Progress: {len(sample_student.completed_courses)} completed, {len(sample_student.current_courses)} current\")\n", |
247 | 279 | "\n", |
248 | 280 | "print(\"\\n🧠 Recommendation Algorithm:\")\n", |
|
0 commit comments