pediatric-ai-scribe-v3/public/js/calculators/equipment.js
2026-05-08 03:18:37 +02:00

38 lines
2.2 KiB
JavaScript

var equipmentCache = null;
export function loadEquipmentData() {
if (equipmentCache) return Promise.resolve(equipmentCache);
return fetch('/data/calculators/equipment.json', { credentials: 'same-origin' })
.then(function(response) {
if (!response.ok) throw new Error('Failed to load equipment data');
return response.json();
})
.then(function(data) {
equipmentCache = data.ageGroups || {};
return equipmentCache;
});
}
export function renderEquipmentResult(eq) {
return ''
+ '<div class="calc-result-header" style="background:#eff6ff;border-color:#2563eb;">'
+ '<div style="font-size:18px;font-weight:700;color:#1d4ed8;">' + eq.label + '</div>'
+ '</div>'
+ '<div style="margin-top:12px;overflow-x:auto;">'
+ '<table class="admin-table" style="font-size:13px;width:100%;"><tbody>'
+ '<tr><td style="font-weight:600;width:40%;">Bag-Valve Mask</td><td>' + eq.bvm + '</td></tr>'
+ '<tr><td style="font-weight:600;">Oral Airway</td><td>' + eq.oral + '</td></tr>'
+ '<tr><td style="font-weight:600;">Nasal Airway</td><td>' + eq.nasal + '</td></tr>'
+ '<tr><td style="font-weight:600;">Laryngoscope Blade</td><td>' + eq.blade + '</td></tr>'
+ '<tr><td style="font-weight:600;">ETT Size</td><td>' + eq.ett + '</td></tr>'
+ '<tr><td style="font-weight:600;">LMA Size</td><td>' + eq.lma + '</td></tr>'
+ '<tr><td style="font-weight:600;">Glidescope</td><td>' + eq.glidescope + '</td></tr>'
+ '<tr><td style="font-weight:600;">IV Catheter</td><td>' + eq.iv + '</td></tr>'
+ '<tr><td style="font-weight:600;">Central Line</td><td>' + eq.cvl + '</td></tr>'
+ '<tr><td style="font-weight:600;">NGT / OGT</td><td>' + eq.ngt + '</td></tr>'
+ '<tr><td style="font-weight:600;">Chest Tube</td><td>' + eq.chest + '</td></tr>'
+ '<tr><td style="font-weight:600;">Foley Catheter</td><td>' + eq.foley + '</td></tr>'
+ '</tbody></table>'
+ '</div>'
+ '<div style="margin-top:10px;font-size:11px;color:var(--g400);"><strong>ETT Formulas:</strong> Uncuffed = (age/4)+4, Cuffed = (age/4)+3, Depth = ETT size x 3. Source: Harriet Lane Handbook.</div>';
}