How rmnkumrydv-cloud/glucotwin works
GlucoTwin turns wearable and health-record data into patient-specific glucose forecasts, spike alerts, uncertainty bands, and what-if comparisons. The doctor’s main workflow runs from the Streamlit dashboard through TwinService to a forecasting model; FastAPI exposes a separate service interface. The supporting preparation and modeling stages preserve causal inputs and patient-level evaluation. README-documented capabilities include the optional neural model, ensemble, explanations, and personalization. Some links rely on README or source-index references rather than complete source excerpts.
Main entry points: service.py TwinService · prepare.py Data preparation · features.py Feature fusion · train.py Model training
Components 18
Doctor experience
- Doctor dashboard
app/dashboard.py - FastAPI interface
app/api.py - TwinService
src/glucotwin/service.py
Patient data
- CGMacros data
- Data preparation
src/glucotwin/prepare.py - Wearable stream
src/glucotwin/data.py - FHIR health record
src/glucotwin/ehr.py - Data quality
src/glucotwin/quality.py
Twin modeling
- Feature fusion
src/glucotwin/features.py - Meal absorption
src/glucotwin/meals.py - Model training
src/glucotwin/train.py - LightGBM twin
src/glucotwin/models.py - P-MRGF neural twin
src/glucotwin/nn.py - Forecast ensemble
src/glucotwin/ensemble.py
Validation and serving
- Patient splits
src/glucotwin/splits.py - Forecast evaluation
src/glucotwin/evaluate.py - Model artifacts
artifacts
Other components
- Diabetologist
Connections 25
- Diabetologist → Doctor dashboard: uses
README.md - Doctor dashboard → TwinService: requests forecasts
app/dashboard.py - FastAPI interface → TwinService: serves requests
app/api.py - CGMacros data → Data preparation: provides inputs
README.md - Data preparation → Wearable stream: loads stream
src/glucotwin/prepare.py - Data preparation → FHIR health record: builds records
src/glucotwin/prepare.py - Data preparation → Feature fusion: builds dataset
src/glucotwin/prepare.py - Data preparation → Patient splits: writes splits
src/glucotwin/prepare.py - Data preparation → Data quality: reports quality
src/glucotwin/prepare.py - Feature fusion → FHIR health record: uses static features
README.md - Feature fusion → Meal absorption: models absorption
README.md - Model training → Feature fusion: trains on features
src/glucotwin/train.py - Model training → Patient splits: uses folds
src/glucotwin/train.py - Model training → LightGBM twin: fits models
src/glucotwin/train.py - Model training → Forecast evaluation: scores predictions
src/glucotwin/train.py - Model training → Model artifacts: saves models
src/glucotwin/train.py - P-MRGF neural twin → Feature fusion: uses features
src/glucotwin/nn.py - Forecast ensemble → LightGBM twin: blends forecasts
README.md - Forecast ensemble → P-MRGF neural twin: blends forecasts
README.md - TwinService → LightGBM twin: loads and predicts
src/glucotwin/service.py - TwinService → FHIR health record: reads records
src/glucotwin/service.py - TwinService → Feature fusion: builds forecast inputs
src/glucotwin/service.py - TwinService → Model artifacts: loads model data
src/glucotwin/service.py - TwinService → Forecast ensemble: may use blend
README.md - TwinService → Diabetologist: returns forecast and explanations
README.md