PERSONAL AI & APPLIED ANALYTICS CASE STUDYBuilt by Rudy Martinez, Principal Analytics & AI Architect at Database Marketer

AI Nutrition & Ingredient Intelligence: Built From Care, Guided by Evidence

A personal project born from caring about the food we eat and the well-being of someone I love. I used conversational AI, thoughtful data engineering, and machine learning to turn everyday observations into better questions for healthcare conversations.

Why I built this: Food should nourish us, bring us joy, and support the people we care about. This project began with a personal goal: helping my wife better understand how meals, ingredients, daily routines, and other experiences might relate to how she feels. We care about ingredient quality and thoughtful food preparation, but even with that attention, it can be difficult to see meaningful patterns across everyday life.

The problem: Food, sleep, activity, and symptoms do not arrive as neat rows in a database. Details get forgotten, observations may be recorded in different places, and several things can change at once. By the time someone sits down with a healthcare professional, weeks of lived experience can be difficult to summarize.

What I built: I created an AI-powered nutrition and life-event intelligence platform that uses conversational logging, clarification before data entry, structured event validation, dbt and BigQuery transformations, and exploratory machine learning. Its purpose is to organize observations and surface questions worth discussing with a qualified professional, not to diagnose conditions or assign causes to individual ingredients.

Built Product Workbench - React 19 + Governed Medallion PipelineDisplayed with 100% synthetic fixture data (seed = 20261114)
Built AI Nutrition and Ingredient Intelligence product workbench showing longitudinal tracking, ingredient flags, and baseline bands populated with synthetic records
Product Overview Workbench: Interactive interface built to connect conversational meal and life-event capture with structured ingredient flags and longitudinal baseline review (rendered here in zero-credential synthetic mode).See verification scope & technical notes ->

Why Food, and Why This Project Matters to Me

I have spent my career helping organizations turn complex information into better decisions. That work is deeply important to me, but it was not the reason this project began.

It began at home. I wanted to help someone I love understand her relationship with food and everyday well-being, without making the act of tracking meals and daily experiences another burden. Food is personal. It is part of how we care for ourselves and for one another, and the ingredients and preparation behind a meal matter to me beyond any dashboard or statistical model.

I could bring my analytics experience to that challenge, but I also had to respect what the data could not tell us. The goal was not to turn uncertainty into false confidence. It was to capture observations with greater care, recognize patterns responsibly, and make conversations with healthcare professionals more useful.

The technology is the means. Better understanding and better care are the reason I built it.

How to read our implementation vs. verification numbers: The private household application connects live external services (Firebase, Telegram, Google Gemini, FatSecret, BigQuery ML, and Semantic Scholar). Because private household logs are never shared publicly, the automated figures reported on this page (such as 12/12 test specs and 410/410 SQLite window parity) measure deterministic software contracts, state transitions, and SQL math on synthetic fixtures - they do not claim clinical efficacy or comprehensive production outcome validation.
Capability LayerBuilt in Private ApplicationVerified in Public Synthetic SuiteWhy It Matters for Everyday Use & Review
Omni-Channel Multimodal CaptureTelegram Bot API (text, voice memos, plate photos, barcodes) + React 19 / Firebase HostingRunnable offline React 19 workbench + simulated webhook/barcode adaptersSupports quick, conversational capture where users already communicate, designed to reduce repetitive form entry.
3-Stage Gemini GatekeeperLive Gemini (T=0.1) router -> T=0.0 JSON extractor -> FatSecret OAuth 2.0 + additive rulesShared Zod schemas, dietaryRules.js, and state-machine hold specs (0 partial rows persisted in synthetic tests)Asks one concise follow-up when missing prep, gluten, or dressing context would corrupt downstream ingredient flags.
dbt + BigQuery ML Trend EngineFirestore-to-BigQuery export + dbt Bronze -> Silver -> Gold + BQML XGBoost & ARIMA_PLUSSanitized dbt/BQML SQL + deterministic 410/410 row parity against in-memory node:sqlite window SQLVerifies that operational schemas and rolling 24h/48h lag windows compute identically without temporal leakage.
Uncertainty-Aware GuardrailsChronological splits, uncertainty bounds, collinearity checks + live Semantic Scholar MeSH lookupChronological 75/25 holdout, Haldane intervals, abs(r) >= 0.35 warnings + documented offline literature boundaryFrames exploratory model outputs as non-causal questions to review with a clinician, never as automated diagnoses.

