Inspiration

Diabetes management still relies heavily on invasive or semi-invasive glucose monitoring. I wanted to explore a different question: can physiological signals already available from wearable devices contain enough information to estimate glycemic state?

That became the foundation for GlycemicPlus, a research prototype that uses photoplethysmography (PPG) data from a wearable sensor to estimate whether a person is experiencing hypoglycemia, is within range, or is experiencing hyperglycemia.

The goal was never to claim that PPG directly measures blood glucose or to replace a continuous glucose monitor. Instead, I wanted to investigate whether wearable cardiovascular signals could provide an additional, non-invasive layer of glycemic-risk awareness.

As a solo developer, I built the complete pipeline myself—from dataset preprocessing and signal analysis to model development, evaluation, visualization, and deployment.

What it does

GlycemicPlus analyzes five-minute windows of wearable PPG data and estimates three glycemic states:

  • Hypoglycemia
  • In range
  • Hyperglycemia

The system uses a hybrid architecture with two complementary approaches.

A CatBoost gradient-boosted model analyzes engineered physiological features extracted from the PPG waveform, while a Temporal Convolutional Network (TCN) learns temporal representations directly from the raw waveform.

Their probability outputs are combined into a final hybrid prediction.

For validation, I compare those predictions against Dexcom CGM measurements used strictly as ground truth. CGM glucose values are never provided to the prediction model.

I also built a replay dashboard that allows users to inspect model probabilities, confidence, historical glucose trajectories, and the corresponding Dexcom ground truth.

How we built it

I used the PhysioCGM dataset, which contains synchronized Dexcom G6 glucose measurements and wearable physiological signals.

The development pipeline was divided into several stages.

First, I audited and processed the raw physiological data, filtered unusable windows, standardized each five-minute PPG segment to 19,200 samples, and created compressed HDF5 datasets for all participants.

I then built several baselines, including Random Forest, XGBoost, and a simple 1D CNN. Subject-independent evaluation revealed substantial cross-person variability, so I preserved those experiments as a test of generalization and created a second evaluation protocol based on chronological personalization.

For the final prototype, each participant's observations were divided chronologically:

70% training → 15% validation → 15% testing

This prevents future observations from leaking backward into training while allowing the model to learn participant-specific physiological characteristics.

The final architecture combines:

CatBoost

  • heart-rate and variability-related characteristics
  • waveform statistics
  • derivative features
  • frequency-domain PPG features
  • pulse-related measurements

Temporal Convolutional Network

  • raw five-minute PPG waveform
  • dilated temporal convolutions
  • residual blocks
  • multi-scale temporal pattern learning

Hybrid ensemble

  • validation-selected fusion of CatBoost and TCN probabilities

On the chronological test set, the models produced:

Model Macro F1 Balanced Accuracy
CatBoost 0.2766 0.3618
TCN 0.3080 0.3528
Hybrid 0.3289 0.3811

The hybrid model performed better than either component alone, suggesting that engineered physiological features and learned temporal representations contain complementary information.

The project was developed primarily with Python, PyTorch, CatBoost, scikit-learn, NumPy, Pandas, SciPy, HDF5, Google Colab, GitHub, Plotly, and Streamlit.

Challenges we ran into

The largest challenge was inter-subject physiological variability.

My initial assumption was that training across multiple people would produce a model that generalized naturally to an unseen participant. Instead, subject-independent evaluation showed that performance could fall close to chance.

For example, a Random Forest evaluated using leave-one-subject-out testing achieved approximately 0.336 balanced accuracy, with essentially no hypoglycemia detection. Even the raw PPG CNN struggled to transfer consistently between participants.

That forced me to rethink the problem instead of simply increasing model complexity.

Another major challenge was extreme class imbalance. Most observations were within the normal glucose range, while hypoglycemic windows were comparatively rare. A model could therefore achieve deceptively high raw accuracy simply by predicting "In Range."

Because of this, I focused on metrics such as Macro F1, balanced accuracy, per-class recall, AUROC, and AUPRC rather than relying on accuracy alone.

The raw PPG signal was also challenging. Motion artifacts, sensor contact, baseline physiological differences, and transient noise can strongly affect wearable optical signals.

Finally, I had to resist the temptation to overfit. As the model became more complex, maintaining strict separation between training, validation, and testing became increasingly important.

Accomplishments that we're proud of

As a solo developer, I am especially proud that GlycemicPlus became much more than a single machine-learning notebook.

I built an end-to-end research pipeline that includes:

  • physiological signal auditing and preprocessing
  • reproducible HDF5 datasets
  • handcrafted PPG feature extraction
  • multiple classical and deep-learning baselines
  • subject-independent evaluation
  • chronological personalized evaluation
  • a gradient-boosted tree model
  • a specialized temporal deep-learning model
  • a hybrid ensemble
  • probability-level ground-truth comparison
  • uncertainty-aware predictions
  • replayable JSON exports
  • an interactive dashboard

I am also proud that the project did not hide weak results.

Some experiments failed. Random Forest essentially collapsed to the majority class under unseen-subject evaluation. The CNN showed substantial cross-subject instability. Those failures became useful evidence that personalization and domain shift are central challenges in wearable physiological modeling.

The strongest final model is still an early research prototype, but the project now provides a reproducible framework for investigating the problem rather than just presenting an optimistic demo.

What we learned

The biggest lesson was that physiological machine learning is fundamentally different from ordinary tabular classification.

Thousands of waveform windows do not necessarily mean thousands of independent observations when they originate from only a small number of people.

I learned how important participant-level evaluation is. Randomly shuffling physiological windows can produce misleading performance because the model may learn a person's characteristic PPG signature rather than a general glycemic relationship.

I also learned that engineered features and deep learning do not have to compete. In GlycemicPlus, CatBoost and the TCN capture different aspects of the signal, and combining them performed better than either model independently.

Most importantly, I learned to treat model uncertainty as part of the product rather than something to hide. If the system predicts:

36.2% Hyperglycemia vs 36.0% In Range

it should not present that as a confident medical determination. GlycemicPlus therefore includes an uncertainty layer designed to distinguish between a model prediction and a prediction that has enough separation to be meaningfully displayed.

What's next for GlycemicPlus

The next stage is to move beyond PPG-only modeling.

The dataset also contains wearable-compatible signals such as accelerometry, heart rate, temperature, and electrodermal activity. Combining those modalities may help the system distinguish glycemic physiology from motion, stress, exercise, and sensor artifacts.

I also want to investigate more advanced temporal architectures, including Conformers and multimodal representation learning, while preserving strict participant-level evaluation.

Another major direction is personalization. The current results suggest that a future system may work best as:

general pretrained model → short personal calibration period → individualized glycemic-risk model

Eventually, I would like to investigate prospective integration with consumer wearables such as Wear OS devices and evaluate whether the system can provide useful early-warning information in real-world conditions.

GlycemicPlus is currently an experimental research prototype, not a medical device and not a replacement for CGM or treatment decisions.

The longer-term goal is to determine whether everyday wearable physiology can become a useful complementary signal for understanding glycemic risk.

Built With

Share this project:

Updates

Submission history