
An open-source, data-driven decision framework for optimizing endurance training while managing Type 2 diabetes. Built by a physician. For athletes and patients.
What is PGIS?
PGIS is an integrated, data-driven decision-support framework designed to answer a critical question every morning: "What training is safe and effective for my body today?"
It is not a commercial app, but a personal algorithm that synthesizes multiple, critical data streams to provide a clear, actionable recommendation. The system was built on a foundational principle: Logs before Intelligence — disciplined data collection precedes any meaningful insight.
CGM readings, fasting glucose, glucose trends
Source: Dexcom CGM
Heart Rate Variability (HRV), resting heart rate
Source: Garmin Watch
Sleep duration & quality, Body Battery, DOMS
Source: Garmin / Manual
Recent workout history, strength sessions
Source: Manual Input
All metrics within 10% of baseline. Sleep ≥7 hrs, glucose stable. Proceed with planned training.
Metrics 10–15% off baseline. Sleep 6–7 hrs. Reduce intensity and duration, avoid fasted training.
Metrics >15% off baseline. Sleep <6 hrs, glucose unstable. Complete rest, focus on recovery.
Clinical Note: The traffic-light model gates daily training decisions, preventing overtraining, hypoglycemia, and injury while optimizing metabolic adaptation.
Maternal–Fetal Medicine Specialist
Physician-Developer · DoctorsWhoCode.blog
Endurance Athlete · Type 2 Diabetes (24 yrs)
Goal: Half Marathon · Thanksgiving 2026
The Story
As a physician-developer and a 60-year-old endurance athlete living with Type 2 diabetes for over two decades, I have navigated a unique intersection of medicine, technology, and personal health. My journey is a constant balancing act between the drive for athletic performance and the non-negotiable demands of glycemic control.
"The most powerful tools are often the ones we build ourselves, born from a deep understanding of the problem we aim to solve."
At the heart of my work with DoctorsWhoCode.blog is a core belief: physicians must transition from being passive consumers of technology to active builders. We are the ones in the trenches of clinical care, and we possess an unmatched understanding of the intricate workflows and unmet needs within healthcare.
PGIS is my personal embodiment of this principle. It is a direct response to the realization that existing commercial solutions, while excellent for general fitness, lacked the specific, nuanced integration of metabolic data required for an aging athlete managing a chronic condition like diabetes. I needed a system that prioritized not just speed, but durability; not just performance, but metabolic stability and long-term health.
Clinical Context: After 24 years of well-controlled Type 2 diabetes, the physiological demands of endurance training introduce unique risks — including nocturnal hypoglycemia after strength sessions, impaired recovery at age 60, and the complex interplay between exercise-induced glucose fluctuations and autonomic balance. PGIS was built to navigate these risks with precision.
The decision to publish PGIS on GitHub is a deliberate act of transparency. By open-sourcing the core logic, we invite scrutiny, collaboration, and trust. You can see the precise algorithms that translate raw data into a readiness score — a stark contrast to proprietary systems where the decision-making process is opaque.
"Technical literacy is professional self-defense. Physicians who code are physicians who lead."
Technology in medicine should not replace the clinician's judgment — it should augment it. It should restore our presence with the patient, powered by data-driven insights. PGIS is my contribution to this vision, and I invite you to explore, adapt, and build upon it.
How It Works
Six integrated capabilities, one unified decision framework.
Morning reports synthesizing HRV, glucose, sleep, and training load into a single GREEN/YELLOW/RED status with specific training recommendations.
HR-based workout plans with fueling strategies tailored to your readiness status. Includes warmup/cooldown requirements and safety protocols.
Performance reviews assessing HR zone compliance, metabolic response, and recovery predictions with optimization recommendations.
Podcast-style briefings using OpenAI TTS — a conversational sports medicine consultant delivering your daily readiness report.
Clinical performance audit presentations and infographics with dark-field design, metric comparisons, and CGM trend overlays.
Template-only repository. Your personal health data stays local. Gitignore rules prevent accidental commits of sensitive information.
The readiness calculator is the core decision engine. Clone the repository, set your personal baselines, and run your first assessment with a handful of lines of Python.
Prerequisites: Python 3.8+, OpenAI API key (for audio generation), a CGM device (e.g., Dexcom), and a fitness tracker with HRV/HR/sleep tracking (e.g., Garmin).
0.82 0.16 80)">"color:oklch(0.52 0.22 295)">from scripts.readiness_calculator 0.82 0.16 80)">"color:oklch(0.52 0.22 295)">import (ReadinessCalculator, Metrics, B0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselines)0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># Initialize with your personal b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselinesmy_b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselines = B0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselines(hrv_b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aseline=YOUR_HRV, 0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># Track 2 weeks to establishrhr_b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aseline=YOUR_RHR,)calculator = ReadinessCalculator(b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselines=my_b0.82 0.16 80)">"color:oklch(0.52 0.22 295)">aselines)0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># Input today's metricsmetrics = Metrics(hrv=29.0,rhr=59.0,sleep_hours=7.5,f0.82 0.16 80)">"color:oklch(0.52 0.22 295)">asting_glucose=93.0,doms=2,body_battery=77,cgm_trend=0.82 0.16 80)">"→", 0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># Stablerecent_strength=False,training_load_48h=0.82 0.16 80)">"low")0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># Get your readiness statusstatus, red_flags, yellow_flags = calculator.calculate(metrics)report = calculator.format_report(metrics)print(report) 0.82 0.16 80)">"color:oklch(0.6 0.01 286)"># → 🟢 GREEN — Cleared for training
For Physicians Who Code
The decision to place the PGIS framework on GitHub is rooted in the mission to empower both clinicians and patients. For physician-developers, this project serves as both a practical tool and a call to action.
You can see the precise algorithms that translate raw data into a readiness score. As clinicians, we should demand to understand the logic behind the tools we use.
Fork it, adapt the algorithms for different patient profiles, integrate new data sources, or build entirely new applications upon this framework.
Technical literacy is professional self-defense. PGIS is a working example of what happens when a clinician applies engineering discipline to a personal health challenge.
Data discipline precedes AI insight. PGIS enforces structured data collection as a prerequisite to any meaningful algorithmic recommendation.
DoctorsWhoCode.blog — Core Philosophy
chukwumaonyeije/pgis-manus-skill
MIT License · Open Source
Performance Glycemic Intelligence System — An integrated decision-support framework for optimizing endurance training while managing Type 2 diabetes.
Repository Structure
references/user_profile.md
TEMPLATE — Your personal baseline profile
references/readiness_algorithm.md
Decision logic documentation
references/visual_style_guide.md
Design specifications for reports
scripts/readiness_calculator.py
Core readiness logic engine
scripts/audio_summary_generator.py
TTS audio generation (OpenAI)
templates/slide_template.md
Presentation structure template
SKILL.md
Complete skill documentation
For People with Type 2 Diabetes
PGIS equips you with a tool to have more informed conversations with your healthcare providers. By tracking your own data and understanding the patterns it reveals, you move from passive patient to active, informed partner in your own care.
PGIS is intentionally designed so that you never commit your personal health data to a public repository. Your health information remains securely under your control.
This system is for informational and educational purposes only. It is not medical advice and should not replace consultation with healthcare professionals. Always consult with your physician before making changes to your diabetes management or exercise routines.
Get Started Today
Fork the repository, customize your baselines, and start making data-driven training decisions today. The framework is yours to adapt.