1. Why Is It So Hard to Understand the Relationship Between Food and How We Feel?

Direct Answer: Food is rarely experienced in isolation. Meals, preparation, sleep, physical activity, stress, and daily routines can overlap, while individual observations are often incomplete. That makes it hard to know which patterns deserve attention and which may be coincidental.

For someone preparing to discuss recurring symptoms or changes in well-being with a clinician, three practical challenges stand out:

  1. Logging takes effort: Traditional forms can ask for so much detail that consistent tracking becomes difficult. A useful product must reduce that friction without losing important context.
  2. Details are easy to miss: A note such as “I had pasta and salad” may leave out ingredients, dressing, preparation, or timing. When those details matter to the question being investigated, the system should ask a concise follow-up instead of silently guessing.
  3. Observations are not explanations: A symptom, an ingredient, and a change in sleep may occur near one another without one causing the other. A timeline helps organize the discussion, but interpretation requires attention to timing, repeated observations, alternative explanations, and uncertainty.

I built the platform to make those observations easier to capture and more useful to review, not to replace clinical reasoning.

SHARED TIMELINE // FIVE DAILY OBSERVATION STREAMS

2. How Does the Platform Bring Food and Daily Life Together for More Useful Conversations?

Direct Answer: The platform organizes five streams of daily observations - nutrition, movement, sleep, regimens, and symptoms - into a common timeline. Its analytical models examine prior 24-hour and 48-hour windows to highlight recurring associations and possible questions for clinician review. Those patterns are exploratory and do not, by themselves, establish what caused a symptom.
STREAM 01 // NUTRITION

Meals, Prep & Hidden Additives

Decomposes barcodes, photos, and text into FODMAP polyols, gums, emulsifiers, raw-vs-cooked preparation, gluten checks, and hydration notes.

prior_polyol_24h, prior_gum_24h, is_raw_plant_prep
STREAM 02 // MOVEMENT

Activity & Recovery Timing

Records strength training intensity, post-meal walks, and post-dinner recovery spacing intervals alongside meal timestamps.

Meal-to-Activity Lag Deltas (<90m vs >=90m)
STREAM 03 // SLEEP & ENERGY

Sleep Continuity & Daily Stress

Captures bedtime, wake interruptions, daily stressors, and midday energy or clarity notes so food logs are reviewed in context.

Overnight-to-Next-Day Context Windows
STREAM 04 // REGIMENS & LABS

Supplements, Regimen & Context

Tracks daily supplement or regimen schedules, chewable or liquid excipient flags, and longitudinal lab context for discussion.

Regimen Timing Lags + Excipient Flags
STREAM 05 // CLINICIAN REVIEW

Symptoms & Organized Questions

Summarizes discomfort scores (0-10), motility notes, modeled baseline intervals, exploratory associations, and literature references.

discomfort >= 7 + daily_max_discomfort
PRODUCT & ANALYTICAL JUDGMENT

The Decisions Behind the Platform

Building the application meant making tradeoffs between ease of use, data reliability, analytical usefulness, and responsible interpretation. These are the decisions that shaped the product.

DecisionApproach I choseWhy it matters
Make logging feel naturalSupport conversational text, voice, images, and barcode-assisted inputsPeople should not have to become data-entry specialists to record their experiences.
Ask before assumingUse an ambiguity gate and structured clarification when key context is missingIncomplete or guessed records can undermine downstream analysis.
Preserve timing and contextModel food, activity, sleep, regimens, and symptoms along a shared timelineRelationships worth investigating may depend on when observations occurred.
Treat predictions as hypothesesInclude time-aware evaluation, uncertainty, and checks for correlated featuresModel importance is not evidence that an ingredient caused an outcome.
Protect private informationKeep the real system private and publish a separate synthetic demonstrationTechnical proof should never require exposing a household's personal records.
Keep a human in the loopPrepare organized summaries and questions for qualified professionalsThe product should inform conversations, not automate medical conclusions.

