Hypertension management

Reading File
Finding Sources
Finding Sources
Searching PubMed

"hypertension" AND "management" AND "guidelines"

Searching the Web

hypertension management guidelines 2025 2026 ACC AHA ESC

Reading File
Reading File
Reading File
Reading Web Page

https://journalfeed.org/article-a-day/2025/new-2025-aha-acc-…

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
I now have comprehensive data. Let me compile the full response.

Hypertension Management

A complete, evidence-based guide aligned with the 2025 AHA/ACC Multisociety Guideline (PMID: 40811516) and the 2024 ESC Guideline, supplemented by Harrison's 22E, Goldman-Cecil Medicine, and Comprehensive Clinical Nephrology.

1. Classification of Blood Pressure in Adults

CategorySystolic (mmHg)Diastolic (mmHg)
Normal<120AND<80
Elevated120-129AND<80
Stage 1 Hypertension130-139OR80-89
Stage 2 Hypertension≥140OR≥90
Hypertensive Crisis>180AND/OR>120
The 2025 AHA/ACC guidelines retain the 2017 staging system. The 2024 ESC guideline uses a slightly different schema (elevated BP: 120-139/80-89; Grade 1: 140-159/90-99; Grade 2: ≥160/≥100), but the treatment threshold of ≥140/90 mmHg is aligned across both.

2. Diagnostic Evaluation

Confirming the Diagnosis

  • Accurate BP measurement is essential: seated, rest 5 minutes, average ≥2 readings on ≥2 occasions
  • Out-of-office BP measurement is preferred: ambulatory BP monitoring (ABPM) or home BP monitoring
  • Rule out white-coat hypertension (elevated in-office, normal ambulatory)
  • Rule out masked hypertension (normal in-office, elevated ambulatory)

Initial Work-up

  • Basic labs: Serum electrolytes, creatinine, eGFR, fasting glucose, lipid panel, urinalysis + urine albumin-to-creatinine ratio (ACR)
  • ECG: Screen for LVH, arrhythmias
  • Echocardiogram: If LVH suspected or signs of heart failure

Secondary Hypertension Screening

Suspect when: onset before age 30, resistant HTN, abrupt worsening, hypokalemia, abdominal bruit
CauseClueTest
Primary aldosteronismHypokalemia, resistant HTNAldosterone/renin ratio
Renal artery stenosisAbdominal bruit, worsening on ACEiDoppler ultrasound, CTA
CKDElevated creatinine, proteinuriaeGFR, urine ACR
Obstructive sleep apneaSnoring, daytime sleepiness, obesityPolysomnography
PheochromocytomaParoxysmal HTN, headache, sweating, palpitations24h urinary metanephrines
Cushing's syndromeCentral obesity, striae, buffalo hump24h urinary cortisol
Hypothyroidism / HyperthyroidismWeight changes, fatigue, palpitationsTSH
New in 2025: Primary aldosteronism screening is recommended for all patients with stage 2 hypertension and those with resistant hypertension, even without hypokalemia (Class 2b). Antihypertensives (except MRAs) should NOT be stopped before aldosterone/renin ratio testing.

3. Cardiovascular Risk Assessment

The 2025 AHA/ACC guidelines formally incorporate the PREVENT risk score (replacing the old Pooled Cohort Equations) to guide treatment decisions in Stage 1 hypertension. Key risk enhancers include:
  • Diabetes
  • CKD
  • LVH
  • Atherosclerotic CVD (ASCVD)
  • History of stroke
  • Albuminuria

4. Treatment Thresholds

BP StageCV RiskRecommendation
Elevated BP (120-129/< 80)AnyLifestyle modification only; no drug therapy
Stage 1 (130-139/80-89)Low-to-moderate riskLifestyle modification; pharmacotherapy guided by PREVENT risk score
Stage 1 (130-139/80-89)High risk (ASCVD, DM, CKD, ≥10% 10-yr ASCVD risk)Lifestyle + pharmacotherapy
Stage 2 (≥140/≥90)AnyLifestyle + pharmacotherapy (initiate 2 drugs)
Both 2025 AHA/ACC and 2024 ESC agree: pharmacotherapy is recommended when average SBP ≥140 mmHg or DBP ≥90 mmHg regardless of CV risk.

