"""Test progress tracker module""" import sys sys.path.insert(0, '.') import progress_tracker as pt print("๐Ÿงช Testing Progress Tracker Module") print("=" * 70) # Create test user profile user_profile = { 'age': 28, 'gender': 'Male', 'weight': 75, 'height': 175, 'goal': 'Weight Loss', 'activity': 'Moderately Active', 'calories': 2200, 'protein': 150, 'carbs': 250, 'fat': 70 } print("๐Ÿ‘ค Test User Profile:") print(f" Age: {user_profile['age']}, Gender: {user_profile['gender']}") print(f" Weight: {user_profile['weight']} kg, Height: {user_profile['height']} cm") print(f" Goal: {user_profile['goal']}, Activity: {user_profile['activity']}") print() # Generate progress data print("๐Ÿ“Š Generating 90 days of progress data...") df = pt.generate_user_progress_data(user_profile, num_days=90) print(f"โœ… Generated {len(df)} days of data") print(f" Columns: {list(df.columns)}") print() # Calculate trends print("๐Ÿ“ˆ Analyzing Trends...") weight_trends = pt.calculate_trends(df, 'Weight') print(f"โœ… Weight Trend: {weight_trends['trend']}") print(f" Total Change: {weight_trends['total_change']:.2f} kg ({weight_trends['percent_change']:.2f}%)") print(f" Start: {weight_trends['start_value']:.1f} kg โ†’ End: {weight_trends['end_value']:.1f} kg") print() calorie_trends = pt.calculate_trends(df, 'Calories') print(f"โœ… Calorie Trend: {calorie_trends['trend']}") print(f" Average: {calorie_trends['overall_avg']:.0f} cal/day") print() # Predictions print("๐Ÿ”ฎ Making Predictions...") predictions = pt.predict_future_values(df, 'Weight', days_ahead=30) print(f"โœ… Predicted weight in 30 days: {predictions[-1]:.1f} kg") print() # Generate charts print("๐Ÿ“Š Generating Visualizations...") tests = [ ('Weight Progress', lambda: pt.create_weight_progress_chart(df, user_profile['goal'])), ('Calories Progress', lambda: pt.create_calories_progress_chart(df, user_profile['calories'])), ('Macros Area Chart', lambda: pt.create_macros_stacked_area_chart(df)), ('Adherence Heatmap', lambda: pt.create_adherence_heatmap(df)) ] for name, func in tests: try: result = func() if result and len(result) > 100: print(f"โœ… {name:<25} : SUCCESS ({len(result):,} chars)") else: print(f"โŒ {name:<25} : FAILED (empty)") except Exception as e: print(f"โŒ {name:<25} : ERROR - {str(e)[:50]}") print() # Get insights print("๐Ÿ’ก Generating Insights...") insights = pt.get_progress_insights(df, user_profile['goal']) print(f"โœ… Generated {len(insights)} insights:") for insight in insights: print(f" {insight['icon']} {insight['message']}") print() print("=" * 70) print("๐ŸŽ‰ Progress Tracker Module Test Complete!")