-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_flowchart_pdf.py
More file actions
511 lines (474 loc) · 27.6 KB
/
Copy pathgenerate_flowchart_pdf.py
File metadata and controls
511 lines (474 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
import subprocess
import os
html_content = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ACS CDSS Patient Risk Assessment & Rules Engine Flowchart</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
}
}
}
}
</script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
@page {
size: A4 portrait;
margin: 10mm 15mm 15mm 15mm;
}
.page-break {
page-break-after: always;
}
.arrow-down {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 10px solid #6366f1;
margin: 4px auto;
}
.line-vertical {
width: 2px;
height: 20px;
background-color: #6366f1;
margin: 0 auto;
}
</style>
</head>
<body class="bg-slate-50 text-slate-900 text-sm p-4">
<!-- ==================== PAGE 1 ==================== -->
<div class="page-break max-w-[800px] mx-auto bg-white p-8 rounded-3xl shadow-sm border border-slate-100">
<!-- Header -->
<div class="flex justify-between items-center border-b-2 border-indigo-600 pb-4 mb-6">
<div>
<span class="text-xs font-bold uppercase tracking-wider text-indigo-600">Clinical Protocol Handout</span>
<h1 class="text-2xl font-extrabold text-slate-900 tracking-tight">ACS CDSS: Patient Risk & Rules Engine</h1>
<p class="text-xs text-slate-500 mt-1">Based on the 2025 ACC/AHA ACS Management Guidelines</p>
</div>
<div class="text-right">
<span class="px-3 py-1.5 rounded-full text-xs font-semibold bg-indigo-50 text-indigo-700 border border-indigo-100">CDSS v1.2</span>
</div>
</div>
<!-- Overview -->
<div class="mb-6 p-4 bg-slate-50 rounded-2xl border border-slate-100">
<h2 class="text-xs font-bold uppercase tracking-wider text-slate-700 mb-1">Introduction</h2>
<p class="text-xs text-slate-600 leading-relaxed">
This flowchart outlines the systematic patient intake verification, risk stratification, and guideline-directed medical therapy rules assessed by the CDSS Dashboard when processing clinical registry data.
</p>
</div>
<!-- Section 1: Initial Ingestion & SpO2 -->
<div class="mb-6">
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">1</span>
<h2 class="text-base font-bold text-slate-900">Initial Check: Oxygenation Safety</h2>
</div>
<!-- Flowchart Box -->
<div class="flex flex-col items-center">
<div class="w-full max-w-md p-3 bg-indigo-50 border border-indigo-100 rounded-xl text-center font-semibold text-indigo-950">
Identify Patient & Verify SpO2 (Oxygen Saturation)
</div>
<div class="line-vertical"></div>
<div class="arrow-down"></div>
<div class="grid grid-cols-2 gap-4 w-full">
<div class="p-3 bg-rose-50 border border-rose-100 rounded-xl text-center">
<span class="block text-xs font-bold text-rose-800 uppercase tracking-wide">If SpO2 < 90% (Hypoxemia)</span>
<p class="text-[11px] text-rose-700 mt-1 font-medium">Trigger: HYPOXEMIA ALERT. Administer supplementary oxygen immediately.</p>
</div>
<div class="p-3 bg-emerald-50 border border-emerald-100 rounded-xl text-center">
<span class="block text-xs font-bold text-emerald-800 uppercase tracking-wide">If SpO2 >= 90%</span>
<p class="text-[11px] text-emerald-700 mt-1 font-medium">Proceed directly to primary diagnosis mapping.</p>
</div>
</div>
</div>
</div>
<!-- Section 2: Reperfusion & Antiplatelet Selection -->
<div>
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">2</span>
<h2 class="text-base font-bold text-slate-900">Reperfusion vs. Antiplatelet Mapping</h2>
</div>
<!-- STEMI vs NSTE-ACS Branching -->
<div class="grid grid-cols-2 gap-6">
<!-- STEMI PATH -->
<div class="border border-slate-200 rounded-2xl p-4 bg-slate-50/50">
<div class="text-center font-bold text-slate-900 border-b border-slate-200 pb-2 mb-3 text-xs bg-rose-50 border border-rose-100 rounded-lg py-1">
PATH A: STEMI Primary Classification
</div>
<div class="space-y-4">
<!-- Fibrinolytics -->
<div class="bg-white p-3 rounded-xl border border-slate-100">
<span class="text-[11px] font-bold text-indigo-600 block uppercase">Fibrinolytic Therapy</span>
<p class="text-xs text-slate-600 mt-1"><strong>Guideline Preferred:</strong> Aspirin + Clopidogrel.</p>
<ul class="text-[8.5px] text-slate-500 list-disc pl-4 mt-1 space-y-1.5">
<li><strong>Aspirin:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 162–325 mg orally (non-enteric coated, chew if possible)</li>
<li>Maintenance Dose: 75–100 mg orally once daily</li>
</ul>
</li>
<li><strong>Clopidogrel (STEMI with fibrinolytic therapy):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Age ≤75 years:
<ul class="list-[square] pl-3 space-y-0.5">
<li>Loading Dose: 300 mg orally</li>
<li>Maintenance Dose: 75 mg orally once daily</li>
</ul>
</li>
<li>Age >75 years:
<ul class="list-[square] pl-3 space-y-0.5">
<li>No loading dose</li>
<li>Maintenance Dose: 75 mg orally once daily</li>
</ul>
</li>
</ul>
</li>
<li><strong>Fibrinolytic therapy:</strong> Consider when primary PCI (PPCI) is not possible, particularly in STEMI.</li>
<li><strong>Parenteral Anticoagulation:</strong> For all patients.</li>
<li><strong>β-blockers:</strong> Reduce reinfarction and ventricular arrhythmias in STEMI.</li>
<li><strong>RAAS Inhibition:</strong> Oral ACE inhibitors reduce all-cause mortality and MACE, especially if LVEF <40%, hypertension, or diabetes mellitus.</li>
</ul>
<div class="mt-2 p-1.5 bg-rose-50 border border-rose-100 rounded text-[9px] text-rose-700 font-semibold">
ALERT: Discontinue Ticagrelor/Prasugrel if used with fibrinolytics (Hemorrhage risk).
</div>
</div>
<!-- PPCI -->
<div class="bg-white p-3 rounded-xl border border-slate-100">
<span class="text-[11px] font-bold text-indigo-600 block uppercase">Primary PCI (PPCI)</span>
<p class="text-xs text-slate-600 mt-1"><strong>Guideline Preferred:</strong> Aspirin + Ticagrelor or Prasugrel.</p>
<ul class="text-[8.5px] text-slate-500 list-disc pl-4 mt-1 space-y-1.5">
<li><strong>Aspirin:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 162–325 mg orally (non-enteric coated, chew if possible)</li>
<li>Maintenance Dose: 75–100 mg orally once daily</li>
</ul>
</li>
<li><strong>Ticagrelor:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 180 mg orally</li>
<li>Maintenance Dose: 90 mg orally twice daily</li>
</ul>
</li>
<li><strong>Prasugrel (PCI only):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 60 mg orally</li>
<li>Maintenance Dose:
<ul class="list-[square] pl-3 space-y-0.5">
<li>10 mg orally once daily if body weight ≥60 kg and age <75 years</li>
<li>5 mg orally once daily if body weight <60 kg or age ≥75 years (use with caution)</li>
</ul>
</li>
</ul>
</li>
<li><strong>Clopidogrel (Fallback):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 300 mg or 600 mg orally</li>
<li>Maintenance Dose: 75 mg orally once daily</li>
</ul>
</li>
<li><strong>Parenteral Anticoagulation:</strong> For all patients.</li>
<li><strong>β-blockers:</strong> Reduce reinfarction and ventricular arrhythmias in STEMI.</li>
<li><strong>RAAS Inhibition:</strong> Oral ACE inhibitors reduce all-cause mortality and MACE, especially if LVEF <40%, hypertension, or diabetes mellitus.</li>
</ul>
</div>
</div>
</div>
<!-- NSTE-ACS PATH -->
<div class="border border-slate-200 rounded-2xl p-4 bg-slate-50/50">
<div class="text-center font-bold text-slate-900 border-b border-slate-200 pb-2 mb-3 text-xs bg-sky-50 border border-sky-100 rounded-lg py-1">
PATH B: NSTE-ACS Classification
</div>
<div class="space-y-4">
<!-- Medical Management -->
<div class="bg-white p-3 rounded-xl border border-slate-100">
<span class="text-[11px] font-bold text-indigo-600 block uppercase">Conservative Medical Management</span>
<p class="text-xs text-slate-600 mt-1"><strong>Guideline Preferred:</strong> Aspirin + Ticagrelor (12 months).</p>
<ul class="text-[8.5px] text-slate-500 list-disc pl-4 mt-1 space-y-1.5">
<li><strong>Aspirin:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 162–325 mg orally (non-enteric coated, chew if possible)</li>
<li>Maintenance Dose: 75–100 mg orally once daily</li>
</ul>
</li>
<li><strong>Ticagrelor:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 180 mg orally</li>
<li>Maintenance Dose: 90 mg orally twice daily</li>
</ul>
</li>
<li><strong>Clopidogrel (Fallback):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 300 mg or 600 mg orally</li>
<li>Maintenance Dose: 75 mg orally once daily</li>
</ul>
</li>
<li><strong>Parenteral Anticoagulation:</strong> For all patients.</li>
<li><strong>β-blockers:</strong> Recommended in patients with LVEF <40% or heart failure.</li>
<li><strong>RAAS Inhibition:</strong> Oral ACE inhibitors reduce all-cause mortality and MACE, especially if LVEF <40%, hypertension, or diabetes mellitus.</li>
</ul>
<div class="mt-2 p-1.5 bg-amber-50 border border-amber-100 rounded text-[9px] text-amber-800 font-semibold">
ALERT: Clopidogrel is non-preferential for standard-risk medical paths.
</div>
</div>
<!-- Invasive Strategy -->
<div class="bg-white p-3 rounded-xl border border-slate-100">
<span class="text-[11px] font-bold text-indigo-600 block uppercase">Invasive Strategy (Angiography)</span>
<p class="text-xs text-slate-600 mt-1"><strong>Guideline Preferred:</strong> Aspirin + Ticagrelor or Prasugrel.</p>
<ul class="text-[8.5px] text-slate-500 list-disc pl-4 mt-1 space-y-1.5">
<li><strong>Aspirin:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 162–325 mg orally (non-enteric coated, chew if possible)</li>
<li>Maintenance Dose: 75–100 mg orally once daily</li>
</ul>
</li>
<li><strong>Ticagrelor:</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 180 mg orally</li>
<li>Maintenance Dose: 90 mg orally twice daily</li>
</ul>
</li>
<li><strong>Prasugrel (PCI only):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 60 mg orally</li>
<li>Maintenance Dose:
<ul class="list-[square] pl-3 space-y-0.5">
<li>10 mg orally once daily if body weight ≥60 kg and age <75 years</li>
<li>5 mg orally once daily if body weight <60 kg or age ≥75 years (use with caution)</li>
</ul>
</li>
</ul>
</li>
<li><strong>Clopidogrel (Fallback):</strong>
<ul class="list-[circle] pl-3 mt-0.5 space-y-0.5 text-slate-400">
<li>Loading Dose: 300 mg or 600 mg orally</li>
<li>Maintenance Dose: 75 mg orally once daily</li>
</ul>
</li>
<li><strong>Parenteral Anticoagulation:</strong> Continue until revascularization (CABG or PCI).</li>
<li><strong>β-blockers:</strong> Recommended in patients with LVEF <40% or heart failure.</li>
<li><strong>RAAS Inhibition:</strong> Oral ACE inhibitors reduce all-cause mortality and MACE, especially if LVEF <40%, hypertension, or diabetes mellitus.</li>
</ul>
<div class="mt-2 p-1.5 bg-rose-50 border border-rose-100 rounded text-[9px] text-rose-800 font-semibold">
<strong>Contraindications for Routine Invasive Procedure:</strong> Route to Conservative strategy instead if patient has High DAPT bleeding risk, Severe thrombocytopenia (↓ platelets), Advanced kidney disease, Acute renal failure (ARF), Limited life expectancy (1-2 years), or Advanced dementia.
</div>
<div class="mt-2 p-1.5 bg-amber-50 border border-amber-100 rounded text-[9px] text-amber-800 font-semibold">
ALERT: Clopidogrel is less effective. Switch to potent agent unless contraindicated/HBR.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ==================== PAGE 2 ==================== -->
<div class="page-break max-w-[800px] mx-auto bg-white p-8 rounded-3xl shadow-sm border border-slate-100 mt-8">
<!-- Section 3: Ischemic Risk and Timing -->
<div class="mb-8">
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">3</span>
<h2 class="text-base font-bold text-slate-900">Ischemic Risk Stratification & Angiography Timing</h2>
</div>
<div class="bg-slate-50 border border-slate-200 rounded-2xl p-4">
<p class="text-xs font-bold text-slate-700 mb-2">High Ischemic Risk Triggers (1 or more):</p>
<div class="grid grid-cols-2 gap-2 text-[11px] mb-4">
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-rose-800 font-semibold">
<span class="w-1.5 h-1.5 bg-rose-600 rounded-full"></span> Troponin Assay Positive
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-rose-800 font-semibold">
<span class="w-1.5 h-1.5 bg-rose-600 rounded-full"></span> SBP < 90 mmHg (Instability)
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-rose-800 font-semibold">
<span class="w-1.5 h-1.5 bg-rose-600 rounded-full"></span> Severe / Refractory Angina
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-rose-800 font-semibold">
<span class="w-1.5 h-1.5 bg-rose-600 rounded-full"></span> Acute Heart Failure / CCF / MR
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-rose-800 font-semibold">
<span class="w-1.5 h-1.5 bg-rose-600 rounded-full"></span> Sustained Arrhythmia (VT/VF)
</div>
</div>
<!-- Decision Box -->
<div class="grid grid-cols-2 gap-4">
<div class="p-3.5 bg-rose-50 border border-rose-100 rounded-xl text-center">
<span class="block text-xs font-bold text-rose-800 uppercase tracking-wide">HIGH ISCHEMIC RISK (YES)</span>
<p class="text-[11px] text-rose-700 mt-1 font-medium">Timing Rule: IMMEDIATE invasive strategy required. Angiography must be performed within 2 hours.</p>
</div>
<div class="p-3.5 bg-emerald-50 border border-emerald-100 rounded-xl text-center">
<span class="block text-xs font-bold text-emerald-800 uppercase tracking-wide">STANDARD ISCHEMIC RISK (NO)</span>
<p class="text-[11px] text-emerald-700 mt-1 font-medium">Timing Rule: Guideline-compliant EARLY invasive strategy. Angiography recommended within 24 hours.</p>
</div>
</div>
</div>
</div>
<!-- Section 4: Bleeding Risk and HBR Customizations -->
<div>
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">4</span>
<h2 class="text-base font-bold text-slate-900">Bleeding Risk (ARC-HBR) & Override Protocols</h2>
</div>
<div class="bg-slate-50 border border-slate-200 rounded-2xl p-4 mb-4">
<p class="text-xs font-bold text-slate-700 mb-2">High Bleeding Risk (HBR) Triggers (1 or more):</p>
<div class="grid grid-cols-2 gap-2 text-[11px] mb-4">
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-amber-800 font-semibold">
<span class="w-1.5 h-1.5 bg-amber-500 rounded-full"></span> Advanced Age (Age >= 75)
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-amber-800 font-semibold">
<span class="w-1.5 h-1.5 bg-amber-500 rounded-full"></span> Severe Renal Impairment / CKD
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-amber-800 font-semibold">
<span class="w-1.5 h-1.5 bg-amber-500 rounded-full"></span> Baseline Severe Anemia (Hb < 11)
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-amber-800 font-semibold">
<span class="w-1.5 h-1.5 bg-amber-500 rounded-full"></span> Atrial Fibrillation / Concurrent OAC
</div>
<div class="flex items-center gap-2 bg-white px-2.5 py-1.5 rounded-lg border border-slate-100 text-amber-800 font-semibold">
<span class="w-1.5 h-1.5 bg-amber-500 rounded-full"></span> Prior Stroke or TIA
</div>
</div>
<div class="p-3 bg-amber-50 border border-amber-100 rounded-xl mb-4">
<span class="block text-xs font-bold text-amber-800 uppercase tracking-wide">CRITICAL OVERRIDE: PRASUGREL CONTRAINDICATION</span>
<p class="text-[11px] text-amber-700 mt-1 font-medium leading-relaxed">
If patient is HBR and assigned to Prasugrel, trigger CONTRAINDICATION OVERRIDE alert. Action: Immediately discontinue Prasugrel and substitute with Clopidogrel 75mg daily.
</p>
</div>
<div class="p-3 bg-indigo-50 border border-indigo-100 rounded-xl mb-4">
<span class="block text-xs font-bold text-indigo-800 uppercase tracking-wide">RBC Transfusion Protocol</span>
<p class="text-[11px] text-indigo-700 mt-1 font-medium leading-relaxed">
RBC transfusion to maintain Hb of 10 g/dL is reasonable in patients with acute or chronic anemia who are not actively bleeding.
</p>
</div>
<p class="text-xs font-bold text-slate-700 mb-2">HBR Rules (Safety Customization Tiers):</p>
<div class="grid grid-cols-3 gap-3">
<div class="p-3 bg-white border border-slate-200 rounded-xl">
<span class="block text-xs font-bold text-indigo-600 uppercase">Rule C: OAC / AF</span>
<p class="text-[10px] text-slate-600 mt-1 leading-normal">
Convert to **Dual Therapy** (OAC + Clopidogrel 75mg) after 1-4 weeks; completely drop Aspirin.
</p>
</div>
<div class="p-3 bg-white border border-slate-200 rounded-xl">
<span class="block text-xs font-bold text-indigo-600 uppercase">Rule B: Minor Bleed</span>
<p class="text-[10px] text-slate-600 mt-1 leading-normal">
**P2Y12 Down-Titration**: Transition from Ticagrelor/Prasugrel to Clopidogrel 75mg daily due to Hb drop/minor bleeding.
</p>
</div>
<div class="p-3 bg-white border border-slate-200 rounded-xl">
<span class="block text-xs font-bold text-indigo-600 uppercase">Rule A: Standard</span>
<p class="text-[10px] text-slate-600 mt-1 leading-normal">
**Short-Course DAPT**: Transition to **Ticagrelor Monotherapy** after 1-3 months, completely dropping Aspirin.
</p>
</div>
</div>
</div>
</div>
</div>
<!-- ==================== PAGE 3 ==================== -->
<div class="max-w-[800px] mx-auto bg-white p-8 rounded-3xl shadow-sm border border-slate-100 mt-8">
<!-- Section 5: Gastrointestinal (GI) Safety Net -->
<div class="mb-8">
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">5</span>
<h2 class="text-base font-bold text-slate-900">Gastrointestinal (GI) Safety Net & Co-Prescribing</h2>
</div>
<div class="bg-slate-50 border border-slate-200 rounded-2xl p-4">
<!-- Decision Logic block -->
<div class="flex flex-col items-center">
<div class="w-full bg-white p-3 border border-slate-100 rounded-xl text-center font-bold text-slate-800 text-xs">
Screen Patient for GI Triggers: High Bleeding Risk OR Peptic Ulcer History OR Age >= 75 OR Concurrent NSAID use
</div>
<div class="line-vertical"></div>
<div class="arrow-down"></div>
</div>
<div class="grid grid-cols-2 gap-4 w-full mt-2">
<div class="p-3 bg-amber-50 border border-amber-100 rounded-xl text-center">
<span class="block text-xs font-bold text-amber-800 uppercase tracking-wide">Trigger Met & No PPI Prescribed</span>
<p class="text-[11px] text-amber-700 mt-1 font-semibold leading-relaxed">
GASTRIC GAP ALERT: Co-prescribe a protective PPI (e.g. Pantoprazole) immediately to mitigate GI bleed risk.
</p>
</div>
<div class="p-3 bg-indigo-50 border border-indigo-100 rounded-xl text-center">
<span class="block text-xs font-bold text-indigo-800 uppercase tracking-wide">Trigger Met & PPI Prescribed</span>
<p class="text-[11px] text-indigo-700 mt-1 font-semibold leading-relaxed">
If Clopidogrel is used: PANTOPRAZOLE is preferred over Omeprazole (prevents CYP2C19 enzyme inhibition).
</p>
</div>
</div>
</div>
</div>
<!-- Section 6: Lipid Secondary Prevention -->
<div>
<div class="flex items-center gap-3 mb-3">
<span class="w-7 h-7 rounded-full bg-indigo-600 text-white font-bold flex items-center justify-center text-xs">6</span>
<h2 class="text-base font-bold text-slate-900">Lipid Secondary Prevention Guidelines</h2>
</div>
<div class="bg-slate-50 border border-slate-200 rounded-2xl p-4">
<div class="space-y-4">
<!-- Statin Intensity -->
<div class="bg-white p-3.5 rounded-xl border border-slate-100">
<span class="text-xs font-bold text-indigo-600 block uppercase">Statin Intensity Evaluation</span>
<p class="text-xs text-slate-700 mt-1 leading-relaxed">
All ACS patients require a baseline **High-Intensity Statin** (e.g., Atorvastatin 40-80mg or Rosuvastatin 20-40mg).
</p>
<div class="mt-2 p-2 bg-rose-50 border border-rose-100 rounded text-[10px] text-rose-700 font-semibold">
OMISSION FAULT: Triggered if patient is not on High-Intensity Statin. Action: Initiate High-Intensity Statin immediately.
</div>
</div>
<!-- Follow-up LDL Goals -->
<div class="bg-white p-3.5 rounded-xl border border-slate-100">
<span class="text-xs font-bold text-indigo-600 block uppercase">Follow-up LDL-C Target Checks</span>
<div class="grid grid-cols-2 gap-4 mt-2">
<div class="p-2.5 bg-rose-50 border border-rose-100 rounded-lg text-center">
<span class="block text-[10px] font-bold text-rose-800 uppercase tracking-wide">LDL-C >= 70 mg/dL</span>
<p class="text-[9.5px] text-rose-700 font-semibold mt-1">LIPID GOAL MISSED. Add Ezetimibe 10mg daily immediately (Class 1 indication).</p>
</div>
<div class="p-2.5 bg-amber-50 border border-amber-100 rounded-lg text-center">
<span class="block text-[10px] font-bold text-amber-800 uppercase tracking-wide">55 <= LDL-C < 70 mg/dL</span>
<p class="text-[9.5px] text-amber-700 font-semibold mt-1">Therapeutic Optimization. Evaluate Ezetimibe addition to target < 55 mg/dL (Class 2a).</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="border-t border-slate-100 mt-8 pt-4 text-center text-[10px] text-slate-400">
ACS CDSS Guidelines Flowchart • Strictly for Clinical Registry & Educational Reference Only
</div>
</div>
</body>
</html>
"""
# Write flowchart HTML file
html_path = 'flowchart.html'
with open(html_path, 'w', encoding='utf-8') as f:
f.write(html_content)
print(f"Generated {html_path}...")
# Run Edge headless to print to PDF
pdf_path = 'ACS_Patient_Risk_Rules_Flowchart.pdf'
edge_executable = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
# Shell command execution
cmd = [
edge_executable,
"--headless=new",
"--disable-gpu",
f"--print-to-pdf={pdf_path}",
"--no-margins",
"--print-to-pdf-no-header",
os.path.abspath(html_path)
]
print("Running Microsoft Edge to generate PDF...")
try:
subprocess.run(cmd, check=True)
print(f"Successfully generated PDF: {pdf_path}")
except Exception as e:
print(f"Error printing PDF using Edge: {str(e)}")