English | 日本語
An Android app, written in Kotlin with Jetpack Compose, that turns a patient's dietary-quality data (HEIFA scores) into a personal dashboard, lets them log their eating habits, and coaches them with AI-generated tips. A separate clinician view aggregates every patient's data and asks the model to surface patterns across the cohort.
Built by Haruto Iriyama.
| Screen | Purpose |
|---|---|
| Welcome / Login / Register | Patients are pre-loaded from a CSV; a user claims their account by matching ID + phone number, then sets a name and password. Session state is persisted so the app reopens on the home screen. |
| Food-intake questionnaire | Food categories, a "persona" that best describes the user's eating style, and meal / sleep / wake times. Answers are stored in Room and pre-filled on return. |
| Home | The user's total Food Quality Score with a quick explanation of what it means. |
| Insights | Per-category HEIFA score bars (vegetables, fruit, grains, dairy, sugar, sodium, …) against their maximum, plus a share button. |
| NutriCoach | Look up any fruit's nutrition facts via the FruityVice API, and generate a motivational tip from Gemini that is tailored to the user's own scores. Tips are saved and can be reviewed later. |
| Clinician dashboard | Behind a clinician key: average HEIFA scores by sex and a "Find data patterns" button that sends the anonymised cohort data to Gemini for a written analysis. |
| Settings | Account details, logout, and the entry point to the clinician view. |
- UI — Jetpack Compose with Material 3 and a bottom navigation bar; one
@Composablescreen per feature underui/screens. - State — MVVM. Each screen has a
ViewModelexposingStateFlows; a singleNutriTrackRepositoryis the only thing the view models talk to. - Persistence — Room database with
Patient,FoodIntakeandNutriCoachTipentities and DAOs. The patient table is seeded fromassets/CustomerData.csvon first launch. - Networking — Retrofit + Gson for FruityVice; the Google Generative AI SDK (
gemini-1.5-flash) for coaching tips and cohort analysis. - Auth —
AuthManagerkeeps the logged-in user inSharedPreferences; passwords are set at registration and checked at login.
app/src/main/java/com/nutritrack/
├── MainActivity.kt NavHost and bottom bar
├── NutriTrackRepository.kt single source of truth: Room + Retrofit + Gemini
├── AuthManager.kt session persistence, CSV loader
├── data/ Room database, entities, DAOs
├── network/ FruityVice Retrofit service
├── ui/screens/ one Composable per screen
├── ui/theme/ Material 3 theme
└── viewModel/ one ViewModel per screen
Requires Android Studio (Ladybug or newer) and an emulator or device on API 35.
-
Create
local.propertiesin the project root (it is git-ignored) and add a Gemini API key:apiKey=YOUR_GEMINI_API_KEY -
Open the project in Android Studio and run the
appconfiguration.
Sample patients live in app/src/main/assets/CustomerData.csv; log in with
any User_ID / PhoneNumber pair from that file.
To reach the clinician dashboard, open Settings → Clinician login and
enter the demo key dollar-entry-apples. It is a fixed demo value in
ClinicianLoginViewModel.kt, not a real credential — a production build
would check it server-side.