5. BP Treatment Targets

  • Universal goal (2025 AHA/ACC): SBP < 130/80 mmHg for most adults on treatment
  • CKD (KDIGO 2021): SBP < 120 mmHg (controversial; based on SPRINT)
  • CKD with diabetes or proteinuria > 1 g/24h: < 130/80 mmHg (Harrison's 22E)
  • Elderly (≥80 years): Target SBP ~150 mmHg (HYVET trial); avoid over-treatment
  • Avoid excessive DBP lowering (< 60-65 mmHg) in patients with CAD due to risk of reducing coronary perfusion

6. Lifestyle Interventions

All patients with elevated BP or hypertension should be counseled on the following (NKF Primer on Kidney Diseases, 8e):
ModificationRecommendationExpected SBP Reduction
Weight reductionMaintain BMI 18.5-24.95-20 mmHg per 10 kg lost
DASH dietRich in fruits, vegetables, low-fat dairy; low saturated fat8-14 mmHg
Sodium restriction< 2,300 mg sodium/day (< 100 mmol/day)2-8 mmHg
Aerobic exercise≥ 30 min/day, most days of the week5-8 mmHg
Dynamic resistance exercise90-150 min/wk; 6 exercises, 3 sets × 10 reps4 mmHg
Isometric exercise (hand grip)4 × 2 min, 3 sessions/wk5 mmHg
Alcohol moderation≤ 2 drinks/day (men); ≤ 1 drink/day (women)2-4 mmHg
The DASH diet alone produces the greatest single dietary effect: net SBP reduction of ~7.6 mmHg and DBP ~4.2 mmHg.

7. Pharmacotherapy

First-Line Drug Classes

The 2025 AHA/ACC recommends initiating with ≥1 of:
  1. Thiazide-type diuretic (preferably chlorthalidone or indapamide over hydrochlorothiazide)
  2. Long-acting dihydropyridine calcium channel blocker (CCB) (e.g., amlodipine)
  3. ACE inhibitor (ACEi) OR Angiotensin receptor blocker (ARB) - never combine both

Initial Drug Strategy

SituationStrategy
Stage 1, low-moderate risk1 first-line agent; titrate before adding
Stage 1, high risk1-2 agents; combination if needed
Stage 2Start with 2 first-line agents of different classes, ideally as a single-pill combination (SPC)
High-risk Stage 1 with comorbiditiesConsider SPC upfront

Drug Class Summary

ClassKey AgentsMain IndicationKey Side Effects
Thiazide-type diureticsChlorthalidone, indapamide, HCTZFirst-line, systolic HTN, elderlyHypokalemia, hyperuricemia, glucose intolerance
Dihydropyridine CCBsAmlodipine, nifedipine LAFirst-line, isolated systolic HTN, elderly, Black patientsAnkle edema, flushing, reflex tachycardia
ACE inhibitorsLisinopril, enalapril, ramiprilFirst-line, HFrEF, CKD, diabetesACE cough (10-20%), hyperkalemia, angioedema, AKI
ARBsLosartan, valsartan, olmesartanAs above; use when ACEi not toleratedHyperkalemia, AKI (no cough)
Non-dihydropyridine CCBsVerapamil, diltiazemHTN with AF, anginaBradycardia, constipation (verapamil), AV block; avoid HFrEF
Beta-blockersMetoprolol, carvedilol, bisoprololCAD, post-MI, HFrEF, AFBradycardia, bronchospasm, fatigue, erectile dysfunction
Aldosterone antagonists (MRAs)Spironolactone, eplerenoneResistant HTN, HFrEF, primary aldosteronismHyperkalemia, gynecomastia (spiro)
Loop diureticsFurosemide, torsemideCKD with eGFR < 25-30, volume overloadElectrolyte wasting, ototoxicity
Central sympatholyticsClonidine, methyldopaResistant HTN (late add-on); methyldopa in pregnancySedation, rebound HTN on abrupt stop
Direct vasodilatorsHydralazine, minoxidilResistant HTN, pregnancy (hydralazine)Reflex tachycardia, fluid retention; lupus-like syndrome (hydralazine); hirsutism (minoxidil)
Alpha-blockersDoxazosin, prazosinBPH + HTNOrthostatic hypotension
Drug interactions to note (Goldman-Cecil Medicine): NSAIDs raise BP and impair renal function. Verapamil/diltiazem are potent CYP3A4 inhibitors - reduce statin doses when co-prescribing. Grapefruit significantly increases dihydropyridine CCB bioavailability (except amlodipine).

8. Compelling Indications - Drug Selection by Comorbidity

ComorbidityPreferred Drug(s)
HFrEFACEi/ARB + beta-blocker + MRA + ARNI (sacubitril/valsartan)
Post-MI / Stable CADBeta-blocker + ACEi or ARB; add dihydropyridine CCB for angina; add thiazide/MRA for resistant BP
LVHARB or ACEi (best LVH regression); avoid direct vasodilators
Diabetes, normal renal functionACEi or ARB + CCB ± thiazide
CKD with albuminuria (DKD)ACEi or ARB (slows progression); add CCB ± chlorthalidone; loop diuretic if eGFR < 25
AF (rate control)Beta-blocker or non-DHP CCB
Stroke/TIA (secondary prevention)Any agent; restart a few days post-stroke
Elderly/ISHThiazide or long-acting DHP CCB
Black patientsThiazide + DHP CCB (ACEi/ARBs less effective as monotherapy)
PregnancyMethyldopa, labetalol, nifedipine (avoid ACEi/ARBs - teratogenic)
Primary aldosteronismMRA (spironolactone or eplerenone)
Resistant HTNAdd MRA; consider clonidine, minoxidil, or hydralazine as later add-ons

9. Resistant Hypertension

Defined as BP ≥130/80 mmHg despite adherence to ≥3 antihypertensive drugs at maximally tolerated doses (including a diuretic), or requiring ≥4 drugs to reach goal.

Approach:

  1. Confirm true resistance (exclude white-coat effect, non-adherence, improper technique)
  2. Review and remove BP-raising drugs (NSAIDs, acetaminophen, oral contraceptives, decongestants, stimulants, licorice, cyclosporine)
  3. Optimize diuretic (switch to chlorthalidone; add loop diuretic if eGFR < 30)
  4. Add spironolactone (most effective 4th agent - reduces SBP ~8-12 mmHg)
  5. Screen for primary aldosteronism
  6. Late add-ons: beta-blocker, clonidine (taper carefully to avoid rebound), doxazosin, minoxidil (requires concurrent diuretic + beta-blocker)
  7. Refer to specialist/consider renal denervation in select cases

10. Hypertensive Emergencies and Urgencies

2025 Update: Terminology Change

The term "hypertensive urgency" has been retired. The 2025 AHA/ACC now uses "severe hypertension without acute target-organ damage" to more accurately reflect pathophysiology and reduce unnecessary ED visits and IV therapy.

Hypertensive Emergency

  • BP typically > 180/120 mmHg with acute target-organ damage
  • Target-organ damage: hypertensive encephalopathy, acute stroke, ACS, acute HF/pulmonary edema, aortic dissection, eclampsia, retinal hemorrhage
  • Goal: Reduce MAP by no more than 20-25% in first hour, then gradually to 160/100 mmHg over next 2-6 hours
  • Treatment: IV agents in ICU setting
IV AgentUse CaseNotes
NicardipineMost emergencies; acute strokeSmooth, titratable CCB
LabetalolMost emergencies; aortic dissection, pregnancyAlpha + beta blockade
ClevidipinePerioperative, most emergenciesUltra-short-acting DHP CCB
Sodium nitroprussideRefractory emergenciesCyanide toxicity risk; avoid in renal failure
HydralazineEclampsia/pre-eclampsiaReflex tachycardia
EsmololAortic dissection, perioperativeUltra-short-acting beta-blocker
PhentolaminePheochromocytoma crisisAlpha-blocker
Avoid nifedipine sublingualAnyUnpredictable BP drop, stroke risk

Severe Hypertension without Target-Organ Damage (former "urgency")

  • Oral antihypertensives are appropriate
  • Gradual BP reduction over 24-48 hours
  • Avoid overly aggressive lowering

11. Special Populations

Elderly (≥65 years)

  • Nonpharmacologic therapy particularly important to reduce drug burden (Braunwald's Heart Disease)
  • After age 70, isolated systolic hypertension (ISH) accounts for >90% of all hypertension cases
  • HYVET trial: treating SBP ≥160 with indapamide to target 150/80 in patients ≥80 years reduced fatal stroke 39%, all-cause mortality 21%, HF 64%
  • SPRINT (patients ≥75): targeting SBP < 120 reduced CV events 34%, mortality 33%
  • Orthostatic hypotension is a major risk - always measure BP sitting and standing

Pregnancy

  • Avoid ACEi and ARBs (teratogenic)
  • Chronic HTN (pre-pregnancy or ≤20 weeks): target < 140/90 mmHg
  • Severe HTN in pregnancy (SBP ≥160 or DBP ≥110): treat urgently, aim for < 160/110 within 30-60 min
  • First-line: labetalol, nifedipine, methyldopa

CKD

  • ACEi or ARB are first-line to slow progression via reducing intraglomerular hypertension
  • Caution: can precipitate AKI in bilateral renal artery stenosis; do not combine ACEi + ARB
  • Loop diuretics replace thiazides when eGFR < 25-30 mL/min
  • Salt restriction is the first-line non-pharmacologic therapy (Harrison's 22E)

Diabetes

  • ~80% of type 2 diabetics have hypertension
  • Start ACEi or ARB + CCB ± thiazide
  • SGLT2 inhibitors (e.g., empagliflozin, dapagliflozin) provide additional BP reduction and cardiorenal protection

12. Monitoring and Follow-up

  • Stage 1, stable on therapy: Review every 3-6 months
  • Stage 2 or newly started therapy: Review within 2-4 weeks for BP response and tolerability
  • Home BP monitoring: Recommended for all patients; two readings, twice daily for 5-7 days before appointments
  • Monitor: electrolytes, creatinine, eGFR (especially with ACEi/ARB and diuretics)
  • Check standing BP periodically in elderly to screen for orthostatic hypotension

Key Sources

  • Harrison's Principles of Internal Medicine, 22nd Edition (2025) - CKD Hypertension
  • Goldman-Cecil Medicine, International Edition - Evidence-based management
  • National Kidney Foundation Primer on Kidney Diseases, 8e - Lifestyle table, DKD management
  • Comprehensive Clinical Nephrology, 7th Edition - BP goals in CKD/DKD
  • Braunwald's Heart Disease, 2-Vol Set - Elderly hypertension management
  • 2025 AHA/ACC/Multisociety Guideline - PMID 40811516 (published August 2025)
  • 2024 ESC Guidelines for Elevated Blood Pressure and Hypertension - ESC 2024

Type 2 Diabetes management

Finding Sources
Finding Sources
Searching PubMed

"type 2 diabetes" AND "management" AND "guidelines"

Searching the Web

type 2 diabetes management guidelines 2025 2026 ADA EASD standards of care

Finding Sources
Finding Sources
Finding Sources
Reading Web Page

https://reference.medscape.com/cc2/p10/standards-care-type-2…

Reading File
Reading File
Reading File
Searching PubMed

"SGLT2 inhibitor" AND "GLP-1" AND "type 2 diabetes" AND "cardiovascular"

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
I now have very comprehensive data from Harrison's 22E, Family Medicine, and the 2026 ADA Standards. Let me compile the full, authoritative response.

Type 2 Diabetes Mellitus - Management

A comprehensive, evidence-based guide aligned with the 2026 ADA Standards of Care, Harrison's Principles of Internal Medicine 22E (2025), and the 2024 ADA/EASD Consensus Report.

1. Overview and Goals of Care

Type 2 DM management is multifaceted. Unlike type 1 DM where glycemic control dominates, T2DM requires simultaneous attention to (Harrison's 22E):
  • Glycemic control
  • Cardiovascular risk reduction (leading cause of mortality in T2DM)
  • Weight management
  • Hypertension management
  • Dyslipidemia treatment
  • Screening and prevention of microvascular complications (retinopathy, nephropathy, neuropathy)
  • Patient education and self-management support
T2DM is a progressive disorder - most patients will eventually require multiple therapeutic agents and sometimes insulin.

2. Diagnosis

TestDiagnostic Threshold
Fasting plasma glucose (FPG)≥ 126 mg/dL (7.0 mmol/L)
2-hour plasma glucose (75g OGTT)≥ 200 mg/dL (11.1 mmol/L)
HbA1c≥ 6.5% (48 mmol/mol)
Random plasma glucose + symptoms≥ 200 mg/dL
Prediabetes (IFG)FPG 100-125 mg/dL
Prediabetes (IGT)2h glucose 140-199 mg/dL
Prediabetes (HbA1c)5.7-6.4%
Confirm with a repeat test on a different day unless classic hyperglycemic symptoms + random glucose ≥ 200 mg/dL.

3. Initial Evaluation

At diagnosis, assess:
  • HbA1c, fasting lipids, LFTs, serum creatinine, eGFR
  • Urine albumin-to-creatinine ratio (UACR) - screen for nephropathy
  • Dilated retinal exam - screen for retinopathy
  • Foot examination (monofilament, pulses, reflexes) - screen for neuropathy/PAD
  • Blood pressure, weight/BMI
  • Screening for depression and diabetes distress
  • Cardiovascular risk assessment (ASCVD history, 10-year risk)
  • Thyroid function (TSH) - hypothyroidism is common in T2DM

4. Glycemic Targets

TargetStandard GoalIndividualized Notes
HbA1c< 7.0% (< 53 mmol/mol)< 6.5% if achievable without hypoglycemia (younger, newly diagnosed, no CVD); < 8.0% in elderly, frail, severe hypoglycemia risk, short life expectancy
Fasting/pre-meal glucose (CGM)80-130 mg/dL
Peak post-meal glucose (1-2h)< 180 mg/dL
Time in range (CGM, 70-180 mg/dL)≥ 70%
Time below range (< 70 mg/dL)< 4%
2026 ADA Update: CGM is now recommended soon after diagnosis for a broader population, including T2DM patients not on insulin, expanding beyond intensive insulin regimens. Automated insulin delivery (AID) systems are the preferred delivery method for T2DM patients who use insulin.

5. Medical Nutrition Therapy (MNT) and Lifestyle

All patients should receive individualized MNT from a registered dietitian. No single "diabetic diet" is mandated - evidence supports several eating patterns (Textbook of Family Medicine, 9e):

Dietary Approaches

  • Mediterranean diet - strong evidence for glycemic control and cardiovascular benefit
  • Low-carbohydrate diet - effective for short-term glycemic and weight improvement
  • DASH diet - beneficial for blood pressure and glucose
  • Plant-based diet - associated with lower ASCVD risk
  • Key principles: reduce sugar-sweetened beverages, reduce refined carbohydrates, increase fiber and whole grains, portion control, avoid ultra-processed foods

Caloric Restriction

  • Reducing caloric intake to ~1,100 kcal/day can decrease fasting glucose in obese T2DM patients within as few as 4 days (Textbook of Family Medicine, 9e)
  • Modest weight loss (5-10%) significantly improves glycemia, blood pressure, and lipids, especially when initiated early after diagnosis

Physical Activity

  • Aerobic: ≥ 150 min/week of moderate-intensity activity (or 75 min vigorous); reduces HbA1c ~0.6-0.7%
  • Resistance training: ≥ 2 sessions/week; improves insulin sensitivity
  • Reduce sedentary time - interrupt prolonged sitting with activity breaks every 30 minutes
  • Pre-exercise glucose monitoring recommended; adjust medication if needed

Weight Management

  • 5-10% weight loss significantly improves glycemic control
  • >15% weight loss (as with GLP-1/GIP agonists) can achieve near-remission
  • Bariatric surgery (BMI ≥ 40, or ≥ 35 with comorbidities): remission rate 40-80%; gold standard is Roux-en-Y gastric bypass (RYGB). After surgery, likelihood of diabetes relapse is ~8% annually (Family Medicine, 9e)

Diabetes Self-Management Education and Support (DSMES)

  • Recommended at diagnosis and at all key transitions
  • 2026 ADA emphasizes personalized, culturally tailored programs
  • Digital platforms and virtual DSMES now formally endorsed for broader access

6. Pharmacotherapy

First-Line Agent

Metformin remains the foundational agent for most patients (Harrison's 22E):
  • Reduces hepatic glucose production, improves peripheral glucose utilization
  • Lowers FPG and insulin levels, modestly reduces weight
  • Cardiovascular neutral to beneficial (UKPDS legacy data)
  • Dose: Start low (500 mg daily), titrate every 1-2 weeks to max 2,000 mg/day
  • Extended-release (XR) form has fewer GI side effects
  • Contraindications: eGFR < 30 mL/min, metabolic acidosis, hepatic disease, unstable CHF, severe hypoxemia
  • Monitor: Vitamin B12 levels (metformin reduces absorption)
  • Hold in: hospitalized patients, patients NPO, before contrast procedures
Paradigm shift (2025/2026): For patients with established ASCVD, HF, or CKD, SGLT2 inhibitors and GLP-1 RAs should be initiated independently of metformin, based on their proven organ-protective benefits.

Drug Class Summary

Class 1: Biguanides (Metformin)

AspectDetail
MechanismInhibits hepatic gluconeogenesis (via AMPK activation); improves insulin sensitivity
HbA1c reduction1.0-1.5%
Weight effectNeutral/modest loss
Hypoglycemia riskLow (monotherapy)
Key side effectsGI (diarrhea, nausea, metallic taste), B12 deficiency, lactic acidosis (rare)

Class 2: SGLT2 Inhibitors (Gliflozins)

(Empagliflozin, Dapagliflozin, Canagliflozin)
AspectDetail
MechanismBlock SGLT2 in proximal tubule → urinary glucose excretion; also reduce tubuloglomerular feedback, renal inflammation
HbA1c reduction0.5-1.0%
Weight effectLoss (-2 to -4 kg)
Blood pressureReduces SBP ~4-5 mmHg
Hypoglycemia riskLow (glucose-independent)
Proven benefitsReduce MACE (EMPA-REG, CANVAS), hospitalization for HF (all patients, with/without T2DM), slow CKD progression (CREDENCE, DAPA-CKD)
Key side effectsGenital mycotic infections, UTI, DKA (rare, euglycemic), volume depletion, Fournier's gangrene (rare)
ContraindicationseGFR < 20-30 (kidney benefit extends to lower eGFR ranges for DAPA/EMPA)
The 2024 meta-analysis in Circulation (PMID: 39210781) confirmed that combining GLP-1 RAs with SGLT2 inhibitors provides additive cardiovascular and kidney protection. A 2026 meta-analysis in Diabetologia (PMID: 41117973) confirmed their combined effectiveness and safety.

Class 3: GLP-1 Receptor Agonists (and Dual GIP/GLP-1 agonists)

(Semaglutide, Dulaglutide, Liraglutide, Exenatide, Tirzepatide)
AspectDetail
MechanismGlucose-dependent insulin secretion, glucagon suppression, slowed gastric emptying, central appetite suppression
HbA1c reduction1.0-2.0% (tirzepatide up to 2.4%)
Weight effectSignificant loss (-5 to -15 kg; tirzepatide up to -22%)
Hypoglycemia riskLow (unless combined with SU/insulin)
Proven benefitsReduce MACE in ASCVD (LEADER, SUSTAIN-6, REWIND); reduce kidney progression; reduce MASLD/steatohepatitis
Key side effectsNausea, vomiting, diarrhea (usually transient), pancreatitis (rare), medullary thyroid carcinoma (rodent data - avoid in MEN2/familial MCT)
DeliveryWeekly SC (semaglutide, dulaglutide); daily SC (liraglutide); or oral daily (oral semaglutide)
New 2026GLP-1 RAs now approved for T1DM with obesity (BMI > 30; 27.5 in Asian Americans)
Tirzepatide (GIP/GLP-1 dual agonist): superior HbA1c and weight reduction vs. semaglutide; FDA-approved for T2DM and obesity.

Class 4: DPP-4 Inhibitors (Gliptins)

(Sitagliptin, Saxagliptin, Linagliptin, Alogliptin)
AspectDetail
MechanismInhibit DPP-4 enzyme → increase endogenous GLP-1 and GIP levels
HbA1c reduction0.5-0.8%
Weight effectNeutral
Hypoglycemia riskLow
Key side effectsNasopharyngitis, UTI; saxagliptin associated with ↑ HF hospitalization; rare: pancreatitis, joint pain
AdvantageWell-tolerated; can use in moderate CKD (dose-adjust); no injection
DisadvantageModest glycemic efficacy; no proven CV or renal benefit

Class 5: Sulfonylureas (SUs)

(Glimepiride, Glipizide, Glyburide/Glibenclamide)
AspectDetail
MechanismStimulate insulin secretion via ATP-sensitive K+ channel on beta cells
HbA1c reduction1.0-1.5%
Weight effectGain (+2-3 kg)
Hypoglycemia riskHIGH - most common cause of oral hypoglycemic-induced hypoglycemia
Key side effectsHypoglycemia, weight gain
NotesMost effective in T2DM < 5 years duration (residual beta-cell function); prefer glimepiride or glipizide over glyburide in elderly; metabolized in liver, cleared by kidney - avoid in significant hepatic/renal dysfunction; interact with many drugs (fluoroquinolones, warfarin, azoles)

Class 6: Insulin

TypeExamplesOnsetDurationUse
Rapid-actingAspart, Lispro, Glulisine10-20 min3-5 hMeal bolus
Short-actingRegular30-60 min5-8 hMeal bolus, IV drip
IntermediateNPH2-4 h12-18 hTwice-daily regimens
Long-actingGlargine (U-100/U-300), Detemir1-2 h20-24 hOnce/twice daily basal
Ultra-longDegludec30-90 min> 42 hOnce daily basal
Pre-mixed70/30, 75/25Variable-Simplified regimens
When to initiate insulin in T2DM:
  • Severe hyperglycemia at presentation (glucose ≥ 300 mg/dL or HbA1c ≥ 10-12%)
  • Catabolic symptoms (weight loss, polyuria, polydipsia)
  • Failure of multiple oral agents to achieve target
  • Perioperative period or hospitalization
  • Pregnancy (if oral agents insufficient or not appropriate)
2026 ADA: Automated insulin delivery (AID)/closed-loop systems are now the preferred insulin delivery method for T2DM patients using insulin.

Class 7: Thiazolidinediones (TZDs)

(Pioglitazone, Rosiglitazone)
AspectDetail
MechanismPPAR-γ agonist → reduce insulin resistance; redistribute fat from central to peripheral
HbA1c reduction0.5-1.4%
Weight effectGain (+2-3 kg)
Hypoglycemia riskLow
Key side effectsPeripheral edema, CHF (contraindicated in class III/IV), fractures (postmenopausal women), macular edema, possible bladder cancer (pioglitazone)
CV benefitPioglitazone reduced recurrent stroke/MI in insulin-resistant patients (PROactive-like data)
ContraindicationsCHF class III/IV, hepatic insufficiency

Class 8: Alpha-Glucosidase Inhibitors

(Acarbose, Miglitol)
  • Inhibit intestinal oligosaccharide cleavage → delay glucose absorption → reduce postprandial hyperglycemia
  • HbA1c reduction: 0.5-0.8%
  • Side effects: flatulence, diarrhea, abdominal distension (GI intolerance often limits use)
  • Avoid in IBD, gastroparesis, creatinine > 2 mg/dL
  • If hypoglycemia occurs while on these agents: treat with pure glucose (not complex carbs)

Class 9: Other Agents

  • Colesevelam (bile acid resin): modest glucose-lowering; also lowers LDL
  • Bromocriptine (dopamine agonist): approved for T2DM; modest HbA1c reduction; reduces post-meal glucose
  • Pramlintide (amylin analogue): adjunct to insulin; reduces post-meal glucose; promotes weight loss; not widely used

7. Treatment Algorithm - Individualized Approach (2026 ADA / Harrison's 22E)

T2DM Diagnosis
      |
      ▼
Lifestyle + MNT (always foundational)
      |
      ▼
Does patient have established ASCVD, HF, or CKD?
      |
   YES ──────────────────────────────────────────►
   |                                              Initiate SGLT2i and/or GLP-1 RA
   |                                              (regardless of metformin/HbA1c)
   |                                              for organ protection
   ▼
   NO → Start Metformin ± SGLT2i or GLP-1 RA
      |
      ▼
HbA1c not at goal after 3 months?
      |
      ▼
Add 2nd agent based on patient profile:
 - ASCVD → GLP-1 RA or SGLT2i (MACE reduction)
 - HF → SGLT2i (preferred)
 - CKD → SGLT2i (preferred) ± finerenone
 - Obesity → GLP-1 RA or tirzepatide
 - Hypoglycemia risk → DPP-4i, GLP-1 RA, or SGLT2i
 - Cost concern → SU or TZD
      |
      ▼
Still not at goal? → Add 3rd agent or insulin

8. Management by Comorbidity

ComorbidityPreferred AgentsAvoid
Established ASCVDGLP-1 RA (semaglutide, liraglutide, dulaglutide) + SGLT2iSUs (hypoglycemia risk), rosiglitazone
Heart failure (HFrEF or HFpEF)SGLT2i (dapagliflozin, empagliflozin)TZDs (fluid retention), saxagliptin
CKD (eGFR 20-60)SGLT2i + finerenone (nsMRA) + ACEi/ARB; GLP-1 RAMetformin if eGFR <30; SUs
ObesityGLP-1 RA, tirzepatide (GIP/GLP-1), SGLT2iSUs, TZDs, insulin (weight gain)
Hypoglycemia riskDPP-4i, GLP-1 RA, SGLT2iSUs, glinides, insulin (without careful titration)
HypertensionSGLT2i (lowers BP ~4 mmHg), GLP-1 RA-
MASLD/NASHGLP-1 RA (semaglutide, tirzepatide), pioglitazone-
Atrial fibrillationNo specific preference; avoid hypoglycemia-
Elderly/frailDPP-4i (safe, no hypoglycemia), GLP-1 RA (low dose), SGLT2iSUs (hypoglycemia, falls), TZDs (fracture, edema), intensive insulin regimens
PregnancyInsulin (first-line); metformin (sometimes used for ovulation induction in PCOS)GLP-1 RA, SGLT2i, TZDs, DPP-4i (all avoid in pregnancy)

9. Cardiovascular Risk Management (ASCVD Prevention)

T2DM doubles the risk of MACE. Comprehensive CV risk reduction includes:

Lipids

  • High-intensity statin for all T2DM patients aged 40-75 years (or any age with ASCVD)
    • Target LDL-C: < 70 mg/dL in high risk; < 55 mg/dL in very high risk (established ASCVD)
  • Add ezetimibe if LDL not at goal on maximum statin
  • Add PCSK9 inhibitor (evolocumab, alirocumab) for very high risk not at LDL goal

Blood Pressure

  • Target: < 130/80 mmHg (ADA 2026)
  • First-line: ACEi or ARB (especially with albuminuria)
  • Add CCB or thiazide as needed

Antiplatelet Therapy

  • Aspirin 75-100 mg/day for secondary prevention (established ASCVD) - Class I
  • Primary prevention: individualized (benefit may be outweighed by bleeding risk)

Smoking Cessation

  • Highest-priority lifestyle intervention for CV risk reduction

GLP-1 RAs and SGLT2i for CV protection

  • Initiate based on CV/renal risk, independent of glucose control
  • GLP-1 RA: LEADER (liraglutide), SUSTAIN-6 (semaglutide), REWIND (dulaglutide) - all showed MACE reduction in ASCVD patients
  • SGLT2i: EMPA-REG OUTCOME (empagliflozin), CANVAS (canagliflozin) - MACE + HF hospitalization reduction

10. Monitoring and Follow-Up

ParameterFrequency
HbA1cEvery 3 months until at goal; then every 6 months
Fasting glucose / CGM dataAt every visit
Blood pressureEvery visit
Lipid panelAnnually (or more often if adjusting therapy)
Urine ACR (microalbuminuria)Annually
eGFR / creatinineAnnually (more often on ACEi/ARB/SGLT2i)
Foot examAnnually (every visit if high risk)
Dilated eye examAt diagnosis, then annually (every 2 years if normal and low risk)
Dental examTwice yearly (gum disease worsens glycemia)
Depression/distress screeningAnnually
Weight / BMIEvery visit
Thyroid function (TSH)Periodically
2026 ADA: Pre-surgical HbA1c target ≤ 8% and intraoperative glucose target 100-180 mg/dL are the new recommendations for hospitalized/surgical patients.

11. Diabetic Complications - Screening and Management

Microvascular

ComplicationScreeningManagement
Nephropathy (DKD)Annual UACR + eGFRACEi/ARB (reduce proteinuria); SGLT2i (slow progression); finerenone (nsMRA) in albuminuric CKD; target BP < 130/80
RetinopathyDilated eye exam at diagnosis, then annuallyOptimize glucose + BP; laser photocoagulation for proliferative retinopathy; anti-VEGF for diabetic macular edema
NeuropathyAnnual monofilament + vibrationTight glycemic control; pregabalin, duloxetine, gabapentin for painful neuropathy; foot care

Macrovascular

  • Aggressive CV risk factor management (statins, BP control, aspirin, cessation of smoking)
  • GLP-1 RA and SGLT2i are now first-line add-on therapies for ASCVD/HF/CKD in T2DM

12. Hypoglycemia Management

Symptoms

  • Mild/moderate: shakiness, sweating, palpitations, confusion (glucose typically < 70 mg/dL)
  • Severe: requires assistance from another person; glucose typically < 54 mg/dL

Treatment - Rule of 15

  • Consume 15g fast-acting carbohydrates (glucose tablets, 4 oz juice, regular soda)
  • Recheck glucose in 15 minutes; repeat if still < 70 mg/dL
  • Follow with a meal or snack once glucose normalizes

Special cases

  • Patients on alpha-glucosidase inhibitors must use pure glucose (not complex carbs)
  • Severe hypoglycemia: glucagon 1 mg SC/IM or intranasal glucagon (Baqsimi); or 25 mL of 50% dextrose IV
  • Educate patients and family on recognition and treatment

Key Sources

  • Harrison's Principles of Internal Medicine, 22E (2025) - Drug mechanisms, T2DM management algorithm
  • Textbook of Family Medicine, 9e - Lifestyle interventions, bariatric surgery
  • 2026 ADA Standards of Care in Diabetes (Diabetes Care, January 2026 supplement) - ADA 2026
  • Neuen BL et al., Circulation 2024 - GLP-1 RA + SGLT2i combination meta-analysis (PMID: 39210781)
  • Colombijn JMT et al., Diabetologia 2026 - SGLT2i + GLP-1 RA effectiveness/safety (PMID: 41117973)
  • Apperloo EM et al., Lancet Diabetes Endocrinol 2024 - SMART-C collaborative meta-analysis (PMID: 38991584)

Generate a quick reference PDF of T2DM medication side effects and monitoring requirements

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && python3 -c "import reportlab; print('…

Running Command

mkdir -p /home/daytona/workspace/t2dm-pdf

Writing File

~/t2dm-pdf/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate
from reportlab.lib.colors import HexColor
from datetime import date

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY      = HexColor("#1a3a5c")
TEAL      = HexColor("#0d7377")
LIGHT_BG  = HexColor("#eef4fb")
HEADER_BG = HexColor("#1a3a5c")
ROW_ALT   = HexColor("#f2f7fc")
ROW_WHITE = colors.white
WARN_RED  = HexColor("#c0392b")
WARN_YEL  = HexColor("#f39c12")
GREEN     = HexColor("#27ae60")
MID_GRAY  = HexColor("#7f8c8d")
BORDER    = HexColor("#b0c4de")

OUTPUT = "/home/daytona/workspace/t2dm-pdf/T2DM_Medication_Reference.pdf"

PAGE_W, PAGE_H = A4
MARGIN = 1.8 * cm

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent="Normal", **kw):
    return ParagraphStyle(name, parent=styles[parent], **kw)

TITLE  = make_style("TITLE",  fontSize=22, textColor=colors.white,
                    fontName="Helvetica-Bold", alignment=TA_CENTER, leading=28)
SUBT   = make_style("SUBT",   fontSize=10, textColor=HexColor("#aed6f1"),
                    fontName="Helvetica", alignment=TA_CENTER, leading=14)
DATE_S = make_style("DATE_S", fontSize=8, textColor=HexColor("#aed6f1"),
                    fontName="Helvetica", alignment=TA_CENTER)
SEC    = make_style("SEC",    fontSize=13, textColor=colors.white,
                    fontName="Helvetica-Bold", alignment=TA_LEFT, leading=18,
                    spaceBefore=8, spaceAfter=4)
BODY   = make_style("BODY",   fontSize=8.5, textColor=HexColor("#2c3e50"),
                    fontName="Helvetica", leading=12)
BOLD8  = make_style("BOLD8",  fontSize=8.5, textColor=HexColor("#1a3a5c"),
                    fontName="Helvetica-Bold", leading=12)
SMALL  = make_style("SMALL",  fontSize=7.5, textColor=MID_GRAY,
                    fontName="Helvetica", leading=10)
WARN   = make_style("WARN",   fontSize=8, textColor=WARN_RED,
                    fontName="Helvetica-Bold", leading=11)
NOTE   = make_style("NOTE",   fontSize=8, textColor=HexColor("#34495e"),
                    fontName="Helvetica-Oblique", leading=11)

# cell paragraph styles
CH  = make_style("CH",  fontSize=8, textColor=colors.white,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CBL = make_style("CBL", fontSize=8, textColor=colors.white,
                 fontName="Helvetica-Bold", alignment=TA_LEFT, leading=11)
CL  = make_style("CL",  fontSize=8, textColor=HexColor("#2c3e50"),
                 fontName="Helvetica", leading=11)
CLB = make_style("CLB", fontSize=8, textColor=HexColor("#1a3a5c"),
                 fontName="Helvetica-Bold", leading=11)
CR  = make_style("CR",  fontSize=8, textColor=WARN_RED,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CG  = make_style("CG",  fontSize=8, textColor=GREEN,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CY  = make_style("CY",  fontSize=8, textColor=WARN_YEL,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)

# ── Header / footer callbacks ────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    # footer
    canvas.setFillColor(NAVY)
    canvas.rect(0, 0, PAGE_W, 1.2*cm, fill=1, stroke=0)
    canvas.setFillColor(colors.white)
    canvas.setFont("Helvetica", 7.5)
    canvas.drawCentredString(PAGE_W/2, 0.45*cm,
        f"T2DM Medication Quick Reference  |  Page {doc.page}  |  Based on 2026 ADA Standards of Care & Harrison's 22E")
    # top stripe (pages > 1)
    if doc.page > 1:
        canvas.setFillColor(NAVY)
        canvas.rect(0, PAGE_H - 1.0*cm, PAGE_W, 1.0*cm, fill=1, stroke=0)
        canvas.setFillColor(colors.white)
        canvas.setFont("Helvetica-Bold", 8)
        canvas.drawString(MARGIN, PAGE_H - 0.65*cm,
                          "T2DM Medications: Side Effects & Monitoring")
        canvas.setFont("Helvetica", 8)
        canvas.drawRightString(PAGE_W - MARGIN, PAGE_H - 0.65*cm,
                               "Quick Reference Card 2026")
    canvas.restoreState()

# ── Helper: coloured section header ──────────────────────────────────────────
def section_header(text, bg=TEAL):
    data = [[Paragraph(text, SEC)]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("LEFTPADDING",  (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING",   (0,0), (-1,-1), 5),
        ("BOTTOMPADDING",(0,0), (-1,-1), 5),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

# ── Helper: legend chip ───────────────────────────────────────────────────────
def legend_table():
    items = [
        [Paragraph("● HIGH", CR), Paragraph("Hypoglycemia risk", CL)],
        [Paragraph("● MOD", CY), Paragraph("Moderate risk / monitor closely", CL)],
        [Paragraph("● LOW", CG), Paragraph("Low / minimal risk", CL)],
    ]
    t = Table(items, colWidths=[2.2*cm, 6*cm], hAlign="LEFT")
    t.setStyle(TableStyle([
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
        ("LEFTPADDING", (0,0), (-1,-1), 2),
        ("TOPPADDING", (0,0), (-1,-1), 2),
        ("BOTTOMPADDING", (0,0), (-1,-1), 2),
    ]))
    return t

# ────────────────────────────────────────────────────────────────────────────
# DATA
# ────────────────────────────────────────────────────────────────────────────

# Main drug table
# Cols: Drug Class | Key Agents | HbA1c ↓ | Hypoglycemia | Weight | Key Side Effects | Contraindications | Monitoring
DRUG_HEADER = [
    Paragraph("Drug Class", CH),
    Paragraph("Key Agents", CH),
    Paragraph("HbA1c ↓", CH),
    Paragraph("Hypo Risk", CH),
    Paragraph("Weight", CH),
    Paragraph("Key Side Effects", CH),
    Paragraph("Contraindications", CH),
    Paragraph("Monitoring", CH),
]

def row(cls, agents, hba1c, hypo, wt, se, ci, mon, alt=False):
    bg = ROW_ALT if alt else ROW_WHITE
    hypo_style = CR if "HIGH" in hypo else (CY if "MOD" in hypo else CG)
    wt_style   = CR if "+" in wt else (CG if "−" in wt else make_style(f"wtn{cls}", parent="CL",
                                        fontSize=8, textColor=MID_GRAY, leading=11))
    return [
        Paragraph(cls,    CLB),
        Paragraph(agents, CL),
        Paragraph(hba1c,  CL),
        Paragraph(hypo,   hypo_style),
        Paragraph(wt,     wt_style if ("+" in wt or "−" in wt) else CL),
        Paragraph(se,     CL),
        Paragraph(ci,     CL),
        Paragraph(mon,    CL),
    ], bg

rows_data = [
    row("Metformin\n(Biguanide)",
        "Metformin\nMetformin XR",
        "1.0–1.5%",
        "LOW",
        "Neutral/\nSlight −",
        "GI upset, diarrhea, nausea,\nmetallic taste (less with XR);\nVit B12 deficiency; lactic\nacidosis (rare)",
        "eGFR <30;\nMetabolic acidosis;\nUnstable CHF;\nHepatic disease;\nSevere hypoxia",
        "eGFR & creatinine at baseline\nthen annually;\nVit B12 annually;\nHold before contrast/surgery"),
    row("SGLT2\nInhibitors",
        "Empagliflozin\nDapagliflozin\nCanagliflozin",
        "0.5–1.0%",
        "LOW",
        "− (−2 to\n−4 kg)",
        "Genital mycotic infections;\nUTI; volume depletion;\nEuglycemic DKA (rare);\nFournier's gangrene (rare);\nLower-limb amputation\n(canagliflozin)",
        "eGFR <20 (glycemic use);\nType 1 DM (relative);\nRecurrent UTIs;\nFasting/surgery\n(hold 3–4 days pre-op)",
        "eGFR & electrolytes before\nstart, then periodically;\nBP monitoring;\nSigns of DKA, UTI,\ngenital infection",
        alt=True),
    row("GLP-1 Receptor\nAgonists",
        "Semaglutide (SC/oral)\nDulaglutide\nLiraglutide\nExenatide\nTirzepatide*",
        "1.0–2.0%\n(*up to 2.4%)",
        "LOW",
        "− (−5 to\n−15 kg)",
        "Nausea, vomiting, diarrhea\n(usually transient, dose-related);\nPancreatitis (rare);\nGallbladder disease;\nHR elevation",
        "Personal/family hx of\nMedullary Thyroid Ca\nor MEN2;\nSevere GI disease\n(gastroparesis)",
        "Renal function (if GI side\neffects cause dehydration);\nPancreatitis symptoms;\nHR;\nLipase if symptomatic"),
    row("DPP-4\nInhibitors",
        "Sitagliptin\nSaxagliptin\nLinagliptin\nAlogliptin",
        "0.5–0.8%",
        "LOW",
        "Neutral",
        "Nasopharyngitis; UTI;\nJoint pain (arthralgia);\nPancreatitis (rare);\nSaxagliptin: ↑ HF\nhospitalization risk",
        "Avoid saxagliptin/\nalogliptin in HF;\nDose-adjust for\nrenal impairment\n(except linagliptin)",
        "eGFR (dose adjustment);\nSigns of pancreatitis;\nHF symptoms (esp.\nsaxagliptin)",
        alt=True),
    row("Sulfonylureas",
        "Glimepiride\nGlipizide\nGlyburide\n(prefer 1st two)",
        "1.0–1.5%",
        "HIGH",
        "+ (+2–3 kg)",
        "Hypoglycemia (most common\nclass effect);\nWeight gain;\nDrug interactions (warfarin,\nfluoroquinolones, azoles)",
        "Significant hepatic or\nrenal impairment;\nAvoid glyburide in\nelderly & CKD",
        "Blood glucose / CGM\nclosely at initiation;\nRenal function;\nWeight;\nSigns of hypoglycemia"),
    row("Thiazolidinediones\n(TZDs)",
        "Pioglitazone\nRosiglitazone",
        "0.5–1.4%",
        "LOW",
        "+ (+2–3 kg)",
        "Peripheral edema; CHF\nexacerbation; Fractures\n(postmenopausal women);\nMacular edema;\nPioglitazone: bladder\ncancer risk; Ovulation\ninduction in PCOS",
        "CHF class III/IV;\nHepatic insufficiency;\nHistory of bladder\ncancer (pioglitazone)",
        "LFTs at baseline;\nWeight & edema;\nBP (fluid retention);\nBone density;\nOphthalmologic exam\nif visual symptoms",
        alt=True),
    row("Insulin\n(all types)",
        "Basal: Glargine,\nDetemir, Degludec\nRapid: Aspart,\nLispro, Glulisine\nPre-mixed: 70/30",
        "1.5–3.5%\n(dose-dependent)",
        "HIGH",
        "+ (variable)",
        "Hypoglycemia;\nWeight gain;\nInjection-site reactions\n(lipohypertrophy);\nHypokalemia (large doses)",
        "Relative: severe\nhypoglycemia unawareness\n(use basal-only or\neducate on CGM/AID)",
        "Blood glucose / CGM daily\nto multiple times/day;\nHbA1c every 3 months;\nWeight;\nInjection sites;\nElectrolytes (ICU/DKA)"),
    row("Alpha-Glucosidase\nInhibitors",
        "Acarbose\nMiglitol",
        "0.5–0.8%",
        "LOW\n(monotherapy)",
        "Neutral",
        "Flatulence; Diarrhea;\nAbdominal distension\n(often limits use);\nTransient LFT elevation\n(acarbose, high dose)",
        "IBD / inflammatory\nbowel disease;\nGastroparesis;\nCreatinine >2 mg/dL;\nCirrhosis",
        "LFTs at baseline and\nperiodically;\nPost-meal glucose;\nNote: treat hypoglycemia\nwith PURE glucose only",
        alt=True),
    row("Meglitinides\n(Glinides)",
        "Repaglinide\nNateglinide",
        "0.5–1.0%",
        "MOD",
        "+ (modest)",
        "Hypoglycemia (shorter-\nacting than SUs);\nWeight gain;\nDrug interactions",
        "Significant hepatic\nimpairment;\nCaution in CKD\n(repaglinide preferred)",
        "Blood glucose before\neach meal;\nHepatic function;\nWeight"),
]

# Monitoring schedule table
MON_HEADER = [
    Paragraph("Parameter", CH),
    Paragraph("Frequency", CH),
    Paragraph("Threshold / Action", CH),
    Paragraph("Relevant Drug Classes", CH),
]
mon_rows = [
    ("HbA1c", "Every 3 months until at goal;\nthen every 6 months",
     "Target <7.0% (standard);\n<6.5% if safe; <8.0% elderly/frail",
     "All glucose-lowering agents"),
    ("eGFR & Serum Creatinine", "At baseline, then annually\n(more often if CKD or dose change)",
     "Metformin: hold if eGFR <30;\nSGLT2i: review if eGFR <45;\nDose-adjust DPP-4i (except linagliptin)",
     "Metformin, SGLT2i, SU, DPP-4i, Insulin"),
    ("Urine ACR (albumin/creatinine)", "Annually",
     "≥30 mg/g = microalbuminuria;\n≥300 mg/g = macroalbuminuria\n→ Add/intensify ACEi/ARB + SGLT2i",
     "All (screening for DKD progression)"),
    ("Blood pressure", "Every clinic visit",
     "Target <130/80 mmHg;\nInitiate/adjust antihypertensives",
     "SGLT2i (BP-lowering effect;\nmonitor for hypotension)"),
    ("Lipid panel (LDL, HDL, TG)", "At diagnosis; then annually\nor after therapy changes",
     "LDL <70 mg/dL (high risk);\n<55 mg/dL (very high / ASCVD)\n→ Adjust statin ± ezetimibe",
     "All (CV risk management)"),
    ("Weight / BMI", "Every clinic visit",
     "≥5% loss: meaningful benefit\nWeight gain: reassess regimen",
     "GLP-1 RA, SGLT2i (weight loss);\nSU, TZD, Insulin (weight gain)"),
    ("Liver function tests (ALT/AST)", "At baseline for TZDs;\nPeriodically during therapy",
     "ALT >3× ULN: discontinue TZD;\nBaseline for acarbose (high dose)",
     "TZDs, Acarbose (high dose)"),
    ("Vitamin B12", "At baseline; then annually",
     "<300 pg/mL: supplement;\nMonitor if neuropathy symptoms",
     "Metformin (reduces B12 absorption)"),
    ("Blood glucose / CGM", "Daily (or as prescribed);\nFasting + post-meal in insulin users",
     "Fasting: 80–130 mg/dL;\nPost-meal peak: <180 mg/dL;\nTime-in-range ≥70%",
     "Insulin, SU, Meglitinides (highest\nhypoglycemia risk)"),
    ("Dilated retinal exam", "At diagnosis;\nthen annually\n(every 2 years if normal/low risk)",
     "Refer to ophthalmology if\nretinopathy detected;\nOptimise BP + glucose",
     "All (screening for diabetic retinopathy)"),
    ("Foot examination", "Annually (every visit if\nhigh-risk neuropathy/PAD)",
     "Loss of protective sensation:\nrefer to podiatry;\nActive ulcer: urgent referral",
     "All (peripheral neuropathy\nand PAD screening)"),
    ("Pancreatitis symptoms", "Clinically (at every visit)",
     "New-onset abdominal pain\n→ Check lipase; hold GLP-1 RA\nor DPP-4i; investigate",
     "GLP-1 RA, DPP-4i"),
    ("Signs of DKA / ketones", "Clinically; urine/blood ketones\nif symptomatic",
     "Euglycemic DKA risk with SGLT2i;\nhold SGLT2i ≥3–4 days pre-surgery\nor prolonged fasting",
     "SGLT2i (euglycemic DKA)"),
    ("Genital / urinary infections", "At every visit (ask specifically)",
     "Recurrent infections: consider\nswitching SGLT2i or treat and\noptimise genital hygiene",
     "SGLT2i"),
]

# Special populations table
SPEC_HEADER = [
    Paragraph("Population", CH),
    Paragraph("Preferred Agents", CH),
    Paragraph("Agents to Avoid / Use with Caution", CH),
    Paragraph("Key Notes", CH),
]
spec_rows = [
    ("Elderly / Frail\n(≥65 years)",
     "DPP-4i (safe, no hypoglycemia);\nGLP-1 RA (low dose);\nSGLT2i (if eGFR adequate)",
     "Sulfonylureas (hypoglycemia, falls);\nTZDs (fracture, edema);\nComplex insulin regimens",
     "Relax HbA1c target to <8.0%;\nMonitor for orthostatic hypotension;\nAvoid polypharmacy"),
    ("CKD (eGFR 20–59)",
     "SGLT2i + ACEi/ARB;\nGLP-1 RA;\nLinagliptin (no renal dose adj);\nRepaglinide (glinide)",
     "Metformin if eGFR <30;\nSU (accumulation, hypoglycemia);\nMost DPP-4i need dose adjustment",
     "Finerenone (nsMRA) add-on if\nalbuminuria ≥300 mg/g;\nSwitch to loop diuretic if\neGFR <30"),
    ("Established ASCVD",
     "GLP-1 RA (semaglutide, liraglutide,\ndulaglutide) + SGLT2i",
     "SU (avoid if hypoglycemia risk);\nRosiglitazone",
     "Initiate SGLT2i/GLP-1 RA\nindependently of metformin;\nHigh-intensity statin mandatory"),
    ("Heart Failure (HFrEF/HFpEF)",
     "SGLT2i (dapagliflozin,\nempagliflozin) — Class I",
     "TZDs (fluid retention, worsen HF);\nSaxagliptin, alogliptin\n(↑ HF hospitalisation)",
     "SGLT2i reduce HF hospitalisation\nand CV death regardless of EF;\nMonitor for volume depletion"),
    ("Obesity (BMI ≥30)",
     "GLP-1 RA or tirzepatide\n(GIP/GLP-1 dual agonist);\nSGLT2i",
     "SU, TZDs, Insulin as initial\nagents (promote weight gain)",
     "Tirzepatide: up to −22% body weight;\nBariatric surgery if BMI ≥40\nor ≥35 with comorbidities"),
    ("Pregnancy",
     "Insulin (first-line for\nall glucose-lowering);\nMetformin (selected cases\n+ PCOS ovulation induction)",
     "GLP-1 RA, SGLT2i, TZDs,\nDPP-4i — ALL contraindicated\nACEi/ARB — contraindicated",
     "Switch to insulin pre-conception\nor as soon as pregnancy confirmed;\nFrequent glucose monitoring essential"),
    ("MASLD / NASH",
     "GLP-1 RA (semaglutide, tirzepatide)\nmost evidence for fibrosis;\nPioglitazone",
     "Avoid excessive alcohol;\nCaution with TZDs in\nadvanced cirrhosis",
     "Semaglutide phase 3 trial (NASH):\ndemonstrated fibrosis regression;\nTirzepatide: significant weight\nloss + liver fat reduction"),
]

# ── Drug interaction box ─────────────────────────────────────────────────────
interactions = [
    ("Sulfonylureas + Fluoroquinolones / Azoles / Clarithromycin / SMX-TMP",
     "↑ SU levels → hypoglycemia. Temporarily discontinue SU when these antibiotics are prescribed."),
    ("Sulfonylureas + Warfarin / Aspirin / NSAIDs",
     "Enhanced hypoglycemic effect or displacement from protein binding. Monitor glucose closely."),
    ("Metformin + Iodinated contrast media",
     "Hold metformin ≥48h before/after contrast (eGFR <60 or large contrast load). Restart after renal function confirmed stable."),
    ("SGLT2i + Loop diuretics / ACEi/ARB",
     "Additive volume depletion and hypotension. Reduce diuretic dose; monitor BP and renal function."),
    ("GLP-1 RA + Oral medications",
     "Delayed gastric emptying slows absorption of oral drugs (e.g., oral contraceptives, levothyroxine). Take OCP ≥1h before or 4h after injection."),
    ("TZDs + Insulin",
     "↑ risk of fluid retention and HF. Avoid combination in CHF. Monitor for oedema."),
    ("Alpha-glucosidase inhibitors + Any glucose-lowering agent causing hypoglycemia",
     "Must treat hypoglycemia with PURE glucose (dextrose tablets). Complex carbohydrates ineffective while on AGIs."),
    ("Insulin + Beta-blockers",
     "Mask tachycardia symptoms of hypoglycemia; may prolong hypoglycemia. Educate patients; sweating still present."),
]

# ── Build the document ────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=MARGIN, rightMargin=MARGIN,
    topMargin=2.0*cm, bottomMargin=1.8*cm,
    title="T2DM Medication Quick Reference",
    author="Orris Clinical Reference",
    subject="Type 2 Diabetes Medications: Side Effects & Monitoring",
)

story = []

# ── COVER BLOCK ───────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("Type 2 Diabetes Mellitus", TITLE),
    Paragraph("Medication Side Effects &amp; Monitoring Requirements", SUBT),
    Paragraph(f"Quick Reference Card  ·  Based on 2026 ADA Standards of Care &amp; Harrison's Principles 22E  ·  {date.today().strftime('%B %Y')}", DATE_S),
]]
cover = Table(cover_data, colWidths=[PAGE_W - 2*MARGIN])
cover.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), NAVY),
    ("TOPPADDING",    (0,0), (-1,-1), 18),
    ("BOTTOMPADDING", (0,0), (-1,-1), 18),
    ("LEFTPADDING",   (0,0), (-1,-1), 12),
    ("RIGHTPADDING",  (0,0), (-1,-1), 12),
    ("ROUNDEDCORNERS", [6,6,6,6]),
]))
story.append(cover)
story.append(Spacer(1, 0.4*cm))

# Legend
story.append(Paragraph("Hypoglycemia Risk Legend:", BOLD8))
story.append(legend_table())
story.append(Spacer(1, 0.3*cm))

# ── SECTION 1: Main Drug Table ────────────────────────────────────────────────
story.append(section_header("1   Drug Classes — Side Effects, Contraindications & Monitoring"))
story.append(Spacer(1, 0.25*cm))

col_w = [2.4*cm, 2.4*cm, 1.4*cm, 1.5*cm, 1.4*cm, 3.8*cm, 3.0*cm, 3.2*cm]
main_table_data = [DRUG_HEADER]
row_bgs = [HEADER_BG]
for r, bg in rows_data:
    main_table_data.append(r)
    row_bgs.append(bg)

main_ts = TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 4),
    ("LEFTPADDING",   (0, 0), (-1,-1), 4),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 4),
    ("GRID",          (0, 0), (-1,-1), 0.35, BORDER),
    ("ROWBACKGROUNDS",(0, 1), (-1,-1), [ROW_WHITE, ROW_ALT]),
    ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
])
main_table = Table(main_table_data, colWidths=col_w, repeatRows=1)
main_table.setStyle(main_ts)
story.append(main_table)
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "* Tirzepatide = GIP/GLP-1 dual agonist. GLP-1 RA benefits for ASCVD/CKD are class-specific and vary by agent — see outcome trial data. "
    "SGLT2i: empagliflozin and dapagliflozin have the most robust HF + CKD outcome data.",
    SMALL))

story.append(PageBreak())

# ── SECTION 2: Monitoring Schedule ───────────────────────────────────────────
story.append(section_header("2   Routine Monitoring Schedule"))
story.append(Spacer(1, 0.25*cm))

mon_col_w = [3.5*cm, 3.5*cm, 5.5*cm, 6.6*cm]
mon_data = [MON_HEADER]
for i, (param, freq, threshold, drugs) in enumerate(mon_rows):
    bg = ROW_ALT if i % 2 else ROW_WHITE
    mon_data.append([
        Paragraph(param,    CLB),
        Paragraph(freq,     CL),
        Paragraph(threshold,CL),
        Paragraph(drugs,    CL),
    ])
mon_table = Table(mon_data, colWidths=mon_col_w, repeatRows=1)
mon_table.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 4),
    ("LEFTPADDING",   (0, 0), (-1,-1), 4),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 4),
    ("GRID",          (0, 0), (-1,-1), 0.35, BORDER),
    ("ROWBACKGROUNDS",(0, 1), (-1,-1), [ROW_WHITE, ROW_ALT]),
    ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
]))
story.append(mon_table)

story.append(PageBreak())

# ── SECTION 3: Special Populations ───────────────────────────────────────────
story.append(section_header("3   Special Populations — Agent Selection"))
story.append(Spacer(1, 0.25*cm))

