AndreaImperatore04 commited on
Commit
6d71d50
·
verified ·
1 Parent(s): 5685673

Delete index.html

Browse files
Files changed (1) hide show
  1. index.html +0 -619
index.html DELETED
@@ -1,619 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SAFER-DAPT</title>
7
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
8
- <script src="https://cdn.plot.ly/plotly-2.27.0.min.js"></script>
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
10
-
11
- <style>
12
- :root {
13
- --academic-blue: #0056b3;
14
- --academic-dark: #1a202c;
15
- --border-color: #dee2e6;
16
- --bg-light: #f4f6f8;
17
- }
18
-
19
- body {
20
- background-color: #ffffff;
21
- font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
22
- color: #333333;
23
- font-size: 14px;
24
- }
25
-
26
- .academic-header {
27
- background-color: var(--academic-blue);
28
- color: white;
29
- padding: 15px 0;
30
- border-bottom: 4px solid #e9ecef;
31
- }
32
-
33
- .academic-header h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: 0.5px; }
34
- .academic-header .subtitle { font-size: 13px; color: #e2e8f0; margin-top: 4px; }
35
-
36
- .main-container { max-width: 1200px; margin: 20px auto; padding: 0 15px; }
37
-
38
- .academic-panel {
39
- border: 1px solid var(--border-color);
40
- border-radius: 2px;
41
- background-color: #ffffff;
42
- margin-bottom: 20px;
43
- }
44
-
45
- .academic-panel-header {
46
- background-color: var(--bg-light);
47
- border-bottom: 1px solid var(--border-color);
48
- padding: 10px 15px;
49
- font-size: 15px;
50
- font-weight: bold;
51
- color: var(--academic-blue);
52
- text-transform: uppercase;
53
- display: flex;
54
- justify-content: space-between;
55
- align-items: center;
56
- }
57
-
58
- .academic-panel-body { padding: 15px; }
59
-
60
- .form-label { font-size: 12px; font-weight: bold; color: #495057; margin-bottom: 4px; display: inline-flex; align-items: center; gap: 5px; }
61
-
62
- .help-icon {
63
- display: inline-block;
64
- background-color: #e9ecef;
65
- color: #6c757d;
66
- border-radius: 50%;
67
- width: 14px;
68
- height: 14px;
69
- text-align: center;
70
- font-size: 10px;
71
- line-height: 14px;
72
- cursor: help;
73
- font-weight: normal;
74
- }
75
-
76
- .form-control, .form-select {
77
- border-radius: 2px;
78
- border: 1px solid #ced4da;
79
- padding: 4px 8px;
80
- font-size: 13px;
81
- height: 30px;
82
- }
83
-
84
- .form-control:focus, .form-select:focus { border-color: var(--academic-blue); box-shadow: none; }
85
- .input-group-text, .input-group .form-control, .input-group .form-select { border-radius: 2px; }
86
-
87
- .form-section-title {
88
- font-size: 13px;
89
- font-weight: bold;
90
- color: #6c757d;
91
- border-bottom: 1px solid #e9ecef;
92
- padding-bottom: 5px;
93
- margin-bottom: 15px;
94
- margin-top: 5px;
95
- }
96
-
97
- .btn-compute {
98
- background-color: var(--academic-blue);
99
- color: white;
100
- border: 1px solid #004085;
101
- border-radius: 2px;
102
- padding: 8px 24px;
103
- font-size: 14px;
104
- font-weight: bold;
105
- transition: background-color 0.2s;
106
- }
107
- .btn-compute:hover { background-color: #004085; color: white; }
108
-
109
- .btn-reset {
110
- background-color: #f8f9fa;
111
- color: #495057;
112
- border: 1px solid #ced4da;
113
- border-radius: 2px;
114
- padding: 8px 16px;
115
- font-size: 14px;
116
- font-weight: bold;
117
- margin-right: 10px;
118
- transition: background-color 0.2s;
119
- }
120
- .btn-reset:hover { background-color: #e2e6ea; }
121
-
122
- .btn-print, .btn-download {
123
- background-color: #ffffff;
124
- color: #495057;
125
- border: 1px solid #ced4da;
126
- border-radius: 2px;
127
- padding: 4px 12px;
128
- font-size: 12px;
129
- font-weight: bold;
130
- cursor: pointer;
131
- margin-right: 5px;
132
- }
133
- .btn-download { background-color: var(--academic-blue); color: #ffffff; border-color: #004085; }
134
- .btn-print:hover { background-color: #f4f6f8; }
135
- .btn-download:hover { background-color: #004085; }
136
-
137
- .result-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
138
- .result-table th, .result-table td { border: 1px solid var(--border-color); padding: 8px 12px; text-align: left; font-size: 14px; }
139
- .result-table th { background-color: var(--bg-light); color: #495057; width: 35%; font-weight: bold; }
140
- .result-table td.value-base { font-weight: bold; color: var(--academic-blue); }
141
-
142
- .recommendation-box {
143
- border-left: 4px solid var(--academic-blue);
144
- background-color: #f8f9fa;
145
- padding: 15px;
146
- margin-bottom: 20px;
147
- }
148
- .recommendation-title { font-weight: bold; font-size: 15px; margin-bottom: 8px; color: var(--academic-dark); }
149
- .recommendation-text { font-size: 14px; color: #333; margin: 0; }
150
-
151
- .math-box {
152
- font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
153
- font-size: 13px;
154
- color: #d63384;
155
- background-color: #f8f9fa;
156
- border: 1px solid #e9ecef;
157
- padding: 6px 10px;
158
- border-radius: 2px;
159
- display: inline-block;
160
- margin: 4px 0;
161
- white-space: nowrap;
162
- overflow-x: auto;
163
- max-width: 100%;
164
- }
165
-
166
- .doc-list { font-size: 13px; padding-left: 20px; margin-top: 10px; }
167
- .doc-list li { margin-bottom: 8px; }
168
-
169
- .nav-tabs .nav-link { border-radius: 2px 2px 0 0; color: #495057; font-size: 13px; font-weight: bold; padding: 8px 16px; }
170
- .nav-tabs .nav-link.active { color: var(--academic-blue); border-top: 3px solid var(--academic-blue); }
171
-
172
- .hidden { display: none !important; }
173
-
174
- .alert-custom {
175
- font-size: 13px;
176
- padding: 10px;
177
- border-radius: 2px;
178
- margin-bottom: 20px;
179
- }
180
-
181
- /* Template PDF nascosto a schermo ma completo di tutto il contenuto */
182
- #pdfTemplate {
183
- position: absolute;
184
- left: -9999px;
185
- top: 0;
186
- width: 800px;
187
- background: #ffffff;
188
- padding: 20px;
189
- color: #333333;
190
- }
191
-
192
- @media print {
193
- body { background-color: #ffffff; padding: 0; margin: 0; font-size: 12px; }
194
- .academic-header, #inputPanel, .nav-tabs, #actionButtons, .help-icon { display: none !important; }
195
- .main-container { width: 100%; max-width: 100%; margin: 0; padding: 10px; }
196
- .row { display: block !important; }
197
- .col-lg-5, .col-lg-7 { width: 100% !important; display: block !important; float: none !important; margin-bottom: 20px; page-break-inside: avoid; }
198
- .academic-panel { border: 1px solid #dee2e6; margin-bottom: 15px; box-shadow: none; page-break-inside: avoid; }
199
- .academic-panel-header { background-color: #f4f6f8 !important; border-bottom: 1px solid #dee2e6; color: #0056b3; -webkit-print-color-adjust: exact; }
200
- .result-table th { background-color: #f4f6f8 !important; -webkit-print-color-adjust: exact; }
201
- .tab-content > .tab-pane { display: block !important; opacity: 1 !important; visibility: visible !important; margin-bottom: 15px; page-break-inside: avoid; }
202
- #tab3d { display: none !important; }
203
- .recommendation-box { border-left-color: #0056b3 !important; background-color: #f8f9fa !important; -webkit-print-color-adjust: exact; }
204
- }
205
- </style>
206
- </head>
207
- <body>
208
-
209
- <header class="academic-header">
210
- <div class="main-container m-0 mx-auto py-0">
211
- <h1>SAFER-DAPT</h1>
212
- <div class="subtitle">SAFINOUS-Assisted Framework for Evaluating Risk during Dual Antiplatelet Therapy.</div>
213
- </div>
214
- </header>
215
-
216
- <div class="main-container">
217
-
218
- <div id="validationAlert" class="alert alert-danger alert-custom hidden" role="alert"></div>
219
-
220
- <!-- INSERIMENTO DATI -->
221
- <div class="academic-panel" id="inputPanel">
222
- <div class="academic-panel-header">Data Entry Form</div>
223
- <div class="academic-panel-body">
224
- <form id="patientForm">
225
- <div class="row g-4">
226
- <div class="col-lg-4">
227
- <div class="form-section-title">Baseline & Laboratory</div>
228
- <div class="row g-2 mb-2">
229
- <div class="col-6">
230
- <label class="form-label">Age</label>
231
- <input type="number" class="form-control" id="Age" value="65">
232
- </div>
233
- <div class="col-6">
234
- <label class="form-label">Sex</label>
235
- <select class="form-select" id="Sex">
236
- <option value="Male">Male</option>
237
- <option value="Female">Female</option>
238
- </select>
239
- </div>
240
- </div>
241
-
242
- <label class="form-label mt-2">Hemoglobin</label>
243
- <div class="input-group mb-2">
244
- <input type="number" step="0.1" class="form-control" id="Hb" value="10.3">
245
- <select class="form-select" id="HbUnit" style="max-width: 90px;">
246
- <option value="g/dL">g/dL</option>
247
- <option value="g/L">g/L</option>
248
- <option value="mmol/L">mmol</option>
249
- </select>
250
- </div>
251
-
252
- <label class="form-label mt-2">WBC Count</label>
253
- <div class="input-group mb-2">
254
- <input type="number" step="0.1" class="form-control" id="WBC" value="7.9">
255
- <select class="form-select" id="WBCUnit" style="max-width: 100px;">
256
- <option value="x10^3/uL">x10³/µL</option>
257
- <option value="cells/uL">cells/µL</option>
258
- </select>
259
- </div>
260
-
261
- <div class="row g-2 mt-2">
262
- <div class="col-5">
263
- <label class="form-label">CrCl <span class="help-icon" data-bs-toggle="tooltip" title="Estimated Creatinine Clearance">?</span></label>
264
- <input type="number" class="form-control" id="CrCl" value="85">
265
- </div>
266
- <div class="col-7">
267
- <label class="form-label">Creatinine</label>
268
- <div class="input-group">
269
- <input type="number" step="0.1" class="form-control" id="Creatinine" value="1.2">
270
- <select class="form-select" id="CrUnit" style="padding-left:4px; padding-right:4px;">
271
- <option value="mg/dL">mg/dL</option>
272
- <option value="umol/L">µmol/L</option>
273
- </select>
274
- </div>
275
- </div>
276
- </div>
277
- </div>
278
-
279
- <div class="col-lg-4">
280
- <div class="form-section-title">Clinical History</div>
281
- <label class="form-label">Prior Bleed</label>
282
- <select class="form-select mb-3" id="PriorBleed"><option value="0">No Prior Bleeding</option><option value="1">Yes, Prior Bleeding</option></select>
283
- <label class="form-label">Diabetes</label>
284
- <select class="form-select mb-3" id="Diabetes"><option value="0">No</option><option value="1">Yes</option></select>
285
- <label class="form-label">Active Smoker</label>
286
- <select class="form-select mb-3" id="Smoking"><option value="0">No</option><option value="1">Yes</option></select>
287
- <label class="form-label">Dyslipidemia</label>
288
- <select class="form-select mb-3" id="Dyslipidemia"><option value="0">No</option><option value="1">Yes</option></select>
289
- <label class="form-label">Hypertension</label>
290
- <select class="form-select" id="Hypertension"><option value="0">No</option><option value="1">Yes</option></select>
291
- </div>
292
-
293
- <div class="col-lg-4">
294
- <div class="form-section-title">Operative Details</div>
295
- <label class="form-label">EVH</label>
296
- <select class="form-select mb-3" id="EVH"><option value="0">No</option><option value="1">Yes</option></select>
297
- <label class="form-label">Complex Grafts</label>
298
- <select class="form-select mb-3" id="ComplexGrafts"><option value="0">No</option><option value="1">Yes</option></select>
299
- <label class="form-label">Number of SVG</label>
300
- <select class="form-select mb-3" id="NSVG"><option value="1">1</option><option value="2" selected>2</option><option value="3">3</option><option value="4">4</option></select>
301
- <label class="form-label">Graft Targets</label>
302
- <div class="d-flex gap-2">
303
- <select class="form-select" id="GraftDiag"><option value="0">No Diag</option><option value="1">Diag</option></select>
304
- <select class="form-select" id="GraftLCx"><option value="0">No LCx/OM</option><option value="1">LCx/OM</option></select>
305
- <select class="form-select" id="GraftRCA"><option value="0">No RCA</option><option value="1">RCA</option></select>
306
- </div>
307
- </div>
308
- </div>
309
-
310
- <hr class="mt-4 mb-3">
311
- <div class="text-right d-flex justify-content-end">
312
- <button type="button" class="btn-reset" onclick="resetForm()">Clear Form</button>
313
- <button type="button" class="btn-compute" onclick="calculateRisk()">Run Risk Analysis</button>
314
- </div>
315
- </form>
316
- </div>
317
- </div>
318
-
319
- <!-- SEZIONE RISULTATI -->
320
- <div id="resultsSection" class="hidden">
321
- <div class="row g-4" id="reportContent">
322
-
323
- <div class="col-lg-5">
324
- <div class="academic-panel">
325
- <div class="academic-panel-header">
326
- Clinical Report
327
- <div id="actionButtons">
328
- <button class="btn-print" onclick="window.print()">Print</button>
329
- <button class="btn-download" onclick="downloadPDF()">Download PDF</button>
330
- </div>
331
- </div>
332
- <div class="academic-panel-body">
333
- <table class="result-table">
334
- <tbody>
335
- <tr><th>SAFINOUS Score</th><td id="valSafinous">0.0</td></tr>
336
- <tr><th>PRECISE-DAPT</th><td id="valPrecise">0.0</td></tr>
337
- <tr><th>CDRS+ Score</th><td class="value-base" id="valCDRS">0.0</td></tr>
338
- <tr><th>CRI Index</th><td class="value-base" id="valCRI">0.0%</td></tr>
339
- </tbody>
340
- </table>
341
-
342
- <div class="recommendation-box" id="trajectoryBox">
343
- <div class="recommendation-title" id="valTrajectory">Trajectory</div>
344
- <p class="recommendation-text" id="valRecommendation">Recommendation details.</p>
345
- </div>
346
-
347
- <div class="form-section-title mt-4">Continuous Metrics Formulas</div>
348
- <div class="math-box text-nowrap">CDRS+ = max(0, 3·SAFINOUS - 2·PRECISE_DAPT + 100)</div><br>
349
- <div class="math-box text-nowrap mt-1">CRI% = [ (P(Isch) - P(Bleed) + 1.0) / 2.0 ] × 100%</div>
350
-
351
- <div class="form-section-title mt-4">Clinical Thresholds</div>
352
- <ul class="doc-list">
353
- <li><strong>High Ischemic:</strong> CDRS+ ≥ 65 (Prolonged DAPT)</li>
354
- <li><strong>Balanced Risk:</strong> 40 ≤ CDRS+ < 65 (Short DAPT)</li>
355
- <li><strong>High Bleeding:</strong> CDRS+ < 40 (Aspirin Mono)</li>
356
- </ul>
357
- </div>
358
- </div>
359
- </div>
360
-
361
- <div class="col-lg-7">
362
- <div class="academic-panel">
363
- <div class="academic-panel-header">Data Visualization</div>
364
- <div class="academic-panel-body p-0">
365
- <ul class="nav nav-tabs px-3 pt-3" id="myTab" role="tablist">
366
- <li class="nav-item" role="presentation"><button class="nav-link active" data-bs-toggle="tab" data-bs-target="#tab2d" type="button">2D Map</button></li>
367
- <li class="nav-item" role="presentation"><button class="nav-link" data-bs-toggle="tab" data-bs-target="#tab3d" type="button">3D Map</button></li>
368
- <li class="nav-item" role="presentation"><button class="nav-link" data-bs-toggle="tab" data-bs-target="#tabimpact" type="button">Feature Impact</button></li>
369
- </ul>
370
-
371
- <div class="tab-content p-3" id="myTabContent">
372
- <div class="tab-pane fade show active" id="tab2d"><div id="plot2d" style="height: 400px; width:100%;"></div></div>
373
- <div class="tab-pane fade" id="tab3d"><div id="plot3d" style="height: 400px; width:100%;"></div></div>
374
- <div class="tab-pane fade" id="tabimpact">
375
- <div id="plotDynamicImpactSaf" style="height: 200px; width:100%;"></div>
376
- <div id="plotDynamicImpactPrec" style="height: 200px; width:100%; margin-top: 15px;"></div>
377
- </div>
378
- </div>
379
- </div>
380
- </div>
381
- </div>
382
-
383
- </div>
384
- </div>
385
- </div>
386
-
387
- <!-- Template PDF completo e strutturato correttamente -->
388
- <div id="pdfTemplate">
389
- <h2 style="color: #0056b3; border-bottom: 2px solid #0056b3; padding-bottom: 5px; margin-bottom: 15px; font-size: 20px;">SAFER-DAPT Clinical Report</h2>
390
-
391
- <table style="width: 100%; border-collapse: collapse; margin-bottom: 15px;">
392
- <tbody>
393
- <tr><th style="border: 1px solid #dee2e6; padding: 6px; background: #f4f6f8; width: 40%; font-size: 13px;">SAFINOUS Score</th><td id="pdfValSafinous" style="border: 1px solid #dee2e6; padding: 6px; font-weight: bold; font-size: 13px;">0.0</td></tr>
394
- <tr><th style="border: 1px solid #dee2e6; padding: 6px; background: #f4f6f8; font-size: 13px;">PRECISE-DAPT</th><td id="pdfValPrecise" style="border: 1px solid #dee2e6; padding: 6px; font-weight: bold; font-size: 13px;">0.0</td></tr>
395
- <tr><th style="border: 1px solid #dee2e6; padding: 6px; background: #f4f6f8; font-size: 13px;">CDRS+ Score</th><td id="pdfValCDRS" style="border: 1px solid #dee2e6; padding: 6px; font-weight: bold; color: #0056b3; font-size: 13px;">0.0</td></tr>
396
- <tr><th style="border: 1px solid #dee2e6; padding: 6px; background: #f4f6f8; font-size: 13px;">CRI Index</th><td id="pdfValCRI" style="border: 1px solid #dee2e6; padding: 6px; font-weight: bold; color: #0056b3; font-size: 13px;">0.0%</td></tr>
397
- </tbody>
398
- </table>
399
-
400
- <div id="pdfTrajectoryBox" style="border-left: 4px solid #0056b3; background: #f8f9fa; padding: 10px; margin-bottom: 15px;">
401
- <div id="pdfValTrajectory" style="font-weight: bold; font-size: 14px; margin-bottom: 4px;">Trajectory</div>
402
- <p id="pdfValRecommendation" style="margin: 0; font-size: 12px;">Recommendation details.</p>
403
- </div>
404
-
405
- <div style="font-size: 12px; font-weight: bold; color: #6c757d; border-bottom: 1px solid #dee2e6; padding-bottom: 3px; margin-bottom: 6px; text-transform: uppercase;">Continuous Metrics Formulas</div>
406
- <div style="font-family: monospace; font-size: 11px; color: #d63384; background: #f8f9fa; border: 1px solid #e9ecef; padding: 4px 8px; margin-bottom: 4px;">CDRS+ = max(0, 3·SAFINOUS - 2·PRECISE_DAPT + 100)</div>
407
- <div style="font-family: monospace; font-size: 11px; color: #d63384; background: #f8f9fa; border: 1px solid #e9ecef; padding: 4px 8px; margin-bottom: 15px;">CRI% = [ (P(Isch) - P(Bleed) + 1.0) / 2.0 ] × 100%</div>
408
-
409
- <div style="font-size: 12px; font-weight: bold; color: #6c757d; border-bottom: 1px solid #dee2e6; padding-bottom: 3px; margin-bottom: 6px; text-transform: uppercase;">Clinical Thresholds</div>
410
- <ul style="font-size: 11px; padding-left: 15px; margin: 0; color: #333;">
411
- <li><strong>High Ischemic:</strong> CDRS+ ≥ 65 (Prolonged DAPT)</li>
412
- <li><strong>Balanced Risk:</strong> 40 ≤ CDRS+ &lt; 65 (Short DAPT)</li>
413
- <li><strong>High Bleeding:</strong> CDRS+ &lt; 40 (Aspirin Mono)</li>
414
- </ul>
415
- </div>
416
-
417
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
418
- <script>
419
- document.addEventListener("DOMContentLoaded", function(){
420
- var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
421
- var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
422
- return new bootstrap.Tooltip(tooltipTriggerEl);
423
- });
424
- });
425
-
426
- const plotlyBaseLayout = {
427
- font: { family: 'Arial, sans-serif', color: '#333', size: 12 },
428
- plot_bgcolor: '#ffffff',
429
- paper_bgcolor: '#ffffff',
430
- margin: { t: 30, b: 30, l: 40, r: 20 }
431
- };
432
-
433
- const bg_data = { p_isch: [], p_bleed: [], cri_pct: [] };
434
- for(let i=0; i<84; i++) {
435
- let p_i = Math.random() * 0.8 + 0.1;
436
- let p_b = Math.random() * 0.8 + 0.1;
437
- bg_data.p_isch.push(p_i);
438
- bg_data.p_bleed.push(p_b);
439
- bg_data.cri_pct.push(((p_i - p_b + 1.0) / 2.0) * 100.0);
440
- }
441
-
442
- function resetForm() {
443
- document.getElementById("patientForm").reset();
444
- document.getElementById("resultsSection").classList.add("hidden");
445
- document.getElementById("validationAlert").classList.add("hidden");
446
- window.scrollTo({ top: 0, behavior: 'smooth' });
447
- }
448
-
449
- function validateInputs(Age, Hb, WBC, CrCl, Creatinine) {
450
- let errors = [];
451
- if(isNaN(Age) || Age < 18 || Age > 110) errors.push("Age must be between 18 and 110 years.");
452
- if(isNaN(Hb) || Hb < 3 || Hb > 25) errors.push("Hemoglobin value is outside expected clinical limits.");
453
- if(isNaN(WBC) || WBC < 0.1 || WBC > 100) errors.push("WBC Count is outside expected clinical limits.");
454
- if(isNaN(CrCl) || CrCl < 1 || CrCl > 250) errors.push("CrCl must be between 1 and 250 mL/min.");
455
- if(isNaN(Creatinine) || Creatinine < 0.1 || Creatinine > 20) errors.push("Serum Creatinine is outside expected limits.");
456
- return errors;
457
- }
458
-
459
- function calculateRisk() {
460
- const alertBox = document.getElementById("validationAlert");
461
- alertBox.classList.add("hidden");
462
- alertBox.innerHTML = "";
463
-
464
- const Age = parseFloat(document.getElementById('Age').value);
465
- const SexFemale = document.getElementById('Sex').value === 'Female' ? 1 : 0;
466
-
467
- let Hb = parseFloat(document.getElementById('Hb').value);
468
- const HbUnit = document.getElementById('HbUnit').value;
469
- if (HbUnit === 'g/L') Hb /= 10.0;
470
- else if (HbUnit === 'mmol/L') Hb *= 1.611;
471
-
472
- let WBC = parseFloat(document.getElementById('WBC').value);
473
- const WBCUnit = document.getElementById('WBCUnit').value;
474
- if (WBCUnit === 'cells/uL') WBC /= 1000.0;
475
-
476
- const CrCl = parseFloat(document.getElementById('CrCl').value);
477
-
478
- let Creatinine = parseFloat(document.getElementById('Creatinine').value);
479
- const CrUnit = document.getElementById('CrUnit').value;
480
- if (CrUnit === 'umol/L') Creatinine /= 88.4;
481
-
482
- const validationErrors = validateInputs(Age, Hb, WBC, CrCl, Creatinine);
483
- if(validationErrors.length > 0) {
484
- alertBox.innerHTML = "<strong>Data Entry Error:</strong><br>" + validationErrors.join("<br>");
485
- alertBox.classList.remove("hidden");
486
- document.getElementById("resultsSection").classList.add("hidden");
487
- window.scrollTo({ top: 0, behavior: 'smooth' });
488
- return;
489
- }
490
-
491
- const PriorBleed = parseInt(document.getElementById('PriorBleed').value);
492
- const Diabetes = parseInt(document.getElementById('Diabetes').value);
493
- const Smoking = parseInt(document.getElementById('Smoking').value);
494
- const Dyslipidemia = parseInt(document.getElementById('Dyslipidemia').value);
495
- const EVH = parseInt(document.getElementById('EVH').value);
496
- const ComplexGrafts = parseInt(document.getElementById('ComplexGrafts').value);
497
- const NSVG = parseInt(document.getElementById('NSVG').value);
498
- const GraftDiag = parseInt(document.getElementById('GraftDiag').value);
499
- const GraftLCx = parseInt(document.getElementById('GraftLCx').value);
500
- const GraftRCA = parseInt(document.getElementById('GraftRCA').value);
501
-
502
- const CreaScore = Creatinine > 1.2 ? 1 : 0;
503
- const Safinous = 0.1*(Age-55) - 3.0*(1-SexFemale) + 1.0*Dyslipidemia + 3.0*Diabetes +
504
- 3.0*Smoking + 2.0*CreaScore - 3.0*EVH + 4.0*ComplexGrafts +
505
- 2.0*(NSVG-1) + 4.0*GraftDiag + 4.0*GraftLCx + 3.0*GraftRCA;
506
-
507
- let Precise = 0.3*Age - 1.5*Hb + 0.8*WBC - 0.15*CrCl + 15.0*PriorBleed + 35.0;
508
- if (Precise < 5) Precise = 5;
509
- if (Precise > 60) Precise = 60;
510
-
511
- const raw_cdrs = (3.0 * Safinous) - (2.0 * Precise) + 100.0;
512
- const CDRS_positive = Math.max(0.0, raw_cdrs);
513
-
514
- const p_isch = 1.0 / (1.0 + Math.exp(-Safinous / 3.5));
515
- const p_bleed = 1.0 / (1.0 + Math.exp(-(Precise - 25.0) / 5.0));
516
- const CRI_pct = ((p_isch - p_bleed + 1.0) / 2.0) * 100.0;
517
-
518
- let traj = "", rec = "", color = "", border_color = "";
519
- if (CDRS_positive >= 65.0) {
520
- traj = "High Ischemic Dominance";
521
- rec = "Prolonged DAPT (6-12 months or longer) to maximize saphenous vein graft patency.";
522
- color = "#0056b3"; border_color = "#0056b3";
523
- } else if (CDRS_positive >= 40.0 && CDRS_positive < 65.0) {
524
- traj = "Balanced Competing Risk (Grey Zone)";
525
- rec = "Individualized, Short DAPT (1-3 months) combined with enhanced clinical surveillance.";
526
- color = "#dc3545"; border_color = "#dc3545";
527
- } else {
528
- traj = "High Bleeding Dominance";
529
- rec = "Aspirin Monotherapy (100 mg/day) to minimize hemorrhagic hazard.";
530
- color = "#fd7e14"; border_color = "#fd7e14";
531
- }
532
-
533
- const resSection = document.getElementById('resultsSection');
534
- resSection.classList.remove('hidden');
535
-
536
- // Popola interfaccia principale
537
- document.getElementById('valSafinous').innerText = Safinous.toFixed(1);
538
- document.getElementById('valPrecise').innerText = Precise.toFixed(1);
539
- document.getElementById('valCDRS').innerText = CDRS_positive.toFixed(1);
540
- document.getElementById('valCRI').innerText = CRI_pct.toFixed(1) + "%";
541
-
542
- document.getElementById('trajectoryBox').style.borderLeftColor = border_color;
543
- const trajSpan = document.getElementById('valTrajectory');
544
- trajSpan.innerText = traj;
545
- trajSpan.style.color = color;
546
- document.getElementById('valRecommendation').innerText = rec;
547
-
548
- // Popola il template PDF nascosto
549
- document.getElementById('pdfValSafinous').innerText = Safinous.toFixed(1);
550
- document.getElementById('pdfValPrecise').innerText = Precise.toFixed(1);
551
- document.getElementById('pdfValCDRS').innerText = CDRS_positive.toFixed(1);
552
- document.getElementById('pdfValCRI').innerText = CRI_pct.toFixed(1) + "%";
553
- document.getElementById('pdfValTrajectory').innerText = traj;
554
- document.getElementById('pdfValTrajectory').style.color = color;
555
- document.getElementById('pdfValRecommendation').innerText = rec;
556
- document.getElementById('pdfTrajectoryBox').style.borderLeftColor = border_color;
557
-
558
- resSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
559
-
560
- draw2DPlot(p_isch, p_bleed);
561
- draw3DPlot(p_isch, p_bleed, CRI_pct);
562
- drawDynamicFeatureImpact(Age, SexFemale, Dyslipidemia, Diabetes, Smoking, CreaScore, EVH, ComplexGrafts, NSVG, GraftDiag, GraftLCx, GraftRCA, Hb, WBC, CrCl, PriorBleed);
563
- }
564
-
565
- function draw2DPlot(px, py) {
566
- const traceBg = { x: bg_data.p_isch, y: bg_data.p_bleed, mode: 'markers', name: 'Cohort', marker: {color: '#adb5bd', size: 5, opacity: 0.6}, type: 'scatter' };
567
- const tracePt = { x: [px], y: [py], mode: 'markers+text', name: 'Patient', text: ['Patient'], textposition: 'top right', textfont: {family: 'Arial', weight: 'bold', color: '#000'}, marker: {color: '#dc3545', size: 9, symbol: 'square', line: {width: 1, color: '#000'}}, type: 'scatter' };
568
- const layout = { ...plotlyBaseLayout, title: {text: 'Probability Distribution', font: {size: 13, weight: 'bold'}}, xaxis: {title: 'P(Ischemia)', gridcolor: '#e9ecef', zeroline: false}, yaxis: {title: 'P(Bleeding)', gridcolor: '#e9ecef', zeroline: false}, showlegend: false };
569
- Plotly.newPlot('plot2d', [traceBg, tracePt], layout, {responsive: true, displayModeBar: false});
570
- }
571
-
572
- function draw3DPlot(px, py, pz) {
573
- const traceBg = { x: bg_data.p_isch, y: bg_data.p_bleed, z: bg_data.cri_pct, mode: 'markers', name: 'Cohort', marker: {color: '#adb5bd', size: 3, opacity: 0.5}, type: 'scatter3d' };
574
- const tracePt = { x: [px], y: [py], z: [pz], mode: 'markers+text', name: 'Patient', text: ['Patient'], textposition: 'top center', marker: {color: '#dc3545', size: 4, symbol: 'square'}, type: 'scatter3d' };
575
- const layout = { ...plotlyBaseLayout, scene: {xaxis: {title: 'P(Isch)'}, yaxis: {title: 'P(Bleed)'}, zaxis: {title: 'CRI %'}}, margin: {t:0, b:0, l:0, r:0}, showlegend: false };
576
- Plotly.newPlot('plot3d', [traceBg, tracePt], layout, {responsive: true, displayModeBar: false});
577
- }
578
-
579
- function drawDynamicFeatureImpact(Age, SexFemale, Dyslipidemia, Diabetes, Smoking, CreaScore, EVH, ComplexGrafts, NSVG, GraftDiag, GraftLCx, GraftRCA, Hb, WBC, CrCl, PriorBleed) {
580
- let safData = [
581
- {name: 'Age', val: 0.1 * (Age - 55)}, {name: 'Male', val: -3.0 * (1 - SexFemale)}, {name: 'Dyslipidemia', val: 1.0 * Dyslipidemia},
582
- {name: 'Diabetes', val: 3.0 * Diabetes}, {name: 'Smoking', val: 3.0 * Smoking}, {name: 'Cr > 1.2', val: 2.0 * CreaScore},
583
- {name: 'EVH', val: -3.0 * EVH}, {name: 'Complex Graft', val: 4.0 * ComplexGrafts}, {name: 'N. SVG', val: 2.0 * (NSVG - 1)},
584
- {name: 'Diag', val: 4.0 * GraftDiag}, {name: 'LCx/OM', val: 4.0 * GraftLCx}, {name: 'RCA', val: 3.0 * GraftRCA}
585
- ].filter(d => d.val !== 0).sort((a,b) => Math.abs(a.val) - Math.abs(b.val));
586
-
587
- let precData = [
588
- {name: 'Age', val: 0.3 * Age}, {name: 'Hb', val: -1.5 * Hb}, {name: 'WBC', val: 0.8 * WBC},
589
- {name: 'CrCl', val: -0.15 * CrCl}, {name: 'Prior Bleed', val: 15.0 * PriorBleed}
590
- ].filter(d => d.val !== 0).sort((a,b) => Math.abs(a.val) - Math.abs(b.val));
591
-
592
- const drawStyledPlot = (data, divId, titleText) => {
593
- const trace = { x: data.map(d => d.val), y: data.map(d => d.name), type: 'bar', orientation: 'h', marker: { color: '#0056b3' } };
594
- const layout = { ...plotlyBaseLayout, title: { text: titleText, font: { size: 12, weight: 'bold' } }, xaxis: { showgrid: true, gridcolor: '#e9ecef', zeroline: true, zerolinecolor: '#6c757d', tickfont: {size: 10} }, yaxis: { showgrid: false, tickfont: {size: 10} }, margin: { t: 25, b: 20, l: 90, r: 10 }, height: 180 };
595
- Plotly.newPlot(divId, [trace], layout, {responsive: true, displayModeBar: false});
596
- };
597
-
598
- drawStyledPlot(safData, 'plotDynamicImpactSaf', 'SAFINOUS Impact Points');
599
- drawStyledPlot(precData, 'plotDynamicImpactPrec', 'PRECISE-DAPT Impact Points');
600
- }
601
-
602
- function downloadPDF() {
603
- const element = document.getElementById('pdfTemplate');
604
- const opt = {
605
- margin: 10,
606
- filename: 'SAFER-DAPT_Clinical_Report.pdf',
607
- image: { type: 'jpeg', quality: 0.98 },
608
- html2canvas: { scale: 2, useCORS: true, logging: false },
609
- jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
610
- };
611
- html2pdf().set(opt).from(element).save();
612
- }
613
-
614
- document.querySelectorAll('button[data-bs-toggle="tab"]').forEach(el => {
615
- el.addEventListener('shown.bs.tab', () => { window.dispatchEvent(new Event('resize')); });
616
- });
617
- </script>
618
- </body>
619
- </html>