TumbuhSehat Mobile Application

TumbuhSehat Mobile Application

Mobile Application Flutter Clean Architecture Domain-Driven Design Event Sourcing

Tumbuh Sehat (“Grow Healthy”) is a Flutter mobile application built to help Indonesian families monitor and optimize the nutritional intake of children aged 0-5 years . It integrates a custom AI food scanner, personalized meal recommendations, WHO-standard growth monitoring, and a nutrition-focused chatbot — all within an offline-first architecture designed for real-world accessibility.

The app covers the full nutrition lifecycle: scanning or logging meals, analyzing nutrient adequacy per family member, generating personalized daily meal plans, tracking calorie history over weeks and months, and detecting stunting or wasting conditions based on international growth standards.

Aspect Description
PlatformAndroid (Flutter cross-platform)
DomainChild Nutrition & Growth Monitoring
Target UsersIndonesian families with children aged 0-5 years
ArchitectureClean Architecture + BLoC/Cubit
AI IntegrationDense-UNet Food Segmentation + OpenAI Chatbot
Data StrategyOffline-first with local SQLite database

The application delivers five major feature areas, each designed around member-aware personalization — every family member (parents, children, pregnant/lactating mothers) gets individually tailored nutrition analysis based on their AKG profile and growth data.

  • AI Food Scanning : Capture a photo of a meal to automatically identify Indonesian food components, estimate portions, and calculate detailed nutritional content using a custom Dense-UNet semantic segmentation model hosted on Hugging Face Spaces.

  • Manual Food Logging : Search from a local database of 161 Indonesian foods with support for 18 URT (Ukuran Rumah Tangga) serving units — including sdm, gelas, centong, porsi, and more.

  • Personalized Meal Recommendations : Auto-generated daily meal plans (breakfast 25%, lunch 40%, dinner 35%) based on remaining AKG targets, with 3 alternatives per food slot. Stunted or wasted children and pregnant/lactating mothers receive additional snack recommendations.

  • WHO Growth Monitoring : Height-for-Age (HAZ) and Weight-for-Height (WHZ) Z-score calculations using the Box-Cox LMS method against WHO reference data. Automatic stunting and wasting detection triggers nutritional adjustments.

  • AI Nutrition Chatbot : Conversational nutrition advisor (“Sobat TumbuhSehat”) powered by OpenAI Assistants API v2 with thread-based persistent conversations.

The flagship feature is a camera-based food scanning system that bridges a custom Dense-UNet segmentation model with a comprehensive local nutrition database. The pipeline processes food images end-to-end:

  • Step 1 — Capture : User selects family members who are eating, then photographs the meal via camera or selects from gallery.

  • Step 2 — Predict : The image is sent to a Hugging Face Spaces endpoint running the Dense-UNet model, which returns per-food-component predictions including label, confidence, estimated volume (mL), and mass (g).

  • Step 3 — Map : AI prediction labels are mapped to local food database entries via the food alias system (e.g., “nasi” → Nasi Putih ID 1006), bridging English/shorthand AI labels to the Indonesian food table.

  • Step 4 — Review : Users review and edit detected food items, adjust quantities and URT serving units, then confirm the meal.

  • Step 5 — Analyze : Nutritional adequacy analysis runs per family member, comparing scanned nutrients against AKG-based meal targets. A warning is issued if any member’s nutrient intake falls below 75% of the meal target.

info

The Dense-UNet model achieves 0.81 mIoU with only 19M parameters — roughly half the parameters of DeepLabV3+ (39M) — making it suitable for real-time mobile inference.

The app follows Clean Architecture principles with strict layer separation, ensuring testability and maintainability. State management uses BLoC/Cubit with 13 cubits orchestrating all business logic.

Layer Responsibility Contents
PresentationUI & State Management13 Cubits, Screens, Widgets
DomainBusiness Contracts5 Abstract Repositories
DataData Access & MappingRepository Impls, 18 Models, 4 Remote + 2 Local Data Sources
CoreCross-cutting ConcernsDatabase, Network, Notifications, Theme, Utils

Key architectural decisions include:

  • Dependency Injection : Centralized via GetIt with lazy singletons for repositories and factories for cubits.

  • Functional Error Handling : Dartz Either monad for all repository return types, enabling explicit success/failure paths without exceptions.

  • Offline-First Design : All family data, meal histories, and recommendations operate fully offline against a local SQLite database.

  • CSV-Seeded Database : 12 SQLite tables populated from bundled CSV files on first launch, including 161 foods with 22 nutrient columns each.

tip

The offline-first strategy ensures the app remains fully functional in areas with unreliable internet connectivity — a common scenario in rural Indonesian communities.

The app incorporates Indonesia’s official Angka Kecukupan Gizi (AKG) nutritional adequacy standards, covering 26 demographic categories from infants to elderly adults, including additive adjustments for pregnancy and lactation:

Category Age Range Base Calories
Children0-5m, 6-11m, 1-3y, 3-6y550-1,650 kcal
Males10-14y through 80y+1,600-2,650 kcal
Females10-14y through 80y+1,400-2,100 kcal
PregnancyTrimester 1 / 2 / 3+180 / +300 / +300 kcal
LactationMonths 1-6 / 7-12+330 / +400 kcal

The meal timing system automatically classifies intake periods, Sarapan (4-11h), Makan Siang (11-15h), Camilan Sore (15-18h), Makan Malam (18-22h), and Camilan Malam (22h+), distributing daily AKG targets proportionally across each meal slot.

info

