Skip to content

STUDYU-64 feat: nutrition tracking - #853

Open
johannesvedder wants to merge 66 commits into
devfrom
feat/nutrition-tracking
Open

johannesvedder wants to merge 66 commits into
devfrom
feat/nutrition-tracking

Conversation

@johannesvedder

@johannesvedder johannesvedder commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Adds end-to-end nutrition tracking for StudyU participants and researchers, including daily food recalls, nutrition task configuration, food search, templates, photo recall, image analysis, FFQ/DHQ survey templates, and flexible task scheduling. This update also merges the current dev branch and resolves the resulting integration conflicts.

Visuals

Please attach screenshots or a short screen recording showing the participant nutrition flow and the designer nutrition configuration before merging.

Testing Steps

  1. Run fvm exec melos bootstrap.
  2. Run rtk scripts/pre-commit-check.
  3. Open the participant app and verify that a nutrition task can be opened, meals and foods can be entered, and recall data is autosaved.
  4. Verify food search, barcode scanning, templates, photo recall, and nutrition summaries where supported by the test environment.
  5. Open Designer v2 and verify nutrition task configuration, custom meal types, minimum meal validation, survey templates, and preview behavior.
  6. Verify the updated app and designer preview deployments linked in the PR checks.

PR Checklist

  • Formatting and analyzer checks pass (rtk scripts/pre-commit-check)
  • Screenshot or video attached
  • Description links related issues, or this item removed when no issue exists

MohamedFarid612 and others added 30 commits November 17, 2025 21:32
feat: foundation of nutritional intake
…recall and meal entry screens and add Map parsing to the Answer model.
… and refine nutrition task result loading with dependency updates.
… selection cards and separate lists for surveys and nutrition tasks.
…d enable/disable logic in the measurements form.
…lEntryScreen, adding task-specific submission logic and result handling.
- Refactor Daily Recall logic into NutritionTaskWidget and DailyRecallEntryViewModel
- Localize MealEntryScreen and FoodEntryScreen
- Add localization keys to app_en.arb and generate AppLocalizations
- Remove obsolete buttons and clean up UI
…rman localization, and refactor color alpha application.
…alculations, and refine ViewModel listener management.
- Add USDA FoodData Central API integration (usda_api_service.dart)
- Integrate barcode scanning via mobile_scanner (barcode_scanner_screen.dart)
- Add dual-API food search (food_search_screen.dart - OpenFoodFacts + USDA)
- Merge new dependencies: http ^1.2.2, mobile_scanner ^7.1.4, openfoodfacts ^3.21.0
- Add camera permissions for Android/iOS barcode scanning
- Maintain nutrition observation autosave and core ViewModel architecture
- Keep localized UI strings over hardcoded API branch versions
- Add search icon to food_entry_screen.dart for quick food lookup

Conflict resolution strategy:
- Removed duplicate DailyRecallEntryScreen (kept superior ViewModel pattern)
- Retained NutritionTaskWidget.route() for navigation (ViewModel integration)
- Combined localized labels with new search functionality
- Preserved autosave manager and study subject integration
…n-observation

merge: api integration nutrition observation
Resolved conflict in food_entry_screen.dart:
- Kept both search button (from nutrition-observation) and template save button (from template-meals)
- Combined imports from both branches
- AppBar now shows both action buttons for search and save-as-template functionality
…egration and dynamically setting app bar titles for add/edit.
- **UI/UX Enhancements**:
  - Overhauled `NutritionTaskWidget`, `MealEntryScreen`, `FoodEntryScreen`, and `RecipeBuilderScreen` with a modern, card-based layout using Material 3 design principles.
  - Improved visual hierarchy with consistent iconography, refined spacing, and better use of theme-based surface colors.
  - Redesigned the food search interface with auto-focus, better loading states, and a new "Quick Actions" section.
  - Added formatted time and date displays to improve readability in the recall diary.

