Food–Body Connection
Food–Body Connection is a full‑stack health analytics application designed to help users identify potential food or environmental allergens associated with adverse symptoms. Users log exposures and symptoms over time, and the system applies statistical analysis
The goal is decision support — not diagnosis. The application highlights candidate trigger foods to investigate further and provides structured insights that can be discussed with healthcare professionals.
What the app does
- Logs allergen exposure events with quantities and timestamps
- Logs symptom events with severity and timing
- Tracks twice-daily check-ins covering mood, sleep, fatigue, gut health, stress, and more
- Logs medications and active regimens with dose and date tracking
- Accepts uploaded health documents (PDF, DOCX, text) for contextual AI analysis
- Stores structured health data in a relational PostgreSQL database with field-level encryption
- Aligns exposure and symptom events using time‑aware windows
- Analyzes relationships between allergens and symptoms
- Generates personalized AI-powered reports highlighting potential trigger foods
- Supports elimination diets and long‑term tracking strategies
- Installable as a Progressive Web App for offline access
Statistical & machine‑learning analysis
The system is designed for real‑world health data: frequent exposures, rare symptoms, delayed responses, and small sample sizes. Models prioritize interpretability and robustness over raw predictive power.
Logistic Regression
- Estimates the probability that an allergen is associated with symptom occurrence
- Produces interpretable odds ratios for each allergen
- Uses regularization and class weighting to handle imbalance
- Evaluated using ROC AUC, symptom recall, and bootstrapped confidence intervals
Fisher Exact Test
- Exact statistical test for association in small or sparse datasets
- Confirms associations suggested by regression models
- Reports p‑values for allergen–symptom relationships
Ordinal Logistic Regression (Dose–Response)
- Models the relationship between exposure volume and symptom severity
- Preserves ordinal symptom intensity information
- Produces odds ratios with confidence intervals for exposure dose
- Supports sensitivity analysis across different post‑exposure time windows
AI‑Powered Summary & Chat
- Generates natural‑language health summaries using Claude (Anthropic API)
- Provides a conversational chat interface grounded in the user's own tracking data
- Incorporates uploaded health documents as additional context for responses
- Clearly scoped to data interpretation — not medical diagnosis
Technology stack
The application is deployed as a cloud‑based system with a static frontend and a secure API backend.
- Backend: FastAPI (Python)
- Database: PostgreSQL on NEON
- ORM: SQLAlchemy
- Authentication: JWT‑based authentication with password reset flow
- AI: Claude (Anthropic API) for health summaries and chat
- Analysis: Statistical modeling and supervised machine learning
- Data security: Field-level encryption on all sensitive health data
- Frontend: Static Progressive Web App hosted on GitHub Pages
System architecture
Static Frontend (GitHub Pages) → HTTPS (JWT‑authenticated API calls) → FastAPI Backend (Oracle) → PostgreSQL Database (NEON)
The backend exposes REST endpoints for data logging, triggering analyses, and returning metrics and plots for visualization.
Database design
The relational schema tracks users, allergens, symptoms, exposure events, symptom events, medications, check-ins, and uploaded documents over time. All timestamps are stored in UTC, sensitive fields are encrypted at rest, and all health data is scoped per user.
- Users: Account and authentication data
- Allergens: User‑defined exposure categories
- Units: Measurement units and conversions
- Allergen logs: Timestamped exposure events
- Symptoms: User‑defined symptom definitions with optional grouping
- Symptom logs: Timestamped symptom events with severity
- Medications: User‑defined medication names
- Medication regimens: Dose, unit, and active date range per medication
- Daily check-ins: Twice-daily structured wellbeing records (morning / evening)
- User documents: Uploaded health documents with extracted text for AI context
- Password reset tokens: Secure, expiring tokens for account recovery
Daily check-ins & wellbeing tracking
Users complete structured morning and evening check-ins to build a continuous picture of their wellbeing alongside allergen and symptom data.
- General variables: mood, sleep quality, fatigue, gut health, stress
- Extended variables: headache, overnight headache, brain fog, tinnitus, visual disturbance, training intensity, illness status
- Check-in trends are visualized over time and can be cross-referenced with allergen and symptom events
- Medication and check-in data can both be included in the unified time series view
Visualizations
The dashboard renders a range of interactive and static plots generated by the backend:
- Allergen importance ranking
- Symptom grouping and EDA
- Time series for allergens, symptoms, check-in variables, and medications
- Symptom calendar heatmap
- Check-in trend plots
- Triptan usage and monthly analysis
- Risk visualizations
- Dose–response analysis with event series overlays
- Model performance metrics page
Limitations & caveats
- Correlation does not imply causation
- Confounders (stress, sleep, illness) are not yet modeled
- Small sample sizes increase uncertainty
- Outputs are not intended for medical diagnosis
Future development
Planned Analysis Enhancements
- Identify and analyze recurring patterns in symptom occurrence
- Enable analysis across user‑selected date ranges
- Support logging of multiple allergens and symptoms within a single event
Data Management Improvements
- Introduce a dedicated Food table with automatic allergen assignment
- Add an editable data view allowing users to modify or delete logged entries
- Provide access to raw data for greater transparency and control
Reporting & Sharing
- Enable optional email delivery of generated reports
Architecture & Scalability
- Migrate to an alternative system architecture to support long‑term growth and scalability
Try the app
The Food–Body Connection app allows users to log foods and symptoms and receive personalised analytical reports.
Launch App