spec_col_w = [3.0*cm, 5.0*cm, 5.3*cm, 5.8*cm]
spec_data = [SPEC_HEADER]
for i, (pop, pref, avoid, notes) in enumerate(spec_rows):
    spec_data.append([
        Paragraph(pop,   CLB),
        Paragraph(pref,  CL),
        Paragraph(avoid, CL),
        Paragraph(notes, CL),
    ])
spec_table = Table(spec_data, colWidths=spec_col_w, repeatRows=1)
spec_table.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 4),
    ("LEFTPADDING",   (0, 0), (-1,-1), 4),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 4),
    ("GRID",          (0, 0), (-1,-1), 0.35, BORDER),
    ("ROWBACKGROUNDS",(0, 1), (-1,-1), [ROW_WHITE, ROW_ALT]),
    ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
]))
story.append(spec_table)
story.append(Spacer(1, 0.3*cm))

# ── SECTION 4: Drug Interactions ─────────────────────────────────────────────
story.append(section_header("4   Key Drug Interactions", bg=NAVY))
story.append(Spacer(1, 0.25*cm))

int_col_w = [6.5*cm, 12.6*cm]
int_data = [
    [Paragraph("Interaction", CH), Paragraph("Clinical Significance & Management", CH)]
]
for i, (combo, effect) in enumerate(interactions):
    bg = ROW_ALT if i % 2 else ROW_WHITE
    int_data.append([
        Paragraph(combo,  CLB),
        Paragraph(effect, CL),
    ])