- **Refactor & Cleanup**:
  - Simplified `DailyRecallEntryViewModel` by removing redundant update methods and consolidating state management.
  - Extracted multiple private sub-widgets in nutrition screens to improve code maintainability and separation of concerns.
  - Standardized localizations and theme usage across the nutrition module.
  - Cleaned up unused imports and simplified navigation logic in the barcode scanner and food search screens.

- **Infrastructure**:
  - Updated `mobile_scanner` to version 7.0.0.
  - Added comprehensive AI coding rules for the project in `CLAUDE.md`.
- Improve dropdown styling using `isDense: true`, `isExpanded: true`, and `TextOverflow.ellipsis` to prevent layout issues.
- Update `description` text field to support variable heights (`minLines: 1`, `maxLines: 2`).
- Fix minor indentation in `carbsController` field.
- Pass NutritionTask to MealEntryScreen so settings are available at entry time
- collectMealContext: hide meal context/company/distraction fields when disabled; skip toggle always shown
- allowRecipes: suppress Create Recipe tile and recipe templates in FoodSearchScreen when disabled
- minimumMealsRequired: enforce via PopScope confirmation dialog on back navigation; show current/minimum progress chip in meals header
- customMealTypes: render researcher-defined chips in MealTypeSelector instead of default MealType enum
- Designer: add customMealTypes FormArray with dynamic add/remove UI in nutrition form
- Designer: add min(1) validation on minimumMealsRequired for publish/test sets
- Designer: fix default title hardcoded string — use translation key
- i18n: add EN/DE keys for min_meals_not_met_title, min_meals_not_met_message, leave_anyway, customMealTypes labels
refactor(analyze-food-image): remove unused imports from index.ts and clean up deno.json
@johannesvedder
johannesvedder force-pushed the feat/nutrition-tracking branch from 22224c7 to 03203bf Compare June 9, 2026 08:36
@johannesvedder
johannesvedder force-pushed the feat/nutrition-tracking branch from 529576c to bd5d5bd Compare June 9, 2026 09:05
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file app core flutter_common designer_v2 labels Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 19aa312):

(expires Mon, 10 Aug 2026 14:01:43 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2149dad49ed83535217e50d5c18c0c8c90da629b

johannesvedder and others added 3 commits June 10, 2026 10:40
# Conflicts:
#	app/lib/l10n/app_de.arb
#	app/lib/l10n/app_en.arb
#	app/lib/l10n/app_localizations.dart
#	app/lib/l10n/app_localizations_de.dart
#	app/lib/l10n/app_localizations_en.dart
#	app/lib/widgets/questionnaire/question_container.dart
#	app/lib/widgets/questionnaire/questions/date_question_widget.dart
#	core/lib/src/models/questionnaire/answer.dart
#	core/lib/src/models/questionnaire/questions/date_question.dart
#	core/lib/src/models/questionnaire/questions/date_question.g.dart
#	core/lib/src/models/questionnaire/questions/questions.dart
#	designer_v2/lib/features/design/measurements/measurements_form_controller.dart
#	designer_v2/lib/features/design/shared/questionnaire/question/question_form_controller.dart
#	designer_v2/lib/features/design/shared/questionnaire/question/question_form_data.dart
#	designer_v2/lib/features/design/shared/questionnaire/question/types/date_question_form_view.dart
#	designer_v2/lib/features/design/shared/questionnaire/question/types/question_type.dart
@johannesvedder
johannesvedder force-pushed the feat/nutrition-tracking branch from a8b94b8 to 10e6c9f Compare July 11, 2026 12:05
@ibrahimozkn ibrahimozkn changed the title feat: nutrition tracking STUDYU-64 feat: nutrition tracking Jul 19, 2026
johannesvedder added a commit that referenced this pull request Aug 3, 2026
Restore normal startup routing from 0915a0e while keeping preview mode enabled for PR #893. Remove before merging into #853/dev.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app core dependencies Pull requests that update a dependency file designer_v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants