Performance Glycemic Intelligence System - An integrated decision-support framework for optimizing endurance training while managing Type 2 diabetes.
Read the full story behind PGIS: From Patient Data to Open Source: Why I Built the Performance Glycemic Intelligence System (PGIS)
This post explores the intersection of medicine, technology, and personal health, and explains why PGIS was released as an open-source project for physicians who code and individuals managing Type 2 diabetes.
This repository contains TEMPLATE files only. Before using this system:
- DO NOT commit personal health data to any public repository
- Customize the template files with your own baselines (see Setup section)
- Keep your personalized versions private - add them to
.gitignore - Never share screenshots containing your CGM data, names, or identifiable information
PGIS combines multiple data streams to make intelligent training decisions:
- Metabolic data: CGM readings, fasting glucose, glucose trends
- Cardiac data: Heart rate, HRV, resting heart rate
- Recovery data: Sleep duration/quality, Body Battery, DOMS
- Training load: Recent workout history, strength sessions
The system uses a traffic light model (GREEN/YELLOW/RED) to gate daily training decisions, preventing overtraining, hypoglycemia, and injury while optimizing metabolic adaptation.
- Daily Readiness Assessments: Morning reports with training recommendations
- Training Prescriptions: HR-based workout plans with fueling strategies
- Post-Workout Analysis: Performance reviews with optimization recommendations
- Audio Summaries: Podcast-style briefings using OpenAI TTS
- Visual Reports: Clinical performance audit presentations and infographics
- Python 3.8+
- OpenAI API key (for audio generation)
- Continuous Glucose Monitor (CGM) - e.g., Dexcom
- Fitness tracker with HRV/HR/sleep tracking - e.g., Garmin
git clone https://github.com/YOUR_USERNAME/pgis-manus-skill.git
cd pgis-manus-skillpip install openai# Linux/Mac
export OPENAI_API_KEY='your-api-key-here'
# Windows PowerShell
$env:OPENAI_API_KEY='your-api-key-here'For persistent setup, add to your shell profile or environment variables.
CRITICAL: Do not edit the template files directly. Create your own private copy:
# Create a private profile (add to .gitignore)
cp references/user_profile.md references/my_profile.mdEdit references/my_profile.md with your personal information:
- Age, sex, dietary preferences
- HRV baseline (track for 2 weeks to establish)
- Resting HR baseline (your typical morning RHR)
- Primary aerobic HR zone (calculate using MAF formula: 180 - age)
- Sleep requirements
- Training goals
Update the baseline values in scripts/readiness_calculator.py:
from readiness_calculator import Baselines, ReadinessCalculator
# Create custom baselines
my_baselines = Baselines(
hrv_baseline=YOUR_HRV, # Your typical HRV
rhr_baseline=YOUR_RHR, # Your typical RHR
)
calculator = ReadinessCalculator(baselines=my_baselines)mkdir -p pgis_reports
# This directory is already in .gitignorefrom scripts.readiness_calculator import ReadinessCalculator, Metrics, Baselines
# Initialize with your baselines
my_baselines = Baselines(hrv_baseline=YOUR_HRV, rhr_baseline=YOUR_RHR)
calculator = ReadinessCalculator(baselines=my_baselines)
# Input today's metrics
metrics = Metrics(
hrv=29.0,
rhr=59.0,
sleep_hours=7.5,
fasting_glucose=93.0,
doms=2,
body_battery=77,
cgm_trend="β",
illness_signs=False,
recent_strength=False,
training_load_48h="low"
)
# Calculate readiness
status, red_flags, yellow_flags = calculator.calculate(metrics)
# Generate report
report = calculator.format_report(metrics)
print(report)from scripts.audio_summary_generator import AudioSummaryGenerator
generator = AudioSummaryGenerator()
audio_path = generator.generate_daily_readiness_audio(
status="GREEN",
metrics={
'hrv': 29.0,
'rhr': 59,
'sleep_hours': 7.5,
'fasting_glucose': 93,
'cgm_trend': 'stable',
'body_battery': 77,
'doms': 2,
'recent_strength': False
},
output_path="pgis_reports/20260225-daily_readiness.mp3"
)pgis-manus-skill/
βββ README.md # This file
βββ .gitignore # Prevents committing personal data
βββ SKILL.md # Complete skill documentation
βββ references/
β βββ user_profile.md # TEMPLATE - Do not edit directly
β βββ readiness_algorithm.md # Decision logic
β βββ visual_style_guide.md # Design specifications
βββ scripts/
β βββ readiness_calculator.py # Core readiness logic
β βββ audio_summary_generator.py # TTS audio generation
βββ templates/
β βββ slide_template.md # Presentation structure
β βββ example_infographic.png # Visual reference
βββ pgis_reports/ # Your outputs (gitignored)
- 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
- Fasting glucose >85 mg/dL
- CGM trend stable or upward (β or β)
- GREEN readiness status
- Carry glucose (minimum 30g fast-acting)
- Check CGM every 10-15 minutes
- Abort if glucose <70 mg/dL
After strength sessions:
- 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
-
Never commit personal health data:
- Add your custom profile to
.gitignore - Keep
pgis_reports/directory private - Don't share screenshots with identifiable info
- Add your custom profile to
-
Use environment variables for sensitive data:
- API keys
- Personal names/identifiers
-
Fork privately if you want version control:
- Create a private fork on GitHub
- Keep your customizations there
If you'd like to contribute improvements to the TEMPLATE system (not personal customizations):
- Fork the repository
- Create a feature branch
- Ensure no personal data is included
- Submit a pull request
Do not submit:
- Personal health data
- Specific baselines or thresholds
- Screenshots with identifiable information
MIT License - See LICENSE file for details
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 diabetes management or exercise routines.
This system is designed for endurance athletes managing Type 2 diabetes, emphasizing:
- Durability and longevity over speed
- Metabolic stability and autonomic balance
- Data-driven, algorithm-based decisions
- Long-term health over short-term performance
For issues with the template system (not personal health questions):
- Open an issue on GitHub
- Check existing documentation in SKILL.md
Remember: Keep your personal health data private. This is a tool to help you make informed training decisions, not a substitute for medical care.