allow bedside respiratory without weight
This commit is contained in:
parent
d71482037f
commit
d8e9ba149e
2 changed files with 33 additions and 3 deletions
|
|
@ -10,8 +10,17 @@ import { S } from './shared.js';
|
|||
function dose(wt, mgPerKg, maxMg) { var d = Math.round(wt * mgPerKg * 10) / 10; return maxMg ? Math.min(d, maxMg) : d; }
|
||||
// Delegates to the shared S.dStr so the per-kg math is visible to the prescriber.
|
||||
function doseStr(wt, mgPerKg, maxMg, unit) {
|
||||
if (!wt) {
|
||||
unit = unit || ' mg';
|
||||
var uTrim = unit.trim() || 'mg';
|
||||
return mgPerKg + ' ' + uTrim + '/kg' + (maxMg != null ? ' <span style="color:var(--g500);font-size:11px;font-weight:400;">(max ' + maxMg + ' ' + uTrim + ')</span>' : '');
|
||||
}
|
||||
return S.dStr(wt, mgPerKg, maxMg, unit);
|
||||
}
|
||||
function ipratropiumDose(wt) {
|
||||
if (!wt) return '250 mcg (<20 kg) or 500 mcg (≥20 kg)';
|
||||
return wt < 20 ? '250 mcg' : '500 mcg';
|
||||
}
|
||||
function drugRow(name, doseText, route, notes) {
|
||||
return '<tr><td style="font-weight:600;">' + name + '</td><td>' + doseText + '</td><td>' + route + '</td><td style="font-size:12px;color:var(--g500);">' + (notes || '') + '</td></tr>';
|
||||
}
|
||||
|
|
@ -23,7 +32,6 @@ function severityBadge(label, color) { return '<span style="display:inline-block
|
|||
function asthmaManagement(severity) {
|
||||
var wt = parseFloat(document.getElementById('resp-weight').value);
|
||||
var resultDiv = document.getElementById('asthma-result');
|
||||
if (!wt) { resultDiv.innerHTML = '<p style="color:var(--red);font-size:13px;">Enter weight (kg).</p>'; return; }
|
||||
|
||||
var html = '';
|
||||
if (severity === 'mild') {
|
||||
|
|
@ -41,7 +49,7 @@ function asthmaManagement(severity) {
|
|||
html += '<p style="font-size:13px;margin:8px 0;">Speaks in phrases, some accessory muscle use, SpO2 90-93%</p>';
|
||||
html += drugTable(
|
||||
drugRow('Albuterol (neb)', doseStr(wt, 0.15, 5, ' mg') + ' (min 2.5 mg)', 'Nebulized', 'q20min x 3 doses, then continuous if needed') +
|
||||
drugRow('Ipratropium', wt < 20 ? '250 mcg' : '500 mcg', 'Nebulized', 'q20min x 3 doses with albuterol') +
|
||||
drugRow('Ipratropium', ipratropiumDose(wt), 'Nebulized', 'q20min x 3 doses with albuterol') +
|
||||
drugRow('Dexamethasone', doseStr(wt, 0.6, 16), 'PO/IV/IM', 'Single dose') +
|
||||
drugRow('O2 supplemental', 'Target SpO2 ≥94%', 'Nasal cannula/mask', 'Titrate to effect')
|
||||
);
|
||||
|
|
@ -51,7 +59,7 @@ function asthmaManagement(severity) {
|
|||
html += '<p style="font-size:13px;margin:8px 0;">Speaks in words only, significant accessory muscle use, SpO2 <90%. Consider ICU.</p>';
|
||||
html += drugTable(
|
||||
drugRow('Albuterol continuous', doseStr(wt, 0.5, 20, ' mg') + '/hr', 'Continuous neb', 'Or 0.15-0.3 mg/kg q20min') +
|
||||
drugRow('Ipratropium', wt < 20 ? '250 mcg' : '500 mcg', 'Nebulized', 'q20min x 3 doses with albuterol') +
|
||||
drugRow('Ipratropium', ipratropiumDose(wt), 'Nebulized', 'q20min x 3 doses with albuterol') +
|
||||
drugRow('Dexamethasone', doseStr(wt, 0.6, 16), 'IV', 'Or methylprednisolone 2 mg/kg IV (max 60 mg)') +
|
||||
drugRow('Magnesium sulfate', doseStr(wt, 50, 2000) + ' IV over 20 min', 'IV', 'Single dose, monitor BP') +
|
||||
drugRow('Epinephrine (IM)', doseStr(wt, 0.01, 0.5) + ' (1:1000)', 'IM', 'If impending arrest / no IV access') +
|
||||
|
|
|
|||
22
test/bedside-respiratory-ventilation.test.js
Normal file
22
test/bedside-respiratory-ventilation.test.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const root = path.join(__dirname, '..');
|
||||
|
||||
function read(relativePath) {
|
||||
return fs.readFileSync(path.join(root, relativePath), 'utf8');
|
||||
}
|
||||
|
||||
test('Bedside respiratory and ventilation references render without requiring weight', () => {
|
||||
const respiratory = read('public/js/bedside/respiratory.js');
|
||||
const ventilation = read('public/js/bedside/ventilation.js');
|
||||
|
||||
assert.doesNotMatch(respiratory, /Enter weight \(kg\)/);
|
||||
assert.match(respiratory, /function ipratropiumDose\(wt\)/);
|
||||
assert.match(respiratory, /return mgPerKg \+ ' ' \+ uTrim \+ '\/kg'/);
|
||||
assert.match(ventilation, /wt \? '1-2 L\/kg\/min = '/);
|
||||
assert.match(ventilation, /: '1-2 L\/kg\/min'/);
|
||||
assert.match(ventilation, /wt \? S\.d\(wt, 6\) \+ '-' \+ S\.d\(wt, 8\) \+ ' mL' : '6-8 mL\/kg'/);
|
||||
});
|
||||
Loading…
Reference in a new issue