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
- Stores structured health data in a relational PostgreSQL database
- Aligns exposure and symptom events using time‑aware windows
- Analyzes relationships between allergens and symptoms
- Generates personalized reports highlighting potential trigger foods
- Supports elimination diets and long‑term tracking strategies
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
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
- Analysis: Statistical modeling and supervised machine learning
- Frontend: Static site hosted on GitHub Pages
System architecture
Static Frontend (GitHub Pages) → HTTPS (JWT‑authenticated API calls) → FastAPI Backend (AWS) → 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, and symptom events over time. All timestamps are stored in UTC, and allergens and symptoms are 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
- Symptom logs: Timestamped symptom events with severity
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