UNPKG

periop-calculators

Version:

Evidence-based perioperative risk assessment calculators for healthcare professionals

201 lines (195 loc) 6.39 kB
interface PatientDemographics { age: number; sex: 'male' | 'female'; weight: number; height: number; neckCircumference?: number; } interface StopBangInput { snoring: boolean; tiredness: boolean; observed: boolean; pressure: boolean; bmi?: number; age?: number; neckCircumference?: number; gender?: 'male' | 'female'; } interface StopBangResult { score: number; risk: 'low' | 'intermediate' | 'high'; interpretation: string; components: { S: boolean; T: boolean; O: boolean; P: boolean; B: boolean; A: boolean; N: boolean; G: boolean; }; recommendations: string[]; } interface CalculatorError { code: string; message: string; field?: string; } interface ValidationResult { isValid: boolean; errors: CalculatorError[]; } interface RCRIInput$1 { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; } interface RCRIResult$1 { score: number; riskClass: 'I' | 'II' | 'III' | 'IV'; estimatedRisk: string; riskPercentage: number; interpretation: string; riskFactors: { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; }; recommendations: string[]; } interface ApfelScoreInput { female: boolean; nonSmoker: boolean; historyOfPONV: boolean; postoperativeOpioids: boolean; } interface ApfelScoreResult { score: number; riskPercentage: number; risk: 'low' | 'moderate' | 'high' | 'very-high'; interpretation: string; riskFactors: { female: boolean; nonSmoker: boolean; historyOfPONV: boolean; postoperativeOpioids: boolean; }; recommendations: string[]; } /** * Calculate STOP-BANG score for obstructive sleep apnea risk assessment * * STOP-BANG is a validated screening tool for obstructive sleep apnea (OSA) * in surgical patients. It consists of 8 yes/no questions. * * Score interpretation: * - 0-2: Low risk of OSA * - 3-4: Intermediate risk of OSA * - 5-8: High risk of OSA * * @param input - STOP-BANG questionnaire responses * @param demographics - Optional patient demographics for auto-calculation * @returns StopBangResult with score, risk level, and recommendations * @throws Error if required inputs are missing or invalid * * @example * ```typescript * const result = calculateStopBang({ * snoring: true, * tiredness: true, * observed: false, * pressure: true, * bmi: 36, * age: 55, * neckCircumference: 43, * gender: 'male' * }); * console.log(result.score); // 6 * console.log(result.risk); // 'high' * ``` */ declare function calculateStopBang(input: StopBangInput, demographics?: PatientDemographics): StopBangResult; /** * Simplified version of STOP-BANG calculation using just the basic inputs * @param input - Basic STOP-BANG inputs * @returns Just the numeric score (0-8) */ declare function calculateStopBangScore(input: StopBangInput): number; /** * RCRI (Revised Cardiac Risk Index) Calculator * * Reference: Lee TH, et al. Derivation and prospective validation of a simple index * for prediction of cardiac risk of major noncardiac surgery. Circulation. 1999;100(10):1043-9. */ interface RCRIInput { /** High-risk surgery (intraperitoneal, intrathoracic, or suprainguinal vascular) */ highRiskSurgery: boolean; /** History of ischemic heart disease */ ischemicHeartDisease: boolean; /** History of congestive heart failure */ congestiveHeartFailure: boolean; /** History of cerebrovascular disease */ cerebrovascularDisease: boolean; /** Insulin therapy for diabetes */ insulinDependentDiabetes: boolean; /** Preoperative serum creatinine >2.0 mg/dL (>177 μmol/L) */ renalInsufficiency: boolean; } interface RCRIResult { /** Total RCRI score (0-6) */ score: number; /** Risk classification */ riskClass: 'I' | 'II' | 'III' | 'IV'; /** Estimated risk of major cardiac complications */ estimatedRisk: string; /** Risk percentage */ riskPercentage: number; /** Clinical interpretation */ interpretation: string; /** Individual risk factors present */ riskFactors: { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; }; /** Clinical recommendations based on risk */ recommendations: string[]; } /** * Calculate the Revised Cardiac Risk Index (RCRI) score * @param input RCRI risk factors * @returns RCRI calculation result with score, risk class, and recommendations */ declare function calculateRCRI(input: RCRIInput): RCRIResult; /** * Helper function to determine if a surgery type is high risk according to RCRI * @param surgeryType Description of the surgery * @returns Whether the surgery is considered high risk */ declare function isHighRiskSurgery(surgeryType: string): boolean; /** * Calculates the Apfel Score for predicting postoperative nausea and vomiting (PONV) * @param input - Patient risk factors * @returns Apfel score result with risk assessment and recommendations * @throws {CalculatorError} If input validation fails */ declare function calculateApfelScore(input: ApfelScoreInput): ApfelScoreResult; /** * Returns detailed information about a specific Apfel risk factor * @param factor - The risk factor to get information about * @returns Detailed description of the risk factor */ declare function getApfelRiskFactorInfo(factor: keyof ApfelScoreInput): string; declare function calculateBMI(weightKg: number, heightCm: number): number; export { calculateApfelScore, calculateBMI, calculateRCRI, calculateStopBang, calculateStopBangScore, getApfelRiskFactorInfo, isHighRiskSurgery }; export type { ApfelScoreInput, ApfelScoreResult, CalculatorError, PatientDemographics, RCRIInput$1 as RCRIInput, RCRIResult$1 as RCRIResult, StopBangInput, StopBangResult, ValidationResult };