These choices reflect how I approach complex problems more generally: start with the person affected, improve the quality of the evidence, challenge what a model appears to say, and only then consider what decision the evidence supports.

FULL-STACK SYSTEM TOPOLOGY // CONNECTED APIS & CLOUD SERVICES

3. What full-stack technologies and external APIs power the end-to-end architecture?

Direct Answer: The private platform connects React 19 + Vite + Tailwind CSS, Firebase (Auth, Firestore, Cloud Functions), the Telegram Bot API, Google Gemini GenAI, the FatSecret Platform OAuth 2.0 API, dbt Core, Google BigQuery & BigQuery ML (XGBoost + ARIMA_PLUS), and the Semantic Scholar Graph API, mirrored via deterministic zero-credential adapters in the public synthetic repository.
Architecture LayerConnected Stack & APIsProduction RoleSanitized Public Repo Adapter
Omni-Channel Client & MessagingTelegram Bot API, React 19, Vite, Tailwind CSS v4Supports quick, conversational capture via text, voice notes, meal photos, and barcodes plus a web timeline and regimen UIInteractive React 19 SPA (src/ui/App.jsx) with multi-turn preset and live simulation
Serverless Cloud & Multi-TenancyFirebase Auth, Cloud Firestore, Cloud Functions (Node.js)Maps authenticated Telegram IDs to Firebase UIDs, holds ephemeral telegram_sessions state, and streams validated logsTenant-isolated session store throwing TenantIsolationError on cross-tenant access
Multi-Agent LLM OrchestrationGoogle Gemini GenAI, Zod v4 ContractsStage 1 Gatekeeper completeness router (T=0.1) -> Stage 2 strict nested JSON extraction (T=0.0)MockGeminiOrchestrator + shared CanonicalNutritionEventSchema invariants
Nutrition & Additive IntelligenceFatSecret Platform API (OAuth 2.0), Additive LexiconResolves GTIN-13 barcodes, plate images, and food queries into raw ingredients checked against dietary and additive rulesMockNutritionCatalogAdapter + deterministic dietaryRules.js (FDA and Monash rules)
Warehouse ELT & In-DB MLdbt Core, Google BigQuery, BQML (XGBoost & ARIMA_PLUS)Transforms Firestore exports through Bronze -> Silver -> Gold 24h/48h lag windows; computes exploratory attribution and modeled baseline bandsSanitized dbt SQL + 410/410 synthetic fixture row parity against node:sqlite + chronological stumps
Literature Retrieval BoundarySemantic Scholar Graph API, Gemini MeSH BuilderFormulates Medical Subject Heading (MeSH) queries from recurring patterns to retrieve peer-reviewed papers for clinician discussionsDocumented offline contract (LiteratureSynthesisInterface) - never fabricates mock clinical citations
Conceptual Architecture diagram illustrating Zone 1 client channels, Zone 2 contract orchestration, and Zone 3 dbt BigQuery Medallion and BigQuery ML boundaries
Conceptual Architecture - End-to-end integration across client channels, external APIs, dbt Medallion layers, and BigQuery ML.
DESIGN LESSONS // GOVERNED AI & TRANSFERABLE PATTERNS

4. What This Personal Project Taught Me About Building Useful AI Products

Direct Answer: The most important lesson was that AI is only as useful as the quality of the information it receives and the judgment applied to its outputs. The design starts with the human experience, makes ambiguity visible, validates information before analysis, and uses models to support better questions rather than overconfident answers. Those principles also apply to business products and operational analytics systems.

Design Tradeoffs: Conventional Tracking, Unchecked AI, and a Governed Approach

DimensionRigid Form-Based TrackersNaive Single-Prompt AI ChatbotsGoverned Gatekeeper + BigQuery ML Approach
Daily Logging UX8-15 manual dropdowns per meal or workout; tedious to sustainAccepts vague notes without checking whether key context is missingConversational voice, photo, barcode, or text; asks 1 follow-up only when missing context matters
Multi-Stream ContextSiloed calorie countersDrops sleep, activity timing, and supplement excipientsOrganizes additives, sleep, activity, recovery spacing, and regimens along shared 24h/48h windows
Conversation OutputPages of raw logs that are hard to summarize quicklyOverconfident AI guesses without statistical boundsExploratory summaries with modeled baseline intervals, collinearity warnings, and literature links

Where These Engineering Patterns Can Apply Beyond Nutrition

Although the project was developed for a personal purpose, several design patterns are transferable: conversational clarification when context is missing, structured validation before writing events, consistent data contracts, time-aware feature modeling, and explicit uncertainty in analytical outputs. These patterns may be useful in customer support, operational intake, and internal analytics workflows, subject to each domain's requirements and appropriate review.

PATTERN 01 // SUPPORT INTAKE

1. Customer support and warranty intake

Ask for missing product, environmental, or timing details before creating records used for troubleshooting.

PATTERN 02 // EVENT COLLECTION

2. Operational event collection

Validate fields and preserve event context before those records enter warehouse reporting and analysis.

PATTERN 03 // ANALYTICS SCOPING

3. Internal analytics requests

Clarify ambiguous business questions, required dimensions, and success criteria before generating analysis specifications.

When NOT to Use This Architecture

Do not deploy stateful LLM gating for simple 3-button deterministic check-ins, one-off <100-row surveys, or autonomous clinical diagnosis and prescribing where licensed clinical evaluation is mandatory.

ENGINEERING SAFEGUARDS // GATEKEEPER STATE MACHINE, ZOD & MEDALLION SQL

5. How Do the Gemini Gatekeeper, Zod Contracts, and Data Models Improve Reliability?

Direct Answer: The architecture separates input clarification, structured extraction, schema validation, and warehouse transformation. Ambiguous submissions can be held for clarification before a canonical event is written; Zod contracts enforce expected fields; and tenant-scoped time windows help keep analytical features aligned with prior observations. These are designed safeguards supported by targeted tests, not a claim that all incoming information is clinically correct or that every possible data-quality failure has been eliminated.

Resolved food entries check ingredient lists against deterministic rules grounded in U.S. FDA Food Additive classifications and Monash University FODMAP polyol standards, while warehouse feature tables use BigQuery RANGE windows in dbt Core ending at 1 PRECEDING.

Synthetic Demo Screenshot showing an ambiguous meal held by the Gatekeeper for clarification before database persistence
Synthetic Demo Screenshot - Selective clarification hold keeps incomplete composite meals out of Bronze storage.
Conceptual Architecture diagram of Stage 1 Gemini Gatekeeper, Stage 2 Zero-Temp Extractor, and Stage 3 FatSecret and Additive Taxonomy Auditor
Conceptual Architecture - Three-stage validation and deterministic additive taxonomy pipeline.
javascript— src/contracts/eventSchema.js (Food, Symptom, Supplement & Life Context)
export const CanonicalNutritionEventSchema = z
  .object({
    event_id: z.string().min(6),
    tenant_id: TenantIdSchema,
    event_timestamp: IsoUtcTimestampSchema, // Strict ISO-8601 UTC ending in 'Z'
    ingested_at: IsoUtcTimestampSchema,
    source_channel: z.enum(['web_console', 'messaging_webhook', 'synthetic_seed']),
    input_modality: z.enum(['text', 'voice_transcript', 'image_vision', 'barcode_gtin']),
    category: z.enum(['food', 'symptom', 'supplement', 'context']),
    raw_input_redacted: z.string().min(1).max(500),
    food_metadata: FoodMetadataSchema.nullable().default(null),
    symptom_metadata: SymptomMetadataSchema.nullable().default(null),
    supplement_metadata: SupplementMetadataSchema.nullable().default(null),
    context_metadata: ContextMetadataSchema.nullable().default(null) // Sleep, exercise, recovery & stress
  })
  .superRefine((val, ctx) => {
    if (val.category === 'food' && !val.food_metadata) {
      ctx.addIssue({ code: 'custom', message: 'food events require food_metadata', path: ['food_metadata'] });
    }
    if (val.category === 'symptom' && !val.symptom_metadata) {
      ctx.addIssue({ code: 'custom', message: 'symptom events require symptom_metadata', path: ['symptom_metadata'] });
    }
  });
sql— warehouse/dbt_reference/models/marts/fct_ml_feature_store.sql
SELECT
  event_id,
  tenant_id,
  event_timestamp,
  COALESCE(SUM(has_high_fodmap_polyol) OVER w24, 0)  AS prior_polyol_24h,
  COALESCE(SUM(has_hydrocolloid_gum) OVER w24, 0)    AS prior_gum_24h,
  COALESCE(SUM(has_emulsifier_irritant) OVER w24, 0) AS prior_emulsifier_24h,
  COALESCE(SUM(has_high_fodmap_polyol) OVER w48, 0)  AS prior_polyol_48h,
  is_elevated_discomfort
FROM {{ ref('int_events_flattened') }}
WINDOW
  w24 AS (
    PARTITION BY tenant_id
    ORDER BY event_epoch_sec ASC
    RANGE BETWEEN 86400 PRECEDING AND 1 PRECEDING
  ),
  w48 AS (
    PARTITION BY tenant_id
    ORDER BY event_epoch_sec ASC
    RANGE BETWEEN 172800 PRECEDING AND 1 PRECEDING
  );
Conceptual Architecture diagram of Bronze, Silver, and Gold dbt BigQuery Medallion transformations feeding XGBoost and ARIMA_PLUS
Conceptual Architecture - Medallion lineage verified at 410/410 row equality against in-memory node:sqlite in the synthetic test fixture.
INTERPRETATION GUARDRAILS // SYNTHETIC ML BENCHMARK & PROTOTYPE DEFECTS

6. How does machine learning highlight trends for doctor visits without making false causal claims?

Direct Answer: Packaged foods and daily habits often overlap, sample sizes are modest, and people may log more consistently when they feel unwell. Pairing BigQuery ML (XGBoost + ARIMA_PLUS) with chronological 75/25 holdouts, uncertainty intervals, and abs(r) >= 0.35 collinearity alerts organizes messy history into qualified questions for a clinician rather than overconfident single-ingredient claims.

What the Models Can Show - and What They Cannot

1. Correlated ingredients can mislead model interpretation

In a 60-day synthetic demonstration, two ingredient categories are intentionally constructed to appear together. A boosted-tree model may assign most of the importance to one feature while assigning little to the other, even though the observed exposure patterns overlap. The synthetic example reports a risk ratio of 7.29x and feature attribution values of 85.3% and 0.0%. These figures demonstrate the interpretation problem within the synthetic dataset; they are not estimates of an ingredient's effects on a real person. The responsible output is a warning about correlated exposures and questions for further review.

2. Baseline comparison in the synthetic demonstration

Plotting daily symptom scores against a model-derived 95% prediction interval (ARIMA_PLUS / rolling 7-day band) in the synthetic dataset helps distinguish ordinary day-to-day fluctuation from periods that differ from the modeled baseline.

3. Engineering defect caught in the private prototype

Auditing the private prototype caught an actual implementation bug where nested Gemini arrays (food_metadata.ingredients[].tags) had evolved ahead of legacy flat SQL paths, resolved by enforcing shared Zod contracts and automated node:sqlite parity assertions (410/410 rows in the synthetic test fixture).

4. Honest boundary on literature synthesis

In the private system, recurring patterns formulate MeSH queries against the Semantic Scholar Graph API so users can review peer-reviewed papers with a clinician. In the offline public repo, LiteratureSynthesisInterface is documented as an explicit interface rather than mocking simulated medical studies.

Synthetic Demo Screenshot showing model-derived 7-day baseline interval, Haldane uncertainty intervals, and correlated-feature warnings on synthetic data
Synthetic Demo Screenshot - Modeled baseline interval, uncertainty bounds, and correlated-exposure warnings on synthetic records.