int_table = Table(int_data, colWidths=int_col_w, repeatRows=1)
int_table.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 4),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 4),
    ("LEFTPADDING",   (0, 0), (-1,-1), 4),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 4),
    ("GRID",          (0, 0), (-1,-1), 0.35, BORDER),
    ("ROWBACKGROUNDS",(0, 1), (-1,-1), [ROW_WHITE, ROW_ALT]),
    ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
]))
story.append(int_table)
story.append(Spacer(1, 0.4*cm))

# ── SECTION 5: Hypoglycemia Quick-Action Box ──────────────────────────────────
story.append(section_header("5   Hypoglycemia — Recognition & Management", bg=HexColor("#922b21")))
story.append(Spacer(1, 0.25*cm))

hypo_data = [
    [Paragraph("Severity", CH), Paragraph("Definition", CH),
     Paragraph("Immediate Treatment", CH), Paragraph("Next Step", CH)],
    [Paragraph("Level 1\n(Alert)", CLB),
     Paragraph("Glucose 54–69 mg/dL\n(3.0–3.8 mmol/L)", CL),
     Paragraph("15 g fast-acting carbs:\n4–6 glucose tablets, 4 oz juice\nor regular soda (not diet)", CL),
     Paragraph("Recheck in 15 min.\nIf still <70 mg/dL, repeat.\nEat meal/snack once normalised.", CL)],
    [Paragraph("Level 2\n(Clinically\nSignificant)", CLB),
     Paragraph("Glucose <54 mg/dL\n(<3.0 mmol/L)", CL),
     Paragraph("15–30 g fast-acting carbs;\nIf on AGIs: PURE glucose only\n(dextrose tabs)", CL),
     Paragraph("Recheck q15 min until >70;\nNotify clinician;\nReview causative medication.", CL)],
    [Paragraph("Level 3\n(Severe)", CLB),
     Paragraph("Requires assistance;\nAltered consciousness\nor seizure", CL),
     Paragraph("IV: 25 mL of 50% dextrose\n(D50W) OR\nGlucagon 1 mg SC/IM OR\nIntranasal glucagon (Baqsimi)", CL),
     Paragraph("Hospital observation;\nReduce/discontinue\noffending agent;\nAddress precipitating cause.", CL)],
]
hypo_col_w = [2.2*cm, 3.5*cm, 6.5*cm, 7.0*cm]
hypo_table = Table(hypo_data, colWidths=hypo_col_w)
hypo_table.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
    ("BACKGROUND",    (0, 1), (-1, 1), HexColor("#fdfefe")),
    ("BACKGROUND",    (0, 2), (-1, 2), HexColor("#fef9e7")),
    ("BACKGROUND",    (0, 3), (-1, 3), HexColor("#fdedec")),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 5),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 5),
    ("LEFTPADDING",   (0, 0), (-1,-1), 5),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 5),
    ("GRID",          (0, 0), (-1,-1), 0.5, BORDER),
    ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
]))
story.append(hypo_table)
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
    "⚠  High-risk agents for hypoglycemia: Sulfonylureas, Meglitinides, Insulin. "
    "Low risk: Metformin, SGLT2i, GLP-1 RA, DPP-4i, TZDs, AGIs (as monotherapy). "
    "Risk increases significantly when any glucose-lowering agent is combined with insulin or sulfonylureas.",
    NOTE))

# ── DISCLAIMER ────────────────────────────────────────────────────────────────
story.append(Spacer(1, 0.35*cm))
story.append(HRFlowable(width="100%", thickness=0.5, color=BORDER))
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "DISCLAIMER: This reference card is intended for educational and clinical support purposes only. "
    "Always consult current prescribing information and apply clinical judgement to individual patient circumstances. "
    "Sources: 2026 ADA Standards of Care in Diabetes (Diabetes Care, Jan 2026 Supplement); "
    "Harrison's Principles of Internal Medicine 22E (2025, McGraw-Hill); "
    "Goodman &amp; Gilman's Pharmacological Basis of Therapeutics 14E.",
    SMALL))

# ── Build ──────────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print("PDF generated successfully:", OUTPUT)
Running Command

cd /home/daytona/workspace/t2dm-pdf && python3 generate_pdf.py

Editing File

~/t2dm-pdf/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/t2dm-pdf/generate_pdf.py'
Running Command

cd /home/daytona/workspace/t2dm-pdf && python3 generate_pdf.py

Running Command

python3 -c " from pypdf import PdfReader r = PdfReader('/home/daytona/workspace/…

Your PDF is ready - 5 pages, 19.8 KB.

T2DM Medication Reference

PDF Document · PDF


Here's what the PDF contains across 5 A4 pages:
Page 1 - Drug Classes Table All 9 drug classes (Metformin, SGLT2i, GLP-1 RA, DPP-4i, Sulfonylureas, TZDs, Insulin, Alpha-glucosidase inhibitors, Meglitinides) laid out in a colour-coded table with:
  • HbA1c reduction
  • Hypoglycemia risk (colour-coded: RED = HIGH, YELLOW = MOD, GREEN = LOW)
  • Weight effect
  • Key side effects
  • Contraindications
  • Monitoring requirements
Page 2 - Routine Monitoring Schedule 14 parameters (HbA1c, eGFR, urine ACR, BP, lipids, weight, LFTs, Vit B12, CGM, retinal exam, foot exam, pancreatitis, DKA signs, genital infections) with frequency, threshold/action, and which drug classes trigger each.
Page 3 - Special Populations 7 populations: Elderly, CKD, Established ASCVD, Heart Failure, Obesity, Pregnancy, and MASLD/NASH - with preferred agents, agents to avoid, and key clinical notes.
Page 4 - Drug Interactions + Hypoglycemia Management 8 key drug interactions (SU + antibiotics, metformin + contrast, SGLT2i + diuretics, GLP-1 RA + oral meds, etc.) and a 3-level hypoglycemia action card with specific treatment doses.

Create same pdf for hypertension

Running Command

mkdir -p /home/daytona/workspace/htn-pdf

Writing File

~/htn-pdf/generate_htn_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.lib.colors import HexColor
from datetime import date

# ── Colour palette ────────────────────────────────────────────────────────────
NAVY      = HexColor("#1a3a5c")
TEAL      = HexColor("#0d7377")
CRIMSON   = HexColor("#922b21")
HEADER_BG = HexColor("#1a3a5c")
ROW_ALT   = HexColor("#f2f7fc")
ROW_WHITE = colors.white
WARN_RED  = HexColor("#c0392b")
WARN_YEL  = HexColor("#f39c12")
GREEN     = HexColor("#27ae60")
MID_GRAY  = HexColor("#7f8c8d")
BORDER    = HexColor("#b0c4de")
LIGHT_BG  = HexColor("#eef4fb")

OUTPUT = "/home/daytona/workspace/htn-pdf/Hypertension_Medication_Reference.pdf"
PAGE_W, PAGE_H = A4
MARGIN = 1.8 * cm

# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent_obj=None, **kw):
    parent = parent_obj if parent_obj else styles["Normal"]
    return ParagraphStyle(name, parent=parent, **kw)

TITLE  = make_style("HTN_TITLE", fontSize=22, textColor=colors.white,
                    fontName="Helvetica-Bold", alignment=TA_CENTER, leading=28)
SUBT   = make_style("HTN_SUBT",  fontSize=10, textColor=HexColor("#aed6f1"),
                    fontName="Helvetica", alignment=TA_CENTER, leading=14)
DATE_S = make_style("HTN_DATE",  fontSize=8, textColor=HexColor("#aed6f1"),
                    fontName="Helvetica", alignment=TA_CENTER)
SEC    = make_style("HTN_SEC",   fontSize=13, textColor=colors.white,
                    fontName="Helvetica-Bold", alignment=TA_LEFT, leading=18,
                    spaceBefore=8, spaceAfter=4)
BODY   = make_style("HTN_BODY",  fontSize=8.5, textColor=HexColor("#2c3e50"),
                    fontName="Helvetica", leading=12)
BOLD8  = make_style("HTN_BOLD8", fontSize=8.5, textColor=HexColor("#1a3a5c"),
                    fontName="Helvetica-Bold", leading=12)
SMALL  = make_style("HTN_SMALL", fontSize=7.5, textColor=MID_GRAY,
                    fontName="Helvetica", leading=10)
NOTE   = make_style("HTN_NOTE",  fontSize=8, textColor=HexColor("#34495e"),
                    fontName="Helvetica-Oblique", leading=11)

