npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

medcalc

v0.2.0

Published

Collection of medical calculators

Readme

MedCalc

NPM version NPM downloads

MedCalc is a JavaScript library providing medical calculators for nephrology and kidney function assessment. It implements evidence-based formulas commonly used in clinical practice for evaluating kidney disease and acute kidney injury.

Features

CKD-EPI 2021 Equation - Calculate estimated Glomerular Filtration Rate (eGFR)
GFR Staging - Determine chronic kidney disease stages based on eGFR
KDIGO Classification - Assess acute kidney injury severity
Zero Dependencies - Lightweight and fast
Type Safe - Built with modern JavaScript and proper validation
Well Tested - Comprehensive test suite with clinical reference values

Installation

npm install medcalc

Usage

CKD-EPI Equation (2021)

Calculate estimated Glomerular Filtration Rate using the latest CKD-EPI creatinine equation:

import { ckdEpi } from 'medcalc'

// Calculate eGFR for a 60-year-old male with creatinine 1.4 mg/dL
const eGFR = ckdEpi({
  creat: 1.4, // Serum creatinine in mg/dL
  age: 60, // Age in years
  gender: 'M', // 'M' for male, 'F' for female
})

console.log(eGFR) // 57.5 mL/min/1.73 m²

GFR Staging

Determine chronic kidney disease stage based on eGFR:

import { gfrStage } from 'medcalc'

const stage = gfrStage({ tfg: 45 }) // tfg = eGFR value
console.log(stage) // '3b'

// Stage reference:
// '1': ≥90 mL/min/1.73 m²
// '2': 60-89 mL/min/1.73 m²
// '3a': 45-59 mL/min/1.73 m²
// '3b': 30-44 mL/min/1.73 m²
// '4': 15-29 mL/min/1.73 m²
// '5': <15 mL/min/1.73 m²

KDIGO Acute Kidney Injury Classification

Assess acute kidney injury severity using KDIGO criteria:

import { kdigo } from 'medcalc'

// Based on creatinine change
const akiStage = kdigo({
  baseCreat: 1.0, // Baseline creatinine (mg/dL)
  currentCreat: 2.1, // Current creatinine (mg/dL)
})

console.log(akiStage) // 2 (Stage 2 AKI)

// Based on urine output
const akiStageUrine = kdigo({
  diuresis: 200, // Urine output (mL)
  interval: 8, // Time interval (hours)
  weight: 70, // Patient weight (kg)
})

// For patients on dialysis
const akiStageDialysis = kdigo({
  inDialysis: true,
})

console.log(akiStageDialysis) // 3 (Stage 3 AKI)

API Reference

ckdEpi(params)

Calculates estimated GFR using the CKD-EPI 2021 equation.

Parameters:

  • creat (number): Serum creatinine in mg/dL
  • age (number): Age in years
  • gender (string): 'M' for male, 'F' for female

Returns: number | undefined - eGFR in mL/min/1.73 m², or undefined for invalid input

gfrStage(params)

Determines CKD stage based on eGFR value.

Parameters:

  • tfg (number): eGFR value in mL/min/1.73 m²

Returns: string | undefined - Stage ('1', '2', '3a', '3b', '4', '5'), or undefined for invalid input

kdigo(params)

Classifies acute kidney injury using KDIGO criteria.

Parameters:

  • baseCreat (number, optional): Baseline creatinine in mg/dL
  • currentCreat (number, optional): Current creatinine in mg/dL
  • diuresis (number, optional): Urine output in mL
  • interval (number, optional): Time interval in hours
  • weight (number, optional): Patient weight in kg
  • inDialysis (boolean, optional): Whether patient is on dialysis

Returns: number | undefined - AKI stage (1, 2, or 3), or undefined if no AKI

Clinical References

Development

# Install dependencies
npm install

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Lint code
npm run lint

License

Copyright © 2018 Luiz Américo Pereira Câmara. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.


Made with ♥ by Luiz Américo Pereira Câmara and contributors