Inspiration

India has more than 100 million adults living with diabetes, and many more with prediabetes. In most homes the routine is the same: prick a finger, see a number, feel guilty, repeat. The glucometer tells you what your sugar is, but never why. Why did last night's dinner push it to 240? Would two rotis instead of rice have helped? Would a short walk after lunch make a difference?

Doctor visits are short, diet charts are generic and rarely built around Indian food, and experimenting on your own body is slow and risky. We wanted to give people a safe place to ask "what if?" before they live it. Engineers test planes on a digital twin before flying them, so we asked: why can't a patient test tomorrow's meal on a twin of their own body?

What it does

GlucoTwin builds a personal digital twin of a user's glucose-insulin system that runs entirely in the browser.

  • Create your twin: enter age, weight, activity level, HbA1c and medication. Your personal model is built in under a minute.
  • Day Simulator: place meals, walks and medicines on a 24-hour timeline and watch your predicted glucose curve respond live.
  • Indian Food Library: about 30 everyday foods (roti, rice, dal, poha, idli, dosa, chai, samosa, fruit) with carbohydrate and glycemic index values and portion controls.
  • Compare Mode: put two scenarios side by side, such as rice vs roti at dinner or a walk vs no walk, and compare peak glucose, time in range and hours spent high.
  • Calibrate My Twin: enter a few real glucometer readings and watch the twin's curve fit itself to your body, with an accuracy score.
  • Insight Coach: plain-language explanations of every curve, one small change to try each week, and an estimate of how much it would help.
  • Safety guardrails: calm alerts to talk to a doctor when a pattern looks unsafe. GlucoTwin is an educational tool, not a medical device.

How we built it

The physiological engine. At the core is the Bergman minimal model, a well-established, peer-reviewed model of how glucose and insulin interact. It tracks three quantities: blood glucose \( G \), insulin action \( X \), and plasma insulin \( I \):

$$\frac{dG}{dt} = -\left(p_1 + X\right)G + p_1 G_b + \frac{R_a(t)}{V_g}$$

$$\frac{dX}{dt} = -p_2 X + p_3\left(I - I_b\right)$$

$$\frac{dI}{dt} = -n\left(I - I_b\right) + \gamma \max\left(G - h,\ 0\right)$$

We solve these with a fourth-order Runge-Kutta method at one-minute steps across a full 24-hour day.

Food, walks and medicine. Each meal becomes a glucose absorption curve \( R_a(t) \) whose shape depends on carbohydrates and glycemic index, so low-GI foods rise slower and lower. A walk temporarily raises insulin sensitivity and adds direct glucose uptake by muscles. Metformin gradually lowers the liver's baseline glucose output.

Personalization. HbA1c is converted to estimated average glucose using the ADA formula:

$$\text{eAG} = 28.7 \times \text{HbA1c} - 46.7$$

This, together with weight and activity level, sets the user's starting parameters.

Calibration (the learning step). When a user enters real readings, the twin searches over two personal parameters, insulin sensitivity and beta-cell response, to minimise the error between simulated and real glucose:

$$\text{RMSE} = \sqrt{\frac{1}{N}\sum_{i=1}^{N}\left(G_{\text{twin}}(t_i) - G_{\text{real}}(t_i)\right)^2}$$

It uses a coarse-to-fine grid search, which runs in well under a second in the browser.

Insight engine. A rule-based engine reads each simulated curve to find the biggest spike and the meal that caused it, long stretches above 180 mg/dL, and low-glucose risk. It then re-runs the simulation with a suggested change to estimate the real benefit.

Stack. Next.js, TypeScript and Tailwind CSS for the interface, Recharts for the charts, a framework-free TypeScript simulation engine with Vitest unit tests, and deployment on Vercel. There is no backend and there are no API keys. All data stays on the user's device.

Challenges we ran into

  • Making the physiology behave. The textbook minimal model describes healthy people. Tuning it to represent Type 2

Built With

Share this project:

Updates

Submission history