# Table cell styles
CH  = make_style("HTN_CH",  fontSize=8, textColor=colors.white,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CBL = make_style("HTN_CBL", fontSize=8, textColor=colors.white,
                 fontName="Helvetica-Bold", alignment=TA_LEFT, leading=11)
CL  = make_style("HTN_CL",  fontSize=8, textColor=HexColor("#2c3e50"),
                 fontName="Helvetica", leading=11)
CLB = make_style("HTN_CLB", fontSize=8, textColor=HexColor("#1a3a5c"),
                 fontName="Helvetica-Bold", leading=11)
CR  = make_style("HTN_CR",  fontSize=8, textColor=WARN_RED,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CG  = make_style("HTN_CG",  fontSize=8, textColor=GREEN,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CY  = make_style("HTN_CY",  fontSize=8, textColor=WARN_YEL,
                 fontName="Helvetica-Bold", alignment=TA_CENTER, leading=11)
CRC = make_style("HTN_CRC", fontSize=8, textColor=WARN_RED,
                 fontName="Helvetica-Bold", alignment=TA_LEFT, leading=11)

# ── Header/footer ─────────────────────────────────────────────────────────────
def on_page(canvas, doc):
    canvas.saveState()
    # footer bar
    canvas.setFillColor(NAVY)
    canvas.rect(0, 0, PAGE_W, 1.2*cm, fill=1, stroke=0)
    canvas.setFillColor(colors.white)
    canvas.setFont("Helvetica", 7.5)
    canvas.drawCentredString(
        PAGE_W/2, 0.45*cm,
        f"Hypertension Medication Quick Reference  |  Page {doc.page}  |  "
        f"Based on 2025 AHA/ACC Guideline & 2024 ESC Guidelines")
    if doc.page > 1:
        canvas.setFillColor(NAVY)
        canvas.rect(0, PAGE_H - 1.0*cm, PAGE_W, 1.0*cm, fill=1, stroke=0)
        canvas.setFillColor(colors.white)
        canvas.setFont("Helvetica-Bold", 8)
        canvas.drawString(MARGIN, PAGE_H - 0.65*cm,
                          "Hypertension Medications: Side Effects & Monitoring")
        canvas.setFont("Helvetica", 8)
        canvas.drawRightString(PAGE_W - MARGIN, PAGE_H - 0.65*cm,
                               "Quick Reference Card 2025/2026")
    canvas.restoreState()

# ── Helpers ───────────────────────────────────────────────────────────────────
def section_header(text, bg=TEAL):
    data = [[Paragraph(text, SEC)]]
    t = Table(data, colWidths=[PAGE_W - 2*MARGIN])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), bg),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    return t

def std_table_style():
    return TableStyle([
        ("BACKGROUND",    (0, 0), (-1, 0), HEADER_BG),
        ("VALIGN",        (0, 0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0, 0), (-1,-1), 4),
        ("BOTTOMPADDING", (0, 0), (-1,-1), 4),
        ("LEFTPADDING",   (0, 0), (-1,-1), 4),
        ("RIGHTPADDING",  (0, 0), (-1,-1), 4),
        ("GRID",          (0, 0), (-1,-1), 0.35, BORDER),
        ("ROWBACKGROUNDS",(0, 1), (-1,-1), [ROW_WHITE, ROW_ALT]),
        ("LINEBELOW",     (0, 0), (-1, 0), 1.5, TEAL),
    ])

# ══════════════════════════════════════════════════════════════════════════════
# DATA
# ══════════════════════════════════════════════════════════════════════════════

# ── BP Classification ─────────────────────────────────────────────────────────
BP_CLASSES = [
    [Paragraph("BP Category", CH),
     Paragraph("Systolic (mmHg)", CH),
     Paragraph("", CH),
     Paragraph("Diastolic (mmHg)", CH),
     Paragraph("Intervention", CH)],
    [Paragraph("Normal", CG),
     Paragraph("<120", CL), Paragraph("AND", CL), Paragraph("<80", CL),
     Paragraph("Encourage healthy lifestyle", CL)],
    [Paragraph("Elevated", CY),
     Paragraph("120–129", CL), Paragraph("AND", CL), Paragraph("<80", CL),
     Paragraph("Lifestyle modification; no drug therapy", CL)],
    [Paragraph("Stage 1\nHypertension", CY),
     Paragraph("130–139", CL), Paragraph("OR", CL), Paragraph("80–89", CL),
     Paragraph("Lifestyle ± pharmacotherapy guided by CV risk\n(PREVENT score)", CL)],
    [Paragraph("Stage 2\nHypertension", CR),
     Paragraph("≥140", CL), Paragraph("OR", CL), Paragraph("≥90", CL),
     Paragraph("Lifestyle + 2 first-line agents (ideally SPC)", CL)],
    [Paragraph("Hypertensive\nCrisis", make_style("HTN_CRCB", parent_obj=CR,
                alignment=TA_LEFT)),
     Paragraph(">180", CL), Paragraph("AND/OR", CL), Paragraph(">120", CL),
     Paragraph("Hypertensive emergency (with TOD) → IV therapy ICU\nSevere HTN without TOD → Oral agents, gradual ↓", CL)],
]

# ── Main Drug Table ───────────────────────────────────────────────────────────
# Cols: Class | Key Agents | BP ↓ SBP | Mechanism | Key Side Effects | Contraindications | Compelling Indications | Monitoring
DRUG_HEADER = [
    Paragraph("Drug Class", CH),
    Paragraph("Key Agents", CH),
    Paragraph("Mechanism", CH),
    Paragraph("Key Side Effects", CH),
    Paragraph("Contraindications /\nCautions", CH),
    Paragraph("Compelling\nIndications", CH),
    Paragraph("Monitoring", CH),
]

drug_rows = [
    # (class, agents, mechanism, side_effects, contraindications, indications, monitoring)
    ("Thiazide-type\nDiuretics",
     "Chlorthalidone (preferred)\nIndapamide\nHCTZ",
     "Inhibit Na-Cl cotransporter\nin distal tubule → ↓ plasma\nvolume → ↓ CO & SVR",
     "Hypokalemia; Hyponatremia;\nHyperuricemia (gout flare);\nGlucose intolerance;\nHypercalcemia;\nDyslipidaemia (HCTZ>\nchlorothalidone)",
     "Gout (relative);\nHypercalcemia;\nAvoid HCTZ in CKD\neGFR <30; switch to\nloop diuretic",
     "ISH in elderly;\nHeart failure;\nBlack patients\n(monotherapy);\nOsteoporosis\n(hypocalciuria)",
     "Serum K+, Na+, creatinine,\nuric acid, glucose, lipids\nat baseline then 2–4 wk\nafter start/dose change;\nannually once stable"),

    ("Dihydropyridine\nCCBs",
     "Amlodipine (preferred)\nNifedipine LA\nFelodipine\nLercanidipine",
     "Block L-type voltage-gated\nCa²⁺ channels in vascular\nsmooth muscle → arterial\nvasodilation",
     "Peripheral ankle oedema\n(most common);\nFlushing; Headache;\nReflex tachycardia;\nGingival hyperplasia;\nGrapefruit interaction\n(not amlodipine)",
     "Amlodipine safest in HF;\nAvoid non-DHP CCBs in\nHFrEF; Avoid nifedipine\nshort-acting (stroke risk)",
     "ISH; Elderly; Black\npatients; Angina;\nRaynaud's;\nCKD (additive with\nACEi/ARB)",
     "BP at each visit;\nHR; Signs of ankle\noedema; LFTs if\nhepatic disease"),

    ("Non-Dihydropyridine\nCCBs",
     "Verapamil\nDiltiazem",
     "Block cardiac + vascular\nCa²⁺ channels → ↓ HR,\n↓ AV conduction,\nvasodilation",
     "Bradycardia; AV block;\nConstipation (verapamil);\nNegative inotropy;\nPeripheral oedema;\nCYP3A4 inhibition\n(↑ statin levels)",
     "HFrEF (contraindicated);\nAV block ≥2nd degree;\nSick sinus syndrome;\nCombination with\nbeta-blocker (bradycardia)",
     "HTN + AF (rate control);\nAngina;\nHTN + SVT",
     "HR, ECG (PR interval);\nBP; Signs of HF;\nDrug interactions\n(statins: reduce dose)"),

    ("ACE Inhibitors\n(ACEi)",
     "Lisinopril\nRamipril\nEnalapril\nPerindopril\nFosinopril",
     "Inhibit ACE → ↓ angiotensin\nII + ↑ bradykinin →\nvasodilation + ↓ aldosterone\n→ efferent arteriolar dilation\n(renoprotective)",
     "Dry persistent cough\n(10–20%; bradykinin);\nAngioedema (rare, 0.1–0.7%);\nHyperkalemia;\nFirst-dose hypotension;\nAKI (renal artery stenosis)",
     "Bilateral renal artery\nstenosis; Pregnancy\n(all trimesters, Category D);\nHistory of angioedema;\nDo NOT combine\nwith ARB",
     "CKD + proteinuria;\nDiabetic nephropathy;\nHFrEF; Post-MI;\nLVH regression;\nSecondary stroke\nprevention",
     "Serum K+ and creatinine\nwithin 1–2 wk of start\nor dose ↑; then every\n3–6 months; BP;\nUACR if CKD"),

    ("Angiotensin\nReceptor Blockers\n(ARBs)",
     "Losartan\nValsartan\nIrbesartan\nOlmesartan\nCandesartan\nTelmisartan",
     "Block AT₁ receptor →\nvasodilation + ↓ aldosterone;\nNo bradykinin effect\n(no cough)",
     "Hyperkalemia;\nFirst-dose hypotension;\nAKI (bilateral RAS);\nNo cough (vs. ACEi)",
     "Bilateral renal artery\nstenosis; Pregnancy\n(Category D);\nDo NOT combine\nwith ACEi;\nCaution: dual RAAS\nblockade",
     "Same as ACEi;\nPreferred when\nACEi not tolerated\n(cough/angioedema);\nHFrEF (valsartan,\ncandesartan)",
     "As ACEi: K+, creatinine,\nBP; UACR;\nMonitor for\nhypotension at\ninitiation"),

    ("Beta-Blockers",
     "Metoprolol succinate\nBisoprolol\nCarvedilol\nAtenolol\nLabetalol\nNebivolol",
     "Block β₁ (cardiac) and/or\nβ₂ adrenoreceptors → ↓ HR,\n↓ CO, ↓ renin secretion;\nCarvedilol/labetalol:\nalpha + beta blockade",
     "Bradycardia; Fatigue;\nBronchospasm (non-selective);\nCold extremities;\nMask hypoglycemia\nsymptoms (tachycardia);\nSexual dysfunction;\nWeight gain;\nRebound HTN if\nabruptly stopped",
     "Asthma / severe COPD\n(cardioselective safer\nbut caution);\nAV block ≥2nd degree;\nDecompensated HF\n(use cautiously,\ntitrate slowly);\nNOT first-line for\nuncomplicated HTN",
     "HFrEF (metoprolol,\nbisoprolol, carvedilol);\nPost-MI; Angina;\nAF rate control;\nHyperkinetic HTN\n(anxiety, palpitations);\nAortic dissection;\nPregnancy (labetalol)",
     "HR (avoid <50 bpm);\nBP; Signs of HF;\nBlood glucose in\ndiabetics;\nTaper slowly\non discontinuation"),

    ("Loop Diuretics",
     "Furosemide\nTorsemide\nBumetanide",
     "Inhibit Na-K-2Cl\ncotransporter in thick\nascending loop of Henle\n→ powerful natriuresis",
     "Hypokalemia;\nHyponatremia;\nHypomagnesemia;\nOtotoxicity (high IV doses);\nHyperuricemia;\nVolume depletion;\nDehydration",
     "Not first-line for HTN;\nUse when eGFR <25–30\nor volume overload;\nCaution in hypovolemia",
     "CKD eGFR <25–30\n(replace thiazide);\nHTN + HF;\nHTN + volume\noverload",
     "Serum K+, Na+,\ncreatinine at baseline\nthen 1–2 wk after\nstart/change;\nBP; Weight;\nSigns of dehydration"),

    ("MRAs\n(Aldosterone\nAntagonists)",
     "Spironolactone\nEplerenone\nFinerenone\n(CKD/DKD)",
     "Block mineralocorticoid\nreceptor → ↓ Na+ reabsorption\n→ ↓ BP + anti-fibrotic;\nFinerenone: non-steroidal,\nbetter renal/cardiac profile",
     "Hyperkalemia (most\nimportant);\nGynecomastia / mastalgia\n(spironolactone, not\neplerenone/finerenone);\nMenstrual irregularity;\nRenal impairment",
     "eGFR <30 or K+ >5.0\n(use with extreme caution);\nCombination with\nACEi + ARB (triple\nRAAS blockade;\ncaution with any 2\nRAAS agents)",
     "Resistant HTN\n(most effective 4th\nagent ~8–12 mmHg ↓);\nHFrEF; Primary\naldosteronism;\nCKD with DKD\n(finerenone)",
     "Serum K+ at 1 week,\n4 weeks, then every\n3 months;\nCreatinine + eGFR;\nGynaecomastia\nsymptoms (spiro)"),

    ("Alpha-1 Blockers",
     "Doxazosin\nPrazosin\nTerazosin",
     "Block postsynaptic α₁\nadrenoreceptors → arterial\nand venous vasodilation",
     "First-dose orthostatic\nhypotension (significant);\nDizziness; Reflex\ntachycardia;\nFluid retention;\nNasal congestion",
     "Not first-line;\nCaution in elderly\n(fall risk);\nCaution in HF\n(increase mortality\nin ALLHAT)",
     "HTN + BPH;\nHTN +\npheochromocytoma\n(phenoxybenzamine);\nResistant HTN\n(late add-on)",
     "BP sitting AND standing\n(orthostatic hypotension);\nFall risk assessment;\nSigns of fluid retention"),

    ("Central\nSympatholy\u00adtics",
     "Clonidine\nMethyldopa\nMoxonidine",
     "Stimulate α₂ (clonidine) or\nimidazoline receptors in CNS\n→ ↓ sympathetic outflow\n→ ↓ HR + BP",
     "Sedation; Dry mouth;\nOrtho\u00adstatic hypo\u00adtension;\nBradycardia;\nRebound HTN on\nabrupt withdrawal;\nDepression (methyldopa);\nHaemolytic anaemia\n(methyldopa)",
     "Avoid in non-adherent\npatients (rebound HTN);\nTaper slowly over\nweeks to discontinue;\nMethyldopa:\navoid in hepatic disease\nand depression",
     "Resistant HTN\n(late add-on);\nPregnancy\n(methyldopa: safest\nin pregnancy);\nHTN emergency\n(IV labetalol/clonidine)",
     "BP sitting + standing;\nHR; Liver function\n(methyldopa);\nDirect Coombs test\n(methyldopa long-term);\nMood/depression"),

    ("Direct\nVasodilators",
     "Hydralazine\nMinoxidil",
     "Open ATP-sensitive K+\nchannels in arteriolar\nsmooth muscle → direct\narterial vasodilation",
     "Reflex tachycardia;\nFluid retention\n(require concurrent\ndiuretic + β-blocker);\nHydralazine: lupus-like\nsyndrome, DILE;\nMinoxidil: hirsutism,\npericardial effusion",
     "Require concurrent\nβ-blocker + diuretic;\nHydralazine:\navoid in aortic\ndissection;\nMinoxidil: caution\nin CAD + recent MI",
     "Resistant HTN\n(very late add-on);\nPregnancy\n(hydralazine IV:\nacute severe HTN);\nHFrEF (hydralazine\n+ nitrate in ACEi/\nARB-intolerant)",
     "BP; HR; Signs of\nfluid retention + weight;\nANA + anti-dsDNA\nif lupus symptoms\n(hydralazine);\nEcho if pericardial\neffusion suspected"),
]

# ── Monitoring Table ──────────────────────────────────────────────────────────
MON_ROWS = [
    ("BP Measurement",
     "Every clinic visit;\nHome BP monitoring\n(2 readings twice daily\n5–7 days before\nappointments)",
     "Target <130/80 mmHg\n(most patients, 2025 AHA/ACC);\n<140/90 mmHg (2024 ESC\ninitiation threshold);\nElderly >80 yrs: ~150 mmHg SBP",
     "All antihypertensive agents"),
    ("Serum Potassium (K+)",
     "Baseline; 1–2 weeks after\nstart/dose change;\nThen every 3–6 months",
     "K+ <3.5: supplement or\nswitch diuretic;\nK+ >5.5: reduce/hold\nACEi/ARB/MRA;\nK+ >6.0: hold immediately",
     "Thiazides (↓ K+);\nLoop diuretics (↓ K+);\nACEi, ARBs, MRAs (↑ K+)"),
    ("Serum Creatinine / eGFR",
     "Baseline; 1–2 weeks after\nstart or dose change;\nAnnually when stable",
     "Rise in creatinine ≤30%\nafter starting ACEi/ARB:\nacceptable (expected);\n>30% rise: investigate\nrenovascular disease;\nHold if AKI develops",
     "ACEi, ARBs (closely);\nMRAs; Thiazides;\nLoop diuretics"),
    ("Serum Sodium (Na+)",
     "Baseline; 2–4 weeks after\nstart; then annually",
     "Na+ <130: severe\nhyponatraemia — reduce\nor hold diuretic;\nElderly at highest risk",
     "Thiazides (↓ Na+);\nLoop diuretics"),
    ("Uric Acid",
     "Baseline; periodically\nif symptomatic",
     "Elevated uric acid:\nconsider switching\nfrom thiazide to\nother agent if gout flares",
     "Thiazide diuretics\n(hyperuricaemia)"),
    ("Blood Glucose / HbA1c",
     "Baseline; annually\n(or more often if\npre-diabetic)",
     "Thiazides may worsen\nglucose tolerance;\nBeta-blockers mask\nhypo symptoms in\ndiabetics",
     "Thiazide diuretics;\nBeta-blockers\n(in diabetic patients)"),
    ("Lipid Panel",
     "Baseline; annually",
     "HCTZ may raise LDL/TG\n(less so chlorthalidone);\nAdjust lipid therapy if\ncardiovascular risk elevated",
     "Thiazide diuretics\n(especially HCTZ)"),
    ("Heart Rate (HR)",
     "Every clinic visit",
     "Resting HR <50 bpm:\nreduce beta-blocker\nor non-DHP CCB dose;\nHR >100: investigate\nsecondary cause",
     "Beta-blockers;\nNon-DHP CCBs\n(verapamil, diltiazem)"),
    ("Orthostatic BP\n(sitting & standing)",
     "At each visit in elderly;\nAfter dose changes;\nIf symptomatic dizziness",
     "Drop >20 mmHg SBP or\n>10 mmHg DBP on standing:\northostatic hypotension —\nreduce dose or change agent",
     "Alpha-blockers;\nCentral sympatholytics;\nHigh-dose diuretics;\nElderly on multiple agents"),
    ("Serum Magnesium",
     "If symptomatic or high\ndiuretic doses",
     "Hypomagnesaemia →\nmuscle cramps, arrhythmia;\nSupplement or reduce\ndiuretic dose",
     "Loop diuretics;\nThiazides (less common)"),
    ("ANA / Anti-dsDNA",
     "If hydralazine > 200 mg/day\nor lupus symptoms develop",
     "Drug-induced lupus (DILE):\ndiscontinue hydralazine;\ntypically anti-histone\nANA positive",
     "Hydralazine"),
    ("ECG / PR Interval",
     "Baseline; if symptomatic\nbradycardia or palpitations",
     "PR prolongation / AV block:\nhold verapamil or diltiazem;\ncheck for drug interactions",
     "Non-DHP CCBs;\nBeta-blockers"),
    ("Urine ACR\n(Albumin/Creatinine\nRatio)",
     "Annually in all\nhypertensive patients\n(screen for DKD)",
     "ACR ≥30 mg/g:\nstart/intensify\nACEi or ARB;\nAim BP <130/80 mmHg",
     "ACEi/ARBs (monitor\nproteinuria reduction);\nSGLT2i if diabetic"),
    ("Rebound / Withdrawal",
     "Monitor BP closely\nif patient misses doses\nor discontinues therapy",
     "Clonidine: rebound\nhypertensive crisis if\nstopped abruptly;\nTaper over weeks;\nBeta-blockers: taper to\navoid angina/MI rebound",
     "Clonidine;\nBeta-blockers\n(always taper)"),
]

# ── Compelling Indications Table ──────────────────────────────────────────────
CI_HEADER = [
    Paragraph("Comorbidity / Indication", CH),
    Paragraph("First-Line Preferred Agents", CH),
    Paragraph("Agents to Prefer as Add-On", CH),
    Paragraph("Agents to Avoid", CH),
]
CI_ROWS = [
    ("Heart Failure with\nReduced EF (HFrEF)",
     "ACEi or ARB (or ARNI:\nsacubitril/valsartan)\n+ Beta-blocker\n(metoprolol, bisoprolol,\ncarvedilol)\n+ MRA (spironolactone)",
     "Loop diuretic\n(volume control);\nSGLT2i (dapa- or\nempagliflozin)",
     "Non-DHP CCBs\n(verapamil, diltiazem);\nDirect vasodilators\nwithout β-blocker;\nTZDs (if diabetic)"),
    ("Stable CAD /\nPost-MI",
     "Beta-blocker + ACEi\nor ARB (first-line)",
     "Dihydropyridine CCB\nfor angina;\nMRA post-MI with\nLVSD;\nThiazide for resistant BP",
     "Excessive DBP lowering\n(<60 mmHg, ↓ coronary\nperfusion)"),
    ("CKD + Proteinuria\n(DKD)",
     "ACEi or ARB\n(reduce intraglomerular\nhypertension + proteinuria)",
     "SGLT2i (slow CKD\nprogression; even at\nlower eGFR);\nFinerenone (if\nalbuminuria ≥300 mg/g);\nLoop diuretic if\neGFR <25–30",
     "Do NOT combine\nACEi + ARB;\nThiazide if eGFR <30"),
    ("Type 2 Diabetes",
     "ACEi or ARB + CCB\n± thiazide-type diuretic",
     "SGLT2i (added CV\n+ renal benefit);\nLoop diuretic if CKD",
     "Beta-blockers (mask\nhypo symptoms);\nHigh-dose thiazide\n(worsen glucose)"),
    ("Atrial Fibrillation\n(rate control)",
     "Beta-blocker OR\nnon-DHP CCB\n(verapamil, diltiazem)",
     "ACEi/ARB for\nnew-onset AF with HTN\n(structural remodelling)",
     "Combining beta-blocker\n+ non-DHP CCB\n(severe bradycardia/\nAV block)"),
    ("Stroke /\nSecondary TIA\nPrevention",
     "Any antihypertensive\n(restart a few days\npost-stroke);\nACEi + thiazide\n(PROGRESS trial)",
     "ARB (telmisartan\nONTARGET data);\nStatin mandatory",
     "Excessive acute lowering\nwithin 24h of ischaemic\nstroke (unless\nthrombolysis planned)"),
    ("LVH",
     "ARB or ACEi\n(best LVH regression);\nCCB",
     "Thiazide diuretic",
     "Hydralazine;\nMinoxidil\n(direct vasodilators:\nno LVH regression)"),
    ("Elderly /\nIsolated Systolic HTN\n(ISH)",
     "Long-acting DHP CCB\n(amlodipine) OR\nThiazide-type diuretic\n(chlorthalidone)",
     "ACEi or ARB if\nalso CKD/HF/DM",
     "Short-acting agents;\nExcessive BP lowering\n(DBP <60 mmHg)"),
    ("Black / African\nAmerican patients",
     "DHP CCB + Thiazide\n(more effective as\nmonotherapy in this\npopulation)",
     "ACEi/ARB less\neffective as monotherapy\nbut add for CKD/HF",
     "ACEi/ARB monotherapy\n(inadequate response\nwithout diuretic/CCB)"),
    ("Pregnancy",
     "Methyldopa;\nLabetalol;\nNifedipine (extended\nrelease)",
     "Hydralazine IV for\nacute severe HTN",
     "ACEi and ARBs\n(teratogenic, Category D);\nMRAs (anti-androgenic);\nDirect renin inhibitors"),
    ("Primary\nAldosteronism",
     "MRA: Spironolactone\nor Eplerenone\n(adrenal hyperplasia);\nAdrenalectomy\n(unilateral adenoma)",
     "Any antihypertensive\nfor residual BP control",
     "Thiazide monotherapy\n(inadequate without\nRAAS blockade)"),
    ("Resistant\nHypertension\n(≥3 agents, failing)",
     "Confirm adherence +\ncorrect technique;\nOptimise diuretic\n(switch to chlorthalidone)\nThen ADD:\nSpironolactone (1st choice\n4th agent)",
     "Beta-blocker, doxazosin,\nclonidine (taper on DC);\nMinoxidil (+ diuretic\n+ β-blocker);\nRenal denervation\n(select centres)",
     "Screen for primary\naldosteronism\nbefore adding agents"),
]

# ── IV Agents for Hypertensive Emergency ─────────────────────────────────────
IV_HEADER = [
    Paragraph("IV Agent", CH),
    Paragraph("Class", CH),
    Paragraph("Onset / Duration", CH),
    Paragraph("Preferred Use", CH),
    Paragraph("Key Cautions", CH),
]
IV_ROWS = [
    ("Nicardipine\n0.5–15 mcg/kg/min",
     "DHP CCB", "Minutes / 15–30 min",
     "Most hypertensive emergencies;\nAcute ischaemic stroke;\nPost-op HTN",
     "Reflex tachycardia;\nAvoid in severe aortic\nstenosis"),
    ("Labetalol\n0.5–2 mg/min or\n20–80 mg IV bolus q10 min",
     "α + β Blocker", "5 min / 3–6 h",
     "Most emergencies;\nAortic dissection;\nPregnancy (eclampsia);\nHypertensive\nencephalopathy",
     "Avoid in asthma;\nAvoid in HFrEF;\nAV block"),
    ("Clevidipine\n1–32 mg/h",
     "Ultra-short\nDHP CCB", "2–4 min / 5–15 min",
     "Perioperative HTN;\nMost emergencies;\nCardiac surgery",
     "Soybean/egg allergy\n(lipid emulsion);\nReflex tachycardia"),
    ("Esmolol\n50–200 mcg/kg/min",
     "Ultra-short\nβ₁ Blocker", "1–2 min / 10–30 min",
     "Aortic dissection\n(combine with\nnicardipine);\nPerioperative;\nHTN + tachyarrhythmia",
     "Avoid asthma;\nAV block;\nMonitor HR closely"),
    ("Sodium\nNitroprusside\n0.25–10 mcg/kg/min",
     "NO donor /\nVasodilator", "Seconds / 1–3 min",
     "Refractory emergencies\n(last resort);\nHTN + acute HF\n(with nitrate)",
     "Cyanide toxicity\n(>48h or renal failure);\nAvoid in raised ICP;\nRequires arterial line"),
    ("Hydralazine\n5–20 mg IV bolus\nq20 min (max 40 mg)",
     "Direct\nVasodilator", "10–20 min / 2–4 h",
     "Eclampsia /\nPre-eclampsia;\nHTN in pregnancy",
     "Unpredictable BP\ndrop; Reflex\ntachycardia;\nNot preferred in\nother emergencies"),
    ("Phentolamine\n5–15 mg IV bolus",
     "α Blocker", "1–2 min / 15–30 min",
     "Phaeochromocytoma\ncrisis;\nCocaine-induced HTN;\nClonidine withdrawal",
     "Avoid beta-blocker\nbefore α-block\n(↑ BP surge);\nReflex tachycardia"),
    ("Glyceryl trinitrate\n(Nitroglycerin)\n5–100 mcg/min",
     "Nitrate /\nNO donor", "2–5 min / 5–10 min",
     "HTN + ACS;\nHTN + acute\npulmonary oedema;\nPost-CABG",
     "Tolerance (>24h);\nAvoid with\nphosphodiesterase-5\ninhibitors;\nHeadache"),
    ("Fenoldopam\n0.1–1.6 mcg/kg/min",
     "DA₁ Agonist", "5 min / 30 min",
     "HTN emergency\n+ AKI risk\n(↑ renal perfusion);\nPost-op",
     "Glaucoma\n(↑ IOP);\nReflex tachycardia;\nHypokalaemia"),
]

# ── Drug Interactions ──────────────────────────────────────────────────────────
INT_ROWS = [
    ("ACEi / ARB + NSAIDs (ibuprofen, naproxen, indomethacin)",
     "NSAIDs blunt antihypertensive effect + impair renal function. Avoid if possible; use paracetamol preferentially. Celecoxib and sulindac have the least effect."),
    ("ACEi / ARB + Potassium supplements or MRA",
     "Additive hyperkalaemia risk. Monitor K+ closely; check within 1 week of adding any new RAAS agent."),
    ("ACEi / ARB + ACEi (dual RAAS blockade)",
     "Do NOT combine ACEi + ARB. No added BP benefit; significantly ↑ AKI, hyperkalaemia, hypotension. ONTARGET trial confirmed harm."),
    ("Beta-blocker + Non-DHP CCB (verapamil/diltiazem)",
     "Additive bradycardia + AV block risk. Avoid combination unless under specialist monitoring."),
    ("Thiazide + Loop diuretic",
     "Sequential nephron blockade → profound volume depletion, electrolyte disturbances. Use only under close supervision in refractory oedema."),
    ("DHP CCBs (non-amlodipine) + Grapefruit juice",
     "Grapefruit inhibits CYP3A4 in intestine → ↑ CCB bioavailability → excessive vasodilation for up to 24h. Advise patients to avoid grapefruit juice."),
    ("Verapamil / Diltiazem + Statins (simvastatin, atorvastatin)",
     "Non-DHP CCBs are potent CYP3A4 inhibitors → ↑ statin levels → myopathy/rhabdomyolysis risk. Reduce simvastatin dose; max simvastatin 20 mg with amlodipine. Use rosuvastatin (no CYP3A4) safely."),
    ("Clonidine + Beta-blocker (on withdrawal)",
     "If both stopped, clonidine rebound HTN is worsened by loss of β-blockade. Always taper clonidine slowly; do not stop abruptly."),
    ("Alpha-blocker + PDE-5 inhibitor (sildenafil, tadalafil)",
     "Profound hypotension, especially with doxazosin. Advise patients; separate doses; use lowest PDE-5 inhibitor dose."),
    ("Loop diuretics + Aminoglycosides",
     "Additive ototoxicity risk. Avoid combination where possible; if necessary, monitor renal function and audiometry."),
    ("Metoprolol / Beta-blockers + Insulin / Sulfonylureas",
     "Beta-blockers mask tachycardia (key warning sign of hypoglycaemia); sweating still present. Inform diabetic patients. Cardioselective β-blockers preferred."),
    ("ACEi + Contrast media",
     "Increased risk of contrast nephropathy, especially with pre-existing CKD. Hold ACEi/ARB 24–48h before high-risk contrast procedures; restart after renal function confirmed stable."),
]

# ══════════════════════════════════════════════════════════════════════════════
# BUILD PDF
# ══════════════════════════════════════════════════════════════════════════════
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=MARGIN, rightMargin=MARGIN,
    topMargin=2.0*cm, bottomMargin=1.8*cm,
    title="Hypertension Medication Quick Reference",
    author="Orris Clinical Reference",
    subject="Hypertension Medications: Side Effects & Monitoring",
)

story = []

# ── Cover block ───────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("Hypertension Management", TITLE),
    Paragraph("Antihypertensive Medications: Side Effects, Indications &amp; Monitoring Requirements", SUBT),
    Paragraph(
        f"Quick Reference Card  ·  2025 AHA/ACC Multisociety Guideline &amp; 2024 ESC Guidelines  ·  {date.today().strftime('%B %Y')}",
        DATE_S),
]]
cover = Table(cover_data, colWidths=[PAGE_W - 2*MARGIN])
cover.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), NAVY),
    ("TOPPADDING",    (0,0), (-1,-1), 18),
    ("BOTTOMPADDING", (0,0), (-1,-1), 18),
    ("LEFTPADDING",   (0,0), (-1,-1), 14),
    ("RIGHTPADDING",  (0,0), (-1,-1), 14),
]))
story.append(cover)
story.append(Spacer(1, 0.35*cm))

# ── Section 0: BP Classification ─────────────────────────────────────────────
story.append(section_header("0   Blood Pressure Classification & Treatment Thresholds", bg=HexColor("#145a32")))
story.append(Spacer(1, 0.2*cm))

bp_col_w = [3.4*cm, 2.4*cm, 1.1*cm, 2.4*cm, 9.8*cm]
bp_table = Table(BP_CLASSES, colWidths=bp_col_w)
bp_table.setStyle(std_table_style())
story.append(bp_table)
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
    "TOD = Target Organ Damage. SPC = Single-Pill Combination. "
    "2025 AHA/ACC universal BP goal: <130/80 mmHg for most adults on treatment. "
    "2024 ESC: initiate pharmacotherapy at confirmed BP ≥140/90 mmHg. "
    "Elderly ≥80 years: target ~150 mmHg SBP (HYVET); avoid DBP <60 mmHg in CAD.",
    SMALL))

