Week 8 Worklog

Week 8 Objectives:

  • Backend: Build the complete Food & Nutrition module (Food, Meal, MealFood) and prepare the data layer to act as dynamic context for the upcoming Amazon Bedrock AI Coach.
  • Frontend: Build the DietScreen relying on the core ensureDailyMeals logic for a consistent 4-meal layout, plus DietHistoryScreen.
  • Enable users to track daily macro intake and begin experimenting with AI prompt engineering for fitness contexts.

Tasks to be carried out this week:

DayTaskStart DateCompletion DateReference Material
2- Build Food entity (table food)
  + Fields: name, caloriesPer100g, proteinPer100g, carbsPer100g, fatsPer100g, unit
  + FoodController (/api/foods): POST /, GET /{id}, GET / (paginated), GET /search?keyword=, PUT /{id}
03/03/202603/03/2026
3- Build Meal entity (table meal)
  + Fields: userProfile (@ManyToOne), date (LocalDateTime), mealType (enum: BREAKFAST/LUNCH/SNACK/DINNER), note
  + MealController (/api/meals): create, get by ID, list (paginated), filter by date, filter by type
03/04/202603/04/2026
4- Build MealFood entity (table meal_food) — join table with computed macros
  + Fields: meal (@ManyToOne), food (@ManyToOne), quantity (float grams)
  + calories, protein, carbs, fats auto-calculated at insertion from Food’s per-100g values × (quantity/100)
  + MealFoodController (/api/meal-foods): add food to meal, list foods in meal, remove
03/05/202603/05/2026
4- Build DailyNutrition entity (table daily_nutrition)
  + Fields: nutritionDate (LocalDate), totalCalories, totalProtein, totalCarbs, totalFats
  + DailyNutritionController (/api/daily-nutrition): POST /calculate?date= recomputes & saves daily totals; GET /?date= retrieves
03/05/202603/05/2026
5- Build DietScreen (Frontend)
  + Display today’s 4 meals (Breakfast/Lunch/Snack/Dinner) via ensureDailyMeals
  + Each meal: food items list, calorie count, progress bar vs. target
  + “Add food” modal: search by name (searchFoods), input quantity in grams, submit → addFoodToMeal
  + Total daily calorie progress bar at top
  + Pull-to-refresh
03/06/202603/06/2026
6- Build DietHistoryScreen (Frontend)
  + Monthly calendar view — tap a date to see that day’s meal breakdown
  + Per-meal food items with calorie totals
- Integrate foodService: getMealsByUser, getMealFoodsByMealId, addFoodToMeal, deleteMealFood into DietScreen
- Test full nutrition tracking loop: add food → view nutrient breakdown → track daily total
03/07/202603/07/2026

Week 8 Achievements:

  • Backend — Food & Nutrition module:
    • Food entity seeded with real food data from the fitness_crawler tool (over 100 food items in local DB).
    • MealFood correctly auto-calculates calories, protein, carbs, fats on insertion based on quantity / 100 * per100gValue.
    • POST /api/daily-nutrition/calculate?date= aggregates all MealFood entries for a date into a single DailyNutrition record.
    • Pagination on GET /api/foods works — PageResponse<T> wrapper handles page, size, totalPages, totalElements.
    • Keyword search on GET /api/foods/search?keyword= performs case-insensitive LIKE query.
  • Frontend — Diet tracking:
    • DietScreen correctly calls ensureDailyMeals to guarantee 4 meal slots exist for today.
    • Food search modal shows paginated results with lazy loading.
    • Adding food: quantity input → backend calculates and stores macros → UI refreshes with updated totals.
    • DietHistoryScreen calendar correctly loads meal data for selected dates.
    • Daily calorie progress bar reflects totalCalories / 2500 target accurately.

AWS Knowledge Learned:

  • Learned the Bedrock Runtime invocation lifecycle in detail, from request body construction to stable response parsing.
  • Compared model selection tradeoffs in terms of latency, answer quality, and token cost for a fitness-coach use case.
  • Practiced prompt design with explicit role, scope boundaries, and expected output structure to keep responses predictable.
  • Studied defensive AI integration patterns including prompt-injection awareness, context-window control, and safe fallback responses.
  • Learned retry and backoff strategies, plus timeout budgeting, to keep chat UX responsive during transient service failures.
  • Understood quota and usage governance as part of AI feature operations, not only as a billing concern.
  • Identified operational metrics for the AI feature such as success rate, response latency, and visible failure categories.

In summary, week 8 expanded AWS learning from infrastructure into managed AI services and their production constraints.

Next Week Plan:

  • Backend: Build the User Metric module — BodyMetric entity and HealthCalculation with BMI / BMR / TDEE computation logic.
  • Frontend: Build HealthDashboardScreen with wheel pickers, BodyMetricListScreen, BodyMetricFormScreen, and all health chart components.