For stunted children (HAZ < -2), the system automatically adds 13% extra calories and 32% extra protein to the AKG baseline. For wasted children (WHZ < -2), catch-up energy (117.5 kcal/kg) and protein (2.8 g/kg) targets are calculated.

The growth monitoring module implements WHO Child Growth Standards using the LMS (Lambda-Mu-Sigma) Box-Cox transformation method:

The Z-score formula used is:

z=(x/M)L1LSz = \frac{(x/M)^L - 1}{L \cdot S}

Where xx is the measured value, and LL, MM, SS are age/height-specific reference parameters from WHO tables. The system evaluates two key indicators:

  • HAZ (Height-for-Age Z-score) : Detects stunting (chronic malnutrition). Supports week-based measurement for ages 0-13 weeks and month-based for older children. Reference data covers boys and girls separately.

  • WHZ (Weight-for-Height Z-score) : Detects wasting (acute malnutrition). Uses gender-specific tables split by age range (0-2 years and 2-5 years) with 0.5 cm height rounding for precision lookup.

Indicator Threshold Condition Action
HAZ< -2Stunted+13% calories, +32% protein
WHZ< -2WastedCatch-up energy 117.5 kcal/kg

The local SQLite database manages 12 tables, all seeded from bundled CSV files on first launch using batch inserts for performance:

Table Purpose Records
foodsIndonesian foods with 22 nutrient columns per 100g161
food_aliasesMaps AI prediction labels to food IDsVariable
urt_conversionsServing unit types (URT) with gram equivalents18
food_serving_optionsFood-to-URT relationships262
meal_historiesTimestamped meal entries with sync flagDynamic
meal_componentsIndividual food items per mealDynamic
meal_eatersFamily members linked to each mealDynamic
akg_standardsIndonesian nutritional adequacy standards26
who_haz_boys / girlsHeight-for-Age LMS reference data~63 each
who_whz_boys/girls_0_2/2_5Weight-for-Height LMS reference data~131 each

The recommendation system generates personalized daily meal plans for each family member by calculating remaining nutritional needs after subtracting today’s consumed nutrients from their individual AKG profile:

  • Each meal slot recommends: 1 carbohydrate + 1 protein (hewani or nabati, randomly selected) + 1 vegetable , with portions calorie-matched to the slot target.

  • Foods are selected by priority ranking from the database, with 3 alternatives offered per food slot for variety.

  • User overrides are persisted per member per date via SharedPreferences, surviving app restarts.

  • Supports a 3-day view (today, tomorrow, day after tomorrow) for meal planning ahead.

tip

For pregnant/lactating mothers and stunted/wasted children, an additional Camilan Sore (afternoon snack) slot is automatically included to meet elevated nutritional needs.

Category Technologies
FrameworkFlutter 3.8+, Dart
State Managementflutter_bloc (Cubit pattern)
Dependency Injectionget_it
Databasesqflite, SharedPreferences
NetworkingDio
AI / MLDense-UNet on Hugging Face Spaces
ChatbotOpenAI Assistants API v2
Chartsfl_chart, syncfusion_flutter_gauges
Cameracamera, image_picker
UI Componentsflutter_chat_ui, lottie, mesh_gradient, shimmer, flutter_svg
Data Layercsv, dartz (Either monad), equatable, json_serializable
Notificationsflutter_local_notifications, timezone
Error HandlingDartz Either<Failure, T>

Beyond core features, several technical details highlight the engineering depth of the project:

  • Responsive Font Scaling : Adaptive font sizing across device widths (320dp-600dp+) with per-font-weight multipliers and zone-based breakpoints for consistent readability.

  • Food Alias System : A mapping layer that bridges AI model output labels (English/shorthand) to Indonesian food database entries, enabling seamless AI-to-local-data integration.

  • Member-Aware Nutrition Analysis : Every family member (parent or child) gets individually tailored AKG targets based on their age, gender, pregnancy/lactation status, and growth Z-scores.

  • Meal Time Classification : Automatic timestamp-to-meal-period mapping with proportional AKG distribution (25% breakfast, 40% lunch, 35% dinner).

  • Multi-Format Visualization : Weekly nutrient summaries, daily calorie bar charts, and monthly trend visualizations using fl_chart with mesh gradient backgrounds.

  • Notification Deep-Linking : Scheduled local notifications that route directly to the nutrition recommendation screen for the relevant family member.

Building a health app for a developing-country context surfaced interesting design constraints. The offline-first architecture proved essential for real-world usability, while the AI food scanning pipeline demonstrated that lightweight models can be practical for mobile deployment when paired with a well-designed local data layer.

Aspect Observation
Offline CapabilityFully functional without internet (except AI scan & chatbot)
AI AccuracyCompetitive at 0.81 mIoU with only 19M parameters
Data Coverage161 Indonesian foods, 26 AKG categories, WHO growth tables
PersonalizationPer-member AKG with pregnancy, lactation, and growth adjustments
LimitationBackend API not yet deployed; sync is designed but not active
LimitationAI model struggles with translucent and low-contrast food items
warning

The backend API for family management and meal history sync is architecturally designed but not yet deployed. The app currently operates in full offline mode.

Given more time and resources, the following improvements would strengthen the platform:

  • Deploy and integrate the backend API for multi-device family data sync

  • Expand the food database beyond 161 items to cover more regional Indonesian cuisines

  • Improve the Dense-UNet model for translucent ingredient segmentation
  • Add growth trend charts with longitudinal HAZ/WHZ tracking over months

  • Implement export functionality for nutrition reports (PDF/share with pediatricians)

  • Conduct user testing with real Indonesian families for UX refinement