diff --git a/public/components/calculators.html b/public/components/calculators.html index ea34f48..7bc69ee 100644 --- a/public/components/calculators.html +++ b/public/components/calculators.html @@ -13,6 +13,8 @@ + + @@ -517,3 +519,120 @@ + + + + + + diff --git a/public/js/calculators.js b/public/js/calculators.js index 09e3e92..5bfa607 100644 --- a/public/js/calculators.js +++ b/public/js/calculators.js @@ -1838,5 +1838,165 @@ resultDiv.classList.remove('hidden'); }); } + + // ═══════════════════════════════════════════════════════════ + // GLASGOW COMA SCALE + // ═══════════════════════════════════════════════════════════ + + // GCS sub-pill navigation + var gcsPanel = document.getElementById('calc-gcs'); + if (gcsPanel) { + gcsPanel.addEventListener('click', function(e) { + var pill = e.target.closest('[data-gcs]'); + if (!pill) return; + gcsPanel.querySelectorAll('[data-gcs]').forEach(function(p) { p.classList.remove('active'); }); + pill.classList.add('active'); + var isInfant = pill.dataset.gcs === 'infant'; + var childP = document.getElementById('gcs-child-panel'); + var infantP = document.getElementById('gcs-infant-panel'); + if (childP) childP.style.display = isInfant ? 'none' : ''; + if (infantP) infantP.style.display = isInfant ? '' : 'none'; + updateGCS(); + }); + + gcsPanel.addEventListener('change', function(e) { + if (e.target.tagName === 'SELECT') updateGCS(); + }); + } + + function updateGCS() { + var isInfant = document.querySelector('[data-gcs="infant"].active') !== null; + var prefix = isInfant ? 'gcs-infant' : 'gcs-child'; + var eye = parseInt(document.getElementById(prefix + '-eye').value) || 0; + var verbal = parseInt(document.getElementById(prefix + '-verbal').value) || 0; + var motor = parseInt(document.getElementById(prefix + '-motor').value) || 0; + var total = eye + verbal + motor; + + var severity, color, bg; + if (total <= 8) { severity = 'Severe (Coma)'; color = '#ef4444'; bg = '#fee2e2'; } + else if (total <= 12) { severity = 'Moderate'; color = '#f59e0b'; bg = '#fef3c7'; } + else { severity = 'Mild'; color = '#10b981'; bg = '#d1fae5'; } + + var resultDiv = document.getElementById('gcs-result'); + if (resultDiv) { + resultDiv.innerHTML = + '
' + + '
GCS: ' + total + '/15
' + + '
' + severity + '
' + + '
' + + '
' + + '
Eye (E)
' + eye + '
' + + '
Verbal (V)
' + verbal + '
' + + '
Motor (M)
' + motor + '
' + + '
' + + '
' + + 'Interpretation: 13-15 Mild, 9-12 Moderate, 3-8 Severe/Coma. ' + + 'Intubation typically considered at GCS ≤ 8. ' + + (isInfant ? 'Using infant-modified verbal and motor scales.' : '') + + '
'; + } + } + // Initial GCS render + setTimeout(updateGCS, 200); + + // ═══════════════════════════════════════════════════════════ + // EQUIPMENT SIZING — Johns Hopkins Kids Kard + // ═══════════════════════════════════════════════════════════ + + var EQUIP_DATA = { + premie: { + label: 'Premie (1-3 kg)', + bvm: 'Infant', nasal: '12 Fr', oral: 'Infant', blade: 'Miller 0', + ett: '2.5-3.0', lma: '1', glidescope: '1', + iv: '22-24 ga', cvl: '3 Fr', ngt: '5 Fr', chest: '10-12 Fr', foley: '6 Fr' + }, + newborn: { + label: 'Newborn (2-4 kg)', + bvm: 'Infant', nasal: '14-16 Fr', oral: 'Small 50 mm', blade: 'Miller 0', + ett: '3.0-3.5', lma: '1', glidescope: '1', + iv: '22-24 ga', cvl: '3-4 Fr', ngt: '5-8 Fr', chest: '10-12 Fr', foley: '6 Fr' + }, + '6mo': { + label: '6 months (6-8 kg)', + bvm: 'Infant', nasal: '14-16 Fr', oral: 'Small 60 mm', blade: 'Miller 1', + ett: '3.5', lma: '1.5', glidescope: '2', + iv: '20-24 ga', cvl: '4 Fr', ngt: '8 Fr', chest: '12-18 Fr', foley: '8 Fr' + }, + '1yr': { + label: '1 year (10 kg)', + bvm: 'Small child', nasal: '14-18 Fr', oral: 'Small 60 mm', blade: 'Miller 1 / MAC 2', + ett: '4.0', lma: '2', glidescope: '2', + iv: '20-24 ga', cvl: '4-5 Fr', ngt: '10 Fr', chest: '16-20 Fr', foley: '8 Fr' + }, + '2-3yr': { + label: '2-3 years (12-16 kg)', + bvm: 'Small child', nasal: '14-18 Fr', oral: 'Small 70 mm', blade: 'Miller 1 / MAC 2', + ett: '4.0-4.5', lma: '2', glidescope: '2', + iv: '18-22 ga', cvl: '4-5 Fr', ngt: '10-12 Fr', chest: '16-24 Fr', foley: '8 Fr' + }, + '4-6yr': { + label: '4-6 years (20-25 kg)', + bvm: 'Child', nasal: '16-20 Fr', oral: 'Small 70-80 mm', blade: 'Miller 2 / MAC 2', + ett: '4.5-5.0', lma: '2.5', glidescope: '3', + iv: '18-22 ga', cvl: '5 Fr', ngt: '12-14 Fr', chest: '20-28 Fr', foley: '8 Fr' + }, + '7-10yr': { + label: '7-10 years (25-35 kg)', + bvm: 'Child / Small adult', nasal: '18-22 Fr', oral: 'Medium 80-90 mm', blade: 'Miller 2 / MAC 2', + ett: '5.5-6.0', lma: '2.5-3', glidescope: '3', + iv: '18-22 ga', cvl: '5 Fr', ngt: '12-14 Fr', chest: '20-32 Fr', foley: '8 Fr' + }, + '11-15yr': { + label: '11-15 years (40-50 kg)', + bvm: 'Adult', nasal: '22-36 Fr', oral: 'Medium 90 mm', blade: 'Miller 2 / MAC 3', + ett: '6.0-6.5', lma: '3', glidescope: '3 or 4', + iv: '18-20 ga', cvl: '7 Fr', ngt: '14-18 Fr', chest: '28-38 Fr', foley: '10 Fr' + }, + '16yr': { + label: '16+ years (>50 kg)', + bvm: 'Adult', nasal: '22-36 Fr', oral: 'Medium 90 mm', blade: 'Miller 2 / MAC 3', + ett: '7.0-8.0', lma: '4', glidescope: '3 or 4', + iv: '18-20 ga', cvl: '7 Fr', ngt: '14-18 Fr', chest: '28-42 Fr', foley: '12 Fr' + } + }; + + var equipPanel = document.getElementById('calc-equipment'); + if (equipPanel) { + equipPanel.addEventListener('change', function(e) { + if (e.target.id !== 'equip-age-select') return; + var key = e.target.value; + var resultDiv = document.getElementById('equip-result'); + if (!key || !EQUIP_DATA[key]) { resultDiv.classList.add('hidden'); return; } + + var eq = EQUIP_DATA[key]; + resultDiv.classList.remove('hidden'); + resultDiv.innerHTML = + '
' + + '
' + eq.label + '
' + + '
' + + '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
Bag-Valve Mask' + eq.bvm + '
Oral Airway' + eq.oral + '
Nasal Airway' + eq.nasal + '
Laryngoscope Blade' + eq.blade + '
ETT Size' + eq.ett + '
LMA Size' + eq.lma + '
Glidescope' + eq.glidescope + '
IV Catheter' + eq.iv + '
Central Line' + eq.cvl + '
NGT / OGT' + eq.ngt + '
Chest Tube' + eq.chest + '
Foley Catheter' + eq.foley + '
' + + '
' + + '
' + + 'ETT Formulas: Uncuffed = (age/4)+4, Cuffed = (age/4)+3, Depth = ETT size x 3. ' + + 'Source: Johns Hopkins Kids Kard.' + + '
'; + }); + } } })();