← Back to Portfolio
M.Sc. Thesis · Live Product · 2023–2025

DiaTwin

Clinical AI insulin dosing support system for Type 1 Diabetes — integrating a proprietary PK/PD engine, Gemini Vision food scanning, and real-time CGM monitoring into a production-grade monorepo platform.

CE Class IIa Pathway DiGA Fast-Track TRL 4–5 AWMF S3 Guideline 057-013
8.7/10

Clinical utility score by LMU Munich. Dual-platform PK/PD engine with bit-for-bit identical Python + TypeScript implementations. RL layer trained on 50,000+ real meal-outcome pairs.

DiaTwin — Main app interface
8.7 Clinical Utility Score / 10
50k+ Meal-Outcome Pairs (RL Layer)
14 Insulin Analogues Supported
3 Platforms (API, Web PWA, Mobile)
Core Features

What DiaTwin Does

⚗️

Proprietary PK/PD Engine

Dual-platform gamma engine (Python + TypeScript, bit-for-bit identical) modelling Insulin on Board (IOB) and Meal on Board (MOB) with circadian baseline correction. Covers 14 insulin analogues per AWMF S3 guideline 057-013.

📸

AI-Powered Nutrition Scanning

Gemini 2.5 Flash Vision pipeline converts food photos into structured nutrition data instantly — carbohydrates, protein, fat, glycaemic index — no manual entry required.

📡

Real-Time CGM Integration

Abbott FreeStyle Libre / LibreLinkUp integration with automatic unit conversion and token caching. Glucose trends fed directly into the dosing algorithm.

🧠

Reinforcement Learning Layer

RL model trained on 50,000+ real meal-outcome pairs personalises dosing suggestions over time, adapting to individual patient response patterns.

🔒

Security & Encryption

JWT HS256 authentication and Fernet symmetric encryption for CGM credentials at rest and in transit. SecureStore for mobile credential management.

Performance Optimisation

60-second in-process LRU cache for patient constants to absorb mobile cold-start bursts. Redis-backed session management and Vercel edge deployment.

AI Food Scanning

From photo to nutrition data in seconds

Point the camera at any meal — the Gemini 2.5 Flash Vision pipeline extracts a full nutritional breakdown and calculates the optimal carbohydrate-insulin ratio based on the patient's personal PK/PD profile.

Gemini 2.5 Flash Vision API Structured JSON output
DiaTwin — AI food scanning interface
CGM Monitoring

Real-time glucose trends & IOB overlay

Live glucose data from Abbott FreeStyle Libre is overlaid with the calculated Insulin on Board curve, giving patients and clinicians a clear picture of the active insulin-glucose interplay at any moment.

Abbott LibreLinkUp Auto unit conversion Token caching
DiaTwin — CGM dashboard and IOB graph
Technical Architecture

Scalable · Secure · Monorepo

// Backend

Python / Flask REST API

35+ REST endpoints. PK/PD computation, RL inference, CGM proxy, and nutrition parsing all server-side. JWT middleware on every protected route.

Flask · MongoDB Atlas · Redis · Render
// Web

React 18 PWA

Progressive Web App with offline capability, service workers, and responsive layouts. Deployed on Vercel with edge caching.

React 18 · TypeScript · Zustand · Vercel
// Mobile

Expo / React Native

Cross-platform mobile app (iOS + Android) with SecureStore for credential management, Expo Camera for food scanning, and EAS Build.

React Native · Expo · EAS · SecureStore

[ DiaTwin Monorepo Architecture Diagram ]

Add your own architecture diagram here

Mobile Experience

iOS & Android App

DiaTwin — Mobile home screen DiaTwin — Mobile food scan screen DiaTwin — Mobile CGM dashboard