PGIS — Performance Glycemic Intelligence System hero image showing a physician's wrist with Garmin watch, CGM data, and Python code
System Activev1.0 · Open Source

Performance
Glycemic
Intelligence

An open-source, data-driven decision framework for optimizing endurance training while managing Type 2 diabetes. Built by a physician. For athletes and patients.

HRV Baseline30–31ms
Glucose Target<100mg/dL
Aerobic HR Zone118–128bpm

What is PGIS?

A Decision Engine for the Athlete-Patient

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.

Metabolic

CGM readings, fasting glucose, glucose trends

Source: Dexcom CGM

Cardiac

Heart Rate Variability (HRV), resting heart rate

Source: Garmin Watch

Recovery

Sleep duration & quality, Body Battery, DOMS

Source: Garmin / Manual

Training Load

Recent workout history, strength sessions

Source: Manual Input

Readiness Status Model
GREENFull Training Clearance

All metrics within 10% of baseline. Sleep ≥7 hrs, glucose stable. Proceed with planned training.

YELLOWModified Training

Metrics 10–15% off baseline. Sleep 6–7 hrs. Reduce intensity and duration, avoid fasted training.

REDRest & Recovery

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.

Dr. Chukwuma Onyeije

Maternal–Fetal Medicine Specialist

Physician-Developer · DoctorsWhoCode.blog

Endurance Athlete · Type 2 Diabetes (24 yrs)

Goal: Half Marathon · Thanksgiving 2026

Age60
T2D Diagnosis24 years
DietVegan
PhilosophyDurability over speed

The Story

From Patient Data
to Open Source

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."

— Dr. Chukwuma Onyeije

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."

— DoctorsWhoCode.blog Philosophy

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

The System in Action

Six integrated capabilities, one unified decision framework.

Daily Readiness Assessment

Morning reports synthesizing HRV, glucose, sleep, and training load into a single GREEN/YELLOW/RED status with specific training recommendations.

Training Prescription

HR-based workout plans with fueling strategies tailored to your readiness status. Includes warmup/cooldown requirements and safety protocols.

Post-Workout Analysis

Performance reviews assessing HR zone compliance, metabolic response, and recovery predictions with optimization recommendations.

Audio Summaries

Podcast-style briefings using OpenAI TTS — a conversational sports medicine consultant delivering your daily readiness report.

Visual Reports

Clinical performance audit presentations and infographics with dark-field design, metric comparisons, and CGM trend overlays.

Privacy by Design

Template-only repository. Your personal health data stays local. Gitignore rules prevent accidental commits of sensitive information.

Get Started in Minutes

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).

readiness_example.py
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)">aselines
my_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 establish
rhr_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 metrics
metrics = 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)"># Stable
recent_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 status
status, 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

Why Open Source Matters

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.

Transparency over the Black Box

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.

A Foundation, Not a Fortress

Fork it, adapt the algorithms for different patient profiles, integrate new data sources, or build entirely new applications upon this framework.

Physicians Must Build, Not Just Consume

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.

Logs Before Intelligence

Data discipline precedes AI insight. PGIS enforces structured data collection as a prerequisite to any meaningful algorithmic recommendation.

DoctorsWhoCode.blog — Core Philosophy

  1. 1.Physicians must build, not just consume, technology.
  2. 2.AI should restore presence in medicine — not replace it.
  3. 3.Technical literacy is professional self-defense.
  4. 4.Workflows should be engineered deliberately.
  5. 5.Logs before intelligence (data discipline precedes AI insight).
  6. 6.Compassion and precision are not mutually exclusive.

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.

Star Fork Watch
View Repository

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

Reclaim Agency Over Your Health

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.

Fasted Run Requirements

  • Fasting glucose >85 mg/dL before starting
  • CGM trend stable or upward (→ or ↑)
  • GREEN readiness status required
  • Carry minimum 30g fast-acting glucose
  • Check CGM every 10–15 minutes
  • Abort immediately if glucose <70 mg/dL

Post-Strength Hypoglycemia Prevention

  • Bedtime fueling: 20–30g complex carbs + 10–15g protein
  • Set CGM low alert to 75 mg/dL
  • Keep fast-acting glucose at bedside
  • Monitor overnight glucose trends

Privacy by Design

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.

  • Never commit personal health data to any public repository
  • Create private local copies of your profile — add them to .gitignore
  • Use environment variables for API keys and sensitive identifiers
  • Fork privately on GitHub to version-control your customizations
  • Keep your pgis_reports/ directory local and private
Medical Disclaimer

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.

Built on These Values

Durability and longevity over speed
Metabolic stability and autonomic balance
Data-driven, algorithm-based decisions
Long-term health over short-term performance

Get Started Today

Build Your Own Intelligence System

Fork the repository, customize your baselines, and start making data-driven training decisions today. The framework is yours to adapt.