story.append(PageBreak())

# ── Section 1: Main Drug Table ────────────────────────────────────────────────
story.append(section_header("1   Antihypertensive Drug Classes — Side Effects, Indications & Monitoring"))
story.append(Spacer(1, 0.2*cm))

drug_col_w = [2.5*cm, 2.5*cm, 3.0*cm, 3.5*cm, 3.0*cm, 2.7*cm, 2.9*cm]
drug_data = [DRUG_HEADER]
for i, r in enumerate(drug_rows):
    cls, agents, mech, se, ci, ind, mon = r
    drug_data.append([
        Paragraph(cls,    CLB),
        Paragraph(agents, CL),
        Paragraph(mech,   CL),
        Paragraph(se,     CL),
        Paragraph(ci,     CL),
        Paragraph(ind,    CL),
        Paragraph(mon,    CL),
    ])

drug_table = Table(drug_data, colWidths=drug_col_w, repeatRows=1)
drug_table.setStyle(std_table_style())
story.append(drug_table)
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
    "* Chlorthalidone preferred over HCTZ (longer half-life, more CV outcome data). "
    "ARB preferred over ACEi when cough/angioedema present. "
    "ARNI (sacubitril/valsartan) replaces ACEi/ARB in HFrEF. "
    "Non-DHP CCBs (verapamil, diltiazem) are potent CYP3A4 inhibitors — check statin doses.",
    SMALL))

story.append(PageBreak())

# ── Section 2: Monitoring Schedule ───────────────────────────────────────────
story.append(section_header("2   Routine Monitoring Schedule"))
story.append(Spacer(1, 0.2*cm))

mon_col_w = [3.4*cm, 3.4*cm, 5.4*cm, 7.0*cm]
MON_HEADER_ROW = [
    Paragraph("Parameter", CH),
    Paragraph("Frequency", CH),
    Paragraph("Target / Action", CH),
    Paragraph("Relevant Drug Classes", CH),
]
mon_data = [MON_HEADER_ROW]
for i, (param, freq, action, drugs) in enumerate(MON_ROWS):
    mon_data.append([
        Paragraph(param,  CLB),
        Paragraph(freq,   CL),
        Paragraph(action, CL),
        Paragraph(drugs,  CL),
    ])
mon_table = Table(mon_data, colWidths=mon_col_w, repeatRows=1)
mon_table.setStyle(std_table_style())
story.append(mon_table)
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
    "Home BP monitoring: 2 readings in the morning and evening for 5–7 days before clinic visits. "
    "Ambulatory BP monitoring (ABPM) is preferred to confirm diagnosis and detect white-coat or masked hypertension. "
    "Always measure BP both sitting and standing in elderly patients and those on multiple agents.",
    NOTE))

story.append(PageBreak())

# ── Section 3: Compelling Indications ────────────────────────────────────────
story.append(section_header("3   Drug Selection by Comorbidity (Compelling Indications)"))
story.append(Spacer(1, 0.2*cm))

ci_col_w = [3.3*cm, 4.6*cm, 4.3*cm, 7.0*cm]
ci_data = [CI_HEADER]
for i, (pop, pref, addon, avoid) in enumerate(CI_ROWS):
    ci_data.append([
        Paragraph(pop,   CLB),
        Paragraph(pref,  CL),
        Paragraph(addon, CL),
        Paragraph(avoid, CL),
    ])
ci_table = Table(ci_data, colWidths=ci_col_w, repeatRows=1)
ci_table.setStyle(std_table_style())
story.append(ci_table)
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
    "Black patients: initiate with thiazide + DHP CCB; ACEi/ARB less effective as monotherapy due to lower renin levels. "
    "Stage 2 HTN: initiate 2 agents in a single-pill combination (SPC) where available. "
    "Resistant HTN: exclude non-adherence, white-coat effect, secondary causes, and BP-raising drugs (NSAIDs, OCP, decongestants, licorice) before adding a 4th agent.",
    NOTE))

story.append(PageBreak())

# ── Section 4: IV Agents ──────────────────────────────────────────────────────
story.append(section_header("4   Hypertensive Emergency — IV Treatment Options", bg=CRIMSON))
story.append(Spacer(1, 0.2*cm))

story.append(Paragraph(
    "Goal: Reduce MAP by no more than 20–25% in first hour, then to ~160/100 mmHg over 2–6 hours. "
    "AVOID sublingual nifedipine (unpredictable BP drop, stroke risk). "
    "Treat in ICU/HDU with continuous arterial BP monitoring. Identify and treat underlying cause.",
    NOTE))
story.append(Spacer(1, 0.2*cm))

iv_col_w = [3.2*cm, 2.4*cm, 2.8*cm, 5.0*cm, 5.8*cm]
iv_data = [IV_HEADER]
for i, (agent, cls, onset, use, caution) in enumerate(IV_ROWS):
    iv_data.append([
        Paragraph(agent,   CLB),
        Paragraph(cls,     CL),
        Paragraph(onset,   CL),
        Paragraph(use,     CL),
        Paragraph(caution, CL),
    ])
iv_table = Table(iv_data, colWidths=iv_col_w, repeatRows=1)
iv_table.setStyle(std_table_style())
story.append(iv_table)
story.append(Spacer(1, 0.25*cm))

# Hypertensive Emergency vs non-emergency box
box_data = [
    [Paragraph("Hypertensive EMERGENCY", make_style("HTN_BE", parent_obj=CLB,
               fontSize=8.5, textColor=WARN_RED)),
     Paragraph("Severe HTN WITHOUT Target-Organ Damage\n(formerly 'hypertensive urgency')", make_style(
               "HTN_BU", parent_obj=CLB, fontSize=8.5, textColor=HexColor("#117a65")))],
    [Paragraph(
        "• BP >180/120 mmHg WITH acute target-organ damage\n"
        "• TOD: encephalopathy, ACS, acute HF, aortic dissection,\n"
        "  eclampsia, haemorrhagic/ischaemic stroke, retinal haemorrhage\n"
        "• Require IV therapy in ICU\n"
        "• Reduce MAP ≤25% in 1h; then target 160/100 over 2–6h\n"
        "• Do NOT normalise BP too rapidly (ischaemia risk)", CL),
     Paragraph(
        "• BP >180/120 mmHg WITHOUT signs of TOD\n"
        "• Term 'hypertensive urgency' RETIRED (2025 AHA/ACC)\n"
        "• Oral antihypertensives appropriate\n"
        "• Gradual reduction over 24–48 hours\n"
        "• Avoid aggressive IV therapy and ED admission\n"
        "• Reassess in outpatient setting within 24–72h", CL)],
]
box_table = Table(box_data, colWidths=[9.2*cm, 10.0*cm])
box_table.setStyle(TableStyle([
    ("BACKGROUND",    (0, 0), (0, 0), HexColor("#fdedec")),
    ("BACKGROUND",    (1, 0), (1, 0), HexColor("#eafaf1")),
    ("BACKGROUND",    (0, 1), (0, 1), HexColor("#fff9f9")),
    ("BACKGROUND",    (1, 1), (1, 1), HexColor("#f0fdf4")),
    ("VALIGN",        (0, 0), (-1,-1), "TOP"),
    ("TOPPADDING",    (0, 0), (-1,-1), 5),
    ("BOTTOMPADDING", (0, 0), (-1,-1), 5),
    ("LEFTPADDING",   (0, 0), (-1,-1), 6),
    ("RIGHTPADDING",  (0, 0), (-1,-1), 6),
    ("GRID",          (0, 0), (-1,-1), 0.5, BORDER),
]))
story.append(box_table)

story.append(PageBreak())

# ── Section 5: Drug Interactions ─────────────────────────────────────────────
story.append(section_header("5   Key Drug Interactions", bg=NAVY))
story.append(Spacer(1, 0.2*cm))

int_col_w = [6.5*cm, 12.7*cm]
int_data = [
    [Paragraph("Interaction", CH), Paragraph("Clinical Significance & Management", CH)]
]
for i, (combo, effect) in enumerate(INT_ROWS):
    int_data.append([
        Paragraph(combo,  CLB),
        Paragraph(effect, CL),
    ])
int_table = Table(int_data, colWidths=int_col_w, repeatRows=1)
int_table.setStyle(std_table_style())
story.append(int_table)
story.append(Spacer(1, 0.3*cm))

# ── Section 6: Lifestyle BP reduction quick table ─────────────────────────────
story.append(section_header("6   Lifestyle Interventions — Expected SBP Reduction", bg=HexColor("#145a32")))
story.append(Spacer(1, 0.2*cm))

ls_col_w = [4.0*cm, 6.5*cm, 3.0*cm, 5.7*cm]
ls_data = [
    [Paragraph("Intervention", CH), Paragraph("Recommendation", CH),
     Paragraph("Expected SBP ↓", CH), Paragraph("Notes", CH)],
    [Paragraph("Weight reduction", CLB),
     Paragraph("Maintain BMI 18.5–24.9 kg/m²", CL),
     Paragraph("5–20 mmHg per 10 kg lost", CG),
     Paragraph("Most effective single lifestyle measure in obese patients", CL)],
    [Paragraph("DASH diet", CLB),
     Paragraph("High fruits, vegetables, low-fat dairy; low saturated fat", CL),
     Paragraph("8–14 mmHg", CG),
     Paragraph("Greatest dietary effect; also lowers LDL", CL)],
    [Paragraph("Sodium restriction", CLB),
     Paragraph("<2,300 mg/day sodium (<100 mmol/day)", CL),
     Paragraph("2–8 mmHg", CG),
     Paragraph("More effective in salt-sensitive patients (elderly, Black, CKD)", CL)],
    [Paragraph("Aerobic exercise", CLB),
     Paragraph("≥30 min/day, most days of the week (brisk walking)", CL),
     Paragraph("5–8 mmHg", CG),
     Paragraph("150 min/week moderate intensity; swimming, cycling also effective", CL)],
    [Paragraph("Dynamic resistance\nexercise", CLB),
     Paragraph("90–150 min/week; 6 exercises, 3 sets × 10 reps", CL),
     Paragraph("~4 mmHg", CG),
     Paragraph("Complements aerobic exercise; improves insulin sensitivity", CL)],
    [Paragraph("Isometric exercise\n(hand-grip)", CLB),
     Paragraph("4 × 2 min, 1 min rest, 3 sessions/week for 8–10 weeks", CL),
     Paragraph("~5 mmHg", CG),
     Paragraph("Underused; good evidence in hypertension guidelines", CL)],
    [Paragraph("Alcohol moderation", CLB),
     Paragraph("≤2 drinks/day men; ≤1 drink/day women", CL),
     Paragraph("2–4 mmHg", CG),
     Paragraph("Heavy alcohol is an important secondary cause of HTN", CL)],
    [Paragraph("Potassium intake", CLB),
     Paragraph("3,500–5,000 mg/day (fruit, vegetables, legumes)", CL),
     Paragraph("2–3 mmHg", CG),
     Paragraph("Check K+ if on ACEi/ARB/MRA before supplementing", CL)],
    [Paragraph("Smoking cessation", CLB),
     Paragraph("Complete cessation; use NRT, varenicline or bupropion", CL),
     Paragraph("Variable acutely;\nsignificant CV risk ↓", CG),
     Paragraph("Smoking does not persistently raise BP but massively ↑ CV risk", CL)],
]
ls_table = Table(ls_data, colWidths=ls_col_w, repeatRows=1)
ls_table.setStyle(std_table_style())
story.append(ls_table)
story.append(Spacer(1, 0.3*cm))

# ── Disclaimer ────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=0.5, color=BORDER))
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
    "DISCLAIMER: This reference card is intended for educational and clinical support purposes only. "
    "Always consult current prescribing information and apply clinical judgement to individual patient circumstances. "
    "Sources: 2025 AHA/ACC/Multisociety Guideline for the Prevention, Detection, Evaluation and Management of High Blood Pressure in Adults "
    "(Hypertension. 2025; PMID 40811516); 2024 ESC Guidelines for Elevated Blood Pressure and Hypertension (ESC 2024); "
    "Harrison's Principles of Internal Medicine 22E (2025); Goldman-Cecil Medicine International Edition; "
    "NKF Primer on Kidney Diseases 8e; Comprehensive Clinical Nephrology 7e; Braunwald's Heart Disease 2e.",
    SMALL))

# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print("PDF generated:", OUTPUT)
Running Command

cd /home/daytona/workspace/htn-pdf && python3 generate_htn_pdf.py 2>&1

Running Command

python3 -c " from pypdf import PdfReader; import os r = PdfReader('/home/daytona…

Your hypertension PDF is ready - 8 pages, 31.8 KB.

Hypertension Medication Reference

PDF Document · PDF


Here's what the 8-page PDF covers:
Page 1 - BP Classification Table AHA/ACC 2025 staging (Normal → Elevated → Stage 1 → Stage 2 → Hypertensive Crisis) with colour-coded rows and intervention thresholds including the new "severe HTN without TOD" terminology.
Pages 2-3 - Drug Class Table (11 classes) Thiazides, DHP CCBs, Non-DHP CCBs, ACEi, ARBs, Beta-blockers, Loop diuretics, MRAs, Alpha-blockers, Central sympatholytics, Direct vasodilators - each with mechanism, key side effects, contraindications, compelling indications, and monitoring.
Page 4 - Monitoring Schedule (14 parameters) BP, K+, creatinine/eGFR, sodium, uric acid, blood glucose, lipids, HR, orthostatic BP, magnesium, ANA/anti-dsDNA, ECG, UACR, rebound/withdrawal - all with frequency, threshold/action, and relevant drug classes.
Page 5 - Compelling Indications Table (12 comorbidities) HFrEF, Stable CAD, CKD, T2DM, AF, Stroke/TIA, LVH, Elderly/ISH, Black patients, Pregnancy, Primary aldosteronism, Resistant HTN - preferred vs. avoid agents.
Pages 6-7 - IV Hypertensive Emergency Table + Emergency vs. Urgency Box 9 IV agents (nicardipine, labetalol, clevidipine, esmolol, nitroprusside, hydralazine, phentolamine, GTN, fenoldopam) with doses, onset, preferred use, and cautions. Side-by-side comparison box: Emergency (IV/ICU) vs. Severe HTN without TOD (oral/outpatient).
Page 8 - Drug Interactions + Lifestyle Table 12 key interactions (ACEi+NSAIDs, dual RAAS, β-blocker+non-DHP CCB, grapefruit+CCB, etc.) plus 9 lifestyle interventions with expected SBP reductions.
This is a shared conversation. Sign in to Orris to start your own chat.