Skip to content

ydsong2/longevity-biomarker-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Longevity Biomarker Tracking System

โš ๏ธ IMPORTANT MEDICAL DISCLAIMER: This is a research and educational tool only. NOT for medical decision-making or health diagnosis.

  • Consult healthcare professionals for all health decisions
  • Biological age calculations are population-based estimates from research studies
  • Not validated for individual health assessment or treatment planning
  • Results should not influence medical care without professional consultation

CI

A comprehensive database system for tracking biomarkers and calculating biological age using scientifically validated models. Built with real NHANES health survey data and implements peer-reviewed algorithms for longevity research.

๐ŸŽฏ What This Application Does

  • Track biomarkers over time - Store and analyze 9 key health biomarkers
  • Calculate biological age - Using validated Phenotypic Age and Homeostatic Dysregulation models
  • Compare to reference ranges - Clinical and longevity-optimized ranges
  • Visualize trends - Interactive web interface for data exploration
  • Research-grade data - Built on NHANES (CDC health survey) data

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Docker & Docker Compose
  • Git
  • MySQL 8.0+

Setup (5 minutes)

# 1. Clone and navigate
git clone https://github.com/yourusername/longevity-biomarker-tracker.git
cd longevity-biomarker-tracker

# 2. Environment setup
cp .env.example .env
make install              # Creates virtual environment + installs dependencies

# 3. Start database
make db                   # Launches MySQL + Adminer web interface

# 4. Start the application (in separate terminals)
make run                  # API server โ†’ http://localhost:8000
make ui                   # Web interface โ†’ http://localhost:80

# 5. Optional: Load sample data
make etl                  # Downloads & processes NHANES data (takes ~10 min)

Verify Installation

make test                 # Should pass all tests

Visit:

๐Ÿ“ Project Structure

longevity-biomarker-tracker/
โ”œโ”€โ”€ sql/                          # ๐Ÿ—„๏ธ Database schema & seed data
โ”‚   โ”œโ”€โ”€ schema.sql                #   MySQL tables, views, indexes
โ”‚   โ””โ”€โ”€ 01_seed.sql               #   Biomarkers, models, reference ranges
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api/                      # ๐ŸŒ FastAPI REST endpoints
โ”‚   โ”‚   โ””โ”€โ”€ main.py               #   User profiles, measurements, biological age
โ”‚   โ”œโ”€โ”€ analytics/                # ๐Ÿงฎ Scientific calculations
โ”‚   โ”‚   โ””โ”€โ”€ hd.py                 #   Homeostatic Dysregulation model
โ”‚   โ””โ”€โ”€ ui/                       # ๐Ÿ’ป Web interface
โ”‚       โ”œโ”€โ”€ index.html            #   Interactive query interface
โ”‚       โ””โ”€โ”€ main.js               #   Biomarker visualizations
โ”œโ”€โ”€ etl/                          # ๐Ÿ”„ Data pipeline
โ”‚   โ”œโ”€โ”€ download_nhanes.py        #   Fetch CDC health survey data
โ”‚   โ”œโ”€โ”€ transform.ipynb           #   Clean & normalize data
โ”‚   โ””โ”€โ”€ load.sh                   #   Bulk load into database
โ”œโ”€โ”€ tests/                        # ๐Ÿงช Test suite
โ”‚   โ”œโ”€โ”€ test_api.py               #   API endpoint tests
โ”‚   โ””โ”€โ”€ test_schema.py            #   Database integrity tests
โ”œโ”€โ”€ docker-compose.yml            # ๐Ÿณ MySQL + Adminer containers
โ”œโ”€โ”€ Makefile                      # ๐Ÿ› ๏ธ Automation commands
โ””โ”€โ”€ requirements.txt              # ๐Ÿ“ฆ Python dependencies

๐Ÿงฌ Scientific Foundation

Biological Age Models

1. Phenotypic Age (Levine et al. 2018)

  • Purpose: Predicts mortality risk better than chronological age
  • Method: Regression model trained on 9 biomarkers from NHANES data
  • Validation: Tested on 42,000+ adults, published in Aging
  • Reference: PMID: 29676998

2. Homeostatic Dysregulation (Cohen et al. 2013)

  • Purpose: Measures physiological system coordination
  • Method: Mahalanobis distance from healthy young adult reference population
  • Innovation: Captures multi-system aging patterns
  • Implementation Note: We applied a linear transformation to convert HD scores to "biological age years" for comparison with Phenotypic Age - this is our methodological assumption, not from the original literature
  • Reference: PMID: 23376244