A useful model should make its limitations visible. Prediction and feature importance can help prioritize questions, but they do not establish causality. I would rather present a qualified finding that invites careful investigation than an impressive number that implies more certainty than the evidence supports.

ANALYTICAL EVALUATION FRAMEWORK

How I Would Evaluate Whether This Product Actually Helps

Building sophisticated technology is not the same as creating something useful. I would evaluate the platform on whether it makes daily tracking easier, produces more reliable observations, communicates uncertainty honestly, and helps someone prepare a clearer account of their experiences. The measures below are an evaluation framework, not claims of achieved outcomes.

Evaluation areaCandidate measureWhy it matters
Ease of useTime to complete a log; clarification completion rateTests whether conversational input actually reduces friction.
Sustained useRepeat logging frequency and retention over timeTests whether the experience remains practical beyond the first few days.
Input qualityPercentage of records passing schemas; missing-context rate; corrected-entry rateSeparates easy capture from analytically trustworthy capture.
Analytical reliabilityChronological holdout performance, baseline comparison, model drift, sample-size coverageTests whether models add value over simple summaries.
Interpretation qualityCorrelation warnings, uncertainty display, limitations communicatedHelps guard against overconfident or causal readings.
Human usefulnessUser review of summaries and whether they make appointment preparation clearerTests whether the product serves its original purpose.

This is the standard I try to apply to analytical products generally: define what success would mean before celebrating the technology, validate the evidence, and keep the person using the output at the center of the decision.

STRUCTURED Q&A // CLINICIAN PREP, PRIVACY & REPRODUCIBILITY

7. Frequently Asked Technical & Product Questions

How is this platform meant to be used alongside a physician or dietitian?

Instead of scrolling through weeks of raw meal notes during a short visit, a user can share an organized summary showing modeled baseline variation, recurring dietary and daily-life associations (with sample sizes and uncertainty bounds), correlated-ingredient warnings, and literature references.

Does the public showcase contain any real personal health data?

Zero. The public repository was built in a separate directory with no private Git history, no API keys, and 410 deterministic synthetic events verified by automated secret and PNG-metadata checks.

How can engineering reviewers run the demonstration locally?

Clone rudy0903/dbmarketer, navigate to ai-nutrition-intelligence/, run npm install, and execute npm test (12/12 automated node:test specs) and npm run dev offline.

Non-Clinical & Synthetic Data Governance Disclaimer: This showcase and its synthetic dataset demonstrate software architecture, data engineering contracts, and statistical pattern-exploration methods designed to organize observational questions for licensed healthcare professionals. It is not a medical device, diagnostic service, or clinical treatment recommender.
APPLIED AI, PRODUCT ANALYTICS & DECISION SYSTEMS

Explore the Project or Start a Conversation

This project began as a personal effort to bring more care and clarity to everyday food and wellness questions, and it reflects how I lead applied AI, product analytics, governed data modeling, and evidence-based decision systems end to end. If you want to inspect the implementation directly, the public repository includes a runnable, zero-credential synthetic demonstration. If you are hiring for analytical leadership or building an applied AI, product analytics, or decision-support capability in your organization, I welcome the conversation.

● APPLIED AI, PRODUCT ANALYTICS & ARCHITECTURE

Start an Applied Analytics or AI Conversation

Inquire about applied AI workflows, product and longitudinal analytics, and evidence-based decision systems - as well as governed dbt/BigQuery architectures, telemetry audits, or principal advisory.

Bot-protected & encryptedResponse within 1 business day
Technical Release Notes & Demonstration Provenance

Edition: Canonical Case Study Showcase (November 2026)

Synthetic Verification Scope: The 410/410 SQLite parity checks and 12/12 automated node:test specs validate schema contracts, conversational ambiguity holds, tenant isolation, and rolling SQL window logic on deterministic synthetic fixtures (seed = 20261114). They verify software and analytical logic in the offline showcase and do not establish clinical effectiveness or live production outcome validation.

License: Database Marketer Source-Available Portfolio & Evaluation License (free to view, clone, test, and run locally for hiring and internal technical evaluation; commercial production use reserved).