Required Biomarkers (9 total)

  1. Albumin - Protein synthesis, nutrition
  2. Alkaline Phosphatase - Liver/bone function
  3. Creatinine - Kidney function
  4. Fasting Glucose - Metabolic health
  5. High-Sensitivity CRP - Inflammation
  6. White Blood Cell Count - Immune function
  7. Lymphocyte Percentage - Immune cell distribution
  8. Mean Corpuscular Volume - Red blood cell size
  9. Red Cell Distribution Width - Blood cell variation

Data Source

  • NHANES 2017-2018 - CDC's National Health and Nutrition Examination Survey
  • Population: Nationally representative US adults
  • Sample Size: 9,000+ participants with complete biomarker panels
  • Public Domain: De-identified, freely available for research

๐Ÿ”ฌ Key Features

Database Architecture

  • MySQL 8.0 with normalized schema (BCNF compliant)
  • 9 core tables with foreign key constraints and cascade rules
  • 4 analytical views for complex queries
  • Performance indexes optimized for biomarker trend analysis

API Endpoints

  • User Management - Create profiles, track demographics
  • Biomarker Storage - Time-series measurement data
  • Biological Age Calculation - Real-time computation using validated models
  • Reference Ranges - Clinical and longevity-optimized comparisons

Web Interface

  • Interactive Queries - Explore data without SQL knowledge
  • Trend Visualization - Biomarker changes over time
  • Range Comparisons - See how values compare to healthy populations
  • Biological Age Dashboard - Track aging metrics

โš™๏ธ Development

Running Tests

make test                 # Full test suite
pytest tests/test_api.py  # API tests only
pytest tests/test_schema.py # Database tests only

Database Management

make db                   # Start database
make db-reset             # Reset schema + seed data
make seed-demo            # Load demo users for testing

Code Quality

make lint                 # Run pre-commit hooks
pre-commit run --all-files # Manual linting

ETL Pipeline

make etl                  # Full pipeline: download โ†’ transform โ†’ load
python etl/download_nhanes.py  # Download only
jupyter notebook etl/transform.ipynb  # Transform only
bash etl/load.sh          # Load only

๐Ÿฅ Reference Ranges

The system includes two types of reference ranges:

Clinical Ranges

  • Standard laboratory reference values
  • Used by healthcare providers for diagnosis
  • Based on 95% of healthy population

Longevity Ranges

  • Optimized for healthy aging
  • Derived from healthiest 20-30 year olds in NHANES
  • More restrictive than clinical ranges
  • Research-based longevity targets

๐Ÿ“Š Sample Queries

The web interface supports multiple pre-built queries including:

  • User Profiles - Demographics and latest biomarker values
  • Biological Age Calculation - Current aging metrics vs chronological age
  • Biomarker Trends - Time-series analysis of individual markers
  • Range Comparisons - Clinical vs longevity reference ranges
  • Population Analytics - Age distributions and biomarker statistics

๐Ÿ”’ Privacy & Security

  • No PHI: Uses de-identified NHANES research data only
  • Local Development: All data stays on your machine
  • No External APIs: Completely self-contained system
  • Research Use: Designed for educational and research purposes

๐Ÿค Team and Credits

Team

This application was developed by:

  • Randal Drew
  • Sam Fine
  • Kelly Luna Jimenez
  • YD Song

The team is grateful for the support of Dr. Ahmed Khaled and his TA team for their advice and feedback.

๐Ÿ“š Academic References

  1. Levine, M. E., et al. (2018). An epigenetic biomarker of aging for lifespan and healthspan. Aging, 10(4), 573-591. PMID: 29676998

  2. Cohen, A. A., et al. (2013). A novel statistical approach shows evidence for multi-system physiological dysregulation during aging. Mechanisms of Ageing and Development, 134(3-4), 110-117. PMID: 23376244

  3. Belsky, D. W., et al. (2015). Quantification of biological aging in young adults. Proceedings of the National Academy of Sciences, 112(30), PMID: 26150497.

  4. NHANES - National Health and Nutrition Examination Survey. Centers for Disease Control and Prevention. Available at: https://www.cdc.gov/nchs/nhanes/

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿšจ Important Notes

  • Research Tool Only: Not intended for clinical use
  • Educational Purpose: Designed for learning about biomarker analysis
  • Data Limitations: Based on population averages, not individual health status
  • Professional Consultation: Always consult healthcare providers for health decisions

Built with scientific rigor using peer-reviewed algorithms and real health survey data. Perfect for researchers, students, and longevity enthusiasts interested in quantified aging.

About

Longevity biomarker tracker allowing users to compare biometrics vs. population averages and calculate biological age

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors